An ECMAScript module for NaCl/TweetNaCl high security cryptographic library.
| .github | ||
| .codeql.yml | ||
| .gitattributes | ||
| .gitignore | ||
| .npm-codeberg.build.ts | ||
| .npm-github.build.ts | ||
| .npm-kaki87.build.ts | ||
| .npm-npm.build.ts | ||
| .yamllint.yml | ||
| _random_bytes.ts | ||
| box.test.ts | ||
| CITATION.cff | ||
| CONTRIBUTING.md | ||
| deno.jsonc | ||
| hash.test.ts | ||
| jsr.jsonc | ||
| LICENSE.md | ||
| lowlevel.ts | ||
| mod.ts | ||
| onetimeauth.test.ts | ||
| README.md | ||
| scalarmult.test.ts | ||
| secretbox.test.ts | ||
| SECURITY.md | ||
| sign.test.ts | ||
| verify.test.ts | ||
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.
#️⃣ Entrypoints
| Name | Path | Description |
|---|---|---|
. |
./mod.ts |
Default. High level APIs. |
./lowlevel |
./lowlevel.ts |
Low level APIs. |
Note
- Different runtimes have vary support for the entrypoints, visit the runtime documentation for more information.
- 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; }
Note
- For the full or prettier documentation, can visit via: