# sodium-browserify

> browser polyfil for sodium

Latest version **1.3.0** (published 2019-07-16) · MIT license · 0 weekly downloads

## Install

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

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.3.0 |
| Published | 2019-07-16 |
| First published | 2015-06-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Unpacked size | 1 MB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 37 |
| Author | Dominic Tarr |
| Maintainers | dominictarr |

## Links

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

## Dependencies (4)

- [sha.js](https://npm.io/package/sha.js.md) 2.4.5
- [tweetnacl](https://npm.io/package/tweetnacl.md) ^0.14.1
- [libsodium-wrappers](https://npm.io/package/libsodium-wrappers.md) ^0.7.4
- [sodium-browserify-tweetnacl](https://npm.io/package/sodium-browserify-tweetnacl.md) ^0.2.5

## Recent versions

- 1.3.0 (latest) — 2019-07-16
- 1.2.7 — 2019-03-24
- 1.2.6 — 2019-03-21
- 1.2.5 — 2019-03-12
- 1.2.4 — 2018-04-09
- 1.2.1 — 2016-11-10
- 1.2.0 — 2016-07-30
- 1.1.2 — 2016-03-21
- 1.0.3 — 2015-12-05
- 1.0.2 — 2015-12-05
- 0.0.0 — 2015-06-15

## README

# sodium-browserify

A polyfil between the apis of [node-sodium](https://github.com/paixaop/node-sodium/)
and [libsodium-wrappers](https://github.com/jedisct1/libsodium.js), heir to [crypto-browserify](https://github.com/crypto-browserify/crypto-browserify)

Mainly, this wraps libsodium-wrappers to make it work with buffers,
and pass the same tests as it does in node, and in the browser.

## UPDATE: WebAssembly!

This now uses webassembly, for a massive speed improvement.
one of the weird quirks of webassembly is that it gets loaded async,
which means you'll only get this speed improvement after waiting a little while,
say 50ms, but in most applications something else will need to load, such as reading database
state or waiting for connections, so this will happen on it's own.

If you try to use this before the wasm has loaded, it will fallback to tweetnacl.

An event is available to ensure wasm is loaded before proceeding:

```
var s = require('sodium-browserify')

s.events.on('sodium-browserify:wasm loaded', function() {
  console.log("wasm was loaded!")
})
```

Tests are generated from sodium, with values stored in JSON so that they can be run in the browser.

## License

MIT

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