Skip to content

[WIP] A minimal unified interface for libsodium-based XChaCha20 Poly1305 encryption/decryption.

License

Notifications You must be signed in to change notification settings

projectdysnomia/libsodium

Folders and files

NameName
Last commit message
Last commit date

Latest commit

1d4309d · Nov 15, 2024

History

14 Commits
Nov 15, 2024
Nov 10, 2024
Sep 30, 2024
Nov 10, 2024
Aug 19, 2024
Nov 10, 2024
Aug 19, 2024
Aug 19, 2024
Nov 10, 2024
Aug 19, 2024
Aug 19, 2024
Nov 15, 2024
Nov 10, 2024
Nov 10, 2024
Sep 30, 2024

Repository files navigation

@projectdysnomia/libsodium

A minimal unified interface for libsodium-based XChaCha20 Poly1305 encryption/decryption.

This is achieved by using the following libraries:

  • sodium-native uses a native build of libsodium and is preferred when available.
  • A heavily stripped down custom build of libsodium.js 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

# 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

// 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");

About

[WIP] A minimal unified interface for libsodium-based XChaCha20 Poly1305 encryption/decryption.

Resources

License

Stars

Watchers

Forks

Packages

No packages published