@weave_protocol/yoxallismus 0.0.1 → 0.2.0-beta.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.
Files changed (64) hide show
  1. package/README.md +236 -16
  2. package/SECURITY.md +110 -0
  3. package/SECURITY_ADVISORIES.md +86 -0
  4. package/SKILL.md +52 -0
  5. package/THREAT_MODEL.md +187 -0
  6. package/WIRE_FORMAT.md +102 -0
  7. package/dist/aead.d.ts +44 -0
  8. package/dist/aead.d.ts.map +1 -0
  9. package/dist/aead.js +96 -0
  10. package/dist/aead.js.map +1 -0
  11. package/dist/cascade.d.ts +31 -0
  12. package/dist/cascade.d.ts.map +1 -0
  13. package/dist/cascade.js +74 -0
  14. package/dist/cascade.js.map +1 -0
  15. package/dist/cli.d.ts +16 -0
  16. package/dist/cli.d.ts.map +1 -0
  17. package/dist/cli.js +501 -0
  18. package/dist/cli.js.map +1 -0
  19. package/dist/double-ratchet.d.ts +106 -0
  20. package/dist/double-ratchet.d.ts.map +1 -0
  21. package/dist/double-ratchet.js +238 -0
  22. package/dist/double-ratchet.js.map +1 -0
  23. package/dist/index.d.ts +54 -0
  24. package/dist/index.d.ts.map +1 -0
  25. package/dist/index.js +79 -0
  26. package/dist/index.js.map +1 -0
  27. package/dist/kdf.d.ts +33 -0
  28. package/dist/kdf.d.ts.map +1 -0
  29. package/dist/kdf.js +45 -0
  30. package/dist/kdf.js.map +1 -0
  31. package/dist/kem.d.ts +79 -0
  32. package/dist/kem.d.ts.map +1 -0
  33. package/dist/kem.js +220 -0
  34. package/dist/kem.js.map +1 -0
  35. package/dist/labels.d.ts +51 -0
  36. package/dist/labels.d.ts.map +1 -0
  37. package/dist/labels.js +93 -0
  38. package/dist/labels.js.map +1 -0
  39. package/dist/ratchet.d.ts +38 -0
  40. package/dist/ratchet.d.ts.map +1 -0
  41. package/dist/ratchet.js +91 -0
  42. package/dist/ratchet.js.map +1 -0
  43. package/dist/sealed.d.ts +33 -0
  44. package/dist/sealed.d.ts.map +1 -0
  45. package/dist/sealed.js +40 -0
  46. package/dist/sealed.js.map +1 -0
  47. package/dist/serialize.d.ts +20 -0
  48. package/dist/serialize.d.ts.map +1 -0
  49. package/dist/serialize.js +97 -0
  50. package/dist/serialize.js.map +1 -0
  51. package/dist/types.d.ts +67 -0
  52. package/dist/types.d.ts.map +1 -0
  53. package/dist/types.js +6 -0
  54. package/dist/types.js.map +1 -0
  55. package/dist/v1-compat.d.ts +37 -0
  56. package/dist/v1-compat.d.ts.map +1 -0
  57. package/dist/v1-compat.js +58 -0
  58. package/dist/v1-compat.js.map +1 -0
  59. package/dist/wire.d.ts +21 -0
  60. package/dist/wire.d.ts.map +1 -0
  61. package/dist/wire.js +114 -0
  62. package/dist/wire.js.map +1 -0
  63. package/package.json +53 -7
  64. package/index.js +0 -27
@@ -0,0 +1,187 @@
1
+ # Threat Model — @weave_protocol/yoxallismus v0.2.0-beta.0
2
+
3
+ **Status:** EXPERIMENTAL. NOT AUDITED. Beta software.
4
+
5
+ **Purpose:** This document names every known attack class this library defends against, every one it does not, every assumption it makes about the runtime environment, and every known limitation of the current release. Read this before adopting.
6
+
7
+ This is the document a serious developer reads before choosing to depend on a cryptographic library. It is also the document that protects users when a vulnerability is discovered — you can point to what was and wasn't in scope.
8
+
9
+ ---
10
+
11
+ ## Adversary model
12
+
13
+ We assume the following adversary capabilities:
14
+
15
+ | Adversary tier | Capabilities | In scope? |
16
+ |---|---|---|
17
+ | **Passive network observer** | Reads all ciphertexts in transit | ✅ Yes |
18
+ | **Active network attacker** | Reads, modifies, replays, injects ciphertexts | ✅ Yes |
19
+ | **Malicious sender** | Sends crafted ciphertexts to try to break decryption | ✅ Yes |
20
+ | **Compromised session key holder** | Has one specific message key at time T | ✅ Yes (partial — forward secrecy) |
21
+ | **Compromised long-term key holder** | Has recipient's full private keypair | ❌ Out of scope for confidentiality (any KEM fails here) |
22
+ | **Quantum-computing adversary (harvest-now-decrypt-later)** | Records ciphertexts now, decrypts post-quantum-computer | ✅ Yes (via hybrid KEM PQ half) |
23
+ | **Nation-state with unbounded resources** | Timing, cache, power, EM side channels | ❌ Out of scope |
24
+ | **Endpoint attacker with code execution** | Reads memory, dumps process | ❌ Out of scope |
25
+ | **Supply chain attacker** | Compromises upstream dependency | ⚠️ Partial (see § Supply Chain) |
26
+ | **RNG compromise** | Predictable/controlled randomness from Node crypto | ❌ Out of scope (defer to Node) |
27
+
28
+ ---
29
+
30
+ ## What v0.1 defends against
31
+
32
+ ### C1. Confidentiality against passive observers
33
+ **Primitive:** AES-256-GCM AEAD wrapped around every message
34
+ **Assumption:** AES-256 remains classically and quantum-resistant to Grover attacks (128-bit effective quantum strength — acceptable for beta scope)
35
+
36
+ ### C2. Integrity against active tampering
37
+ **Primitive:** GCM 128-bit authentication tag on every ciphertext
38
+ **Verified:** `weave-yoxall audit-self` runs single-bit ciphertext flip, tag flip, wrong-key attacks; all rejected
39
+
40
+ ### C3. Context binding via Associated Data
41
+ **Primitive:** AAD field bound into every AEAD encryption
42
+ **Use:** Prevents an attacker from replaying ciphertext across contexts (e.g. session A message swapped into session B)
43
+
44
+ ### C4. Post-quantum shared-secret exchange
45
+ **Primitive:** ML-KEM-768 (NIST FIPS 203) composed with X25519 via HKDF-SHA-256
46
+ **Guarantee:** An attacker must break BOTH X25519 (via Shor) AND ML-KEM (via a novel lattice attack) to recover the shared secret
47
+ **Reference:** Signal PQXDH, Cloudflare X25519Kyber768Draft00, Google Chrome KyberHybrid
48
+
49
+ ### C5. Harvest-now-decrypt-later resistance
50
+ **Assumption:** Recorded ciphertexts, decrypted after a fault-tolerant quantum computer arrives, remain confidential because the PQ half is not broken by Shor
51
+ **Caveat:** This assumes ML-KEM-768 remains secure. NIST's confidence is high but not absolute; SPHINCS+ or HQC as backup is a possible v0.2 addition
52
+
53
+ ### C6. Wrong-recipient rejection
54
+ **Primitive:** ML-KEM's implicit rejection + X25519 correctness
55
+ **Behavior:** A wrong recipient trying to decapsulate produces a *different* shared secret; subsequent AEAD decryption fails with authentication error
56
+
57
+ ### C7. Forward secrecy within a session
58
+ **Primitive:** Double Ratchet symmetric chains (HMAC-SHA-256); message keys deleted after use
59
+ **Guarantee:** Compromising session state at message N does not reveal earlier messages
60
+
61
+ ### C8. Chosen-ciphertext security (IND-CCA2)
62
+ **Primitive:** ML-KEM-768 provides IND-CCA2 by construction; X25519 is used with ephemeral keys per encapsulation
63
+ **Behavior:** An attacker cannot use the recipient as a decryption oracle to extract information about other ciphertexts
64
+
65
+ ### C9. Post-compromise security (new in v0.2)
66
+ **Primitive:** Double Ratchet DH ratchet (fresh X25519 keys every round trip)
67
+ **Guarantee:** An attacker who copies a party's full session state can read traffic only until both parties have sent again. After that round trip the session derives keys from DH secrets the attacker never saw. The test suite demonstrates this with a stolen session copy.
68
+ **Limitation:** Healing requires the attacker to be passive during the round trip. An active attacker holding the state can impersonate the party instead.
69
+
70
+ ### C10. Out-of-order and lost messages (new in v0.2)
71
+ **Primitive:** Skipped-message key retention (at most 1000 per chain step, 2000 in total)
72
+ **Guarantee:** Messages can arrive in any order and some can be lost; the session stays in sync. A lost first message doesn't strand the session, because the handshake is repeated until the first reply.
73
+
74
+ ### C11. Robust decryption (new in v0.2)
75
+ **Behavior:** Forged, replayed, or out-of-window ratchet messages throw and leave the session unchanged, because decryption runs on a copy that is committed only after authentication succeeds.
76
+
77
+ ### C12. Single-primitive break of the symmetric cipher (optional, new in v0.2)
78
+ **Primitive:** Cascade mode, with AES-256-GCM inside ChaCha20-Poly1305 under independent HKDF-derived keys
79
+ **Guarantee:** Confidentiality holds if either AES-256 or ChaCha20 holds.
80
+
81
+
82
+ ---
83
+
84
+ ## What v0.2 does NOT defend against
85
+
86
+ ### N1. Post-quantum post-compromise security
87
+ **Missing:** A PQ KEM inside the ratchet (as in Signal's SPQR / triple ratchet)
88
+ **Impact:** The session start is hybrid post-quantum, but ongoing DH ratchet steps are classical X25519. A future quantum attacker who recorded the traffic and later breaks X25519 can follow the ratchet *after* the first DH step. Messages protected only by the initial KEM chain remain PQ-safe.
89
+ **Planned:** after v0.3
90
+
91
+ ### N2. Multi-agent m-of-n threshold decryption
92
+ **Missing:** Threshold encryption primitive
93
+ **Impact:** Any single compromised agent that holds a private key can decrypt state that was intended to require multi-party approval
94
+ **Planned:** v0.3
95
+
96
+ ### N3. Sender authentication
97
+ **Missing:** Identity keys or signatures
98
+ **Impact:** Sealed boxes and ratchet sessions are **sender-anonymous**: the recipient learns that someone who knew its public key sent the message, not who. Authenticate peers at a higher layer (for example Domere handoff tokens).
99
+ **Planned:** v0.3
100
+
101
+ ### N4. Side-channel attacks
102
+ **Missing:** Constant-time guarantees, memory-cleared secret handling, side-channel resistant primitives
103
+ **Impact:** An attacker with timing, cache, power, or EM measurement access may be able to recover keys
104
+ **Assumption:** Attackers with side-channel access have already compromised the endpoint
105
+
106
+ ### N5. Compromised randomness
107
+ **Missing:** RNG verification, hardware RNG integration (QRNG)
108
+ **Impact:** If Node's `crypto.randomBytes()` returns predictable output (compromised RNG, buggy CPU, VM entropy starvation), all key generation and nonce generation is compromised
109
+ **Planned:** QRNG hook in v0.3
110
+
111
+ ### N6. Malicious dependency updates
112
+ **Missing:** No lockfile verification, no reproducible builds, no dependency signing
113
+ **Impact:** A compromised `@noble/post-quantum` update could substitute broken cryptography without detection
114
+ **Mitigation:** We use `@noble/post-quantum` from Paul Miller's well-audited noble suite; the risk is low but not zero
115
+ **Planned:** SLSA/reproducible-build attestations in v0.3+
116
+
117
+ ### N7. Endpoint compromise
118
+ **Missing:** Memory scrubbing after key use, TEE integration, hardware-backed key storage
119
+ **Impact:** An attacker with code execution on the endpoint can read all cryptographic material from process memory
120
+ **Assumption:** Endpoint security is out of scope for a cryptographic library
121
+
122
+ ### N8. Regulated data handling
123
+ **Missing:** No FIPS 140-3 validation, no HIPAA-compliant audit trail, no PCI-DSS-approved deployment model
124
+ **Impact:** Cannot be used for regulated data storage or transmission
125
+ **Explicit non-goal for the beta series**
126
+
127
+ ### N9. Formal audit
128
+ **Missing:** No external cryptographic audit by Trail of Bits, NCC Group, Cure53, or comparable
129
+ **Impact:** Any latent implementation bug is undiscovered
130
+ **By design for the beta series** — validation is via public use, forks, and responsible disclosure (see SECURITY.md)
131
+
132
+ ---
133
+
134
+ ## Assumptions about the runtime environment
135
+
136
+ - **Node.js ≥ 18** with functional `crypto` module (AES-256-GCM, HKDF, X25519 keygen, DER SPKI/PKCS8 encoding)
137
+ - **`@noble/post-quantum` ≥ 0.4.0** installed and unmodified
138
+ - **RNG** functioning correctly (`crypto.randomBytes()` returns cryptographically-random output)
139
+ - **Endpoint** not compromised
140
+ - **Filesystem** protects the `.priv` file with mode 600 (or equivalent)
141
+ - **Wire format** endpoints agree on `_version` field and reject unknown versions
142
+
143
+ ---
144
+
145
+ ## Supply chain
146
+
147
+ ### Dependencies (v0.1.0-beta.0)
148
+
149
+ | Package | Version | Purpose | Risk |
150
+ |---|---|---|---|
151
+ | `@noble/post-quantum` | ^0.4.0 | ML-KEM-768 primitive | LOW — Paul Miller's audited noble suite |
152
+ | Node built-in `crypto` | ≥ 18 | X25519, AES-256-GCM, HKDF | LOW — audited by Node maintainers |
153
+
154
+ No native modules. No transitive deps beyond the standard toolchain. `npm audit` should report 0 vulnerabilities.
155
+
156
+ ### Build reproducibility
157
+
158
+ - Deterministic TypeScript compilation from published source
159
+ - No preinstall/postinstall scripts
160
+ - No compiled binaries in the tarball
161
+
162
+ ---
163
+
164
+ ## Known unknowns
165
+
166
+ Documented so we don't pretend we've thought of everything:
167
+
168
+ 1. **ML-KEM-768 novel attacks** — NIST's post-quantum competition selected ML-KEM after multiple rounds of cryptanalysis. Confidence is high but the algorithm is only ~10 years old. Any advance in lattice reduction could reduce security margins.
169
+ 2. **X25519 side channels in Node** — Node's X25519 implementation relies on OpenSSL. Any side-channel vulnerability there propagates here.
170
+ 3. **HKDF composition edge cases** — Our combination of X25519 secret + ML-KEM secret via HKDF follows Signal PQXDH and Cloudflare's hybrid TLS design. If those designs have a subtle flaw, this library inherits it.
171
+ 4. **Ratchet edge cases** — Our symmetric ratchet is simpler than Signal Double Ratchet but has similar attack surface. Session-boundary bugs, sessionId collisions, and message-counter overflow are documented risks.
172
+ 5. **JSON wire format** — Base64url-wrapped JSON is not the fastest or smallest wire format. It's chosen for debuggability during beta. It also inherits any JSON parsing vulnerabilities in the receiving environment.
173
+
174
+ ---
175
+
176
+ ## Version history
177
+
178
+ - **v0.2.0-beta.0**: Double Ratchet (post-compromise security, out-of-order delivery), hybrid KEM combiner v2, sealed boxes, cascade AEAD, and the locked `yoxall/2` wire format (WIRE_FORMAT.md). Advisories YOXALL-2026-001, -002 and -003 published.
179
+ - **v0.1.0-beta.0** — Initial public beta. PQ-hybrid KEM, AEAD, symmetric ratcheting. Aggressive experimental labeling. Threat model established.
180
+
181
+ ---
182
+
183
+ ## How to report vulnerabilities
184
+
185
+ See [SECURITY.md](SECURITY.md) for the responsible-disclosure process.
186
+
187
+ Please report all cryptographic findings — even ones you're unsure of. Accepted reports are credited in [SECURITY_ADVISORIES.md](SECURITY_ADVISORIES.md) alongside the corresponding fix.
package/WIRE_FORMAT.md ADDED
@@ -0,0 +1,102 @@
1
+ # Wire Format `yoxall/2`: Locked
2
+
3
+ > **Stability promise.** Everything in this document is frozen from `@weave_protocol/yoxallismus@0.2.0-beta.0` through `1.0`. Data written by 0.2 will be readable by every later release up to and including 1.0. Changes in that window may only **add** optional envelope fields (readers ignore unknown fields) or add new envelope types. Anything else ships as `yoxall/3`.
4
+ >
5
+ > The known-answer vectors in [`test/vectors/yoxall-2.json`](test/vectors/yoxall-2.json) are part of this lock: CI fails if any byte of them changes.
6
+
7
+ ## Conventions
8
+
9
+ - Envelopes are JSON objects with `_type` and `_version: "yoxall/2"`.
10
+ - Binary fields are **base64url without padding**.
11
+ - Integers are JSON numbers in `0 … 2³²−1`.
12
+ - `HKDF` = HKDF-SHA-256 (RFC 5869). `HMAC` = HMAC-SHA-256. `‖` = concatenation. `Z32` = 32 zero bytes.
13
+ - Every label below is an ASCII string used verbatim as HKDF `info`.
14
+
15
+ ## Keys (unchanged since v0.1)
16
+
17
+ | Object | Layout |
18
+ |---|---|
19
+ | Hybrid public key | X25519 public (32 B) + ML-KEM-768 public (1184 B) |
20
+ | Hybrid private key | X25519 private (32 B) + ML-KEM-768 private (2400 B) |
21
+ | KEM ciphertext | X25519 ephemeral public (32 B) + ML-KEM-768 ciphertext (1088 B) |
22
+
23
+ Key envelopes `yoxall-pubkey` / `yoxall-keypair` keep their v0.1 shape and are accepted under either version string.
24
+
25
+ ## Hybrid KEM combiner v2
26
+
27
+ ```
28
+ ss = HKDF(ikm = ss_mlkem ‖ ss_x25519 ‖ eph_x25519_pub ‖ recipient_x25519_pub,
29
+ salt = Z32,
30
+ info = "weave-yoxall/2 kem-combine",
31
+ L = 32)
32
+ ```
33
+
34
+ Same shape as X-Wing: hashing the X25519 ephemeral and recipient public keys makes the combined secret IND-CCA even if only the X25519 half is relied on. The v0.1 combiner (`"weave-yoxall v0.1 pq-hybrid-combine"`) is kept **only** for reading v0.1 data (see YOXALL-2026-002).
35
+
36
+ ## Sealed box: `yoxall-sealed`
37
+
38
+ ```
39
+ ss = KEM-v2 encapsulate(recipient)
40
+ key = HKDF(ss, salt = Z32, info = "weave-yoxall/2 seal " ‖ mode, L = 32)
41
+ ```
42
+
43
+ | `mode` | Body |
44
+ |---|---|
45
+ | `aes-256-gcm` | `nonce` = random 12 B; `ct` = AES-256-GCM(key, nonce, pt, aad) ‖ tag (16 B) |
46
+ | `cascade` | see Cascade below; `nonce` = outer ChaCha20 nonce |
47
+
48
+ ```json
49
+ { "_type": "yoxall-sealed", "_version": "yoxall/2", "mode": "aes-256-gcm",
50
+ "x25519eph": "<32 B>", "mlkem": "<1088 B>", "nonce": "<12 B>", "ct": "<…>" }
51
+ ```
52
+
53
+ The AAD is **never** stored in the envelope; the recipient supplies the expected value to `open()`.
54
+
55
+ ## Cascade AEAD
56
+
57
+ ```
58
+ k_aes = HKDF(key, Z32, "weave-yoxall/2 cascade aes-256-gcm", 32)
59
+ k_chacha = HKDF(key, Z32, "weave-yoxall/2 cascade chacha20-poly1305", 32)
60
+ inner = n1 ‖ AES-256-GCM(k_aes, n1, pt, aad) ‖ tag1
61
+ ct = ChaCha20-Poly1305(k_chacha, n2, inner, aad) ‖ tag2
62
+ ```
63
+
64
+ `n1`, `n2` are independent random 12-byte nonces; `n2` is the envelope `nonce`. Overhead is 44 bytes plus the outer nonce.
65
+
66
+ ## Double Ratchet
67
+
68
+ Follows the [Signal Double Ratchet specification](https://signal.org/docs/specifications/doubleratchet/).
69
+
70
+ ```
71
+ session start (rk, ck0) = HKDF(ss_kem_v2, Z32, "weave-yoxall/2 dr-init", 64)
72
+ session AD ad = SHA-256("weave-yoxall/2 dr-ad" ‖ kem_ct.x25519eph ‖ kem_ct.mlkem
73
+ ‖ responder.x25519_pub ‖ responder.mlkem_pub)
74
+ KDF_RK(rk, dh) (rk', ck) = HKDF(ikm = dh, salt = rk, "weave-yoxall/2 dr-rk", 64)
75
+ KDF_CK(ck) ck' = HMAC(ck, 0x02); mk = HMAC(ck, 0x01)
76
+ message key key ‖ nonce = HKDF(mk, Z32, "weave-yoxall/2 dr-msg", 44) (32 B + 12 B)
77
+ header bytes dh (32 B) ‖ pn (uint32 BE) ‖ n (uint32 BE) (40 B)
78
+ ciphertext AES-256-GCM(key, nonce, pt, aad = ad ‖ header ‖ caller_aad) ‖ tag
79
+ ```
80
+
81
+ - The **initiator** sends first with chain `ck0` and a fresh X25519 ratchet key. Its messages carry the KEM ciphertext as `handshake` until the first reply arrives.
82
+ - The **responder** sets `ckr = ck0`, `dhr` = the initiator's header key, generates its ratchet key, and derives its first sending chain with `KDF_RK(rk, DH(own, dhr))`.
83
+ - Skipped message keys are kept (at most 1000 per chain step, 2000 in total).
84
+
85
+ ```json
86
+ { "_type": "yoxall-dr-msg", "_version": "yoxall/2",
87
+ "dh": "<32 B>", "pn": 0, "n": 3,
88
+ "handshake": { "x25519eph": "<32 B>", "mlkem": "<1088 B>" },
89
+ "ct": "<…>" }
90
+ ```
91
+
92
+ ### Session state: `yoxall-dr-session` (secret)
93
+
94
+ Fields: `role` (`initiator` | `responder`), `ad`, `rk`, `dhsPub`, `dhsPriv`, `dhr`, `cks`, `ckr` (32 B or `null`), `ns`, `nr`, `pn`, `skipped` (array of `["<dh b64url>:<n>", "<mk>"]`, oldest first), `pendingHandshake` (KEM ciphertext object or `null`). **Contains secret key material: store it encrypted and never log it.**
95
+
96
+ ## Legacy formats
97
+
98
+ | Format | Status |
99
+ |---|---|
100
+ | `yoxall/0.1.0-beta.0` envelopes (`yoxall-kem-ct`, `yoxall-payload`, `yoxall-encrypted-file`) | **Readable**, through `PQCipher` and `weave-yoxall decrypt`. Written only by the deprecated v0.1 APIs. |
101
+ | v0.1 symmetric ratchet | Deprecated: no interoperable session start (YOXALL-2026-001). |
102
+ | Yoxallismus v1 (`YXLS` header, Hord `YoxallismusCipher`) | **Detected, not decryptable** by any implementation (YOXALL-2026-003). |
package/dist/aead.d.ts ADDED
@@ -0,0 +1,44 @@
1
+ /**
2
+ * AEAD wrapper for @weave_protocol/yoxallismus.
3
+ *
4
+ * Uses Node's built-in AES-256-GCM. Chose AES-256 over ChaCha20-Poly1305
5
+ * for v0.1 because it's hardware-accelerated on all modern CPUs and gives
6
+ * ~128-bit quantum security via Grover's algorithm (the reduced strength
7
+ * is still adequate for the beta scope).
8
+ *
9
+ * NONCE HANDLING:
10
+ * Each encryption generates a fresh 12-byte random nonce. Callers MUST
11
+ * NOT reuse nonces with the same key — this is the most common AEAD
12
+ * footgun. The ratchet module derives per-message nonces via HKDF to
13
+ * avoid this class of bug.
14
+ *
15
+ * KEY SIZE:
16
+ * AES-256 requires exactly 32 bytes. Keys shorter or longer will throw.
17
+ */
18
+ import type { EncryptedPayload } from './types.js';
19
+ export declare const KEY_LEN = 32;
20
+ export declare const NONCE_LEN = 12;
21
+ export declare const TAG_LEN = 16;
22
+ /**
23
+ * Encrypt plaintext with AES-256-GCM. Nonce is auto-generated.
24
+ * Associated data (AAD) is optional but recommended for context binding.
25
+ */
26
+ export declare function aeadEncrypt(key: Uint8Array, plaintext: Uint8Array, associatedData?: Uint8Array): EncryptedPayload;
27
+ /**
28
+ * Encrypt with a caller-provided nonce. Used by the ratchet where
29
+ * nonces are deterministically derived from chain state (never random).
30
+ *
31
+ * WARNING: never call this with a nonce you have previously used with
32
+ * the same key. Doing so catastrophically breaks GCM confidentiality
33
+ * AND integrity.
34
+ */
35
+ export declare function aeadEncryptWithNonce(key: Uint8Array, plaintext: Uint8Array, nonce: Uint8Array, associatedData?: Uint8Array): EncryptedPayload;
36
+ /**
37
+ * Decrypt an EncryptedPayload. Throws on:
38
+ * - key length mismatch
39
+ * - nonce length mismatch
40
+ * - GCM auth tag verification failure (ciphertext tamper, wrong key,
41
+ * wrong nonce, wrong AAD)
42
+ */
43
+ export declare function aeadDecrypt(key: Uint8Array, payload: EncryptedPayload): Uint8Array;
44
+ //# sourceMappingURL=aead.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"aead.d.ts","sourceRoot":"","sources":["../src/aead.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAGH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAEnD,eAAO,MAAM,OAAO,KAAK,CAAC;AAC1B,eAAO,MAAM,SAAS,KAAK,CAAC;AAC5B,eAAO,MAAM,OAAO,KAAK,CAAC;AAE1B;;;GAGG;AACH,wBAAgB,WAAW,CACzB,GAAG,EAAE,UAAU,EACf,SAAS,EAAE,UAAU,EACrB,cAAc,CAAC,EAAE,UAAU,GAC1B,gBAAgB,CAMlB;AAED;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAClC,GAAG,EAAE,UAAU,EACf,SAAS,EAAE,UAAU,EACrB,KAAK,EAAE,UAAU,EACjB,cAAc,CAAC,EAAE,UAAU,GAC1B,gBAAgB,CAqBlB;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,UAAU,EAAE,OAAO,EAAE,gBAAgB,GAAG,UAAU,CAwBlF"}
package/dist/aead.js ADDED
@@ -0,0 +1,96 @@
1
+ /**
2
+ * AEAD wrapper for @weave_protocol/yoxallismus.
3
+ *
4
+ * Uses Node's built-in AES-256-GCM. Chose AES-256 over ChaCha20-Poly1305
5
+ * for v0.1 because it's hardware-accelerated on all modern CPUs and gives
6
+ * ~128-bit quantum security via Grover's algorithm (the reduced strength
7
+ * is still adequate for the beta scope).
8
+ *
9
+ * NONCE HANDLING:
10
+ * Each encryption generates a fresh 12-byte random nonce. Callers MUST
11
+ * NOT reuse nonces with the same key — this is the most common AEAD
12
+ * footgun. The ratchet module derives per-message nonces via HKDF to
13
+ * avoid this class of bug.
14
+ *
15
+ * KEY SIZE:
16
+ * AES-256 requires exactly 32 bytes. Keys shorter or longer will throw.
17
+ */
18
+ import { createCipheriv, createDecipheriv, randomBytes } from 'node:crypto';
19
+ export const KEY_LEN = 32; // AES-256
20
+ export const NONCE_LEN = 12; // GCM standard
21
+ export const TAG_LEN = 16; // GCM auth tag
22
+ /**
23
+ * Encrypt plaintext with AES-256-GCM. Nonce is auto-generated.
24
+ * Associated data (AAD) is optional but recommended for context binding.
25
+ */
26
+ export function aeadEncrypt(key, plaintext, associatedData) {
27
+ if (key.length !== KEY_LEN) {
28
+ throw new Error(`aeadEncrypt: key must be ${KEY_LEN} bytes, got ${key.length}`);
29
+ }
30
+ const nonce = randomBytes(NONCE_LEN);
31
+ return aeadEncryptWithNonce(key, plaintext, nonce, associatedData);
32
+ }
33
+ /**
34
+ * Encrypt with a caller-provided nonce. Used by the ratchet where
35
+ * nonces are deterministically derived from chain state (never random).
36
+ *
37
+ * WARNING: never call this with a nonce you have previously used with
38
+ * the same key. Doing so catastrophically breaks GCM confidentiality
39
+ * AND integrity.
40
+ */
41
+ export function aeadEncryptWithNonce(key, plaintext, nonce, associatedData) {
42
+ if (key.length !== KEY_LEN) {
43
+ throw new Error(`aeadEncryptWithNonce: key must be ${KEY_LEN} bytes, got ${key.length}`);
44
+ }
45
+ if (nonce.length !== NONCE_LEN) {
46
+ throw new Error(`aeadEncryptWithNonce: nonce must be ${NONCE_LEN} bytes, got ${nonce.length}`);
47
+ }
48
+ const cipher = createCipheriv('aes-256-gcm', Buffer.from(key), Buffer.from(nonce));
49
+ if (associatedData && associatedData.length > 0) {
50
+ cipher.setAAD(Buffer.from(associatedData));
51
+ }
52
+ const enc = Buffer.concat([cipher.update(Buffer.from(plaintext)), cipher.final()]);
53
+ const tag = cipher.getAuthTag();
54
+ const ciphertext = new Uint8Array(enc.length + tag.length);
55
+ ciphertext.set(enc, 0);
56
+ ciphertext.set(tag, enc.length);
57
+ return {
58
+ nonce,
59
+ ciphertext,
60
+ ...(associatedData ? { associatedData } : {}),
61
+ };
62
+ }
63
+ /**
64
+ * Decrypt an EncryptedPayload. Throws on:
65
+ * - key length mismatch
66
+ * - nonce length mismatch
67
+ * - GCM auth tag verification failure (ciphertext tamper, wrong key,
68
+ * wrong nonce, wrong AAD)
69
+ */
70
+ export function aeadDecrypt(key, payload) {
71
+ if (key.length !== KEY_LEN) {
72
+ throw new Error(`aeadDecrypt: key must be ${KEY_LEN} bytes, got ${key.length}`);
73
+ }
74
+ if (payload.nonce.length !== NONCE_LEN) {
75
+ throw new Error(`aeadDecrypt: nonce must be ${NONCE_LEN} bytes, got ${payload.nonce.length}`);
76
+ }
77
+ if (payload.ciphertext.length < TAG_LEN) {
78
+ throw new Error(`aeadDecrypt: ciphertext too short (min ${TAG_LEN} bytes for GCM tag)`);
79
+ }
80
+ const ctBody = payload.ciphertext.slice(0, payload.ciphertext.length - TAG_LEN);
81
+ const tag = payload.ciphertext.slice(payload.ciphertext.length - TAG_LEN);
82
+ const decipher = createDecipheriv('aes-256-gcm', Buffer.from(key), Buffer.from(payload.nonce));
83
+ if (payload.associatedData && payload.associatedData.length > 0) {
84
+ decipher.setAAD(Buffer.from(payload.associatedData));
85
+ }
86
+ decipher.setAuthTag(Buffer.from(tag));
87
+ // Node throws with an obscure error on tag mismatch; wrap for clarity
88
+ try {
89
+ const dec = Buffer.concat([decipher.update(Buffer.from(ctBody)), decipher.final()]);
90
+ return new Uint8Array(dec);
91
+ }
92
+ catch (err) {
93
+ throw new Error('aeadDecrypt: authentication failed (ciphertext tampered, wrong key, wrong nonce, or wrong AAD)');
94
+ }
95
+ }
96
+ //# sourceMappingURL=aead.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"aead.js","sourceRoot":"","sources":["../src/aead.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAG5E,MAAM,CAAC,MAAM,OAAO,GAAG,EAAE,CAAC,CAAC,UAAU;AACrC,MAAM,CAAC,MAAM,SAAS,GAAG,EAAE,CAAC,CAAC,eAAe;AAC5C,MAAM,CAAC,MAAM,OAAO,GAAG,EAAE,CAAC,CAAC,eAAe;AAE1C;;;GAGG;AACH,MAAM,UAAU,WAAW,CACzB,GAAe,EACf,SAAqB,EACrB,cAA2B;IAE3B,IAAI,GAAG,CAAC,MAAM,KAAK,OAAO,EAAE,CAAC;QAC3B,MAAM,IAAI,KAAK,CAAC,4BAA4B,OAAO,eAAe,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC;IAClF,CAAC;IACD,MAAM,KAAK,GAAG,WAAW,CAAC,SAAS,CAAC,CAAC;IACrC,OAAO,oBAAoB,CAAC,GAAG,EAAE,SAAS,EAAE,KAAK,EAAE,cAAc,CAAC,CAAC;AACrE,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,oBAAoB,CAClC,GAAe,EACf,SAAqB,EACrB,KAAiB,EACjB,cAA2B;IAE3B,IAAI,GAAG,CAAC,MAAM,KAAK,OAAO,EAAE,CAAC;QAC3B,MAAM,IAAI,KAAK,CAAC,qCAAqC,OAAO,eAAe,GAAG,CAAC,MAAM,EAAE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AAC,CAAC,CAAC;QACpF,OAAO,IAAI,UAAU,CAAC,GAAG,CAAC,CAAC;IAC7B,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CAAC,gGAAgG,CAAC,CAAC;IACpH,CAAC;AACH,CAAC"}
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Cascade AEAD: AES-256-GCM inside ChaCha20-Poly1305.
3
+ *
4
+ * Two independent ciphers, two independent keys (derived from one 32-byte
5
+ * key with HKDF under distinct labels), two independent random nonces:
6
+ *
7
+ * inner = AES-256-GCM(k_aes, n1, plaintext, aad) ‖ tag1
8
+ * outer = ChaCha20-Poly1305(k_chacha, n2, n1 ‖ inner, aad) ‖ tag2
9
+ *
10
+ * Confidentiality holds if EITHER cipher holds; forgery requires breaking
11
+ * the outer AEAD and then the inner one. This is a defense-in-depth hedge
12
+ * against a break in one primitive, not a performance feature: it costs
13
+ * two passes and 44 extra bytes.
14
+ *
15
+ * Why not XOR the two keystreams? XOR composition drops both ciphers'
16
+ * authentication and makes key/nonce misuse in either one fatal for the
17
+ * whole construction. Layering keeps every AEAD guarantee of both.
18
+ */
19
+ export interface CascadePayload {
20
+ /** ChaCha20-Poly1305 nonce (outer layer). The AES nonce is inside the ciphertext. */
21
+ nonce: Uint8Array;
22
+ /** n1 ‖ AES-GCM ciphertext ‖ tag1, encrypted by ChaCha20-Poly1305 ‖ tag2 */
23
+ ciphertext: Uint8Array;
24
+ }
25
+ export declare function cascadeEncrypt(key: Uint8Array, plaintext: Uint8Array, aad?: Uint8Array): CascadePayload;
26
+ /** Fixed-nonce variant for known-answer test vectors only. Never reuse nonces in real use. */
27
+ export declare function cascadeEncryptWith(key: Uint8Array, plaintext: Uint8Array, aad: Uint8Array | undefined, n1: Uint8Array, n2: Uint8Array): CascadePayload;
28
+ export declare function cascadeDecrypt(key: Uint8Array, payload: CascadePayload, aad?: Uint8Array): Uint8Array;
29
+ /** Bytes added by cascade mode on top of the plaintext (n1 + 2 tags; outer nonce stored separately). */
30
+ export declare const CASCADE_OVERHEAD: number;
31
+ //# sourceMappingURL=cascade.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cascade.d.ts","sourceRoot":"","sources":["../src/cascade.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAUH,MAAM,WAAW,cAAc;IAC7B,qFAAqF;IACrF,KAAK,EAAE,UAAU,CAAC;IAClB,4EAA4E;IAC5E,UAAU,EAAE,UAAU,CAAC;CACxB;AA2BD,wBAAgB,cAAc,CAAC,GAAG,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,GAAG,CAAC,EAAE,UAAU,GAAG,cAAc,CAEvG;AAED,8FAA8F;AAC9F,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,GAAG,EAAE,UAAU,GAAG,SAAS,EAAE,EAAE,EAAE,UAAU,EAAE,EAAE,EAAE,UAAU,GAAG,cAAc,CAKtJ;AAED,wBAAgB,cAAc,CAAC,GAAG,EAAE,UAAU,EAAE,OAAO,EAAE,cAAc,EAAE,GAAG,CAAC,EAAE,UAAU,GAAG,UAAU,CAMrG;AAED,wGAAwG;AACxG,eAAO,MAAM,gBAAgB,QAAkB,CAAC"}
@@ -0,0 +1,74 @@
1
+ /**
2
+ * Cascade AEAD: AES-256-GCM inside ChaCha20-Poly1305.
3
+ *
4
+ * Two independent ciphers, two independent keys (derived from one 32-byte
5
+ * key with HKDF under distinct labels), two independent random nonces:
6
+ *
7
+ * inner = AES-256-GCM(k_aes, n1, plaintext, aad) ‖ tag1
8
+ * outer = ChaCha20-Poly1305(k_chacha, n2, n1 ‖ inner, aad) ‖ tag2
9
+ *
10
+ * Confidentiality holds if EITHER cipher holds; forgery requires breaking
11
+ * the outer AEAD and then the inner one. This is a defense-in-depth hedge
12
+ * against a break in one primitive, not a performance feature: it costs
13
+ * two passes and 44 extra bytes.
14
+ *
15
+ * Why not XOR the two keystreams? XOR composition drops both ciphers'
16
+ * authentication and makes key/nonce misuse in either one fatal for the
17
+ * whole construction. Layering keeps every AEAD guarantee of both.
18
+ */
19
+ import { createCipheriv, createDecipheriv, randomBytes } from 'node:crypto';
20
+ import { hkdf } from './kdf.js';
21
+ const NONCE = 12;
22
+ const TAG = 16;
23
+ const K_AES = 'weave-yoxall/2 cascade aes-256-gcm';
24
+ const K_CHACHA = 'weave-yoxall/2 cascade chacha20-poly1305';
25
+ function keys(key) {
26
+ if (key.length !== 32)
27
+ throw new Error(`cascade: key must be 32 bytes, got ${key.length}`);
28
+ const salt = new Uint8Array(32);
29
+ return { aes: Buffer.from(hkdf(key, salt, K_AES, 32)), chacha: Buffer.from(hkdf(key, salt, K_CHACHA, 32)) };
30
+ }
31
+ function seal(algo, key, nonce, pt, aad) {
32
+ const c = createCipheriv(algo, key, nonce, { authTagLength: TAG });
33
+ if (aad && aad.length)
34
+ c.setAAD(Buffer.from(aad), { plaintextLength: pt.length });
35
+ return Buffer.concat([c.update(Buffer.from(pt)), c.final(), c.getAuthTag()]);
36
+ }
37
+ function unseal(algo, key, nonce, ct, aad) {
38
+ if (ct.length < TAG)
39
+ throw new Error('cascade: authentication failed');
40
+ const body = Buffer.from(ct.subarray(0, ct.length - TAG));
41
+ const d = createDecipheriv(algo, key, nonce, { authTagLength: TAG });
42
+ if (aad && aad.length)
43
+ d.setAAD(Buffer.from(aad), { plaintextLength: body.length });
44
+ d.setAuthTag(Buffer.from(ct.subarray(ct.length - TAG)));
45
+ try {
46
+ return Buffer.concat([d.update(body), d.final()]);
47
+ }
48
+ catch {
49
+ throw new Error('cascade: authentication failed (tampered, wrong key, or wrong AAD)');
50
+ }
51
+ }
52
+ export function cascadeEncrypt(key, plaintext, aad) {
53
+ return cascadeEncryptWith(key, plaintext, aad, randomBytes(NONCE), randomBytes(NONCE));
54
+ }
55
+ /** Fixed-nonce variant for known-answer test vectors only. Never reuse nonces in real use. */
56
+ export function cascadeEncryptWith(key, plaintext, aad, n1, n2) {
57
+ if (n1.length !== NONCE || n2.length !== NONCE)
58
+ throw new Error(`cascade: nonces must be ${NONCE} bytes`);
59
+ const k = keys(key);
60
+ const inner = Buffer.concat([Buffer.from(n1), seal('aes-256-gcm', k.aes, Buffer.from(n1), plaintext, aad)]);
61
+ return { nonce: new Uint8Array(n2), ciphertext: new Uint8Array(seal('chacha20-poly1305', k.chacha, Buffer.from(n2), inner, aad)) };
62
+ }
63
+ export function cascadeDecrypt(key, payload, aad) {
64
+ if (payload.nonce.length !== NONCE)
65
+ throw new Error(`cascade: nonce must be ${NONCE} bytes`);
66
+ const k = keys(key);
67
+ const inner = unseal('chacha20-poly1305', k.chacha, Buffer.from(payload.nonce), payload.ciphertext, aad);
68
+ if (inner.length < NONCE + TAG)
69
+ throw new Error('cascade: authentication failed');
70
+ return new Uint8Array(unseal('aes-256-gcm', k.aes, inner.subarray(0, NONCE), inner.subarray(NONCE), aad));
71
+ }
72
+ /** Bytes added by cascade mode on top of the plaintext (n1 + 2 tags; outer nonce stored separately). */
73
+ export const CASCADE_OVERHEAD = NONCE + 2 * TAG;
74
+ //# sourceMappingURL=cascade.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cascade.js","sourceRoot":"","sources":["../src/cascade.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC5E,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAEhC,MAAM,KAAK,GAAG,EAAE,CAAC;AACjB,MAAM,GAAG,GAAG,EAAE,CAAC;AACf,MAAM,KAAK,GAAG,oCAAoC,CAAC;AACnD,MAAM,QAAQ,GAAG,0CAA0C,CAAC;AAS5D,SAAS,IAAI,CAAC,GAAe;IAC3B,IAAI,GAAG,CAAC,MAAM,KAAK,EAAE;QAAE,MAAM,IAAI,KAAK,CAAC,sCAAsC,GAAG,CAAC,MAAM,EAA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1
+ #!/usr/bin/env node
2
+ /**
3
+ * weave-yoxall — CLI for @weave_protocol/yoxallismus.
4
+ *
5
+ * Subcommands:
6
+ * status Print library status, primitives, known limitations
7
+ * keygen Generate a hybrid keypair, write to files
8
+ * encrypt Encrypt a file to a recipient's public key
9
+ * decrypt Decrypt a file with a private key
10
+ * test Run all self-tests (reproducible-claims suite)
11
+ * benchmark Micro-benchmarks vs baseline
12
+ * audit-self Run known-attack test vectors
13
+ * help Show this message
14
+ */
15
+ export {};
16
+ //# sourceMappingURL=cli.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;GAYG"}