1.0.0 • Published 5 years ago

sharedkeytree v1.0.0

Weekly downloads
3
License
MIT
Repository
github
Last release
5 years ago

keytree

Generate deterministic shared secrets between two parties based of (link)Wp0042(link). Two parties exchange public keys plus a message (eg: a nounce + timestamp), from there multiple shared secrets can be derived by both parties.

Install

npm install keytree

Example

const keytree = require('sharedkeytree')

var t1 = new keytree({
  priv: serverPrivate, // hex format
  pub: clientPublic,   // hex format
  msg: 'common message'
})

var t2 = new keytree({
  priv: clientPrivate,
  pub: serverPublic,
  msg: 'common message'
})

t1.derive().toString('hex') // 1c56352098780de84006b38e6...
t2.derive().toString('hex') // 1c56352098780de84006b38e6...

t1.child()
  .child()
  .branch()
  .child()
  .derive().toString('hex') // 1e5a900bd21d820ad3d49...

t2.child()
  .child()
  .branch()
  .child()
  .derive().toString('hex') // 1e5a900bd21d820ad3d49...