@weave_protocol/yoxallismus 0.0.1 → 0.1.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.
- package/README.md +201 -17
- package/SECURITY.md +110 -0
- package/SECURITY_ADVISORIES.md +43 -0
- package/SKILL.md +50 -0
- package/THREAT_MODEL.md +170 -0
- package/dist/aead.d.ts +44 -0
- package/dist/aead.d.ts.map +1 -0
- package/dist/aead.js +96 -0
- package/dist/aead.js.map +1 -0
- package/dist/cli.d.ts +16 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +451 -0
- package/dist/cli.js.map +1 -0
- package/dist/index.d.ts +49 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +72 -0
- package/dist/index.js.map +1 -0
- package/dist/kdf.d.ts +33 -0
- package/dist/kdf.d.ts.map +1 -0
- package/dist/kdf.js +45 -0
- package/dist/kdf.js.map +1 -0
- package/dist/kem.d.ts +50 -0
- package/dist/kem.d.ts.map +1 -0
- package/dist/kem.js +167 -0
- package/dist/kem.js.map +1 -0
- package/dist/labels.d.ts +50 -0
- package/dist/labels.d.ts.map +1 -0
- package/dist/labels.js +92 -0
- package/dist/labels.js.map +1 -0
- package/dist/ratchet.d.ts +38 -0
- package/dist/ratchet.d.ts.map +1 -0
- package/dist/ratchet.js +91 -0
- package/dist/ratchet.js.map +1 -0
- package/dist/serialize.d.ts +20 -0
- package/dist/serialize.d.ts.map +1 -0
- package/dist/serialize.js +97 -0
- package/dist/serialize.js.map +1 -0
- package/dist/types.d.ts +67 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +6 -0
- package/dist/types.js.map +1 -0
- package/dist/v1-compat.d.ts +19 -0
- package/dist/v1-compat.d.ts.map +1 -0
- package/dist/v1-compat.js +22 -0
- package/dist/v1-compat.js.map +1 -0
- package/package.json +51 -7
- package/index.js +0 -27
package/README.md
CHANGED
|
@@ -1,26 +1,210 @@
|
|
|
1
|
-
# @weave_protocol/yoxallismus
|
|
1
|
+
# 🔐 @weave_protocol/yoxallismus
|
|
2
2
|
|
|
3
|
-
**
|
|
4
|
-
|
|
5
|
-
cryptographic library pulled in by default `npm install`.
|
|
3
|
+
> **Post-quantum cryptographic composition layer for AI agents.**
|
|
4
|
+
> Built on NIST-standardized primitives. Composed for multi-agent, memory-persistent, headless-tool architectures.
|
|
6
5
|
|
|
7
|
-
|
|
6
|
+
[](https://www.npmjs.com/package/@weave_protocol/yoxallismus)
|
|
7
|
+
[](../LICENSE)
|
|
8
|
+
[]()
|
|
9
|
+
[]()
|
|
8
10
|
|
|
9
|
-
|
|
10
|
-
npm install @weave_protocol/yoxallismus@beta
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
The real package is a post-quantum cryptographic composition layer.
|
|
14
|
-
It is **experimental** and **not audited**. Read the following before use:
|
|
11
|
+
---
|
|
15
12
|
|
|
16
|
-
|
|
17
|
-
- [THREAT_MODEL.md](https://github.com/Tyox-all/Weave_Protocol/blob/main/yoxallismus/THREAT_MODEL.md)
|
|
18
|
-
- [SECURITY.md](https://github.com/Tyox-all/Weave_Protocol/blob/main/yoxallismus/SECURITY.md)
|
|
13
|
+
## ⚠️ EXPERIMENTAL — NOT AUDITED ⚠️
|
|
19
14
|
|
|
20
|
-
|
|
15
|
+
**This library has NOT undergone external cryptographic audit.**
|
|
21
16
|
|
|
22
|
-
|
|
17
|
+
**DO NOT USE for:**
|
|
18
|
+
- Regulated data (HIPAA, PCI-DSS, SOC2-audited storage)
|
|
23
19
|
- Medical records
|
|
24
20
|
- Financial records
|
|
25
21
|
- Legal evidence
|
|
26
|
-
- Any system where cryptographic failure would cause real-world harm
|
|
22
|
+
- Any system where a cryptographic failure would cause real-world harm
|
|
23
|
+
|
|
24
|
+
**DO USE for:**
|
|
25
|
+
- Research on post-quantum agent architectures
|
|
26
|
+
- Experimentation with PQ-hybrid primitives
|
|
27
|
+
- Development against future PQ-cryptographic patterns
|
|
28
|
+
- Learning post-quantum cryptography by example
|
|
29
|
+
|
|
30
|
+
**Read [THREAT_MODEL.md](THREAT_MODEL.md) and [SECURITY.md](SECURITY.md) before using this library for anything.**
|
|
31
|
+
|
|
32
|
+
The version is `0.1.0-beta.0` for a reason. The wire format may break between v0.1 and v0.2. Formal external audit is not currently planned — the library is being validated by public use, forks, community verification, and a coordinated-disclosure program. Your judgment as an adopter is your only safety net; make it well.
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
## What this is
|
|
37
|
+
|
|
38
|
+
An agent-native cryptographic composition layer built on NIST FIPS 203 (ML-KEM-768) and standard classical primitives (X25519, AES-256-GCM, HKDF-SHA-256). It doesn't invent new cryptographic primitives — it composes audited ones for the specific threat surface of long-lived, multi-agent AI systems.
|
|
39
|
+
|
|
40
|
+
The design principle: **novel architecture, standardized primitives.** The primitives (X25519, ML-KEM-768, AES-256-GCM, HKDF) are NIST-standardized or de facto industry standard. The composition (PQ-hybrid KEM, session ratcheting, agent-scoped context binding) is what's novel and what should be scrutinized.
|
|
41
|
+
|
|
42
|
+
## What this isn't
|
|
43
|
+
|
|
44
|
+
- **Not a replacement for liboqs, PQClean, or BoringSSL.** Those libraries are the primitive layer. This library composes them for agent use cases.
|
|
45
|
+
- **Not audited.** Signal, Cloudflare, Google, and every serious PQ-crypto deployment has been externally audited. This library has not.
|
|
46
|
+
- **Not production-ready.** v0.1.0-beta.0 explicitly.
|
|
47
|
+
|
|
48
|
+
## Installation
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
npm install @weave_protocol/yoxallismus
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
To silence the runtime beta banner:
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
export YOXALL_SILENCE_BETA_WARNING=1
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Quick start (programmatic)
|
|
61
|
+
|
|
62
|
+
```typescript
|
|
63
|
+
import { PQCipher } from '@weave_protocol/yoxallismus';
|
|
64
|
+
|
|
65
|
+
// Alice generates a keypair, shares her public key
|
|
66
|
+
const alice = PQCipher.generateKeypair();
|
|
67
|
+
const alicePub = PQCipher.publicKeyOf(alice);
|
|
68
|
+
|
|
69
|
+
// Bob encrypts a message to Alice
|
|
70
|
+
const bundle = PQCipher.encryptTo(alicePub, new TextEncoder().encode('secret'));
|
|
71
|
+
|
|
72
|
+
// Alice decrypts
|
|
73
|
+
const message = PQCipher.decryptFrom(alice, bundle.ciphertext, bundle.payload);
|
|
74
|
+
console.log(new TextDecoder().decode(message)); // "secret"
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## Quick start (CLI)
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
# Generate a hybrid keypair
|
|
81
|
+
weave-yoxall keygen --out=./alice
|
|
82
|
+
|
|
83
|
+
# Encrypt a file to a public key
|
|
84
|
+
weave-yoxall encrypt --to=./alice.pub --in=./message.txt
|
|
85
|
+
|
|
86
|
+
# Decrypt with the corresponding private key
|
|
87
|
+
weave-yoxall decrypt --with=./alice.priv --in=./message.txt.yox
|
|
88
|
+
|
|
89
|
+
# See status, primitives, known limitations
|
|
90
|
+
weave-yoxall status
|
|
91
|
+
|
|
92
|
+
# Run the reproducible-claims test suite
|
|
93
|
+
weave-yoxall test
|
|
94
|
+
|
|
95
|
+
# Run known-attack test vectors
|
|
96
|
+
weave-yoxall audit-self
|
|
97
|
+
|
|
98
|
+
# Benchmarks
|
|
99
|
+
weave-yoxall benchmark
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
## What's inside (v0.1.0-beta.0)
|
|
103
|
+
|
|
104
|
+
| Component | Primitive | Size / Cost |
|
|
105
|
+
|---|---|---|
|
|
106
|
+
| Classical KEM | X25519 (Node crypto) | 32B pub / 32B priv |
|
|
107
|
+
| Post-quantum KEM | ML-KEM-768 via `@noble/post-quantum` (NIST FIPS 203) | 1184B pub / 2400B priv |
|
|
108
|
+
| Hybrid combination | HKDF-SHA-256 over concatenated shared secrets | 32B output |
|
|
109
|
+
| AEAD | AES-256-GCM (Node crypto) | 12B nonce, 16B tag |
|
|
110
|
+
| KDF | HKDF-SHA-256 (Node crypto) | 32B default |
|
|
111
|
+
| Ratchet | Symmetric ratchet (chain-key advance via HKDF) | Forward secrecy within session |
|
|
112
|
+
| Wire format | JSON envelopes with `_type` + `_version` discriminator | Base64url values |
|
|
113
|
+
|
|
114
|
+
## Performance (v0.1.0-beta.0)
|
|
115
|
+
|
|
116
|
+
Measured on Node.js 22, x86_64, single-threaded, warm cache:
|
|
117
|
+
|
|
118
|
+
| Operation | Time per op |
|
|
119
|
+
|---|---|
|
|
120
|
+
| AEAD encrypt (1 KB) | ~0.024 ms |
|
|
121
|
+
| Hybrid keypair generation | ~3.1 ms |
|
|
122
|
+
| Hybrid encap + decap | ~2.4 ms |
|
|
123
|
+
| End-to-end PQCipher (1 KB) | ~2.3 ms |
|
|
124
|
+
|
|
125
|
+
Reproduce with `weave-yoxall benchmark`.
|
|
126
|
+
|
|
127
|
+
## Reproducible claims
|
|
128
|
+
|
|
129
|
+
Every claim in this README is backed by a runnable test. To verify:
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
weave-yoxall test
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
This runs assertions on:
|
|
136
|
+
- AEAD encrypt/decrypt roundtrip
|
|
137
|
+
- Ciphertext bit-flip rejection
|
|
138
|
+
- AAD binding
|
|
139
|
+
- PQ-hybrid keypair sizes match NIST FIPS 203
|
|
140
|
+
- Encapsulate/decapsulate produce matching shared secrets
|
|
141
|
+
- Wrong recipient cannot decrypt
|
|
142
|
+
- Ratchet forward-motion and message counter
|
|
143
|
+
- Serialization roundtrip preserves bytes
|
|
144
|
+
|
|
145
|
+
To verify known-attack vectors are rejected:
|
|
146
|
+
|
|
147
|
+
```bash
|
|
148
|
+
weave-yoxall audit-self
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
## Known limitations
|
|
152
|
+
|
|
153
|
+
- **No formal external audit** performed
|
|
154
|
+
- **No threshold encryption** (multi-agent m-of-n) yet — planned v0.2+
|
|
155
|
+
- **No DH double-ratchet** — v0.1 only has symmetric ratcheting; no post-compromise recovery. Planned v0.2.
|
|
156
|
+
- **No zero-knowledge proofs** yet — planned v0.3+
|
|
157
|
+
- **No verifiable delay functions** yet — planned v0.3+
|
|
158
|
+
- **No FHE integration** yet — planned v0.4+
|
|
159
|
+
- **No Yoxallismus v1 backward-compat shim** yet — planned v0.2
|
|
160
|
+
- **No cascade cipher** (classical ⊕ PQ) mode — planned v0.2
|
|
161
|
+
- **No quantum-RNG integration** — planned v0.3+
|
|
162
|
+
- **Wire format not stabilized** — may change between v0.1 and v0.2 (migration tooling will accompany the break)
|
|
163
|
+
|
|
164
|
+
See `weave-yoxall status` for the machine-readable version of this list.
|
|
165
|
+
|
|
166
|
+
## Threat model
|
|
167
|
+
|
|
168
|
+
Full threat model in [THREAT_MODEL.md](THREAT_MODEL.md).
|
|
169
|
+
|
|
170
|
+
**What v0.1 defends against:**
|
|
171
|
+
- Passive network observation (via AEAD)
|
|
172
|
+
- Ciphertext tampering (via AEAD auth tag)
|
|
173
|
+
- Wrong-recipient decryption (via hybrid KEM correctness)
|
|
174
|
+
- Chosen-ciphertext attacks on the KEM (via ML-KEM's IND-CCA2 security + X25519 ephemeral keys)
|
|
175
|
+
- Post-quantum harvest-now-decrypt-later on ciphertexts (via hybrid KEM PQ half)
|
|
176
|
+
- Forward secrecy of past messages within a session (via ratcheting)
|
|
177
|
+
|
|
178
|
+
**What v0.1 does NOT defend against:**
|
|
179
|
+
- Post-compromise recovery (need DH ratcheting; planned v0.2)
|
|
180
|
+
- Multi-agent state isolation (need threshold encryption; planned v0.2+)
|
|
181
|
+
- Side-channel attacks (timing, cache, power)
|
|
182
|
+
- Compromised RNG
|
|
183
|
+
- Malicious dependency updates
|
|
184
|
+
- Runtime memory attacks (buffer inspection, coredump)
|
|
185
|
+
- Endpoint compromise
|
|
186
|
+
- Nation-state adversaries with unlimited quantum resources
|
|
187
|
+
|
|
188
|
+
## Security reports
|
|
189
|
+
|
|
190
|
+
See [SECURITY.md](SECURITY.md).
|
|
191
|
+
|
|
192
|
+
## Roadmap
|
|
193
|
+
|
|
194
|
+
The full research scope is intentionally proprietary until Q1 2027 IP position is set. The public roadmap:
|
|
195
|
+
|
|
196
|
+
- **v0.1.0-beta** (this release) — PQ-hybrid KEM + AEAD + symmetric ratchet + CLI + test suites + aggressive labels
|
|
197
|
+
- **v0.2.0-beta** — DH double-ratchet, cascade cipher (classical ⊕ PQ), v1 backward-compat shim, wire format stabilization
|
|
198
|
+
- **v0.3.0-beta** — Threshold encryption (multi-agent m-of-n), verifiable delay functions, ZK state-transition proofs (experimental), QRNG integration hook
|
|
199
|
+
- **v0.4.0-beta** — Homomorphic bounded arithmetic (FHE integration)
|
|
200
|
+
- **v1.0** — Once the community has hammered on it enough that we're confident the primitives compose correctly. No time table.
|
|
201
|
+
|
|
202
|
+
## License
|
|
203
|
+
|
|
204
|
+
Apache 2.0 — see [LICENSE](../LICENSE). No warranty. No fitness for purpose. Use at your own risk.
|
|
205
|
+
|
|
206
|
+
## Contact
|
|
207
|
+
|
|
208
|
+
- **Bug reports** → [GitHub Issues](https://github.com/Tyox-all/Weave_Protocol/issues)
|
|
209
|
+
- **Security reports** → see [SECURITY.md](SECURITY.md)
|
|
210
|
+
- **Everything else** → <TYox-all@tutamail.com>
|
package/SECURITY.md
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
# Security Policy — @weave_protocol/yoxallismus
|
|
2
|
+
|
|
3
|
+
## Reporting a vulnerability
|
|
4
|
+
|
|
5
|
+
**Do not open a public GitHub issue for security reports.**
|
|
6
|
+
|
|
7
|
+
Send security reports to: **<TYox-all@tutamail.com>**
|
|
8
|
+
|
|
9
|
+
Include:
|
|
10
|
+
1. Version affected (start of subject line: `[YOXALL SECURITY vX.Y.Z]`)
|
|
11
|
+
2. Vulnerability class (cryptographic, implementation, side-channel, supply-chain, other)
|
|
12
|
+
3. Reproducer — ideally a runnable test case
|
|
13
|
+
4. Impact assessment — what an attacker can achieve
|
|
14
|
+
5. Suggested fix (optional)
|
|
15
|
+
|
|
16
|
+
Expect an acknowledgement within 72 hours. Response times vary — this is a solo-maintained beta.
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## Responsible disclosure program
|
|
21
|
+
|
|
22
|
+
**Status:** Active as of v0.1.0-beta.0
|
|
23
|
+
|
|
24
|
+
This library is deliberately unaudited. Community verification is the only safety net. We commit to fast triage, coordinated disclosure, and public recognition of researchers who report responsibly.
|
|
25
|
+
|
|
26
|
+
### What reporters receive
|
|
27
|
+
|
|
28
|
+
- **Acknowledgement in the advisory** — every fixed vulnerability publishes an entry in [SECURITY_ADVISORIES.md](SECURITY_ADVISORIES.md) crediting the reporter (with permission, or anonymously by request)
|
|
29
|
+
- **CVE assignment** where warranted, via GitHub Security Advisories
|
|
30
|
+
- **Coordinated disclosure timeline** — reporter and maintainer agree on publication timing
|
|
31
|
+
- **A direct communication channel** with the maintainer, not a support queue
|
|
32
|
+
- **First-report priority** — if two people report the same issue, the earlier report gets credited
|
|
33
|
+
|
|
34
|
+
There is no monetary bounty program at this time. If that changes, this document will be updated with the terms.
|
|
35
|
+
|
|
36
|
+
### Scope
|
|
37
|
+
|
|
38
|
+
**In scope:**
|
|
39
|
+
- Any file in the `@weave_protocol/yoxallismus` npm package
|
|
40
|
+
- Wire-format ambiguity or parsing vulnerabilities
|
|
41
|
+
- Composition flaws in the PQ-hybrid KEM
|
|
42
|
+
- Ratchet state confusion, chain-key reuse, message-key derivation errors
|
|
43
|
+
- KDF misuse, HKDF domain-separation errors
|
|
44
|
+
- AEAD misuse, nonce-reuse patterns
|
|
45
|
+
- Documentation claims that don't match code behavior
|
|
46
|
+
|
|
47
|
+
**Out of scope:**
|
|
48
|
+
- Vulnerabilities in `@noble/post-quantum` (report to that project directly)
|
|
49
|
+
- Vulnerabilities in Node.js crypto module (report to Node)
|
|
50
|
+
- Attacks requiring endpoint compromise, physical access, or side channels
|
|
51
|
+
- Attacks on the theoretical strength of ML-KEM-768 or X25519 that assume advances not currently known (report as research, not as vulnerability)
|
|
52
|
+
- Regulatory-compliance findings (this library is explicitly not compliance-ready)
|
|
53
|
+
- Any behavior explicitly noted in THREAT_MODEL.md as out of scope
|
|
54
|
+
|
|
55
|
+
### Severity classification
|
|
56
|
+
|
|
57
|
+
Every accepted report is classified for the public advisory:
|
|
58
|
+
|
|
59
|
+
| Severity | Definition |
|
|
60
|
+
|---|---|
|
|
61
|
+
| **Critical** | Confidentiality break — attacker recovers plaintext or key material without holding the private key |
|
|
62
|
+
| **High** | Integrity break — attacker forges valid ciphertexts, or bypasses AEAD authentication |
|
|
63
|
+
| **Medium** | Denial-of-service, algorithm confusion, wire-format ambiguity that could enable attacks |
|
|
64
|
+
| **Low** | Documentation errors that could mislead users into insecure usage |
|
|
65
|
+
|
|
66
|
+
### Rules of engagement
|
|
67
|
+
|
|
68
|
+
1. **No public disclosure** before a fix is released (or 90 days from acknowledgment, whichever is sooner)
|
|
69
|
+
2. **No attacks on users' data** — only against your own test infrastructure
|
|
70
|
+
3. **No social engineering** or attacks on the maintainer's accounts
|
|
71
|
+
4. **One vulnerability per report** — chained vulnerabilities credited as the highest-severity link
|
|
72
|
+
|
|
73
|
+
---
|
|
74
|
+
|
|
75
|
+
## Disclosure process
|
|
76
|
+
|
|
77
|
+
1. Report received → acknowledgment within 72 hours
|
|
78
|
+
2. Triage → severity assignment within 7 days
|
|
79
|
+
3. Fix development → target 30 days for high/critical; 90 days for medium/low
|
|
80
|
+
4. Coordinated disclosure — reporter and maintainer agree on public advisory timing
|
|
81
|
+
5. Fix released with corresponding entry in SECURITY_ADVISORIES.md
|
|
82
|
+
6. CVE assignment via GitHub Security Advisories, where warranted
|
|
83
|
+
|
|
84
|
+
---
|
|
85
|
+
|
|
86
|
+
## What we won't do
|
|
87
|
+
|
|
88
|
+
- **We won't sue researchers who follow this policy in good faith.** Reports made in good faith under this policy are considered authorized testing under DMCA § 1201(j) and CFAA safe harbors.
|
|
89
|
+
- **We won't retaliate** against reporters, even for reports we ultimately reject.
|
|
90
|
+
- **We won't gag researchers** after 90 days from acknowledgment. Coordinated disclosure is a request, not a permanent obligation.
|
|
91
|
+
|
|
92
|
+
---
|
|
93
|
+
|
|
94
|
+
## Cryptographic questions that are NOT security reports
|
|
95
|
+
|
|
96
|
+
If you have questions about:
|
|
97
|
+
- Algorithm choices (Why ML-KEM-768 not 1024?)
|
|
98
|
+
- Wire format decisions (Why JSON not CBOR?)
|
|
99
|
+
- Missing features (When is threshold coming?)
|
|
100
|
+
- Design tradeoffs
|
|
101
|
+
|
|
102
|
+
...open a regular GitHub discussion or issue. These aren't security-sensitive and belong in public conversation.
|
|
103
|
+
|
|
104
|
+
---
|
|
105
|
+
|
|
106
|
+
## Beta software reminder
|
|
107
|
+
|
|
108
|
+
This is beta. It is NOT audited. Reports about *its beta status* are not vulnerabilities — that's stated policy.
|
|
109
|
+
|
|
110
|
+
Reports about **cryptographic correctness**, **composition safety**, **wire format flaws**, and **implementation bugs** are exactly what the disclosure program is for.
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# Security Advisories — @weave_protocol/yoxallismus
|
|
2
|
+
|
|
3
|
+
_This document is the public record of all security advisories issued for this library._
|
|
4
|
+
|
|
5
|
+
_As of v0.1.0-beta.0: no advisories have been issued yet._
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Format
|
|
10
|
+
|
|
11
|
+
Each entry follows this structure:
|
|
12
|
+
|
|
13
|
+
```
|
|
14
|
+
### YOXALL-YYYY-NNN — <title>
|
|
15
|
+
|
|
16
|
+
- **Severity:** Critical / High / Medium / Low
|
|
17
|
+
- **Affects:** @weave_protocol/yoxallismus X.Y.Z–X.Y.Z
|
|
18
|
+
- **Fixed in:** @weave_protocol/yoxallismus X.Y.Z
|
|
19
|
+
- **Reporter:** Name (with permission) or "anonymous"
|
|
20
|
+
- **CVE:** CVE-YYYY-NNNNN (if assigned)
|
|
21
|
+
|
|
22
|
+
**Description:** ...
|
|
23
|
+
|
|
24
|
+
**Impact:** ...
|
|
25
|
+
|
|
26
|
+
**Root cause:** ...
|
|
27
|
+
|
|
28
|
+
**Fix:** ...
|
|
29
|
+
|
|
30
|
+
**Mitigation for users on older versions:** ...
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## Advisories
|
|
36
|
+
|
|
37
|
+
_(none yet)_
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
## Reporting a new vulnerability
|
|
42
|
+
|
|
43
|
+
See [SECURITY.md](SECURITY.md) for the responsible-disclosure process.
|
package/SKILL.md
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
## 🔐 Skill: `pq-crypto`
|
|
2
|
+
|
|
3
|
+
You have access to `@weave_protocol/yoxallismus` — an EXPERIMENTAL post-quantum cryptographic composition layer. NOT AUDITED. Use with care.
|
|
4
|
+
|
|
5
|
+
### When to invoke
|
|
6
|
+
|
|
7
|
+
Use PQ crypto when the user:
|
|
8
|
+
- Asks about post-quantum encryption or NIST FIPS 203 (ML-KEM)
|
|
9
|
+
- Wants to encrypt data with hybrid classical + post-quantum security
|
|
10
|
+
- Is building a system that needs harvest-now-decrypt-later resistance
|
|
11
|
+
- Needs a Signal-style ratchet for forward secrecy
|
|
12
|
+
- Asks about "quantum-safe" or "PQ-hybrid" cryptography
|
|
13
|
+
|
|
14
|
+
### Key exports
|
|
15
|
+
|
|
16
|
+
```typescript
|
|
17
|
+
import { PQCipher } from '@weave_protocol/yoxallismus';
|
|
18
|
+
|
|
19
|
+
// Simple encrypt-to-recipient facade
|
|
20
|
+
const alice = PQCipher.generateKeypair();
|
|
21
|
+
const bundle = PQCipher.encryptTo(PQCipher.publicKeyOf(alice), plaintext);
|
|
22
|
+
const decrypted = PQCipher.decryptFrom(alice, bundle.ciphertext, bundle.payload);
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Lower-level primitives also exported:
|
|
26
|
+
- `generateHybridKeypair`, `encapsulate`, `decapsulate` — hybrid KEM
|
|
27
|
+
- `aeadEncrypt`, `aeadDecrypt` — AES-256-GCM AEAD
|
|
28
|
+
- `hkdf`, `deriveAeadKey`, `deriveNonce` — HKDF-SHA-256 KDF
|
|
29
|
+
- `initRatchet`, `ratchetEncrypt`, `ratchetDecrypt` — symmetric ratchet
|
|
30
|
+
- `serialize*` / `deserialize*` — wire format helpers
|
|
31
|
+
|
|
32
|
+
### CLI commands
|
|
33
|
+
|
|
34
|
+
- `weave-yoxall status` — library status + known limitations
|
|
35
|
+
- `weave-yoxall keygen --out=<name>` — generate keypair
|
|
36
|
+
- `weave-yoxall encrypt --to=<pub> --in=<file>` — encrypt file
|
|
37
|
+
- `weave-yoxall decrypt --with=<priv> --in=<file>` — decrypt file
|
|
38
|
+
- `weave-yoxall test` — reproducible-claims test suite
|
|
39
|
+
- `weave-yoxall audit-self` — known-attack test vectors
|
|
40
|
+
- `weave-yoxall benchmark` — micro-benchmarks
|
|
41
|
+
|
|
42
|
+
### Critical caveats
|
|
43
|
+
|
|
44
|
+
- **NOT AUDITED.** Do not use for regulated, medical, financial, or legal data.
|
|
45
|
+
- Wire format may break between v0.1 and v0.2.
|
|
46
|
+
- No post-compromise recovery yet (planned v0.2 via DH double-ratchet).
|
|
47
|
+
- No threshold encryption yet (planned v0.3).
|
|
48
|
+
- Silence the runtime beta banner with `YOXALL_SILENCE_BETA_WARNING=1`.
|
|
49
|
+
|
|
50
|
+
Always point users to `THREAT_MODEL.md` and `SECURITY.md` before recommending adoption.
|
package/THREAT_MODEL.md
ADDED
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
# Threat Model — @weave_protocol/yoxallismus v0.1.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:** Symmetric ratcheting via HKDF chain advance
|
|
59
|
+
**Guarantee:** Compromising the chain key at message N does not reveal messages 1..N-1
|
|
60
|
+
**Limitation:** Does NOT provide post-compromise recovery (see § Not defended)
|
|
61
|
+
|
|
62
|
+
### C8. Chosen-ciphertext security (IND-CCA2)
|
|
63
|
+
**Primitive:** ML-KEM-768 provides IND-CCA2 by construction; X25519 is used with ephemeral keys per encapsulation
|
|
64
|
+
**Behavior:** An attacker cannot use the recipient as a decryption oracle to extract information about other ciphertexts
|
|
65
|
+
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
## What v0.1 does NOT defend against
|
|
69
|
+
|
|
70
|
+
### N1. Post-compromise recovery
|
|
71
|
+
**Missing:** DH double-ratchet (Signal Protocol style)
|
|
72
|
+
**Impact:** If a chain key is compromised at message N, all *future* messages in that session become readable to the attacker until the session is torn down and re-established
|
|
73
|
+
**Planned:** v0.2
|
|
74
|
+
|
|
75
|
+
### N2. Multi-agent m-of-n threshold decryption
|
|
76
|
+
**Missing:** Threshold encryption primitive
|
|
77
|
+
**Impact:** Any single compromised agent that holds a private key can decrypt state that was intended to require multi-party approval
|
|
78
|
+
**Planned:** v0.3
|
|
79
|
+
|
|
80
|
+
### N3. Out-of-order message delivery
|
|
81
|
+
**Missing:** Skipped-message key retention
|
|
82
|
+
**Impact:** Messages must be decrypted in order. Skipping a message breaks the chain for all subsequent messages
|
|
83
|
+
**Planned:** v0.2
|
|
84
|
+
|
|
85
|
+
### N4. Side-channel attacks
|
|
86
|
+
**Missing:** Constant-time guarantees, memory-cleared secret handling, side-channel resistant primitives
|
|
87
|
+
**Impact:** An attacker with timing, cache, power, or EM measurement access may be able to recover keys
|
|
88
|
+
**Assumption:** Attackers with side-channel access have already compromised the endpoint
|
|
89
|
+
|
|
90
|
+
### N5. Compromised randomness
|
|
91
|
+
**Missing:** RNG verification, hardware RNG integration (QRNG)
|
|
92
|
+
**Impact:** If Node's `crypto.randomBytes()` returns predictable output (compromised RNG, buggy CPU, VM entropy starvation), all key generation and nonce generation is compromised
|
|
93
|
+
**Planned:** QRNG hook in v0.3
|
|
94
|
+
|
|
95
|
+
### N6. Malicious dependency updates
|
|
96
|
+
**Missing:** No lockfile verification, no reproducible builds, no dependency signing
|
|
97
|
+
**Impact:** A compromised `@noble/post-quantum` update could substitute broken cryptography without detection
|
|
98
|
+
**Mitigation:** We use `@noble/post-quantum` from Paul Miller's well-audited noble suite; the risk is low but not zero
|
|
99
|
+
**Planned:** SLSA/reproducible-build attestations in v0.3+
|
|
100
|
+
|
|
101
|
+
### N7. Endpoint compromise
|
|
102
|
+
**Missing:** Memory scrubbing after key use, TEE integration, hardware-backed key storage
|
|
103
|
+
**Impact:** An attacker with code execution on the endpoint can read all cryptographic material from process memory
|
|
104
|
+
**Assumption:** Endpoint security is out of scope for a cryptographic library
|
|
105
|
+
|
|
106
|
+
### N8. Regulated data handling
|
|
107
|
+
**Missing:** No FIPS 140-3 validation, no HIPAA-compliant audit trail, no PCI-DSS-approved deployment model
|
|
108
|
+
**Impact:** Cannot be used for regulated data storage or transmission
|
|
109
|
+
**Explicit non-goal for the beta series**
|
|
110
|
+
|
|
111
|
+
### N9. Formal audit
|
|
112
|
+
**Missing:** No external cryptographic audit by Trail of Bits, NCC Group, Cure53, or comparable
|
|
113
|
+
**Impact:** Any latent implementation bug is undiscovered
|
|
114
|
+
**By design for the beta series** — validation is via public use, forks, and responsible disclosure (see SECURITY.md)
|
|
115
|
+
|
|
116
|
+
---
|
|
117
|
+
|
|
118
|
+
## Assumptions about the runtime environment
|
|
119
|
+
|
|
120
|
+
- **Node.js ≥ 18** with functional `crypto` module (AES-256-GCM, HKDF, X25519 keygen, DER SPKI/PKCS8 encoding)
|
|
121
|
+
- **`@noble/post-quantum` ≥ 0.4.0** installed and unmodified
|
|
122
|
+
- **RNG** functioning correctly (`crypto.randomBytes()` returns cryptographically-random output)
|
|
123
|
+
- **Endpoint** not compromised
|
|
124
|
+
- **Filesystem** protects the `.priv` file with mode 600 (or equivalent)
|
|
125
|
+
- **Wire format** endpoints agree on `_version` field and reject unknown versions
|
|
126
|
+
|
|
127
|
+
---
|
|
128
|
+
|
|
129
|
+
## Supply chain
|
|
130
|
+
|
|
131
|
+
### Dependencies (v0.1.0-beta.0)
|
|
132
|
+
|
|
133
|
+
| Package | Version | Purpose | Risk |
|
|
134
|
+
|---|---|---|---|
|
|
135
|
+
| `@noble/post-quantum` | ^0.4.0 | ML-KEM-768 primitive | LOW — Paul Miller's audited noble suite |
|
|
136
|
+
| Node built-in `crypto` | ≥ 18 | X25519, AES-256-GCM, HKDF | LOW — audited by Node maintainers |
|
|
137
|
+
|
|
138
|
+
No native modules. No transitive deps beyond the standard toolchain. `npm audit` should report 0 vulnerabilities.
|
|
139
|
+
|
|
140
|
+
### Build reproducibility
|
|
141
|
+
|
|
142
|
+
- Deterministic TypeScript compilation from published source
|
|
143
|
+
- No preinstall/postinstall scripts
|
|
144
|
+
- No compiled binaries in the tarball
|
|
145
|
+
|
|
146
|
+
---
|
|
147
|
+
|
|
148
|
+
## Known unknowns
|
|
149
|
+
|
|
150
|
+
Documented so we don't pretend we've thought of everything:
|
|
151
|
+
|
|
152
|
+
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.
|
|
153
|
+
2. **X25519 side channels in Node** — Node's X25519 implementation relies on OpenSSL. Any side-channel vulnerability there propagates here.
|
|
154
|
+
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.
|
|
155
|
+
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.
|
|
156
|
+
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.
|
|
157
|
+
|
|
158
|
+
---
|
|
159
|
+
|
|
160
|
+
## Version history
|
|
161
|
+
|
|
162
|
+
- **v0.1.0-beta.0** — Initial public beta. PQ-hybrid KEM, AEAD, symmetric ratcheting. Aggressive experimental labeling. Threat model established.
|
|
163
|
+
|
|
164
|
+
---
|
|
165
|
+
|
|
166
|
+
## How to report vulnerabilities
|
|
167
|
+
|
|
168
|
+
See [SECURITY.md](SECURITY.md) for the responsible-disclosure process.
|
|
169
|
+
|
|
170
|
+
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/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"}
|