NaCl (ES)
DistBoard @hugoalh ● GitHub ● JSR ● NPM
An ECMAScript module for NaCl/TweetNaCl high security cryptographic library.
This is a modified edition of the TweetNaCl JS which with ECMAScript and TypeScript.
Runtime Targets
Any runtime which support ECMAScript should able to use this; These runtimes are officially supported:
Runtime Permissions
This does not request any runtime permission.
Sources & Entrypoints
- GitHub Raw
https://raw.githubusercontent.com/hugoalh/nacl-es/{Tag}/mod.ts - JSR
jsr:@hugoalh/nacl[@{Tag}] - NPM
npm:@hugoalh/nacl[@{Tag}]
| Name | Path | Description |
|---|---|---|
. |
./mod.ts |
Default. High level APIs. |
./lowlevel |
./lowlevel.ts |
Low level APIs. |
- Different runtimes have vary support for the sources and entrypoints, visit the runtime documentation for more information.
- It is recommended to include tag for immutability.
- These are not part of the public APIs hence should not be used:
- Benchmark/Test file (e.g.:
example.bench.ts,example.test.ts).- Entrypoint name or path include any underscore prefix (e.g.:
_example.ts,foo/_example.ts).- Identifier/Namespace/Symbol include any underscore prefix (e.g.:
_example,Foo._example).
APIs
function box(msg: Uint8Array, nonce: Uint8Array, publicKey: Uint8Array, secretKey: Uint8Array): Uint8Array;function boxBefore(publicKey: Uint8Array, secretKey: Uint8Array): Uint8Array;function boxKeyPair(): KeyPair;function boxKeyPairFromSecretKey(secretKey: Uint8Array): KeyPair;function boxOpen(msg: Uint8Array, nonce: Uint8Array, publicKey: Uint8Array, secretKey: Uint8Array): Uint8Array | null;function hash(msg: Uint8Array): Uint8Array;function scalarMult(n: Uint8Array, p: Uint8Array): Uint8Array;function scalarMultBase(n: Uint8Array): Uint8Array;function secretBox(msg: Uint8Array, nonce: Uint8Array, key: Uint8Array): Uint8Array;function secretBoxOpen(box: Uint8Array, nonce: Uint8Array, key: Uint8Array): Uint8Array | null;function sign(msg: Uint8Array, secretKey: Uint8Array): Uint8Array;function signDetached(msg: Uint8Array, secretKey: Uint8Array): Uint8Array;function signDetachedVerify(msg: Uint8Array, sig: Uint8Array, publicKey: Uint8Array): boolean;function signKeyPair(): KeyPair;function signKeyPairFromSecretKey(secretKey: Uint8Array): KeyPair;function signKeyPairFromSeed(seed: Uint8Array): KeyPair;function signOpen(signedMsg: Uint8Array, publicKey: Uint8Array): Uint8Array | null;function verify(x: Uint8Array, y: Uint8Array): boolean;interface KeyPair { publicKey: Uint8Array; secretKey: Uint8Array; }
- For the full or prettier documentation, can visit via: