leviathan-crypto 2.0.1 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CLAUDE.md +88 -281
- package/LICENSE +4 -0
- package/README.md +275 -87
- package/dist/aes/aes-cbc.d.ts +40 -0
- package/dist/aes/aes-cbc.js +158 -0
- package/dist/aes/aes-ctr.d.ts +50 -0
- package/dist/aes/aes-ctr.js +141 -0
- package/dist/aes/aes-gcm-siv.d.ts +67 -0
- package/dist/aes/aes-gcm-siv.js +217 -0
- package/dist/aes/aes-gcm.d.ts +61 -0
- package/dist/aes/aes-gcm.js +226 -0
- package/dist/aes/cipher-suite.d.ts +21 -0
- package/dist/aes/cipher-suite.js +179 -0
- package/dist/aes/embedded.d.ts +1 -0
- package/dist/aes/embedded.js +26 -0
- package/dist/aes/generator.d.ts +14 -0
- package/dist/aes/generator.js +103 -0
- package/dist/aes/index.d.ts +58 -0
- package/dist/aes/index.js +125 -0
- package/dist/aes/ops.d.ts +60 -0
- package/dist/aes/ops.js +164 -0
- package/dist/aes/pool-worker.d.ts +1 -0
- package/dist/aes/pool-worker.js +92 -0
- package/dist/aes/types.d.ts +1 -0
- package/dist/aes/types.js +23 -0
- package/dist/aes.wasm +0 -0
- package/dist/blake3/embedded.d.ts +1 -0
- package/dist/blake3/embedded.js +26 -0
- package/dist/blake3/index.d.ts +143 -0
- package/dist/blake3/index.js +620 -0
- package/dist/blake3/types.d.ts +102 -0
- package/dist/blake3/types.js +31 -0
- package/dist/blake3/validate.d.ts +29 -0
- package/dist/blake3/validate.js +80 -0
- package/dist/blake3.wasm +0 -0
- package/dist/chacha20/cipher-suite.d.ts +10 -0
- package/dist/chacha20/cipher-suite.js +98 -13
- package/dist/chacha20/generator.d.ts +12 -0
- package/dist/chacha20/generator.js +91 -0
- package/dist/chacha20/index.d.ts +100 -3
- package/dist/chacha20/index.js +169 -35
- package/dist/chacha20/ops.d.ts +57 -6
- package/dist/chacha20/ops.js +107 -27
- package/dist/chacha20/pool-worker.js +14 -0
- package/dist/chacha20/types.d.ts +1 -32
- package/dist/cte-wasm.d.ts +1 -0
- package/dist/cte-wasm.js +3 -0
- package/dist/cte.wasm +0 -0
- package/dist/curve25519.wasm +0 -0
- package/dist/ecdsa/der.d.ts +23 -0
- package/dist/ecdsa/der.js +192 -0
- package/dist/ecdsa/ecprivatekey-der.d.ts +32 -0
- package/dist/ecdsa/ecprivatekey-der.js +230 -0
- package/dist/ecdsa/embedded.d.ts +1 -0
- package/dist/ecdsa/embedded.js +25 -0
- package/dist/ecdsa/index.d.ts +124 -0
- package/dist/ecdsa/index.js +366 -0
- package/dist/ecdsa/types.d.ts +31 -0
- package/dist/ecdsa/types.js +28 -0
- package/dist/ecdsa/validate.d.ts +18 -0
- package/dist/ecdsa/validate.js +92 -0
- package/dist/ed25519/embedded.d.ts +1 -0
- package/dist/ed25519/embedded.js +31 -0
- package/dist/ed25519/index.d.ts +70 -0
- package/dist/ed25519/index.js +308 -0
- package/dist/ed25519/types.d.ts +27 -0
- package/dist/ed25519/types.js +27 -0
- package/dist/ed25519/validate.d.ts +7 -0
- package/dist/ed25519/validate.js +77 -0
- package/dist/embedded/aes-pool-worker.d.ts +1 -0
- package/dist/embedded/aes-pool-worker.js +5 -0
- package/dist/embedded/aes.d.ts +1 -0
- package/dist/embedded/aes.js +3 -0
- package/dist/embedded/blake3.d.ts +1 -0
- package/dist/embedded/blake3.js +3 -0
- package/dist/embedded/chacha20-pool-worker.d.ts +1 -0
- package/dist/embedded/chacha20-pool-worker.js +5 -0
- package/dist/embedded/chacha20.d.ts +1 -1
- package/dist/embedded/chacha20.js +2 -2
- package/dist/embedded/curve25519.d.ts +1 -0
- package/dist/embedded/curve25519.js +3 -0
- package/dist/embedded/mldsa.d.ts +1 -0
- package/dist/embedded/mldsa.js +3 -0
- package/dist/embedded/mlkem.d.ts +1 -0
- package/dist/embedded/mlkem.js +3 -0
- package/dist/embedded/p256.d.ts +1 -0
- package/dist/embedded/p256.js +3 -0
- package/dist/embedded/serpent-pool-worker.d.ts +1 -0
- package/dist/embedded/serpent-pool-worker.js +5 -0
- package/dist/embedded/serpent.d.ts +1 -1
- package/dist/embedded/serpent.js +2 -2
- package/dist/embedded/sha2.d.ts +1 -1
- package/dist/embedded/sha2.js +2 -2
- package/dist/embedded/sha3.d.ts +1 -1
- package/dist/embedded/sha3.js +2 -2
- package/dist/embedded/slhdsa.d.ts +1 -0
- package/dist/embedded/slhdsa.js +3 -0
- package/dist/errors.d.ts +92 -1
- package/dist/errors.js +111 -1
- package/dist/fortuna.d.ts +18 -12
- package/dist/fortuna.js +166 -99
- package/dist/index.d.ts +42 -11
- package/dist/index.js +65 -20
- package/dist/init.d.ts +1 -3
- package/dist/init.js +73 -7
- package/dist/keccak/embedded.js +1 -1
- package/dist/keccak/index.d.ts +2 -0
- package/dist/keccak/index.js +4 -2
- package/dist/loader.d.ts +1 -19
- package/dist/loader.js +26 -32
- package/dist/merkle/blake3-tree.d.ts +35 -0
- package/dist/merkle/blake3-tree.js +187 -0
- package/dist/merkle/checkpoint.d.ts +58 -0
- package/dist/merkle/checkpoint.js +217 -0
- package/dist/merkle/index.d.ts +19 -0
- package/dist/merkle/index.js +37 -0
- package/dist/merkle/merkle-log.d.ts +130 -0
- package/dist/merkle/merkle-log.js +207 -0
- package/dist/merkle/merkle-verifier.d.ts +126 -0
- package/dist/merkle/merkle-verifier.js +296 -0
- package/dist/merkle/proof.d.ts +70 -0
- package/dist/merkle/proof.js +300 -0
- package/dist/merkle/sha256-tree.d.ts +33 -0
- package/dist/merkle/sha256-tree.js +145 -0
- package/dist/merkle/signed-log.d.ts +156 -0
- package/dist/merkle/signed-log.js +356 -0
- package/dist/merkle/signed-note.d.ts +309 -0
- package/dist/merkle/signed-note.js +648 -0
- package/dist/merkle/sth.d.ts +31 -0
- package/dist/merkle/sth.js +31 -0
- package/dist/merkle/storage.d.ts +40 -0
- package/dist/merkle/storage.js +71 -0
- package/dist/merkle/tree.d.ts +68 -0
- package/dist/merkle/tree.js +94 -0
- package/dist/mldsa/embedded.d.ts +1 -0
- package/dist/{kyber → mldsa}/embedded.js +5 -5
- package/dist/mldsa/expand.d.ts +53 -0
- package/dist/mldsa/expand.js +188 -0
- package/dist/mldsa/format.d.ts +16 -0
- package/dist/mldsa/format.js +68 -0
- package/dist/mldsa/hashvariant.d.ts +32 -0
- package/dist/mldsa/hashvariant.js +248 -0
- package/dist/mldsa/index.d.ts +142 -0
- package/dist/mldsa/index.js +463 -0
- package/dist/mldsa/keygen.d.ts +16 -0
- package/dist/mldsa/keygen.js +232 -0
- package/dist/mldsa/params.d.ts +21 -0
- package/dist/mldsa/params.js +55 -0
- package/dist/mldsa/sha3-helpers.d.ts +30 -0
- package/dist/mldsa/sha3-helpers.js +124 -0
- package/dist/mldsa/sign.d.ts +36 -0
- package/dist/mldsa/sign.js +380 -0
- package/dist/mldsa/types.d.ts +91 -0
- package/dist/mldsa/types.js +25 -0
- package/dist/mldsa/validate.d.ts +55 -0
- package/dist/mldsa/validate.js +125 -0
- package/dist/mldsa/verify.d.ts +29 -0
- package/dist/mldsa/verify.js +269 -0
- package/dist/mldsa.wasm +0 -0
- package/dist/mlkem/embedded.d.ts +1 -0
- package/dist/mlkem/embedded.js +27 -0
- package/dist/mlkem/indcpa.d.ts +49 -0
- package/dist/{kyber → mlkem}/indcpa.js +48 -48
- package/dist/mlkem/index.d.ts +37 -0
- package/dist/{kyber → mlkem}/index.js +41 -31
- package/dist/mlkem/kem.d.ts +21 -0
- package/dist/{kyber → mlkem}/kem.js +48 -13
- package/dist/{kyber → mlkem}/params.d.ts +4 -4
- package/dist/{kyber → mlkem}/params.js +2 -2
- package/dist/mlkem/suite.d.ts +12 -0
- package/dist/{kyber → mlkem}/suite.js +17 -12
- package/dist/{kyber → mlkem}/types.d.ts +4 -3
- package/dist/{kyber → mlkem}/types.js +1 -1
- package/dist/mlkem/validate.d.ts +23 -0
- package/dist/{kyber → mlkem}/validate.js +24 -20
- package/dist/{kyber.wasm → mlkem.wasm} +0 -0
- package/dist/p256.wasm +0 -0
- package/dist/ratchet/index.d.ts +8 -0
- package/dist/ratchet/index.js +38 -0
- package/dist/ratchet/kdf-chain.d.ts +13 -0
- package/dist/ratchet/kdf-chain.js +85 -0
- package/dist/ratchet/ratchet-keypair.d.ts +9 -0
- package/dist/ratchet/ratchet-keypair.js +61 -0
- package/dist/ratchet/root-kdf.d.ts +4 -0
- package/dist/ratchet/root-kdf.js +124 -0
- package/dist/ratchet/skipped-key-store.d.ts +14 -0
- package/dist/ratchet/skipped-key-store.js +154 -0
- package/dist/ratchet/types.d.ts +36 -0
- package/dist/ratchet/types.js +26 -0
- package/dist/serpent/cipher-suite.d.ts +10 -0
- package/dist/serpent/cipher-suite.js +144 -56
- package/dist/serpent/generator.d.ts +12 -0
- package/dist/serpent/generator.js +97 -0
- package/dist/serpent/index.d.ts +62 -1
- package/dist/serpent/index.js +97 -21
- package/dist/serpent/pool-worker.js +28 -102
- package/dist/serpent/serpent-cbc.d.ts +16 -6
- package/dist/serpent/serpent-cbc.js +58 -37
- package/dist/serpent/shared-ops.d.ts +63 -0
- package/dist/serpent/shared-ops.js +178 -0
- package/dist/serpent/types.d.ts +1 -5
- package/dist/serpent.wasm +0 -0
- package/dist/sha2/hash.d.ts +2 -0
- package/dist/sha2/hash.js +53 -0
- package/dist/sha2/hkdf.js +5 -5
- package/dist/sha2/index.d.ts +22 -1
- package/dist/sha2/index.js +80 -11
- package/dist/sha2/types.d.ts +41 -2
- package/dist/sha2.wasm +0 -0
- package/dist/sha3/hash.d.ts +2 -0
- package/dist/sha3/hash.js +53 -0
- package/dist/sha3/index.d.ts +87 -3
- package/dist/sha3/index.js +317 -19
- package/dist/sha3/kmac.d.ts +121 -0
- package/dist/sha3/kmac.js +800 -0
- package/dist/sha3.wasm +0 -0
- package/dist/shared/pkcs7.d.ts +22 -0
- package/dist/shared/pkcs7.js +84 -0
- package/dist/sign/ctx.d.ts +41 -0
- package/dist/sign/ctx.js +102 -0
- package/dist/sign/envelope.d.ts +45 -0
- package/dist/sign/envelope.js +152 -0
- package/dist/sign/hasher.d.ts +9 -0
- package/dist/sign/hasher.js +132 -0
- package/dist/sign/index.d.ts +11 -0
- package/dist/sign/index.js +34 -0
- package/dist/sign/sign-stream.d.ts +25 -0
- package/dist/sign/sign-stream.js +112 -0
- package/dist/sign/suites/ecdsa-p256.d.ts +2 -0
- package/dist/sign/suites/ecdsa-p256.js +120 -0
- package/dist/sign/suites/ed25519.d.ts +3 -0
- package/dist/sign/suites/ed25519.js +165 -0
- package/dist/sign/suites/hybrid-classical.d.ts +23 -0
- package/dist/sign/suites/hybrid-classical.js +526 -0
- package/dist/sign/suites/hybrid-pq.d.ts +4 -0
- package/dist/sign/suites/hybrid-pq.js +234 -0
- package/dist/sign/suites/mldsa.d.ts +7 -0
- package/dist/sign/suites/mldsa.js +161 -0
- package/dist/sign/suites/slhdsa.d.ts +7 -0
- package/dist/sign/suites/slhdsa.js +176 -0
- package/dist/sign/types.d.ts +106 -0
- package/dist/sign/types.js +28 -0
- package/dist/sign/verify-stream.d.ts +30 -0
- package/dist/sign/verify-stream.js +227 -0
- package/dist/slhdsa/embedded.d.ts +1 -0
- package/dist/slhdsa/embedded.js +26 -0
- package/dist/slhdsa/index.d.ts +149 -0
- package/dist/slhdsa/index.js +493 -0
- package/dist/slhdsa/params.d.ts +26 -0
- package/dist/slhdsa/params.js +70 -0
- package/dist/slhdsa/prehash.d.ts +68 -0
- package/dist/slhdsa/prehash.js +307 -0
- package/dist/slhdsa/sign.d.ts +39 -0
- package/dist/slhdsa/sign.js +116 -0
- package/dist/slhdsa/types.d.ts +129 -0
- package/dist/slhdsa/types.js +27 -0
- package/dist/slhdsa/validate.d.ts +60 -0
- package/dist/slhdsa/validate.js +127 -0
- package/dist/slhdsa/verify.d.ts +32 -0
- package/dist/slhdsa/verify.js +107 -0
- package/dist/slhdsa.wasm +0 -0
- package/dist/stream/header.js +8 -8
- package/dist/stream/index.d.ts +1 -0
- package/dist/stream/index.js +1 -0
- package/dist/stream/open-stream.js +65 -22
- package/dist/stream/seal-stream-pool.d.ts +2 -0
- package/dist/stream/seal-stream-pool.js +100 -33
- package/dist/stream/seal-stream.d.ts +1 -1
- package/dist/stream/seal-stream.js +48 -19
- package/dist/stream/seal.js +6 -6
- package/dist/stream/types.d.ts +3 -1
- package/dist/stream/types.js +1 -1
- package/dist/types.d.ts +22 -1
- package/dist/types.js +1 -1
- package/dist/utils.d.ts +9 -10
- package/dist/utils.js +84 -59
- package/dist/wasm-source.d.ts +9 -8
- package/dist/wasm-source.js +1 -1
- package/dist/x25519/embedded.d.ts +1 -0
- package/dist/x25519/embedded.js +31 -0
- package/dist/x25519/index.d.ts +43 -0
- package/dist/x25519/index.js +159 -0
- package/dist/x25519/types.d.ts +25 -0
- package/dist/x25519/types.js +27 -0
- package/dist/x25519/validate.d.ts +2 -0
- package/dist/x25519/validate.js +39 -0
- package/package.json +123 -64
- package/SECURITY.md +0 -276
- package/dist/ct-wasm.d.ts +0 -1
- package/dist/ct-wasm.js +0 -3
- package/dist/ct.wasm +0 -0
- package/dist/docs/aead.md +0 -323
- package/dist/docs/architecture.md +0 -932
- package/dist/docs/argon2id.md +0 -302
- package/dist/docs/chacha20.md +0 -674
- package/dist/docs/exports.md +0 -241
- package/dist/docs/fortuna.md +0 -313
- package/dist/docs/init.md +0 -302
- package/dist/docs/loader.md +0 -161
- package/dist/docs/serpent.md +0 -519
- package/dist/docs/sha2.md +0 -613
- package/dist/docs/sha3.md +0 -546
- package/dist/docs/types.md +0 -276
- package/dist/docs/utils.md +0 -367
- package/dist/embedded/kyber.d.ts +0 -1
- package/dist/embedded/kyber.js +0 -3
- package/dist/kyber/embedded.d.ts +0 -1
- package/dist/kyber/indcpa.d.ts +0 -49
- package/dist/kyber/index.d.ts +0 -38
- package/dist/kyber/kem.d.ts +0 -21
- package/dist/kyber/suite.d.ts +0 -13
- package/dist/kyber/validate.d.ts +0 -19
package/package.json
CHANGED
|
@@ -1,66 +1,125 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
2
|
+
"name": "leviathan-crypto",
|
|
3
|
+
"version": "3.0.0",
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"description": "Paranoid post-quantum WASM cryptography library with bitsliced ciphers (Serpent, XChaCha20, AES), ML-KEM, lattice and hash-based signatures (ML-DSA, SLH-DSA, hybrid composites), hashing (SHA-2, SHA-3, BLAKE3), forward-secret ratchet, and Fortuna CSPRNG. Zero dependencies, tree-shakeable, and side-effect-free.",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/xero/leviathan-crypto.git"
|
|
9
|
+
},
|
|
10
|
+
"bugs": {
|
|
11
|
+
"url": "https://github.com/xero/leviathan-crypto/issues"
|
|
12
|
+
},
|
|
13
|
+
"homepage": "https://leviathan.3xi.club",
|
|
14
|
+
"author": "xero (https://x-e.ro)",
|
|
15
|
+
"type": "module",
|
|
16
|
+
"sideEffects": false,
|
|
17
|
+
"exports": {
|
|
18
|
+
".": "./dist/index.js",
|
|
19
|
+
"./stream": "./dist/stream/index.js",
|
|
20
|
+
"./serpent": "./dist/serpent/index.js",
|
|
21
|
+
"./serpent/embedded": "./dist/serpent/embedded.js",
|
|
22
|
+
"./chacha20": "./dist/chacha20/index.js",
|
|
23
|
+
"./chacha20/embedded": "./dist/chacha20/embedded.js",
|
|
24
|
+
"./sha2": "./dist/sha2/index.js",
|
|
25
|
+
"./sha2/embedded": "./dist/sha2/embedded.js",
|
|
26
|
+
"./sha3": "./dist/sha3/index.js",
|
|
27
|
+
"./sha3/embedded": "./dist/sha3/embedded.js",
|
|
28
|
+
"./keccak": "./dist/keccak/index.js",
|
|
29
|
+
"./keccak/embedded": "./dist/keccak/embedded.js",
|
|
30
|
+
"./mlkem": "./dist/mlkem/index.js",
|
|
31
|
+
"./mlkem/embedded": "./dist/mlkem/embedded.js",
|
|
32
|
+
"./aes": "./dist/aes/index.js",
|
|
33
|
+
"./aes/embedded": "./dist/aes/embedded.js",
|
|
34
|
+
"./blake3": "./dist/blake3/index.js",
|
|
35
|
+
"./blake3/embedded": "./dist/blake3/embedded.js",
|
|
36
|
+
"./ecdsa": "./dist/ecdsa/index.js",
|
|
37
|
+
"./ecdsa/embedded": "./dist/ecdsa/embedded.js",
|
|
38
|
+
"./ed25519": "./dist/ed25519/index.js",
|
|
39
|
+
"./ed25519/embedded": "./dist/ed25519/embedded.js",
|
|
40
|
+
"./mldsa": "./dist/mldsa/index.js",
|
|
41
|
+
"./mldsa/embedded": "./dist/mldsa/embedded.js",
|
|
42
|
+
"./slhdsa": "./dist/slhdsa/index.js",
|
|
43
|
+
"./slhdsa/embedded": "./dist/slhdsa/embedded.js",
|
|
44
|
+
"./x25519": "./dist/x25519/index.js",
|
|
45
|
+
"./x25519/embedded": "./dist/x25519/embedded.js",
|
|
46
|
+
"./ratchet": "./dist/ratchet/index.js",
|
|
47
|
+
"./sign": "./dist/sign/index.js",
|
|
48
|
+
"./merkle": "./dist/merkle/index.js"
|
|
49
|
+
},
|
|
50
|
+
"types": "./dist/index.d.ts",
|
|
51
|
+
"files": [
|
|
52
|
+
"dist",
|
|
53
|
+
"CLAUDE.md"
|
|
54
|
+
],
|
|
55
|
+
"keywords": [
|
|
56
|
+
"cryptography",
|
|
57
|
+
"encryption",
|
|
58
|
+
"crypto",
|
|
59
|
+
"typescript",
|
|
60
|
+
"wasm",
|
|
61
|
+
"webassembly",
|
|
62
|
+
"simd",
|
|
63
|
+
"isomorphic",
|
|
64
|
+
"zero-dependency",
|
|
65
|
+
"constant-time",
|
|
66
|
+
"bitsliced",
|
|
67
|
+
"side-channel",
|
|
68
|
+
"post-quantum",
|
|
69
|
+
"pqc",
|
|
70
|
+
"hybrid",
|
|
71
|
+
"aead",
|
|
72
|
+
"kem",
|
|
73
|
+
"key-encapsulation",
|
|
74
|
+
"signing",
|
|
75
|
+
"signature",
|
|
76
|
+
"hashing",
|
|
77
|
+
"cipher",
|
|
78
|
+
"serpent",
|
|
79
|
+
"serpent-256",
|
|
80
|
+
"chacha20",
|
|
81
|
+
"xchacha20",
|
|
82
|
+
"poly1305",
|
|
83
|
+
"xchacha20-poly1305",
|
|
84
|
+
"aes",
|
|
85
|
+
"aes-256",
|
|
86
|
+
"aes-gcm-siv",
|
|
87
|
+
"kyber",
|
|
88
|
+
"ml-kem",
|
|
89
|
+
"mlkem",
|
|
90
|
+
"ml-dsa",
|
|
91
|
+
"mldsa",
|
|
92
|
+
"slh-dsa",
|
|
93
|
+
"slhdsa",
|
|
94
|
+
"ed25519",
|
|
95
|
+
"x25519",
|
|
96
|
+
"ecdsa",
|
|
97
|
+
"ecdsa-p256",
|
|
98
|
+
"p256",
|
|
99
|
+
"prime256v1",
|
|
100
|
+
"secp256r1",
|
|
101
|
+
"sha",
|
|
102
|
+
"sha-256",
|
|
103
|
+
"sha-512",
|
|
104
|
+
"sha-3",
|
|
105
|
+
"keccak",
|
|
106
|
+
"shake",
|
|
107
|
+
"cshake",
|
|
108
|
+
"blake3",
|
|
109
|
+
"hmac",
|
|
110
|
+
"kmac",
|
|
111
|
+
"hkdf",
|
|
112
|
+
"argon2",
|
|
113
|
+
"argon2id",
|
|
114
|
+
"fortuna",
|
|
115
|
+
"csprng",
|
|
116
|
+
"entropy",
|
|
117
|
+
"double-ratchet",
|
|
118
|
+
"ratchet",
|
|
119
|
+
"forward-secrecy",
|
|
120
|
+
"spqr",
|
|
121
|
+
"merkle",
|
|
122
|
+
"merkle-tree",
|
|
123
|
+
"transparency-log"
|
|
124
|
+
]
|
|
66
125
|
}
|
package/SECURITY.md
DELETED
|
@@ -1,276 +0,0 @@
|
|
|
1
|
-
# Leviathan Crypto Library Security Policy
|
|
2
|
-
|
|
3
|
-
<img src="https://github.com/xero/leviathan-crypto/raw/main/docs/logo.svg" alt="Leviathan logo" width="100" align="left">
|
|
4
|
-
|
|
5
|
-
- **[Version Support](#supported-versions)**
|
|
6
|
-
- **[Security Posture](#security-posture)**
|
|
7
|
-
- **[Cryptanalytic Audits](#cryptanalytic-audits)**
|
|
8
|
-
- **[Vulnerability Reporting](#reporting-a-vulnerability)**
|
|
9
|
-
|
|
10
|
-
---
|
|
11
|
-
|
|
12
|
-
## Supported Versions
|
|
13
|
-
|
|
14
|
-
| Version | Supported |
|
|
15
|
-
| ------- | --------- |
|
|
16
|
-
| v2.0.x | ✓ |
|
|
17
|
-
| v1.4.x | ✗ |
|
|
18
|
-
| v1.3.x | ✗ |
|
|
19
|
-
| v1.2.x | ✗ |
|
|
20
|
-
| v1.1.x | ✗ |
|
|
21
|
-
| v1.0.x | ✗ |
|
|
22
|
-
|
|
23
|
-
> [!CAUTION]
|
|
24
|
-
> **All v1.x releases are deprecated.** Upgrading to v2 is strongly
|
|
25
|
-
> recommended. v1.x releases will not receive security patches.
|
|
26
|
-
|
|
27
|
-
> [!WARNING]
|
|
28
|
-
> **v1.x known issues** (addressed in v2):
|
|
29
|
-
> - Partial WASM buffer wipe on AEAD and serpent auth failure.
|
|
30
|
-
> - HMAC tag and HKDF operations do not zero intermediate key material.
|
|
31
|
-
> - TransformStream error paths leak derived keys.
|
|
32
|
-
> - Pool workers copy result buffers.
|
|
33
|
-
> - Scalar JS `constantTimeEqual` was "best-effort only".
|
|
34
|
-
|
|
35
|
-
> [!WARNING]
|
|
36
|
-
> **v2.0.0 known issue** (addressed in v2.0.1):
|
|
37
|
-
> - `SealStreamPool` with `SerpentCipher` and `chunkSize: 65536` silently
|
|
38
|
-
> produces corrupt plaintext on decrypt for inputs >= 65536 bytes. No
|
|
39
|
-
> authentication error is raised. Upgrade to v2.0.1 immediately.
|
|
40
|
-
|
|
41
|
-
## Security Posture
|
|
42
|
-
|
|
43
|
-
[`leviathan-crypto`](https://leviathan.3xi.club) is a cryptography library.
|
|
44
|
-
Security is not an afterthought, it is the primary design constraint at every
|
|
45
|
-
layer of the stack.
|
|
46
|
-
|
|
47
|
-
### Algorithm Correctness
|
|
48
|
-
|
|
49
|
-
Every primitive in this library was implemented by hand in AssemblyScript
|
|
50
|
-
against the authoritative specification for that algorithm:
|
|
51
|
-
[FIPS 180-4][fips180] (SHA-2), [FIPS 202][fips202] (SHA-3),
|
|
52
|
-
[FIPS 203][fips203] (ML-KEM),
|
|
53
|
-
[RFC 8439][rfc8439] (ChaCha20-Poly1305), [RFC 2104][rfc2104] (HMAC),
|
|
54
|
-
[RFC 5869][rfc5869] (HKDF), and the original
|
|
55
|
-
[Serpent-256 specification][serpent] and S-box reference. No algorithm was
|
|
56
|
-
ported from an existing implementation. The specs are always the source of truth.
|
|
57
|
-
|
|
58
|
-
All implementations are verified against published known-answer test vectors
|
|
59
|
-
from NIST, RFC appendices, NESSIE, and the Argon2 reference suite. Vectors
|
|
60
|
-
are immutable: if an implementation produces incorrect output, the
|
|
61
|
-
implementation is fixed and vectors are never adjusted to match code.
|
|
62
|
-
|
|
63
|
-
### Side-Channel Resistance
|
|
64
|
-
|
|
65
|
-
Serpent's S-boxes are implemented as Boolean gate circuits designed with no table
|
|
66
|
-
lookups, no data-dependent memory access, and no data-dependent branches. Every
|
|
67
|
-
bit is processed unconditionally on every block. This is the most
|
|
68
|
-
timing-safe cipher implementation approach available in a WASM runtime,
|
|
69
|
-
where JIT optimisation can otherwise introduce observable timing variation.
|
|
70
|
-
|
|
71
|
-
All security-sensitive comparisons (e.g. MAC verification, padding validation)
|
|
72
|
-
use [`constantTimeEqual`][utils], which is backed by a dedicated WASM SIMD module
|
|
73
|
-
(v128 XOR accumulate + `any_true`) when WebAssembly SIMD is available. The WASM
|
|
74
|
-
execution path eliminates JIT short-circuiting and speculative optimization as
|
|
75
|
-
theoretical side-channel vectors. On runtimes without SIMD (sha2/sha3-only
|
|
76
|
-
consumers), the function falls back to a JS XOR-accumulate loop. This is best-effort
|
|
77
|
-
constant-time, not a hardware-level guarantee. WASM comparison memory is
|
|
78
|
-
wiped after every call.
|
|
79
|
-
|
|
80
|
-
### WASM Execution Model
|
|
81
|
-
|
|
82
|
-
All cryptographic computation runs in WebAssembly, isolated outside the
|
|
83
|
-
JavaScript JIT. WASM execution is deterministic and not subject to JIT
|
|
84
|
-
speculation or optimisation. Each primitive family compiles to its own
|
|
85
|
-
isolated binary with its own linear memory. For example, key material in
|
|
86
|
-
the Serpent module cannot interact with memory in the SHA-3 module,
|
|
87
|
-
even in principle. A dedicated WASM module handles constant-time comparison
|
|
88
|
-
with its own single-page memory that is wiped after every call.
|
|
89
|
-
|
|
90
|
-
Serpent and ChaCha20 modules require WebAssembly SIMD (`v128` instructions).
|
|
91
|
-
`init()` and `initModule()` perform a SIMD preflight check and throw a
|
|
92
|
-
clear error on runtimes without support. SIMD has been a baseline feature
|
|
93
|
-
of all major browsers and runtimes since 2021. SHA-2 and SHA-3 modules
|
|
94
|
-
run on any WASM-capable runtime.
|
|
95
|
-
|
|
96
|
-
The `kyber` module requires WebAssembly SIMD for NTT and polynomial
|
|
97
|
-
arithmetic (`v128` instructions). The SIMD preflight check is applied on
|
|
98
|
-
`init()` alongside serpent and chacha20. Its linear memory is independent
|
|
99
|
-
from all other modules. The kyber module's constant-time path (FO transform
|
|
100
|
-
decapsulation) uses dedicated `ct_verify` and `ct_cmov` functions implemented
|
|
101
|
-
in the kyber WASM binary. The comparison never passes through JavaScript.
|
|
102
|
-
|
|
103
|
-
### Cryptanalytic Audits
|
|
104
|
-
|
|
105
|
-
All primitives undergo periodic cryptographic implementation reviews. See the [audit index][audits] for a full summary.
|
|
106
|
-
|
|
107
|
-
| Primitive | Audit Description |
|
|
108
|
-
| ------------------------------ | -------------------------------------------------------------------------------------- |
|
|
109
|
-
| [serpent_audit][serpent_audit] | Correctness verification, side-channel analysis, cryptanalytic attack paper review |
|
|
110
|
-
| [chacha_audit][chacha_audit] | XChaCha20-Poly1305 correctness, Poly1305 field arithmetic, HChaCha20 nonce extension |
|
|
111
|
-
| [sha2_audit][sha2_audit] | SHA-256/512/384 correctness, HMAC and HKDF composition, constant verification |
|
|
112
|
-
| [sha3_audit][sha3_audit] | Keccak permutation correctness, θ/ρ/π/χ/ι step verification, round constant derivation |
|
|
113
|
-
| [hmac_audit][hmac_audit] | HMAC-SHA256/512/384 construction, key processing, RFC 4231 vector coverage |
|
|
114
|
-
| [hkdf_audit][hkdf_audit] | HKDF extract-then-expand, info field domain separation, stream key derivation |
|
|
115
|
-
| [kyber_audit][kyber_audit] | ML-KEM FIPS 203 correctness, NTT/Montgomery/Barrett verification, FO transform CT analysis, ACVP validation |
|
|
116
|
-
| [stream_audit][stream_audit] | Streaming AEAD composition, counter nonce binding, final-chunk detection, key wipe paths |
|
|
117
|
-
|
|
118
|
-
#### Additional Serpent-256 research
|
|
119
|
-
|
|
120
|
-
The security margin of Serpent-256 has been independently researched and
|
|
121
|
-
documented. The best known attack on the full 32-round cipher, _"biclique
|
|
122
|
-
cryptanalysis"_, achieves a complexity of 2²⁵⁵·¹⁹ with 2⁴ chosen
|
|
123
|
-
ciphertexts. This provides less than one bit of advantage over exhaustive
|
|
124
|
-
key search and has zero practical impact. Independent research conducted
|
|
125
|
-
against this implementation improved on the published result by −0.20 bits
|
|
126
|
-
through systematic parameter search, confirming no structural weakness
|
|
127
|
-
beyond what the published literature describes.
|
|
128
|
-
|
|
129
|
-
See: [`xero/BicliqueFinder/biclique_research.md`][biclique]
|
|
130
|
-
|
|
131
|
-
### Authenticated Encryption by Default
|
|
132
|
-
|
|
133
|
-
Raw unauthenticated cipher modes (`SerpentCbc`, `SerpentCtr`, `ChaCha20`) and
|
|
134
|
-
stateless caller-managed-nonce primitives (`ChaCha20Poly1305`,
|
|
135
|
-
`XChaCha20Poly1305`) are exposed for power users but are not the recommended
|
|
136
|
-
entry point. The primary API surfaces (`Seal`, `SealStream`, `OpenStream`,
|
|
137
|
-
`SealStreamPool`, and `KyberSuite`) are authenticated by construction with
|
|
138
|
-
internally managed nonces.
|
|
139
|
-
|
|
140
|
-
**All streaming constructions satisfy the _Cryptographic Doom Principle_:**
|
|
141
|
-
|
|
142
|
-
`SealStream` / `OpenStream` with `SerpentCipher` uses encrypt-then-MAC
|
|
143
|
-
(SerpentCbc + HMAC-SHA256). MAC verification is the unconditional gate on
|
|
144
|
-
the open path. Decryption is unreachable until that gate clears. HKDF key
|
|
145
|
-
derivation with the stream nonce and counter-nonce domain separation
|
|
146
|
-
extends this guarantee to full stream integrity.
|
|
147
|
-
|
|
148
|
-
`SealStream` / `OpenStream` with `XChaCha20Cipher` uses XChaCha20-Poly1305
|
|
149
|
-
AEAD per chunk. The Poly1305 tag is verified inside the WASM `aeadDecrypt`
|
|
150
|
-
call before any plaintext is produced. On authentication failure, the full
|
|
151
|
-
chunk output buffer is wiped and plaintext bytes are never returned.
|
|
152
|
-
Counter nonces with TAG_DATA/TAG_FINAL final-flag domain separation ensure
|
|
153
|
-
reorder, splice, truncation, and cross-stream substitution all fail AEAD
|
|
154
|
-
verification before decryption.
|
|
155
|
-
|
|
156
|
-
`SealStreamPool` delegates per-chunk AEAD to isolated Web Workers. Each
|
|
157
|
-
worker holds its own derived subkey and WASM instance. Any authentication
|
|
158
|
-
error kills all workers, wipes all key material, and marks the pool dead. No retry, no partial results.
|
|
159
|
-
|
|
160
|
-
### Dependency Management
|
|
161
|
-
|
|
162
|
-
The library has **zero** runtime dependencies by design.
|
|
163
|
-
`sideEffects: false` is enforced in `package.json`. Argon2id integration
|
|
164
|
-
is documented as an _optional_ external dependency.
|
|
165
|
-
See: [`leviathan-crypto/wiki/argon2id`][argon2id-wiki].
|
|
166
|
-
|
|
167
|
-
Build toolchain dependencies are pinned with exact version locks in
|
|
168
|
-
`bun.lock`. GitHub Actions workflows use [SHA-pinned action references][workflows]
|
|
169
|
-
throughout with no floating tags. Supply chain integrity is treated as a
|
|
170
|
-
first-class concern for a cryptography library.
|
|
171
|
-
|
|
172
|
-
### Explicit Initialisation
|
|
173
|
-
|
|
174
|
-
No class silently auto-initialises. The [`init()`][init] gate is mandatory and
|
|
175
|
-
explicit, giving consumers full control over when WASM modules are loaded
|
|
176
|
-
and ensuring no hidden initialisation costs or race conditions. Classes
|
|
177
|
-
throw immediately if used before initialisation rather than failing
|
|
178
|
-
silently.
|
|
179
|
-
|
|
180
|
-
### Agentic Development Contracts
|
|
181
|
-
|
|
182
|
-
All AI-assisted development on this repository operates under a strict
|
|
183
|
-
agentic contract defined in [`AGENTS.md`][agents]. The contract enforces
|
|
184
|
-
spec authority over planning documents, immutable test vectors, gate
|
|
185
|
-
discipline before extending any test suite, independent algorithm
|
|
186
|
-
derivation from published standards, and constant-time/wipe requirements
|
|
187
|
-
for all security-sensitive code paths. Agents are explicitly prohibited
|
|
188
|
-
from guessing cryptographic values or resolving spec ambiguities silently.
|
|
189
|
-
|
|
190
|
-
The contract has been verified against Claude, GitHub Copilot (VS Code),
|
|
191
|
-
OpenHands, Kilo Code, Cursor, Windsurf, and Aider. Configuration files for
|
|
192
|
-
each are present in the repository and all route to [`AGENTS.md`][agents]
|
|
193
|
-
as the single source of authority.
|
|
194
|
-
|
|
195
|
-
---
|
|
196
|
-
|
|
197
|
-
## Reporting a Vulnerability
|
|
198
|
-
|
|
199
|
-
> [!IMPORTANT]
|
|
200
|
-
> **_Please do not open a public issue for security vulnerabilities._**
|
|
201
|
-
|
|
202
|
-
### Private Advisory (preferred)
|
|
203
|
-
|
|
204
|
-
Use GitHub's private vulnerability reporting form:
|
|
205
|
-
[https://github.com/xero/leviathan-crypto/security/advisories/new][advisory]
|
|
206
|
-
|
|
207
|
-
This opens a private channel between you and the maintainer, and you will
|
|
208
|
-
receive a response promptly. If the vulnerability is confirmed,
|
|
209
|
-
we will collaborate to fully understand the issue, including a review of
|
|
210
|
-
proposed fixes, so you can track and validate firsthand. Before any public
|
|
211
|
-
advisory is published, we will agree on a coordinated disclosure timeline.
|
|
212
|
-
After disclosure, you are encouraged to publish your own write-up, blog post,
|
|
213
|
-
or research notes, for full hacker scene credit.
|
|
214
|
-
|
|
215
|
-
### Direct Contact
|
|
216
|
-
|
|
217
|
-
If you prefer to contact the maintainer directly:
|
|
218
|
-
|
|
219
|
-
- **Email:** x﹫xero.style · PGP: [`0xAC1D0000`][pgp]
|
|
220
|
-
- **Matrix:** x0﹫rx.haunted.computer
|
|
221
|
-
|
|
222
|
-
> [!NOTE]
|
|
223
|
-
> Encrypted communication is welcome and _preferred_ for sensitive reports.
|
|
224
|
-
|
|
225
|
-
### Scope
|
|
226
|
-
|
|
227
|
-
**Reports are in scope for:**
|
|
228
|
-
|
|
229
|
-
- Authentication bypass in AEAD constructions
|
|
230
|
-
- Key material exposure or improper zeroing
|
|
231
|
-
- Incorrect entropy or CSPRNG weaknesses in Fortuna
|
|
232
|
-
- Side-channel vulnerabilities (timing, memory access patterns)
|
|
233
|
-
- Correctness bugs in cryptographic implementations (wrong output against
|
|
234
|
-
test vectors)
|
|
235
|
-
- Platform-specific behavioral differences (WASM execution, binary output,
|
|
236
|
-
or timing characteristics that differ across operating systems or CPU
|
|
237
|
-
architectures)
|
|
238
|
-
- Supply chain issues (dependency tampering, workflow compromise)
|
|
239
|
-
- Improper scope of exported symbols
|
|
240
|
-
|
|
241
|
-
**Out of scope:**
|
|
242
|
-
|
|
243
|
-
- Vulnerabilities in third-party packages not maintained by this project.
|
|
244
|
-
This includes optional peer dependencies such as argon2id.
|
|
245
|
-
Please report those directly to their maintainers.
|
|
246
|
-
- Issues requiring physical access to the user's device
|
|
247
|
-
- Theoretical attacks with no practical exploit path (e.g. complexity
|
|
248
|
-
improvements that remain computationally infeasible)
|
|
249
|
-
- Issues in the demo applications that do not affect the core library.
|
|
250
|
-
Please open an issue in the [`leviathan-demos`][demos] repository instead.
|
|
251
|
-
|
|
252
|
-
[fips180]: https://csrc.nist.gov/publications/detail/fips/180/4/final
|
|
253
|
-
[fips202]: https://csrc.nist.gov/publications/detail/fips/202/final
|
|
254
|
-
[fips203]: https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.203.pdf
|
|
255
|
-
[rfc8439]: https://www.rfc-editor.org/rfc/rfc8439
|
|
256
|
-
[rfc2104]: https://www.rfc-editor.org/rfc/rfc2104
|
|
257
|
-
[rfc5869]: https://www.rfc-editor.org/rfc/rfc5869
|
|
258
|
-
[serpent]: https://www.cl.cam.ac.uk/~rja14/Papers/serpent.pdf
|
|
259
|
-
[utils]: https://github.com/xero/leviathan-crypto/wiki/utils#constanttimeequal
|
|
260
|
-
[demos]: https://github.com/xero/leviathan-demos/
|
|
261
|
-
[serpent_audit]: https://github.com/xero/leviathan-crypto/wiki/serpent_audit
|
|
262
|
-
[chacha_audit]: https://github.com/xero/leviathan-crypto/wiki/chacha_audit
|
|
263
|
-
[sha2_audit]: https://github.com/xero/leviathan-crypto/wiki/sha2_audit
|
|
264
|
-
[sha3_audit]: https://github.com/xero/leviathan-crypto/wiki/sha3_audit
|
|
265
|
-
[hmac_audit]: https://github.com/xero/leviathan-crypto/wiki/hmac_audit
|
|
266
|
-
[hkdf_audit]: https://github.com/xero/leviathan-crypto/wiki/hkdf_audit
|
|
267
|
-
[kyber_audit]: https://github.com/xero/leviathan-crypto/wiki/kyber_audit
|
|
268
|
-
[stream_audit]: https://github.com/xero/leviathan-crypto/wiki/stream_audit
|
|
269
|
-
[audits]: https://github.com/xero/leviathan-crypto/wiki/audits
|
|
270
|
-
[biclique]: https://github.com/xero/BicliqueFinder/blob/main/biclique-research.md
|
|
271
|
-
[argon2id-wiki]: https://github.com/xero/leviathan-crypto/wiki/argon2id
|
|
272
|
-
[workflows]: https://github.com/xero/leviathan-crypto/blob/main/scripts/pin-actions.ts
|
|
273
|
-
[init]: https://github.com/xero/leviathan-crypto/wiki/init
|
|
274
|
-
[agents]: https://github.com/xero/leviathan-crypto/blob/main/AGENTS.md
|
|
275
|
-
[advisory]: https://github.com/xero/leviathan-crypto/security/advisories/new
|
|
276
|
-
[pgp]: https://0w.nz/pgp.pub
|
package/dist/ct-wasm.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const CT_WASM: Uint8Array<ArrayBuffer>;
|
package/dist/ct-wasm.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
// auto-generated — do not edit
|
|
2
|
-
// raw WASM bytes for constant-time comparison module
|
|
3
|
-
export const CT_WASM = new Uint8Array([0, 97, 115, 109, 1, 0, 0, 0, 1, 8, 1, 96, 3, 127, 127, 127, 1, 127, 2, 16, 1, 3, 101, 110, 118, 6, 109, 101, 109, 111, 114, 121, 2, 1, 1, 1, 3, 2, 1, 0, 7, 20, 2, 7, 99, 111, 109, 112, 97, 114, 101, 0, 0, 6, 109, 101, 109, 111, 114, 121, 2, 0, 10, 111, 1, 109, 2, 3, 127, 1, 123, 3, 64, 32, 3, 65, 16, 106, 34, 4, 32, 2, 76, 4, 64, 32, 6, 32, 0, 32, 3, 106, 253, 0, 4, 0, 32, 1, 32, 3, 106, 253, 0, 4, 0, 253, 81, 253, 80, 33, 6, 32, 4, 33, 3, 12, 1, 11, 11, 3, 64, 32, 2, 32, 3, 74, 4, 64, 32, 5, 32, 0, 32, 3, 106, 45, 0, 0, 32, 1, 32, 3, 106, 45, 0, 0, 115, 114, 33, 5, 32, 3, 65, 1, 106, 33, 3, 12, 1, 11, 11, 32, 6, 253, 83, 4, 64, 65, 0, 15, 11, 32, 5, 69, 11]);
|
package/dist/ct.wasm
DELETED
|
Binary file
|