# sodium-secretstream

> Wraps libsodiums secretstream in a higher level abstraction

Latest version **1.2.0** (published 2025-04-12) · MIT license · 0 weekly downloads

## Install

```sh
npm install sodium-secretstream
pnpm add sodium-secretstream
yarn add sodium-secretstream
bun add sodium-secretstream
```

## Health

**Score 35/100 (D)** — status: stable.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: stale.

## Facts

| | |
|---|---|
| Version | 1.2.0 |
| Published | 2025-04-12 |
| First published | 2021-02-08 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 5.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 7 |
| Author | Mathias Buus |
| Maintainers | mafintosh |

## Links

- npm: https://www.npmjs.com/package/sodium-secretstream
- Repository: https://github.com/mafintosh/sodium-secretstream
- Issues: https://github.com/mafintosh/sodium-secretstream/issues
- npm.io page: https://npm.io/package/sodium-secretstream

## Dependencies (2)

- [b4a](https://npm.io/package/b4a.md) ^1.1.1
- [sodium-universal](https://npm.io/package/sodium-universal.md) ^5.0.0

## Recent versions

- 1.2.0 (latest) — 2025-04-12
- 1.1.1 — 2024-10-04
- 1.1.0 — 2023-01-10
- 1.0.2 — 2021-11-22
- 1.0.1 — 2021-04-13
- 1.0.0 — 2021-02-08
- 0.0.0 — 2021-02-08

## README

# sodium-secretstream

Wraps libsodium's secretstream in a higher level abstraction

```
npm install sodium-secretstream
```

## Usage

``` js
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

---
_Source: https://npm.io/package/sodium-secretstream · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
