Skip to content

Commit

Permalink
Merge 9650acf into 80c2834
Browse files Browse the repository at this point in the history
  • Loading branch information
daoauth committed Aug 7, 2020
2 parents 80c2834 + 9650acf commit 16178a5
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions docs/web3-shh.rst
Original file line number Diff line number Diff line change
Expand Up @@ -759,25 +759,25 @@ Example

.. code-block:: javascript
var identities = [];
var identities = {};
var subscription = null;
Promise.all([
web3.shh.newSymKey().then((id) => {identities.push(id);}),
web3.shh.newKeyPair().then((id) => {identities.push(id);})
web3.shh.newSymKey().then((id) => {identities.symKey = id;}),
web3.shh.newKeyPair().then((id) => {identities.keyPair = id;})
]).then(() => {
// will receive also its own message send, below
subscription = shh.subscribe("messages", {
symKeyID: identities[0],
subscription = web3.shh.subscribe("messages", {
symKeyID: identities.symKey,
topics: ['0xffaadd11']
}).on('data', console.log);
}).then(() => {
web3.shh.post({
symKeyID: identities[0], // encrypts using the sym key ID
sig: identities[1], // signs the message using the keyPair ID
symKeyID: identities.symKey, // encrypts using the sym key ID
sig: identities.keyPair, // signs the message using the keyPair ID
ttl: 10,
topic: '0xffaadd11',
payload: '0xffffffdddddd1122',
Expand Down

0 comments on commit 16178a5

Please sign in to comment.