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/dist/docs/types.md
DELETED
|
@@ -1,276 +0,0 @@
|
|
|
1
|
-
# TypeScript Interfaces
|
|
2
|
-
|
|
3
|
-
> [!NOTE]
|
|
4
|
-
> Defines the abstract interfaces all leviathan-crypto cryptographic classes implement. These are type-only exports; they contain no runtime code and generate no JavaScript output.
|
|
5
|
-
|
|
6
|
-
> ### Table of Contents
|
|
7
|
-
> - [API Reference](#api-reference)
|
|
8
|
-
> - [Usage Examples](#usage-examples)
|
|
9
|
-
> - [WasmSource](#wasmsource)
|
|
10
|
-
> - [CipherSuite](#ciphersuite)
|
|
11
|
-
> - [DerivedKeys](#derivedkeys)
|
|
12
|
-
> - [SealStreamOpts](#sealstreamopts)
|
|
13
|
-
> - [PoolOpts](#poolopts)
|
|
14
|
-
|
|
15
|
-
---
|
|
16
|
-
|
|
17
|
-
## API Reference
|
|
18
|
-
|
|
19
|
-
Use these interfaces when you need generic code that works with any hash function, any cipher, or any AEAD scheme without depending on a specific implementation. They are available immediately on import with no `init()` call required.
|
|
20
|
-
|
|
21
|
-
### Hash
|
|
22
|
-
|
|
23
|
-
```typescript
|
|
24
|
-
interface Hash {
|
|
25
|
-
hash(msg: Uint8Array): Uint8Array;
|
|
26
|
-
dispose(): void;
|
|
27
|
-
}
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
Interface for unkeyed hash functions (e.g., SHA-256, SHA-512, SHA-3).
|
|
31
|
-
|
|
32
|
-
| Method | Description |
|
|
33
|
-
|---|---|
|
|
34
|
-
| `hash(msg)` | Hashes the entire message and returns the digest as a new `Uint8Array`. |
|
|
35
|
-
| `dispose()` | Releases WASM resources and wipes internal buffers. Call when done. |
|
|
36
|
-
|
|
37
|
-
---
|
|
38
|
-
|
|
39
|
-
### KeyedHash
|
|
40
|
-
|
|
41
|
-
```typescript
|
|
42
|
-
interface KeyedHash {
|
|
43
|
-
hash(key: Uint8Array, msg: Uint8Array): Uint8Array;
|
|
44
|
-
dispose(): void;
|
|
45
|
-
}
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
Interface for keyed hash functions / MACs (e.g., HMAC-SHA256, HMAC-SHA512).
|
|
49
|
-
|
|
50
|
-
`KeyedHash` does **not** extend `Hash`. Its `hash` method takes a `key` parameter in addition to the message.
|
|
51
|
-
|
|
52
|
-
| Method | Description |
|
|
53
|
-
|---|---|
|
|
54
|
-
| `hash(key, msg)` | Computes the keyed hash / MAC over `msg` using `key`. Returns the tag as a new `Uint8Array`. |
|
|
55
|
-
| `dispose()` | Releases WASM resources and wipes internal buffers. Call when done. |
|
|
56
|
-
|
|
57
|
-
---
|
|
58
|
-
|
|
59
|
-
### Blockcipher
|
|
60
|
-
|
|
61
|
-
```typescript
|
|
62
|
-
interface Blockcipher {
|
|
63
|
-
encrypt(block: Uint8Array): Uint8Array;
|
|
64
|
-
decrypt(block: Uint8Array): Uint8Array;
|
|
65
|
-
dispose(): void;
|
|
66
|
-
}
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
Interface for raw block ciphers (e.g., Serpent in ECB mode). Operates on single blocks.
|
|
70
|
-
|
|
71
|
-
| Method | Description |
|
|
72
|
-
|---|---|
|
|
73
|
-
| `encrypt(block)` | Encrypts a single block and returns the ciphertext. |
|
|
74
|
-
| `decrypt(block)` | Decrypts a single block and returns the plaintext. |
|
|
75
|
-
| `dispose()` | Releases WASM resources and wipes internal buffers (including expanded key schedule). |
|
|
76
|
-
|
|
77
|
-
---
|
|
78
|
-
|
|
79
|
-
### Streamcipher
|
|
80
|
-
|
|
81
|
-
```typescript
|
|
82
|
-
interface Streamcipher {
|
|
83
|
-
encrypt(msg: Uint8Array): Uint8Array;
|
|
84
|
-
decrypt(msg: Uint8Array): Uint8Array;
|
|
85
|
-
dispose(): void;
|
|
86
|
-
}
|
|
87
|
-
```
|
|
88
|
-
|
|
89
|
-
Interface for stream ciphers and block cipher streaming modes (e.g., Serpent-CTR, ChaCha20). Handles arbitrary-length messages.
|
|
90
|
-
|
|
91
|
-
| Method | Description |
|
|
92
|
-
|---|---|
|
|
93
|
-
| `encrypt(msg)` | Encrypts an arbitrary-length message. Returns the ciphertext (same length as input). |
|
|
94
|
-
| `decrypt(msg)` | Decrypts an arbitrary-length ciphertext. Returns the plaintext (same length as input). |
|
|
95
|
-
| `dispose()` | Releases WASM resources and wipes internal buffers. |
|
|
96
|
-
|
|
97
|
-
---
|
|
98
|
-
|
|
99
|
-
### AEAD
|
|
100
|
-
|
|
101
|
-
```typescript
|
|
102
|
-
interface AEAD {
|
|
103
|
-
encrypt(msg: Uint8Array, aad?: Uint8Array): Uint8Array;
|
|
104
|
-
decrypt(ciphertext: Uint8Array, aad?: Uint8Array): Uint8Array;
|
|
105
|
-
dispose(): void;
|
|
106
|
-
}
|
|
107
|
-
```
|
|
108
|
-
|
|
109
|
-
Interface for authenticated encryption with associated data (e.g., XChaCha20-Poly1305). Provides both confidentiality and integrity.
|
|
110
|
-
|
|
111
|
-
| Method | Description |
|
|
112
|
-
|---|---|
|
|
113
|
-
| `encrypt(msg, aad?)` | Encrypts `msg` and authenticates both `msg` and optional `aad`. Returns ciphertext with appended authentication tag. |
|
|
114
|
-
| `decrypt(ciphertext, aad?)` | Decrypts and verifies the authentication tag. Returns plaintext on success. Throws `Error` on authentication failure. Never returns null. |
|
|
115
|
-
| `dispose()` | Releases WASM resources and wipes internal buffers. |
|
|
116
|
-
|
|
117
|
-
---
|
|
118
|
-
|
|
119
|
-
## Usage Examples
|
|
120
|
-
|
|
121
|
-
### Type-constraining a function parameter
|
|
122
|
-
|
|
123
|
-
```typescript
|
|
124
|
-
import type { Hash } from 'leviathan-crypto'
|
|
125
|
-
|
|
126
|
-
function digestAndLog(hasher: Hash, data: Uint8Array): Uint8Array {
|
|
127
|
-
const digest = hasher.hash(data)
|
|
128
|
-
console.log('digest length:', digest.length)
|
|
129
|
-
return digest
|
|
130
|
-
}
|
|
131
|
-
```
|
|
132
|
-
|
|
133
|
-
This function accepts any `Hash` implementation (`SHA256`, `SHA512`, `SHA3_256`, etc.) without importing any of them directly.
|
|
134
|
-
|
|
135
|
-
---
|
|
136
|
-
|
|
137
|
-
### Accepting any AEAD scheme
|
|
138
|
-
|
|
139
|
-
```typescript
|
|
140
|
-
import type { AEAD } from 'leviathan-crypto'
|
|
141
|
-
|
|
142
|
-
function sealMessage(aead: AEAD, plaintext: Uint8Array, metadata: Uint8Array): Uint8Array {
|
|
143
|
-
return aead.encrypt(plaintext, metadata)
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
function openMessage(aead: AEAD, ciphertext: Uint8Array, metadata: Uint8Array): Uint8Array {
|
|
147
|
-
// decrypt() throws on auth failure, no null check needed
|
|
148
|
-
return aead.decrypt(ciphertext, metadata)
|
|
149
|
-
}
|
|
150
|
-
```
|
|
151
|
-
|
|
152
|
-
---
|
|
153
|
-
|
|
154
|
-
### Generic keyed-hash wrapper
|
|
155
|
-
|
|
156
|
-
```typescript
|
|
157
|
-
import type { KeyedHash } from 'leviathan-crypto'
|
|
158
|
-
|
|
159
|
-
function authenticate(mac: KeyedHash, key: Uint8Array, ...parts: Uint8Array[]): Uint8Array {
|
|
160
|
-
// Concatenate all message parts, then compute the tag
|
|
161
|
-
const total = parts.reduce((sum, p) => sum + p.length, 0)
|
|
162
|
-
const msg = new Uint8Array(total)
|
|
163
|
-
let offset = 0
|
|
164
|
-
for (const part of parts) {
|
|
165
|
-
msg.set(part, offset)
|
|
166
|
-
offset += part.length
|
|
167
|
-
}
|
|
168
|
-
return mac.hash(key, msg)
|
|
169
|
-
}
|
|
170
|
-
```
|
|
171
|
-
|
|
172
|
-
---
|
|
173
|
-
|
|
174
|
-
### Storing a cipher with its interface type
|
|
175
|
-
|
|
176
|
-
```typescript
|
|
177
|
-
import type { Streamcipher, Blockcipher } from 'leviathan-crypto'
|
|
178
|
-
|
|
179
|
-
interface EncryptionContext {
|
|
180
|
-
cipher: Streamcipher | Blockcipher
|
|
181
|
-
mode: 'stream' | 'block'
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
function cleanup(ctx: EncryptionContext): void {
|
|
185
|
-
ctx.cipher.dispose()
|
|
186
|
-
}
|
|
187
|
-
```
|
|
188
|
-
|
|
189
|
-
---
|
|
190
|
-
|
|
191
|
-
## WasmSource
|
|
192
|
-
|
|
193
|
-
Union type for WASM module sources. Accepted by `init()`, `serpentInit()`, etc.
|
|
194
|
-
|
|
195
|
-
`string | URL | ArrayBuffer | Uint8Array | WebAssembly.Module | Response | Promise<Response>`
|
|
196
|
-
|
|
197
|
-
---
|
|
198
|
-
|
|
199
|
-
## CipherSuite
|
|
200
|
-
|
|
201
|
-
Cipher-specific logic injected into `SealStream` and `OpenStream`.
|
|
202
|
-
|
|
203
|
-
| Field | Type | Description |
|
|
204
|
-
|-------|------|-------------|
|
|
205
|
-
| `formatEnum` | `number` | Wire format ID encoded in header byte 0 bits 0-5 (max 0x3f): bits 0-3 = cipher nibble (0x1=xchacha20, 0x2=serpent), bits 4-5 = KEM selector (0x00=none, 0x10=ML-KEM-512, 0x20=ML-KEM-768, 0x30=ML-KEM-1024), bit 6 reserved |
|
|
206
|
-
| `formatName` | `string` | Human-readable label, e.g. `'xchacha20'`, `'serpent'`, `'mlkem768+xchacha20'` |
|
|
207
|
-
| `hkdfInfo` | `string` | HKDF info string for key derivation |
|
|
208
|
-
| `keySize` | `number` | Seal/encrypt key size in bytes (encapsulation key bytes for KEM suites) |
|
|
209
|
-
| `decKeySize` | `number \| undefined` | Open/decrypt key size in bytes (decapsulation key bytes for KEM suites). Absent → same as `keySize` (symmetric case) |
|
|
210
|
-
| `kemCtSize` | `number` | KEM ciphertext byte length appended to the header in the preamble. `0` for symmetric suites |
|
|
211
|
-
| `tagSize` | `number` | Authentication tag size in bytes |
|
|
212
|
-
| `padded` | `boolean` | Whether ciphertext includes padding (PKCS7 for CBC) |
|
|
213
|
-
| `wasmChunkSize` | `number` | WASM buffer capacity for one padded chunk. `SealStreamPool.create()` validates `paddedFull ≤ wasmChunkSize` at startup for padded ciphers and throws `RangeError` if the check fails. `SerpentCipher`: 65552. `XChaCha20Cipher`: 65536. `KyberSuite` forwards from its inner cipher. |
|
|
214
|
-
| `wasmModules` | `readonly string[]` | Cipher-specific WASM modules used by pool workers and per-chunk operations (not transitive dependencies such as HKDF-SHA-256 used by `deriveKeys()`) |
|
|
215
|
-
|
|
216
|
-
| Method | Signature | Description |
|
|
217
|
-
|--------|-----------|-------------|
|
|
218
|
-
| `deriveKeys` | `(masterKey, nonce) → DerivedKeys` | HKDF key derivation |
|
|
219
|
-
| `sealChunk` | `(keys, counterNonce, chunk, aad?) → Uint8Array` | Encrypt one chunk |
|
|
220
|
-
| `openChunk` | `(keys, counterNonce, chunk, aad?) → Uint8Array` | Decrypt one chunk |
|
|
221
|
-
| `wipeKeys` | `(keys) → void` | Zero derived key material |
|
|
222
|
-
| `createPoolWorker` | `() → Worker` | Create a Web Worker for pool use |
|
|
223
|
-
|
|
224
|
-
Implementations: `XChaCha20Cipher`, `SerpentCipher` (plain `const` objects, not classes), and `KyberSuite` (factory function returning a `CipherSuite`). See [ciphersuite.md](./ciphersuite.md).
|
|
225
|
-
|
|
226
|
-
> [!IMPORTANT]
|
|
227
|
-
> All CipherSuite implementations use HKDF-SHA-256 in `deriveKeys()`. The stream layer requires
|
|
228
|
-
> `sha2` to be initialized regardless of which cipher is selected.
|
|
229
|
-
|
|
230
|
-
---
|
|
231
|
-
|
|
232
|
-
## DerivedKeys
|
|
233
|
-
|
|
234
|
-
Opaque key material returned by `CipherSuite.deriveKeys()`.
|
|
235
|
-
|
|
236
|
-
| Field | Type | Description |
|
|
237
|
-
|-------|------|-------------|
|
|
238
|
-
| `bytes` | `readonly Uint8Array` | Raw derived key bytes (opaque to the stream layer) |
|
|
239
|
-
|
|
240
|
-
---
|
|
241
|
-
|
|
242
|
-
## SealStreamOpts
|
|
243
|
-
|
|
244
|
-
Options for `SealStream` constructor.
|
|
245
|
-
|
|
246
|
-
| Field | Type | Default | Description |
|
|
247
|
-
|-------|------|---------|-------------|
|
|
248
|
-
| `chunkSize` | `number` | `65536` | Chunk size in bytes. Range: [1024, 16777215]. |
|
|
249
|
-
| `framed` | `boolean` | `false` | Enable u32be length-prefixed framing. |
|
|
250
|
-
|
|
251
|
-
---
|
|
252
|
-
|
|
253
|
-
## PoolOpts
|
|
254
|
-
|
|
255
|
-
Options for `SealStreamPool.create()`.
|
|
256
|
-
|
|
257
|
-
| Field | Type | Default | Description |
|
|
258
|
-
|-------|------|---------|-------------|
|
|
259
|
-
| `wasm` | `WasmSource \| Record<string, WasmSource>` | | WASM module source(s). Single source for single-module ciphers, Record for multi-module. |
|
|
260
|
-
| `workers` | `number` | `navigator.hardwareConcurrency ?? 4` | Number of Web Workers. |
|
|
261
|
-
| `chunkSize` | `number` | `65536` | Chunk size in bytes. |
|
|
262
|
-
| `framed` | `boolean` | `false` | Enable framed mode. |
|
|
263
|
-
| `jobTimeout` | `number` | `30000` | Per-job timeout in milliseconds. |
|
|
264
|
-
|
|
265
|
-
---
|
|
266
|
-
|
|
267
|
-
> ## Cross-References
|
|
268
|
-
>
|
|
269
|
-
> - [index](./README.md) — Project Documentation index
|
|
270
|
-
> - [architecture](./architecture.md) — architecture overview, module relationships, buffer layouts, and build pipeline
|
|
271
|
-
> - [utils](./utils.md) — encoding utilities and `constantTimeEqual` for verifying MACs from `KeyedHash`
|
|
272
|
-
> - [serpent](./serpent.md) — Serpent classes implement `Blockcipher`, `Streamcipher`, and `AEAD`
|
|
273
|
-
> - [chacha20](./chacha20.md) — `XChaCha20Cipher` is a `CipherSuite` for `SealStream`/`OpenStream`/`Seal`; `Seal` provides one-shot AEAD over any `CipherSuite`; `ChaCha20`/`ChaCha20Poly1305`/`XChaCha20Poly1305` are stateless primitives
|
|
274
|
-
> - [sha2](./sha2.md) — SHA-2 classes implement `Hash`; HMAC classes implement `KeyedHash`
|
|
275
|
-
> - [sha3](./sha3.md) — SHA-3 classes implement `Hash`; SHAKE classes extend with XOF API
|
|
276
|
-
> - [test-suite](./test-suite.md) — test suite structure and vector corpus
|
package/dist/docs/utils.md
DELETED
|
@@ -1,367 +0,0 @@
|
|
|
1
|
-
# Utilities
|
|
2
|
-
|
|
3
|
-
> [!NOTE]
|
|
4
|
-
> Pure TypeScript utilities that ship alongside the WASM-backed primitives. No `init()` call required; all functions work immediately on import.
|
|
5
|
-
|
|
6
|
-
> ### Table of Contents
|
|
7
|
-
> - [Security Notes](#security-notes)
|
|
8
|
-
> - [API Reference](#api-reference)
|
|
9
|
-
> - [Usage Examples](#usage-examples)
|
|
10
|
-
> - [Error Conditions](#error-conditions)
|
|
11
|
-
|
|
12
|
-
---
|
|
13
|
-
|
|
14
|
-
The module covers encoding (hex, UTF-8, and base64 conversions between strings and `Uint8Array`), security (constant-time comparison and secure memory wiping), byte manipulation (XOR and concatenation), and random byte generation.
|
|
15
|
-
|
|
16
|
-
## Security Notes
|
|
17
|
-
|
|
18
|
-
**`constantTimeEqual`** uses a WASM SIMD module when available to remove the JS JIT compiler from the timing picture, falling back to an XOR-accumulate loop on older runtimes. Use this function whenever you compare MACs, hashes, authentication tags, or any secret-derived values. Never use `===`, `Buffer.equals`, or a manual loop-with-break for security comparisons. Those leak timing information that attackers can exploit to recover secrets. Inputs are limited to [`CT_MAX_BYTES`](#ct_max_bytes) (32768 bytes) per side.
|
|
19
|
-
|
|
20
|
-
The length check in `constantTimeEqual` is not constant-time, because array length is non-secret in all standard protocols. If your use case treats length as secret, pad to equal length before comparing.
|
|
21
|
-
|
|
22
|
-
**`wipe`** zeroes a typed array in-place. Call it on keys, plaintext buffers, and any other sensitive data as soon as you are done with them. JavaScript's garbage collector does not guarantee timely or complete erasure of memory.
|
|
23
|
-
|
|
24
|
-
**`randomBytes`** delegates to `crypto.getRandomValues` (Web Crypto API), which is cryptographically secure in all modern browsers and Node.js 19+. It does not fall back to `Math.random` or any insecure source.
|
|
25
|
-
|
|
26
|
-
The encoding functions (`hexToBytes`, `bytesToHex`, `utf8ToBytes`, `bytesToUtf8`, `base64ToBytes`, `bytesToBase64`) perform no security-sensitive operations.
|
|
27
|
-
|
|
28
|
-
---
|
|
29
|
-
|
|
30
|
-
## API Reference
|
|
31
|
-
|
|
32
|
-
### hexToBytes
|
|
33
|
-
|
|
34
|
-
```typescript
|
|
35
|
-
hexToBytes(hex: string): Uint8Array
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
Converts a hex string to a `Uint8Array`. Accepts lowercase or uppercase characters. An optional `0x` or `0X` prefix is stripped automatically. Throws `RangeError` on odd-length input.
|
|
39
|
-
|
|
40
|
-
---
|
|
41
|
-
|
|
42
|
-
### bytesToHex
|
|
43
|
-
|
|
44
|
-
```typescript
|
|
45
|
-
bytesToHex(bytes: Uint8Array): string
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
Converts a `Uint8Array` to a lowercase hex string (no prefix).
|
|
49
|
-
|
|
50
|
-
---
|
|
51
|
-
|
|
52
|
-
### utf8ToBytes
|
|
53
|
-
|
|
54
|
-
```typescript
|
|
55
|
-
utf8ToBytes(str: string): Uint8Array
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
Encodes a JavaScript string as UTF-8 bytes using the platform `TextEncoder`.
|
|
59
|
-
|
|
60
|
-
---
|
|
61
|
-
|
|
62
|
-
### bytesToUtf8
|
|
63
|
-
|
|
64
|
-
```typescript
|
|
65
|
-
bytesToUtf8(bytes: Uint8Array): string
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
Decodes UTF-8 bytes to a JavaScript string using the platform `TextDecoder`.
|
|
69
|
-
|
|
70
|
-
---
|
|
71
|
-
|
|
72
|
-
### base64ToBytes
|
|
73
|
-
|
|
74
|
-
```typescript
|
|
75
|
-
base64ToBytes(b64: string): Uint8Array | undefined
|
|
76
|
-
```
|
|
77
|
-
|
|
78
|
-
Decodes a base64 or base64url string to a `Uint8Array`. Handles padded, unpadded, and legacy `%3d` padding. Unpadded base64url input is accepted (RFC 4648 §5). Returns `undefined` if the input is not valid base64 (illegal characters or `rem=1` length).
|
|
79
|
-
|
|
80
|
-
---
|
|
81
|
-
|
|
82
|
-
### bytesToBase64
|
|
83
|
-
|
|
84
|
-
```typescript
|
|
85
|
-
bytesToBase64(bytes: Uint8Array, url?: boolean): string
|
|
86
|
-
```
|
|
87
|
-
|
|
88
|
-
Encodes a `Uint8Array` to a base64 string. Pass `url = true` for base64url (RFC 4648 §5), which uses `-` and `_` instead of `+` and `/` with no padding characters. Defaults to standard base64.
|
|
89
|
-
|
|
90
|
-
---
|
|
91
|
-
|
|
92
|
-
### constantTimeEqual
|
|
93
|
-
|
|
94
|
-
```typescript
|
|
95
|
-
constantTimeEqual(a: Uint8Array, b: Uint8Array): boolean
|
|
96
|
-
```
|
|
97
|
-
|
|
98
|
-
Returns `true` if `a` and `b` contain identical bytes. Returns `false` immediately if the arrays differ in length (length is non-secret in all standard protocols).
|
|
99
|
-
|
|
100
|
-
When WebAssembly SIMD is available the comparison runs inside a WASM module, removing the JS JIT compiler from the timing picture. Speculative optimisation and branch prediction inside the engine cannot short-circuit the loop. On runtimes without SIMD support the function falls back to an XOR-accumulate loop in JavaScript, which is best-effort but not a hardware-level guarantee. The overall posture is best-available constant-time, not a cryptographic proof of timing safety.
|
|
101
|
-
|
|
102
|
-
Maximum input size is [`CT_MAX_BYTES`](#ct_max_bytes) (32768 bytes) per side. Throws `RangeError` if either array exceeds this limit.
|
|
103
|
-
|
|
104
|
-
Use this function when working with lower-level unauthenticated primitives or building custom authenticated protocols on top of the hashing and KDF APIs. Three common cases:
|
|
105
|
-
|
|
106
|
-
**Encrypt-then-MAC with `SerpentCbc` or `SerpentCtr`.** If you use the `dangerUnauthenticated` primitive directly and compute your own HMAC-SHA256 tag, compare that tag with `constantTimeEqual`. See the [example below](#encrypt-then-mac-with-serpentcbc).
|
|
107
|
-
|
|
108
|
-
**Argon2id key verification.** When re-deriving an Argon2id hash to verify a passphrase, the final comparison must be constant-time. See [argon2id.md](./argon2id.md#password-hashing-and-verification) for the full example.
|
|
109
|
-
|
|
110
|
-
**Custom HMAC protocols.** Any protocol where you derive a MAC with `HMAC_SHA256` or `HMAC_SHA512` and compare it against a received value. See [examples.md](./examples.md#hmac-sha256-message-authentication) for a complete example.
|
|
111
|
-
|
|
112
|
-
---
|
|
113
|
-
|
|
114
|
-
### CT_MAX_BYTES
|
|
115
|
-
|
|
116
|
-
```typescript
|
|
117
|
-
const CT_MAX_BYTES: 32768
|
|
118
|
-
```
|
|
119
|
-
|
|
120
|
-
Maximum input size accepted by [`constantTimeEqual`](#constanttimeequal) per side, in bytes. Reflects the physical layout of the WASM comparison module: one 64 KiB page of linear memory split equally between the two input buffers (32 KiB each).
|
|
121
|
-
|
|
122
|
-
In practice the largest comparison performed anywhere in this library is a 32-byte HMAC-SHA-256 tag. This limit only matters for custom protocols that compare unusually large values. Use this constant to guard your own inputs rather than hardcoding the magic number:
|
|
123
|
-
|
|
124
|
-
```typescript
|
|
125
|
-
import { constantTimeEqual, CT_MAX_BYTES } from 'leviathan-crypto'
|
|
126
|
-
|
|
127
|
-
if (a.length > CT_MAX_BYTES || b.length > CT_MAX_BYTES) {
|
|
128
|
-
throw new RangeError(`comparison input exceeds CT_MAX_BYTES (${CT_MAX_BYTES})`)
|
|
129
|
-
}
|
|
130
|
-
const match = constantTimeEqual(a, b)
|
|
131
|
-
```
|
|
132
|
-
|
|
133
|
-
---
|
|
134
|
-
|
|
135
|
-
### wipe
|
|
136
|
-
|
|
137
|
-
```typescript
|
|
138
|
-
wipe(data: Uint8Array | Uint16Array | Uint32Array): void
|
|
139
|
-
```
|
|
140
|
-
|
|
141
|
-
Zeroes a typed array in-place by calling `fill(0)`. Use this to clear keys, plaintext, or any sensitive material when you are done with it.
|
|
142
|
-
|
|
143
|
-
---
|
|
144
|
-
|
|
145
|
-
### xor
|
|
146
|
-
|
|
147
|
-
```typescript
|
|
148
|
-
xor(a: Uint8Array, b: Uint8Array): Uint8Array
|
|
149
|
-
```
|
|
150
|
-
|
|
151
|
-
Returns a new `Uint8Array` where each byte is `a[i] ^ b[i]`. Both arrays must have the same length. Throws `RangeError` if they differ.
|
|
152
|
-
|
|
153
|
-
---
|
|
154
|
-
|
|
155
|
-
### concat
|
|
156
|
-
|
|
157
|
-
```typescript
|
|
158
|
-
concat(...arrays: Uint8Array[]): Uint8Array
|
|
159
|
-
```
|
|
160
|
-
|
|
161
|
-
Concatenates one or more `Uint8Array`s into a new array.
|
|
162
|
-
|
|
163
|
-
---
|
|
164
|
-
|
|
165
|
-
### randomBytes
|
|
166
|
-
|
|
167
|
-
```typescript
|
|
168
|
-
randomBytes(n: number): Uint8Array
|
|
169
|
-
```
|
|
170
|
-
|
|
171
|
-
Returns `n` cryptographically secure random bytes via the Web Crypto API (`crypto.getRandomValues`).
|
|
172
|
-
|
|
173
|
-
---
|
|
174
|
-
|
|
175
|
-
### hasSIMD
|
|
176
|
-
|
|
177
|
-
```typescript
|
|
178
|
-
hasSIMD(): boolean
|
|
179
|
-
```
|
|
180
|
-
|
|
181
|
-
Returns `true` if the current runtime supports WebAssembly SIMD (the `v128`
|
|
182
|
-
type and associated operations). The result is computed once on first call by
|
|
183
|
-
validating a minimal v128 WASM module, then cached for subsequent calls.
|
|
184
|
-
|
|
185
|
-
`SerpentCtr.encryptChunk`, `SerpentCbc.decrypt`, and `ChaCha20.encryptChunk`
|
|
186
|
-
call this internally to select the fast SIMD path at runtime. It is exported
|
|
187
|
-
for informational purposes. You do not need to call it yourself. SIMD dispatch
|
|
188
|
-
is fully automatic.
|
|
189
|
-
|
|
190
|
-
Supported in all modern browsers and Node.js 16+. Returns `false` in older
|
|
191
|
-
environments, which fall back silently to the scalar path.
|
|
192
|
-
|
|
193
|
-
---
|
|
194
|
-
|
|
195
|
-
## Usage Examples
|
|
196
|
-
|
|
197
|
-
### Converting between formats
|
|
198
|
-
|
|
199
|
-
```typescript
|
|
200
|
-
import { hexToBytes, bytesToHex, utf8ToBytes, bytesToUtf8 } from 'leviathan-crypto'
|
|
201
|
-
|
|
202
|
-
// Hex round-trip
|
|
203
|
-
const bytes = hexToBytes('deadbeef')
|
|
204
|
-
console.log(bytesToHex(bytes)) // "deadbeef"
|
|
205
|
-
|
|
206
|
-
// 0x prefix is accepted
|
|
207
|
-
const prefixed = hexToBytes('0xCAFE')
|
|
208
|
-
console.log(bytesToHex(prefixed)) // "cafe"
|
|
209
|
-
|
|
210
|
-
// UTF-8 round-trip
|
|
211
|
-
const encoded = utf8ToBytes('hello world')
|
|
212
|
-
console.log(bytesToUtf8(encoded)) // "hello world"
|
|
213
|
-
```
|
|
214
|
-
|
|
215
|
-
---
|
|
216
|
-
|
|
217
|
-
### Base64 encoding and decoding
|
|
218
|
-
|
|
219
|
-
```typescript
|
|
220
|
-
import { bytesToBase64, base64ToBytes, utf8ToBytes, bytesToUtf8 } from 'leviathan-crypto'
|
|
221
|
-
|
|
222
|
-
const data = utf8ToBytes('leviathan-crypto')
|
|
223
|
-
const b64 = bytesToBase64(data)
|
|
224
|
-
console.log(b64) // "bGV2aWF0aGFuLWNyeXB0bw=="
|
|
225
|
-
|
|
226
|
-
// base64url variant (safe for URLs and filenames, no padding)
|
|
227
|
-
const b64url = bytesToBase64(data, true)
|
|
228
|
-
console.log(b64url) // "bGV2aWF0aGFuLWNyeXB0bw"
|
|
229
|
-
|
|
230
|
-
// Decoding (accepts both standard and url variants)
|
|
231
|
-
const decoded = base64ToBytes(b64)
|
|
232
|
-
if (decoded) console.log(bytesToUtf8(decoded)) // "leviathan-crypto"
|
|
233
|
-
```
|
|
234
|
-
|
|
235
|
-
---
|
|
236
|
-
|
|
237
|
-
### Encrypt-then-MAC with SerpentCbc
|
|
238
|
-
|
|
239
|
-
If you use `SerpentCbc` or `SerpentCtr` directly with `{ dangerUnauthenticated: true }`, you are responsible for authentication. The correct pattern is Encrypt-then-MAC: encrypt first, then compute HMAC-SHA256 over the ciphertext, and use `constantTimeEqual` to verify on decrypt.
|
|
240
|
-
|
|
241
|
-
```typescript
|
|
242
|
-
import {
|
|
243
|
-
init, SerpentCbc, HMAC_SHA256,
|
|
244
|
-
constantTimeEqual, randomBytes, wipe, concat,
|
|
245
|
-
} from 'leviathan-crypto'
|
|
246
|
-
import { serpentWasm } from 'leviathan-crypto/serpent/embedded'
|
|
247
|
-
import { sha2Wasm } from 'leviathan-crypto/sha2/embedded'
|
|
248
|
-
|
|
249
|
-
await init({ serpent: serpentWasm, sha2: sha2Wasm })
|
|
250
|
-
|
|
251
|
-
const encKey = randomBytes(32)
|
|
252
|
-
const macKey = randomBytes(32)
|
|
253
|
-
const iv = randomBytes(16)
|
|
254
|
-
|
|
255
|
-
// ── Encrypt ──────────────────────────────────────────────────────────────────
|
|
256
|
-
|
|
257
|
-
const cbc = new SerpentCbc({ dangerUnauthenticated: true })
|
|
258
|
-
const ct = cbc.encrypt(encKey, iv, plaintext)
|
|
259
|
-
cbc.dispose()
|
|
260
|
-
|
|
261
|
-
// MAC covers iv || ct so the IV is authenticated too
|
|
262
|
-
const hmac = new HMAC_SHA256()
|
|
263
|
-
const tag = hmac.hash(macKey, concat(iv, ct))
|
|
264
|
-
hmac.dispose()
|
|
265
|
-
|
|
266
|
-
const envelope = concat(iv, ct, tag) // store or transmit this
|
|
267
|
-
|
|
268
|
-
// ── Decrypt ──────────────────────────────────────────────────────────────────
|
|
269
|
-
|
|
270
|
-
const receivedIv = envelope.subarray(0, 16)
|
|
271
|
-
const receivedCt = envelope.subarray(16, envelope.length - 32)
|
|
272
|
-
const receivedTag = envelope.subarray(envelope.length - 32)
|
|
273
|
-
|
|
274
|
-
const hmac2 = new HMAC_SHA256()
|
|
275
|
-
const expectedTag = hmac2.hash(macKey, concat(receivedIv, receivedCt))
|
|
276
|
-
hmac2.dispose()
|
|
277
|
-
|
|
278
|
-
// Always verify before decrypting — never decrypt unauthenticated ciphertext
|
|
279
|
-
if (!constantTimeEqual(expectedTag, receivedTag)) {
|
|
280
|
-
wipe(expectedTag)
|
|
281
|
-
throw new Error('Authentication failed')
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
const cbc2 = new SerpentCbc({ dangerUnauthenticated: true })
|
|
285
|
-
const pt = cbc2.decrypt(encKey, receivedIv, receivedCt)
|
|
286
|
-
cbc2.dispose()
|
|
287
|
-
wipe(expectedTag)
|
|
288
|
-
```
|
|
289
|
-
|
|
290
|
-
> [!NOTE]
|
|
291
|
-
> `Seal` with `SerpentCipher` does all of this for you — key derivation, IV handling, Encrypt-then-MAC, and constant-time verification — with no manual steps. The pattern above is only relevant if you need direct access to the raw `SerpentCbc` primitive.
|
|
292
|
-
|
|
293
|
-
---
|
|
294
|
-
|
|
295
|
-
### Generating random keys and nonces
|
|
296
|
-
|
|
297
|
-
```typescript
|
|
298
|
-
import { randomBytes } from 'leviathan-crypto'
|
|
299
|
-
|
|
300
|
-
const key = randomBytes(32) // 256-bit symmetric key
|
|
301
|
-
const nonce = randomBytes(24) // 192-bit nonce for XChaCha20
|
|
302
|
-
const iv = randomBytes(16) // 128-bit IV for Serpent-CBC
|
|
303
|
-
```
|
|
304
|
-
|
|
305
|
-
---
|
|
306
|
-
|
|
307
|
-
### Wiping sensitive data after use
|
|
308
|
-
|
|
309
|
-
```typescript
|
|
310
|
-
import { randomBytes, wipe } from 'leviathan-crypto'
|
|
311
|
-
|
|
312
|
-
const key = randomBytes(32)
|
|
313
|
-
|
|
314
|
-
// ... use the key for encryption / decryption ...
|
|
315
|
-
|
|
316
|
-
// When done, zero the key material so it does not linger in memory
|
|
317
|
-
wipe(key)
|
|
318
|
-
// key is now all zeroes
|
|
319
|
-
```
|
|
320
|
-
|
|
321
|
-
---
|
|
322
|
-
|
|
323
|
-
### XOR and concatenation
|
|
324
|
-
|
|
325
|
-
```typescript
|
|
326
|
-
import { xor, concat, randomBytes } from 'leviathan-crypto'
|
|
327
|
-
|
|
328
|
-
const a = randomBytes(16)
|
|
329
|
-
const b = randomBytes(16)
|
|
330
|
-
|
|
331
|
-
// XOR two equal-length arrays
|
|
332
|
-
const xored = xor(a, b)
|
|
333
|
-
|
|
334
|
-
// Concatenate two arrays
|
|
335
|
-
const combined = concat(a, b)
|
|
336
|
-
console.log(combined.length) // 32
|
|
337
|
-
```
|
|
338
|
-
|
|
339
|
-
---
|
|
340
|
-
|
|
341
|
-
## Error Conditions
|
|
342
|
-
|
|
343
|
-
| Function | Condition | Behavior |
|
|
344
|
-
|---|---|---|
|
|
345
|
-
| `hexToBytes` | Odd-length string | Throws `RangeError` |
|
|
346
|
-
| `hexToBytes` | Invalid hex characters | Bytes decode as `NaN` -> `0` |
|
|
347
|
-
| `base64ToBytes` | Invalid length or characters | Returns `undefined` |
|
|
348
|
-
| `constantTimeEqual` | Arrays differ in length | Returns `false` immediately |
|
|
349
|
-
| `constantTimeEqual` | Either array exceeds `CT_MAX_BYTES` | Throws `RangeError` |
|
|
350
|
-
| `xor` | Arrays differ in length | Throws `RangeError` |
|
|
351
|
-
| `randomBytes` | `crypto` not available | Throws (runtime-dependent) |
|
|
352
|
-
| `hasSIMD` | `WebAssembly` not available | Returns `false` |
|
|
353
|
-
|
|
354
|
-
---
|
|
355
|
-
|
|
356
|
-
> ## Cross-References
|
|
357
|
-
>
|
|
358
|
-
> - [index](./README.md) — Project Documentation index
|
|
359
|
-
> - [architecture](./architecture.md) — architecture overview, module relationships, buffer layouts, and build pipeline
|
|
360
|
-
> - [serpent](./serpent.md) — Serpent modes consume keys from `randomBytes`; wrappers use `wipe` and `constantTimeEqual`
|
|
361
|
-
> - [chacha20](./chacha20.md) — ChaCha20/Poly1305 classes use `randomBytes` for nonce generation
|
|
362
|
-
> - [sha2](./sha2.md) — SHA-2 and HMAC classes; output often converted with `bytesToHex`
|
|
363
|
-
> - [sha3](./sha3.md) — SHA-3 and SHAKE classes; output often converted with `bytesToHex`
|
|
364
|
-
> - [argon2id](./argon2id.md) — passphrase-based encryption; uses `constantTimeEqual` for hash verification
|
|
365
|
-
> - [examples](./examples.md) — full HMAC-SHA256 custom protocol example using `constantTimeEqual`
|
|
366
|
-
> - [types](./types.md) — public interfaces whose implementations rely on these utilities
|
|
367
|
-
> - [test-suite](./test-suite.md) — test suite structure and vector corpus
|
package/dist/embedded/kyber.d.ts
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MTjQX+BjvAFhcepduaf1z4hXiA/b7xNn9r8TX5t5V3FgR7p3lyZbTx7EJt6V7ykvz28hPNf69cyydIddFt7lmurMzzTYsXN07S3y19i8ml55aepRezW/k5S2O8zxonT9Bb2XPkzOYfV7avnG/NWl7T418Sk823l38ln2gMiVcX7mPHlz9Lv0n30EPN55uX8T3i0+wg+4hcWrx5cY6qpc81fyJeWXxk+Q3y2aX7F4aWrEW2tJFvXHx6+WvLf6Jfaf565S/8z/zHfN/if+RnLBIWq9OzlZHSbcOHD49Pjd358X3FrZdMHDlYqmy9a7g6uXVy+PD/ADWXD1qaIgAA";
|
package/dist/embedded/kyber.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
// Generated by scripts/embed-wasm.ts — do not edit
|
|
2
|
-
// gzip-compressed WASM binary, base64-encoded. Decoded and decompressed by loadEmbedded().
|
|
3
|
-
export const WASM_GZ_BASE64 = 'H4sIAAAAAAAAA61ae4xcVRk/z/uc2ZmiCNZCv3upPMQtj7ZQWh57lmdLwUZCND6y3W5nN3t3drc7c3ewgsw2QuwfhAQjpIomxSAQFAwmoFGQrhoVNP6DRGNQ+UONf6iJEgP7mB37nXPv7J3Z2Skm0Ow95/vu953zPX7nnO/cgQxXJykhhO70DhBaP8DqdXKA1skBXseeqNcNg9YPEIJvad0waV2L0Dq/8QbS6z+LSMEYY1LalHJOKePYcsYY50JQSoVwXCEFcu0fOTf6Y6X4tulDs+XSnkOE9CFVmpyuHNk/PFaqEloYK8X7p8tH7ihPx4PD1RJhWc4d458vEZ7LcC4lLEteRkSWvJzILLmNWFlyO7Gz5A7iZMkriJslryReltxJ/Cx5FcmdkZC10kjL+HwHU9vfV2hnXkryHZzLSKGDczkpdnC2kQ0dnO3kjA7ODvK+Ds4V5P0dnCvJmfmxUnxHqXToY6Oj1VJMPoCO3VYdS8izMGP7JxLqbKTuSKkPInV9nFAbi5raXxmfLCWsD+Fsn5we3V8ZTTib/LvGD5cGZ0dHS5UqOQcB8KlSPFx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hg146ekq7KVxzHd5xdNy2MZU0HWHEGnK0g8M68glRXpfl1dJfV4wWyRbd4ikQi92vFoH2xea8oAC25tcrlwscovnAS/uyBb1oTn42gWLW04v0jbK1qQaMQhC/ITSVCMy0t9Oi9uy5t1sfkWiwIqXKKo/hxpVdeIoS9VponkJft/CF21j6IP+EYr3STOAwIJe361CCXzfDP5QAlYUunjrc8DF2i9dMPg9O7CQh7/KJB+NTh0iRzfuSRaAzj7G18zoJ8PbKDKTkbEzMsmvIHTCv9qEI6kmhL6I4FzJlalaCbJn3yCO0KQzz3xh8LpjT/qK8rrCH5D0kltdlPrrF35m0vsxWLrUw9FmqrjlZrN/nDGiHnB8tokSddzxjzGB/0MEJeQfS17jqyvvW3xdPig301fJnc0pdpH1AvkJv33p2sUX5TXstUWH1ulPl78nf7xwb/MTjQX+BjvAFhcepduaf1z4hXiA/b7xNn9r8TX5t5V3FgR7p3lyZbTx7EJt6V7ykvz28hPNf69cyydIddFt7lmurMzzTYsXN07S3y19i8ml55aepRezW/k5S2O8zxonT9Bb2XPkzOYfV7avnG/NWl7T418Sk823l38ln2gMiVcX7mPHlz9Lv0n30EPN55uX8T3i0+wg+4hcWrx5cY6qpc81fyJeWXxk+Q3y2aX7F4aWrEW2tJFvXHx6+WvLf6Jfaf565S/8z/zHfN/if+RnLBIWq9OzlZHSbcOHD49Pjd358X3FrZdMHDlYqmy9a7g6uXVy+PD/ADWXD1qaIgAA';
|
package/dist/kyber/embedded.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { WASM_GZ_BASE64 as kyberWasm } from '../embedded/kyber.js';
|