Skip to content

Instantly share code, notes, and snippets.

@achiko
Created July 9, 2018 11:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save achiko/b4b58bb1bde29ab40a3782a0d9bc5c01 to your computer and use it in GitHub Desktop.
Save achiko/b4b58bb1bde29ab40a3782a0d9bc5c01 to your computer and use it in GitHub Desktop.
const Web3 = require('web3');
const web3 = new Web3('ws://localhost:8546');
const shh = web3.shh;
// Generate Symkey From password
// https://github.com/ethereum/go-ethereum/wiki/Whisper-Usage#generatesymkeyfrompassword
shh.generateSymKeyFromPassword("hello").then((symKeyID) => {
console.log('This is symkey ID unique foe every run: ', symKeyID);
// Get symkey from local node by useing symKeyID
// https://github.com/ethereum/go-ethereum/wiki/Whisper-Usage#generatesymkeyfrompassword
shh.getSymKey(symKeyID).then((symKey) => {
console.log('This is identical symkey : ', symKey);
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment