An ECMAScript module for NaCl/TweetNaCl high security cryptographic library.
Find a file
2026-08-10 14:47:50 +08:00
.github Update resources 2026-07-15 13:04:04 +08:00
.codeql.yml Update resources 2025-08-26 17:40:37 +08:00
.gitattributes Initial 2025-07-16 14:07:56 +08:00
.gitignore Update resources 2026-04-21 17:45:58 +08:00
.npm-codeberg.build.ts Update resources 2026-08-03 18:24:54 +08:00
.npm-github.build.ts Update resources 2026-08-03 18:24:54 +08:00
.npm-kaki87.build.ts Update resources 2026-08-03 18:24:54 +08:00
.npm-npm.build.ts Update resources 2026-08-03 18:24:54 +08:00
.yamllint.yml Initial 2025-07-16 14:07:56 +08:00
_random_bytes.ts Initial 2025-07-16 14:07:56 +08:00
box.test.ts Update test 2026-07-02 18:23:54 +08:00
CITATION.cff Update resources 2026-06-30 18:44:14 +08:00
CONTRIBUTING.md Update resources 2026-08-03 18:24:54 +08:00
deno.jsonc Update resources 2026-08-10 14:47:50 +08:00
hash.test.ts Update test 2026-07-02 18:23:54 +08:00
jsr.jsonc Update resources 2026-06-30 18:44:14 +08:00
LICENSE.md Update resources 2026-06-19 13:11:47 +08:00
lowlevel.ts Update resources 2025-09-16 17:43:44 +08:00
mod.ts Fmt 2026-07-08 17:36:52 +08:00
onetimeauth.test.ts Update test 2026-07-02 18:23:54 +08:00
README.md Update resources 2026-08-10 14:47:50 +08:00
scalarmult.test.ts Update test 2026-07-02 18:23:54 +08:00
secretbox.test.ts Update test 2026-07-02 18:23:54 +08:00
SECURITY.md Update resources 2026-07-02 18:25:37 +08:00
sign.test.ts Update test 2026-07-02 18:23:54 +08:00
verify.test.ts Update test 2026-07-02 18:23:54 +08:00

NaCl (ES)

⚖️ MIT

🔗 DistBoard @hugoalhGitHubJSRNPM

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