Socket
Socket
Sign inDemoInstall

sodium-secretstream

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sodium-secretstream

Wraps libsodiums secretstream in a higher level abstraction


Version published
Weekly downloads
2.4K
decreased by-28.59%
Maintainers
1
Weekly downloads
 
Created
Source

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

FAQs

Package last updated on 10 Jan 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc