sodium-secretstream
Wraps libsodiums secretstream in a higher level abstraction
Last updated 3 years ago by mafintosh .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ gnpm install sodium-secretstream 
SYNC missed versions from official npm registry.

sodium-secretstream

Wraps libsodium's secretstream in a higher level abstraction

npm install sodium-secretstream

Usage

const { Pull, Push, keygen } = require('sodium-secretstream')

const key = keygen()

// the sender
const push = new Push(key)

// the receiver
const pull = new Pull(key)

// send header to the other side
pull.init(push.header)

// send the cipher to the other side
const cipher1 = push.next(Buffer.from('test'))

// prints "test"
console.log(pull.next(cipher1))

// send the cipher to the other side
const cipher2 = push.next(Buffer.from('test 2'))

// prints "test 2"
console.log(pull.next(cipher2))

// when done send a final signal
const cipher3 = push.final()

// prints <empty buffer>
console.log(pull.next(cipher3))

// but sets pull.final to true
console.log(pull.final)

License

MIT

Current Tags

  • 1.1.0                                ...           latest (2 years ago)

5 Versions

  • 1.1.0                                ...           2 years ago
  • 1.0.2                                ...           3 years ago
  • 1.0.1                                ...           3 years ago
  • 1.0.0                                ...           4 years ago
  • 0.0.0                                ...           4 years ago
Maintainers (1)
Downloads
Today 1
This Week 1
This Month 1
Last Day 0
Last Week 0
Last Month 0
Dependencies (1)
Dev Dependencies (0)
None

Copyright 2013 - present © cnpmjs.org | Home |