Guest User

Untitled

a guest
Jan 16th, 2018
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. function generateSignature(...signingData) {
  2. const raw = web3Util.soliditySha3(...signingData);
  3. const salted = ethUtil.hashPersonalMessage(ethUtil.toBuffer(raw));
  4. const {
  5. v,
  6. r,
  7. s
  8. } = lodash.mapValues(ethUtil.ecsign(salted, ethUtil.toBuffer('0x'+user.pk.trim())), (value, key) => key === 'v' ? value : ethUtil.bufferToHex(value));
  9. //console.log("Signature complete! ", v, r, s);
  10. return {v: v, r: r, s: s};
  11. }
Add Comment
Please, Sign In to add comment