Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/projectdysnomia/libsodium
[WIP] A minimal unified interface for libsodium-based XChaCha20 Poly1305 encryption/decryption.
https://github.com/projectdysnomia/libsodium
Last synced: 4 days ago
JSON representation
[WIP] A minimal unified interface for libsodium-based XChaCha20 Poly1305 encryption/decryption.
- Host: GitHub
- URL: https://github.com/projectdysnomia/libsodium
- Owner: projectdysnomia
- License: mit
- Created: 2024-08-18T11:38:49.000Z (3 months ago)
- Default Branch: dev
- Last Pushed: 2024-11-10T18:06:58.000Z (4 days ago)
- Last Synced: 2024-11-10T18:30:58.863Z (4 days ago)
- Language: JavaScript
- Homepage:
- Size: 24.4 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# @projectdysnomia/libsodium
A minimal unified interface for libsodium-based XChaCha20 Poly1305 encryption/decryption.This is achieved by using the following libraries:
- [`sodium-native`](https://www.npmjs.com/package/sodium-native) uses a native build of libsodium and is preferred when available.
- A heavily stripped down custom build of [libsodium.js](https://www.npmjs.com/package/libsodium) is used as a fallback.
The differences between libsodium.js and this package are as follows:
- The WASM binary initiates synchronously, making it better suited for CommonJS environments
- Only the WASM binary is provided, there is no fallback to JS-based emulation
- Only `crypto_aead_xchacha20poly1305_ietf_*` (sans `crypto_aead_xchacha20poly1305_ietf_keygen`) and `sodium_init` methods are exposed in the WASM binary## Installation
```sh
# install with the WASM backend bundled by default
npm install @projectdysnomia/libsodium
# optionally, you may also install sodium-native for better performance
npm install sodium-native
```## Usage
```js
// auto-selected backend: native is preferred
const mod = require("@projectdysnomia/libsodium");
// native-only
const mod = require("@projectdysnomia/libsodium/native");
// WASM-only
const mod = require("@projectdysnomia/libsodium/wasm");```