@environment-safe/sodium v0.0.1
@environment-safe/sodium
This library is an ESM polyfill of sodium-universal along with ported tests from chloride-tests and sodium-javascript to native buildless ESM, usable in node or the browser, locally shimmed from the browserify compile ready to run in place, with no build needed.
Usage
For docs consult the sodium-native docs and additionally pull in the CryptoBuffer definition for cross environment buffer handling.
import {
CryptoBuffer, randombytes_buf
} from '@environment-safe/sodium';
var rnd = CryptoBuffer.allocUnsafe(12);
randombytes_buf(rnd);
// rnd now contains random dataTesting
Run the es module tests to test the root modules
npm run import-testto run the same test inside the browser:
npm run browser-testto run the same test headless in chrome:
npm run headless-browser-testto run the same test inside docker:
npm run container-testRun the commonjs tests against the /dist commonjs source (generated with the build-commonjs target).
npm run require-testDevelopment
All work is done in the .mjs files and will be transpiled on commit to commonjs and tested.
If the above tests pass, then attempt a commit which will generate .d.ts files alongside the src files and commonjs classes in dist
9 months ago