@weave_protocol/yoxallismus 0.2.0-beta.1 → 0.3.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 +42 -3
- package/THREAT_MODEL.md +13 -3
- package/WIRE_FORMAT.md +39 -0
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -1
- package/dist/index.js.map +1 -1
- package/dist/intent.d.ts +77 -0
- package/dist/intent.d.ts.map +1 -0
- package/dist/intent.js +161 -0
- package/dist/intent.js.map +1 -0
- package/dist/labels.d.ts +1 -1
- package/dist/labels.js +1 -1
- package/dist/sig.d.ts +80 -0
- package/dist/sig.d.ts.map +1 -0
- package/dist/sig.js +143 -0
- package/dist/sig.js.map +1 -0
- package/dist/wire.d.ts +12 -0
- package/dist/wire.d.ts.map +1 -1
- package/dist/wire.js +40 -0
- package/dist/wire.js.map +1 -1
- package/package.json +4 -3
package/README.md
CHANGED
|
@@ -106,6 +106,43 @@ Persist sessions with `serializeSession()` / `deserializeSession()`. Those envel
|
|
|
106
106
|
|
|
107
107
|
`PQCipher` (the v0.1 API) still works and still reads v0.1 data; use `seal()` / `open()` for new code.
|
|
108
108
|
|
|
109
|
+
**Post-quantum signatures (new in 0.3):**
|
|
110
|
+
|
|
111
|
+
```typescript
|
|
112
|
+
import { generateSigningKey, verifyKeyOf, sign, verify, serializeVerifyKey, serializeSignature } from '@weave_protocol/yoxallismus';
|
|
113
|
+
|
|
114
|
+
const agent = generateSigningKey(); // Ed25519 + ML-DSA-65
|
|
115
|
+
const record = new TextEncoder().encode('{"tool":"Read","decision":"deny"}');
|
|
116
|
+
|
|
117
|
+
// The context names what is signed: a signature made for one purpose never verifies for another
|
|
118
|
+
const sig = sign(agent, record, 'ward-receipt');
|
|
119
|
+
verify(verifyKeyOf(agent), record, sig, 'ward-receipt'); // true only if BOTH halves verify
|
|
120
|
+
|
|
121
|
+
// Share the public key and the signature as yoxall/2 envelopes
|
|
122
|
+
const pub = serializeVerifyKey(agent); // no secret inside
|
|
123
|
+
const wire = serializeSignature(sig, agent);
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
Keep `serializeSigningKey()` output secret: it holds both seeds.
|
|
127
|
+
|
|
128
|
+
**Intent capsules (new in 0.3): sign what an agent is allowed to do, so it can't drift from it:**
|
|
129
|
+
|
|
130
|
+
```typescript
|
|
131
|
+
import { generateSigningKey, verifyKeyOf, issueIntent, verifyIntent, serializeIntent } from '@weave_protocol/yoxallismus';
|
|
132
|
+
|
|
133
|
+
const you = generateSigningKey(); // keep this away from the agent
|
|
134
|
+
const capsule = issueIntent(you, {
|
|
135
|
+
goal: 'Summarise the Q4 report',
|
|
136
|
+
scope: { read: ['/repo/docs/**'], urls: ['https://docs.example.com/**'], capabilities: ['file_read', 'http_request'] },
|
|
137
|
+
ttlSeconds: 2 * 60 * 60,
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
verifyIntent(capsule, { trusted: [verifyKeyOf(you)] }); // { ok: true } until it expires; any edit makes it fail
|
|
141
|
+
const file = serializeIntent(capsule); // yoxall-intent JSON envelope
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
Ward enforces capsules on every tool call, in every harness it supports, from its next release.
|
|
145
|
+
|
|
109
146
|
## Quick start (CLI)
|
|
110
147
|
|
|
111
148
|
```bash
|
|
@@ -131,7 +168,7 @@ weave-yoxall audit-self
|
|
|
131
168
|
weave-yoxall benchmark
|
|
132
169
|
```
|
|
133
170
|
|
|
134
|
-
## What's inside (v0.
|
|
171
|
+
## What's inside (v0.3)
|
|
135
172
|
|
|
136
173
|
| Component | Primitive | Size / Cost |
|
|
137
174
|
|---|---|---|
|
|
@@ -142,6 +179,8 @@ weave-yoxall benchmark
|
|
|
142
179
|
| Cascade AEAD *(new)* | AES-256-GCM inside ChaCha20-Poly1305, independent keys | +44B |
|
|
143
180
|
| Sealed boxes *(new)* | Hybrid KEM → HKDF → AEAD or cascade | 1120B KEM ciphertext |
|
|
144
181
|
| Double Ratchet *(new)* | Signal Double Ratchet over X25519, seeded by the hybrid KEM | Forward secrecy + post-compromise security |
|
|
182
|
+
| Intent capsules *(new in 0.3)* | Goal + scope + expiry, signed with the hybrid signature by a key the agent never holds | ~4.6 KB JSON |
|
|
183
|
+
| Hybrid signatures *(new in 0.3)* | Ed25519 + ML-DSA-65 via `@noble/post-quantum` (NIST FIPS 204); both must verify | 1984B pub / 64B seeds / 3373B signature, ~2 ms to verify |
|
|
145
184
|
| Wire format | `yoxall/2` JSON envelopes, **locked through 1.0** | Base64url values |
|
|
146
185
|
| v1 detection *(new)* | Recognizes Hord `YoxallismusCipher` payloads (unrecoverable; YOXALL-2026-003) | — |
|
|
147
186
|
|
|
@@ -231,8 +270,8 @@ The full research scope is intentionally proprietary until Q1 2027 IP position i
|
|
|
231
270
|
|
|
232
271
|
- **v0.1.0-beta** (this release) — PQ-hybrid KEM + AEAD + symmetric ratchet + CLI + test suites + aggressive labels
|
|
233
272
|
- **v0.2.0-beta** — DH double-ratchet, cascade cipher (classical ⊕ PQ), v1 backward-compat shim, wire format stabilization
|
|
234
|
-
- **v0.3.0-beta** —
|
|
235
|
-
- **
|
|
273
|
+
- **v0.3.0-beta** — Post-quantum hybrid signatures (Ed25519 + ML-DSA-65) ✅ and signed **intent capsules** ✅: an agent's task and scope, signed so that drift from it can be detected and blocked
|
|
274
|
+
- **Later** — Threshold encryption (multi-agent m-of-n), verifiable delay functions, ZK state-transition proofs (experimental), QRNG integration hook, homomorphic bounded arithmetic (FHE)
|
|
236
275
|
- **v1.0** — Once the community has hammered on it enough that we're confident the primitives compose correctly. No time table.
|
|
237
276
|
|
|
238
277
|
## 🕸️ Part of Weave Protocol
|
package/THREAT_MODEL.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Threat Model — @weave_protocol/yoxallismus v0.
|
|
1
|
+
# Threat Model — @weave_protocol/yoxallismus v0.3.0-beta.0
|
|
2
2
|
|
|
3
3
|
**Status:** EXPERIMENTAL. NOT AUDITED. Beta software.
|
|
4
4
|
|
|
@@ -78,6 +78,16 @@ We assume the following adversary capabilities:
|
|
|
78
78
|
**Primitive:** Cascade mode, with AES-256-GCM inside ChaCha20-Poly1305 under independent HKDF-derived keys
|
|
79
79
|
**Guarantee:** Confidentiality holds if either AES-256 or ChaCha20 holds.
|
|
80
80
|
|
|
81
|
+
### C13. Post-quantum signatures (new in v0.3)
|
|
82
|
+
**Primitive:** Ed25519 + ML-DSA-65 (NIST FIPS 204); both halves must verify
|
|
83
|
+
**Guarantee:** A signature can't be forged unless both Ed25519 and ML-DSA-65 are broken, so signatures made today stay trustworthy after large quantum computers arrive ("harvest now, forge later"). Each half signs a domain-separated encoding that binds the purpose (context) and the whole hybrid public key. A signature made for one purpose doesn't verify for another, a half can't be moved to another key pair, and neither half is a valid plain Ed25519 or ML-DSA signature on its own.
|
|
84
|
+
**Limits:** It proves who signed, not that the signer was honest. There is no key revocation or rotation: decide at a higher layer which keys you trust.
|
|
85
|
+
|
|
86
|
+
### C14. Intent tampering and drift (new in v0.3)
|
|
87
|
+
**Primitive:** Intent capsules: the task's goal and scope, signed with C13 under context `intent-capsule` by a key the agent never holds
|
|
88
|
+
**Guarantee:** An agent, or a prompt injection steering it, can't widen, extend or rewrite its own intent: any change to the goal, scope, expiry or target agent breaks the signature, and a capsule from an untrusted key is refused even when its signature is valid. A policy engine that checks every tool call against a verified capsule (Ward does) can detect and block drift.
|
|
89
|
+
**Limits:** The capsule says what is allowed, not that the agent's work matches the goal: a call inside the scope can still do the wrong thing. It can only be as narrow as the scope you write. Anyone who can delete the capsule file can stop it applying, so a policy that requires one must fail closed when it is missing, as Ward's does.
|
|
90
|
+
|
|
81
91
|
|
|
82
92
|
---
|
|
83
93
|
|
|
@@ -95,8 +105,8 @@ We assume the following adversary capabilities:
|
|
|
95
105
|
|
|
96
106
|
### N3. Sender authentication
|
|
97
107
|
**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.
|
|
99
|
-
**
|
|
108
|
+
**Impact:** Sealed boxes and ratchet sessions are **sender-anonymous**: the recipient learns that someone who knew its public key sent the message, not who.
|
|
109
|
+
**Partly addressed in v0.3:** hybrid signatures (C13) let a sender sign what they seal, but sealed boxes and ratchet messages are not signed automatically yet. Sign the plaintext with `sign()`, or authenticate peers at a higher layer (for example Domere handoff tokens).
|
|
100
110
|
|
|
101
111
|
### N4. Side-channel attacks
|
|
102
112
|
**Missing:** Constant-time guarantees, memory-cleared secret handling, side-channel resistant primitives
|
package/WIRE_FORMAT.md
CHANGED
|
@@ -93,6 +93,45 @@ ciphertext AES-256-GCM(key, nonce, pt, aad = ad ‖ header ‖ caller_aad)
|
|
|
93
93
|
|
|
94
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
95
|
|
|
96
|
+
## Hybrid signatures (added in 0.3.0-beta.0)
|
|
97
|
+
|
|
98
|
+
New envelope types: nothing above changes. Algorithm `ed25519+ml-dsa-65` (Ed25519, RFC 8032; ML-DSA-65, NIST FIPS 204). A signature is valid only if **both** halves verify.
|
|
99
|
+
|
|
100
|
+
**Bytes each half signs:**
|
|
101
|
+
|
|
102
|
+
```
|
|
103
|
+
m' = "weave-yoxall/2 hybrid-sig" ‖ 0x00 ‖ len(ctx) ‖ ctx ‖ SHA-256(pk) ‖ message
|
|
104
|
+
pk = ed25519_pub (32B) ‖ mldsa65_pub (1952B)
|
|
105
|
+
ctx = 1–255 bytes of UTF-8 naming the purpose, e.g. "ward-receipt"
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
Ed25519 signs `m'`. ML-DSA-65 signs `m'` with FIPS 204 context `"weave-yoxall/2"`, hedged (fresh randomness). Neither half is a valid plain signature over `message`.
|
|
109
|
+
|
|
110
|
+
| `_type` | Fields | Secret? |
|
|
111
|
+
|---|---|---|
|
|
112
|
+
| `yoxall-sig-pub` | `alg`, `keyId`, `ed25519` (32B), `mldsa` (1952B) | No |
|
|
113
|
+
| `yoxall-sig-secret` | `alg`, `keyId`, `ed25519Seed` (32B), `mldsaSeed` (32B) | **Yes** |
|
|
114
|
+
| `yoxall-sig` | `alg`, `ctx`, `keyId`, `ed25519` (64B), `mldsa` (3309B) | No |
|
|
115
|
+
|
|
116
|
+
`keyId` is the first 16 hex characters of SHA-256(`pk`). In a signature it only says which key to look up: `verify()` with the right key is the check. Readers refuse a `keyId` that doesn't match the key it sits beside. Known-answer vectors: `test/vectors/yoxall-2-sig.json`.
|
|
117
|
+
|
|
118
|
+
## Intent capsule: `yoxall-intent` (added in 0.3.0-beta.0)
|
|
119
|
+
|
|
120
|
+
A signed record of what an agent was asked to do, issued with a key the agent never holds. Pretty-printed JSON:
|
|
121
|
+
|
|
122
|
+
| Field | Meaning |
|
|
123
|
+
|---|---|
|
|
124
|
+
| `_type`, `_version` | `"yoxall-intent"`, `"yoxall/2"` |
|
|
125
|
+
| `id` | 32 hex characters, random |
|
|
126
|
+
| `goal` | 1–2000 characters, the task in plain words |
|
|
127
|
+
| `scope` | Object with any of `capabilities`, `read`, `write`, `list`, `urls`: lists of at most 64 strings, each 1–1024 characters, without control characters or quotes. Unknown fields are refused. |
|
|
128
|
+
| `issuedAt`, `expiresAt` | ISO 8601 times, expiry after issue |
|
|
129
|
+
| `agent` | Optional: the agent the capsule is for |
|
|
130
|
+
| `issuer` | The issuer's `yoxall-sig-pub` envelope |
|
|
131
|
+
| `sig` | `{ ctx: "intent-capsule", ed25519, mldsa }`: a hybrid signature over the canonical JSON (keys sorted, no whitespace) of every field except `sig` |
|
|
132
|
+
|
|
133
|
+
A capsule is accepted only if it is well-formed, its issuer key matches a trusted key **byte for byte**, its signature verifies under context `intent-capsule`, and the current time is between `issuedAt` (minus 5 minutes of clock skew) and `expiresAt`. Whether a tool call is inside `scope` is for the policy engine to decide.
|
|
134
|
+
|
|
96
135
|
## Legacy formats
|
|
97
136
|
|
|
98
137
|
| Format | Status |
|
package/dist/index.d.ts
CHANGED
|
@@ -13,9 +13,11 @@ export { hkdf, deriveAeadKey, deriveNonce, HKDF_HASH, } from './kdf.js';
|
|
|
13
13
|
export { initRatchet, ratchetEncrypt, ratchetDecrypt, } from './ratchet.js';
|
|
14
14
|
export { serializePublicKey, deserializePublicKey, serializeKeypair, deserializeKeypair, serializeCiphertext, deserializeCiphertext, serializePayload, deserializePayload, } from './serialize.js';
|
|
15
15
|
export { seal, open, type SealedMessage, type SealMode, type SealOptions } from './sealed.js';
|
|
16
|
+
export { generateSigningKey, signingKeyFromSeeds, verifyKeyOf, verifyKeyBytes, keyIdOf, sign, verify, SIG_ALG, type HybridSigningKey, type HybridVerifyKey, type HybridSignature, } from './sig.js';
|
|
17
|
+
export { issueIntent, verifyIntent, serializeIntent, deserializeIntent, INTENT_CONTEXT, type IntentCapsule, type IntentScope, type IntentCheck, type IssueOptions, } from './intent.js';
|
|
16
18
|
export { cascadeEncrypt, cascadeDecrypt, CASCADE_OVERHEAD, type CascadePayload } from './cascade.js';
|
|
17
19
|
export { initiateSession, acceptSession, ratchetEncrypt as drEncrypt, ratchetDecrypt as drDecrypt, encodeHeader, MAX_SKIP, MAX_SKIPPED_TOTAL, type DoubleRatchetSession, type RatchetMessage, type RatchetHeader, } from './double-ratchet.js';
|
|
18
|
-
export { WIRE_VERSION_2, serializeSealed, deserializeSealed, serializeRatchetMessage, deserializeRatchetMessage, serializeSession, deserializeSession, } from './wire.js';
|
|
20
|
+
export { WIRE_VERSION_2, serializeSealed, deserializeSealed, serializeRatchetMessage, deserializeRatchetMessage, serializeSession, deserializeSession, serializeVerifyKey, deserializeVerifyKey, serializeSigningKey, deserializeSigningKey, serializeSignature, deserializeSignature, } from './wire.js';
|
|
19
21
|
export type { CombinerVersion } from './kem.js';
|
|
20
22
|
export { readV1, inspectV1, V1PayloadUnrecoverableError, type V1HeaderInfo } from './v1-compat.js';
|
|
21
23
|
export type { HybridKeypair, HybridPublicKey, EncapsulationResult, HybridCiphertext, EncryptedPayload, RatchetSession, } from './types.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAUH,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAGrC,OAAO,EACL,qBAAqB,EACrB,WAAW,EACX,WAAW,EACX,WAAW,GACZ,MAAM,UAAU,CAAC;AAGlB,OAAO,EACL,WAAW,EACX,WAAW,EACX,oBAAoB,EACpB,OAAO,EACP,SAAS,EACT,OAAO,GACR,MAAM,WAAW,CAAC;AAGnB,OAAO,EACL,IAAI,EACJ,aAAa,EACb,WAAW,EACX,SAAS,GACV,MAAM,UAAU,CAAC;AAGlB,OAAO,EACL,WAAW,EACX,cAAc,EACd,cAAc,GACf,MAAM,cAAc,CAAC;AAGtB,OAAO,EACL,kBAAkB,EAClB,oBAAoB,EACpB,gBAAgB,EAChB,kBAAkB,EAClB,mBAAmB,EACnB,qBAAqB,EACrB,gBAAgB,EAChB,kBAAkB,GACnB,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,aAAa,EAAE,KAAK,QAAQ,EAAE,KAAK,WAAW,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAUH,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAGrC,OAAO,EACL,qBAAqB,EACrB,WAAW,EACX,WAAW,EACX,WAAW,GACZ,MAAM,UAAU,CAAC;AAGlB,OAAO,EAC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kB,4BAAsB;IAC/C,MAAM,CAAC,kBAAkB,4BAAsB;IAC/C,MAAM,CAAC,oBAAoB,8BAAwB;IACnD,MAAM,CAAC,gBAAgB,0BAAoB;IAC3C,MAAM,CAAC,kBAAkB,4BAAsB;IAC/C,MAAM,CAAC,mBAAmB,6BAAuB;IACjD,MAAM,CAAC,qBAAqB,+BAAyB;CACtD"}
|
package/dist/index.js
CHANGED
|
@@ -24,9 +24,13 @@ export { initRatchet, ratchetEncrypt, ratchetDecrypt, } from './ratchet.js';
|
|
|
24
24
|
export { serializePublicKey, deserializePublicKey, serializeKeypair, deserializeKeypair, serializeCiphertext, deserializeCiphertext, serializePayload, deserializePayload, } from './serialize.js';
|
|
25
25
|
// v0.2: sealed boxes, cascade AEAD, double ratchet, locked yoxall/2 wire format
|
|
26
26
|
export { seal, open } from './sealed.js';
|
|
27
|
+
// v0.3: PQ-hybrid signatures (Ed25519 + ML-DSA-65)
|
|
28
|
+
export { generateSigningKey, signingKeyFromSeeds, verifyKeyOf, verifyKeyBytes, keyIdOf, sign, verify, SIG_ALG, } from './sig.js';
|
|
29
|
+
// v0.3: intent capsules (signed task scope, for detecting and blocking drift)
|
|
30
|
+
export { issueIntent, verifyIntent, serializeIntent, deserializeIntent, INTENT_CONTEXT, } from './intent.js';
|
|
27
31
|
export { cascadeEncrypt, cascadeDecrypt, CASCADE_OVERHEAD } from './cascade.js';
|
|
28
32
|
export { initiateSession, acceptSession, ratchetEncrypt as drEncrypt, ratchetDecrypt as drDecrypt, encodeHeader, MAX_SKIP, MAX_SKIPPED_TOTAL, } from './double-ratchet.js';
|
|
29
|
-
export { WIRE_VERSION_2, serializeSealed, deserializeSealed, serializeRatchetMessage, deserializeRatchetMessage, serializeSession, deserializeSession, } from './wire.js';
|
|
33
|
+
export { WIRE_VERSION_2, serializeSealed, deserializeSealed, serializeRatchetMessage, deserializeRatchetMessage, serializeSession, deserializeSession, serializeVerifyKey, deserializeVerifyKey, serializeSigningKey, deserializeSigningKey, serializeSignature, deserializeSignature, } from './wire.js';
|
|
30
34
|
// v1 (Hord YoxallismusCipher): detection only, v1 payloads are unrecoverable
|
|
31
35
|
export { readV1, inspectV1, V1PayloadUnrecoverableError } from './v1-compat.js';
|
|
32
36
|
// ─── High-level facade ──────────────────────────────────────────
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,cAAc,EAAU,MAAM,aAAa,CAAC;AAErD,yEAAyE;AACzE,cAAc,EAAE,CAAC;AAEjB,mEAAmE;AAEnE,2BAA2B;AAC3B,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,MAAM;AACN,OAAO,EACL,qBAAqB,EACrB,WAAW,EACX,WAAW,EACX,WAAW,GACZ,MAAM,UAAU,CAAC;AAElB,OAAO;AACP,OAAO,EACL,WAAW,EACX,WAAW,EACX,oBAAoB,EACpB,OAAO,EACP,SAAS,EACT,OAAO,GACR,MAAM,WAAW,CAAC;AAEnB,MAAM;AACN,OAAO,EACL,IAAI,EACJ,aAAa,EACb,WAAW,EACX,SAAS,GACV,MAAM,UAAU,CAAC;AAElB,mFAAmF;AACnF,OAAO,EACL,WAAW,EACX,cAAc,EACd,cAAc,GACf,MAAM,cAAc,CAAC;AAEtB,gBAAgB;AAChB,OAAO,EACL,kBAAkB,EAClB,oBAAoB,EACpB,gBAAgB,EAChB,kBAAkB,EAClB,mBAAmB,EACnB,qBAAqB,EACrB,gBAAgB,EAChB,kBAAkB,GACnB,MAAM,gBAAgB,CAAC;AAExB,gFAAgF;AAChF,OAAO,EAAE,IAAI,EAAE,IAAI,EAAuD,MAAM,aAAa,CAAC;AAC9F,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,gBAAgB,EAAuB,MAAM,cAAc,CAAC;AACrG,OAAO,EACL,eAAe,EACf,aAAa,EACb,cAAc,IAAI,SAAS,EAC3B,cAAc,IAAI,SAAS,EAC3B,YAAY,EACZ,QAAQ,EACR,iBAAiB,GAIlB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,cAAc,EACd,eAAe,EACf,iBAAiB,EACjB,uBAAuB,EACvB,yBAAyB,EACzB,gBAAgB,EAChB,kBAAkB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,cAAc,EAAU,MAAM,aAAa,CAAC;AAErD,yEAAyE;AACzE,cAAc,EAAE,CAAC;AAEjB,mEAAmE;AAEnE,2BAA2B;AAC3B,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,MAAM;AACN,OAAO,EACL,qBAAqB,EACrB,WAAW,EACX,WAAW,EACX,WAAW,GACZ,MAAM,UAAU,CAAC;AAElB,OAAO;AACP,OAAO,EACL,WAAW,EACX,WAAW,EACX,oBAAoB,EACpB,OAAO,EACP,SAAS,EACT,OAAO,GACR,MAAM,WAAW,CAAC;AAEnB,MAAM;AACN,OAAO,EACL,IAAI,EACJ,aAAa,EACb,WAAW,EACX,SAAS,GACV,MAAM,UAAU,CAAC;AAElB,mFAAmF;AACnF,OAAO,EACL,WAAW,EACX,cAAc,EACd,cAAc,GACf,MAAM,cAAc,CAAC;AAEtB,gBAAgB;AAChB,OAAO,EACL,kBAAkB,EAClB,oBAAoB,EACpB,gBAAgB,EAChB,kBAAkB,EAClB,mBAAmB,EACnB,qBAAqB,EACrB,gBAAgB,EAChB,kBAAkB,GACnB,MAAM,gBAAgB,CAAC;AAExB,gFAAgF;AAChF,OAAO,EAAE,IAAI,EAAE,IAAI,EAAuD,MAAM,aAAa,CAAC;AAC9F,mDAAmD;AACnD,OAAO,EACL,kBAAkB,EAClB,mBAAmB,EACnB,WAAW,EACX,cAAc,EACd,OAAO,EACP,IAAI,EACJ,MAAM,EACN,OAAO,GAIR,MAAM,UAAU,CAAC;AAClB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
*
|
|
4
|
+
* The person (or orchestrator) who starts a task issues a capsule with a key
|
|
5
|
+
* the agent never holds. It says the goal in plain words and the scope in a
|
|
6
|
+
* form a policy engine can check against every tool call: capabilities,
|
|
7
|
+
* file paths, URLs, an expiry, and optionally which agent it is for. It is
|
|
8
|
+
* signed with the hybrid Ed25519 + ML-DSA-65 signature (context
|
|
9
|
+
* "intent-capsule"), so the agent, or a prompt injection steering it, can't
|
|
10
|
+
* widen or rewrite its own intent: any edit breaks the signature.
|
|
11
|
+
*
|
|
12
|
+
* This module defines the capsule and checks that it is authentic, trusted
|
|
13
|
+
* and current. Deciding whether a tool call is inside the scope is the
|
|
14
|
+
* policy engine's job (Ward does it with its own path and URL rules).
|
|
15
|
+
*
|
|
16
|
+
* SIGNED BYTES
|
|
17
|
+
* The canonical JSON (keys sorted, no whitespace) of every field except
|
|
18
|
+
* `sig`, i.e. _type, _version, id, goal, scope, issuedAt, expiresAt,
|
|
19
|
+
* agent (if set) and issuer.
|
|
20
|
+
*/
|
|
21
|
+
import { type HybridSigningKey, type HybridVerifyKey, type HybridSignature } from './sig.js';
|
|
22
|
+
export declare const INTENT_CONTEXT = "intent-capsule";
|
|
23
|
+
export declare const INTENT_TYPE = "yoxall-intent";
|
|
24
|
+
export interface IntentScope {
|
|
25
|
+
/** Capabilities the agent may use (Ward capability names, e.g. "file_read", "shell_exec"). Omitted: any. */
|
|
26
|
+
capabilities?: string[];
|
|
27
|
+
/** Path globs the agent may read. */
|
|
28
|
+
read?: string[];
|
|
29
|
+
/** Path globs the agent may write. */
|
|
30
|
+
write?: string[];
|
|
31
|
+
/** Path globs the agent may list. */
|
|
32
|
+
list?: string[];
|
|
33
|
+
/** URL globs the agent may reach. */
|
|
34
|
+
urls?: string[];
|
|
35
|
+
}
|
|
36
|
+
export interface IntentCapsule {
|
|
37
|
+
id: string;
|
|
38
|
+
goal: string;
|
|
39
|
+
scope: IntentScope;
|
|
40
|
+
issuedAt: string;
|
|
41
|
+
expiresAt: string;
|
|
42
|
+
/** If set, the capsule is only for this agent (WARD.md's `agent`). */
|
|
43
|
+
agent?: string;
|
|
44
|
+
issuer: HybridVerifyKey;
|
|
45
|
+
sig: HybridSignature;
|
|
46
|
+
}
|
|
47
|
+
export interface IssueOptions {
|
|
48
|
+
goal: string;
|
|
49
|
+
scope: IntentScope;
|
|
50
|
+
/** Lifetime in seconds; or give expiresAt. */
|
|
51
|
+
ttlSeconds?: number;
|
|
52
|
+
expiresAt?: Date;
|
|
53
|
+
agent?: string;
|
|
54
|
+
/** For tests: the issue time. */
|
|
55
|
+
now?: Date;
|
|
56
|
+
}
|
|
57
|
+
export type IntentCheck = {
|
|
58
|
+
ok: true;
|
|
59
|
+
capsule: IntentCapsule;
|
|
60
|
+
} | {
|
|
61
|
+
ok: false;
|
|
62
|
+
reason: string;
|
|
63
|
+
};
|
|
64
|
+
/** Issue and sign a capsule. The signing key is the issuer's; never give it to the agent. */
|
|
65
|
+
export declare function issueIntent(key: HybridSigningKey, opts: IssueOptions): IntentCapsule;
|
|
66
|
+
/**
|
|
67
|
+
* Is this capsule authentic, from a trusted issuer, and current? The issuer
|
|
68
|
+
* key must match one of `trusted` byte for byte. Never throws.
|
|
69
|
+
*/
|
|
70
|
+
export declare function verifyIntent(c: IntentCapsule, opts: {
|
|
71
|
+
trusted: HybridVerifyKey[];
|
|
72
|
+
now?: Date;
|
|
73
|
+
}): IntentCheck;
|
|
74
|
+
/** `yoxall-intent` envelope: the signed body plus `sig`. */
|
|
75
|
+
export declare function serializeIntent(c: IntentCapsule): string;
|
|
76
|
+
export declare function deserializeIntent(s: string): IntentCapsule;
|
|
77
|
+
//# sourceMappingURL=intent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"intent.d.ts","sourceRoot":"","sources":["../src/intent.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAGH,OAAO,EAAsD,KAAK,gBAAgB,EAAE,KAAK,eAAe,EAAE,KAAK,e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,YAAY,GAAG,aAAa,CAiBpF;AAID;;;GAGG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAAE,aAAa,EAAE,IAAI,EAAE;IAAE,OAAO,EAAE,eAAe,EAAE,CAAC;IAAC,GAAG,CAAC,EAAE,IAAI,CAAA;CAAE,GAAG,WAAW,CAa5G;AAMD,4DAA4D;AAC5D,wBAAgB,eAAe,CAAC,CAAC,EAAE,aAAa,GAAG,MAAM,CAExD;AAED,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,MAAM,GAAG,aAAa,CAY1D"}
|
package/dist/intent.js
ADDED
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Intent capsules: a signed record of what an agent was asked to do.
|
|
3
|
+
*
|
|
4
|
+
* The person (or orchestrator) who starts a task issues a capsule with a key
|
|
5
|
+
* the agent never holds. It says the goal in plain words and the scope in a
|
|
6
|
+
* form a policy engine can check against every tool call: capabilities,
|
|
7
|
+
* file paths, URLs, an expiry, and optionally which agent it is for. It is
|
|
8
|
+
* signed with the hybrid Ed25519 + ML-DSA-65 signature (context
|
|
9
|
+
* "intent-capsule"), so the agent, or a prompt injection steering it, can't
|
|
10
|
+
* widen or rewrite its own intent: any edit breaks the signature.
|
|
11
|
+
*
|
|
12
|
+
* This module defines the capsule and checks that it is authentic, trusted
|
|
13
|
+
* and current. Deciding whether a tool call is inside the scope is the
|
|
14
|
+
* policy engine's job (Ward does it with its own path and URL rules).
|
|
15
|
+
*
|
|
16
|
+
* SIGNED BYTES
|
|
17
|
+
* The canonical JSON (keys sorted, no whitespace) of every field except
|
|
18
|
+
* `sig`, i.e. _type, _version, id, goal, scope, issuedAt, expiresAt,
|
|
19
|
+
* agent (if set) and issuer.
|
|
20
|
+
*/
|
|
21
|
+
import { randomBytes } from 'node:crypto';
|
|
22
|
+
import { sign, verify, verifyKeyOf, keyIdOf, verifyKeyBytes } from './sig.js';
|
|
23
|
+
import { serializeVerifyKey, deserializeVerifyKey, WIRE_VERSION_2 } from './wire.js';
|
|
24
|
+
export const INTENT_CONTEXT = 'intent-capsule';
|
|
25
|
+
export const INTENT_TYPE = 'yoxall-intent';
|
|
26
|
+
const MAX_GOAL = 2000;
|
|
27
|
+
const MAX_ENTRIES = 64;
|
|
28
|
+
const MAX_ENTRY = 1024;
|
|
29
|
+
/** Clock skew tolerated on issuedAt */
|
|
30
|
+
const SKEW_MS = 5 * 60 * 1000;
|
|
31
|
+
// ─── Canonical JSON ─────────────────────────────────────────────
|
|
32
|
+
function canonical(v) {
|
|
33
|
+
if (Array.isArray(v))
|
|
34
|
+
return `[${v.map(canonical).join(',')}]`;
|
|
35
|
+
if (v && typeof v === 'object') {
|
|
36
|
+
const o = v;
|
|
37
|
+
return `{${Object.keys(o).filter((k) => o[k] !== undefined).sort().map((k) => `${JSON.stringify(k)}:${canonical(o[k])}`).join(',')}}`;
|
|
38
|
+
}
|
|
39
|
+
return JSON.stringify(v);
|
|
40
|
+
}
|
|
41
|
+
function body(c) {
|
|
42
|
+
return {
|
|
43
|
+
_type: INTENT_TYPE,
|
|
44
|
+
_version: WIRE_VERSION_2,
|
|
45
|
+
id: c.id,
|
|
46
|
+
goal: c.goal,
|
|
47
|
+
scope: normalizeScope(c.scope),
|
|
48
|
+
issuedAt: c.issuedAt,
|
|
49
|
+
expiresAt: c.expiresAt,
|
|
50
|
+
agent: c.agent,
|
|
51
|
+
issuer: JSON.parse(serializeVerifyKey(c.issuer)),
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
const signedBytes = (c) => new TextEncoder().encode(canonical(body(c)));
|
|
55
|
+
// ─── Validation ─────────────────────────────────────────────────
|
|
56
|
+
const SCOPE_KEYS = ['capabilities', 'read', 'write', 'list', 'urls'];
|
|
57
|
+
function normalizeScope(scope) {
|
|
58
|
+
const out = {};
|
|
59
|
+
for (const k of SCOPE_KEYS)
|
|
60
|
+
if (scope[k] !== undefined)
|
|
61
|
+
out[k] = [...scope[k]];
|
|
62
|
+
return out;
|
|
63
|
+
}
|
|
64
|
+
function validate(c) {
|
|
65
|
+
if (typeof c.id !== 'string' || !/^[0-9a-f]{32}$/.test(c.id))
|
|
66
|
+
throw new Error('intent: id must be 32 hex characters');
|
|
67
|
+
if (typeof c.goal !== 'string' || !c.goal.trim() || c.goal.length > MAX_GOAL)
|
|
68
|
+
throw new Error(`intent: goal must be 1–${MAX_GOAL} characters`);
|
|
69
|
+
if (!c.scope || typeof c.scope !== 'object' || Array.isArray(c.scope))
|
|
70
|
+
throw new Error('intent: scope must be an object');
|
|
71
|
+
for (const k of Object.keys(c.scope))
|
|
72
|
+
if (!SCOPE_KEYS.includes(k))
|
|
73
|
+
throw new Error(`intent: unknown scope field "${k}"`);
|
|
74
|
+
for (const k of SCOPE_KEYS) {
|
|
75
|
+
const v = c.scope[k];
|
|
76
|
+
if (v === undefined)
|
|
77
|
+
continue;
|
|
78
|
+
if (!Array.isArray(v) || v.length > MAX_ENTRIES)
|
|
79
|
+
throw new Error(`intent: scope.${k} must be a list of at most ${MAX_ENTRIES} entries`);
|
|
80
|
+
for (const e of v) {
|
|
81
|
+
// Entries become policy rules: no control characters or quotes that could change their meaning
|
|
82
|
+
if (typeof e !== 'string' || !e || e.length > MAX_ENTRY || /[\u0000-\u001f\u007f"'`]/.test(e))
|
|
83
|
+
throw new Error(`intent: invalid scope.${k} entry`);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
const issued = Date.parse(c.issuedAt), expires = Date.parse(c.expiresAt);
|
|
87
|
+
if (!Number.isFinite(issued) || !Number.isFinite(expires) || expires <= issued)
|
|
88
|
+
throw new Error('intent: issuedAt and expiresAt must be ISO times, expiry after issue');
|
|
89
|
+
if (c.agent !== undefined && (typeof c.agent !== 'string' || !c.agent || c.agent.length > 200))
|
|
90
|
+
throw new Error('intent: invalid agent');
|
|
91
|
+
}
|
|
92
|
+
// ─── Issue / verify ─────────────────────────────────────────────
|
|
93
|
+
/** Issue and sign a capsule. The signing key is the issuer's; never give it to the agent. */
|
|
94
|
+
export function issueIntent(key, opts) {
|
|
95
|
+
const now = opts.now ?? new Date();
|
|
96
|
+
const expires = opts.expiresAt ?? (opts.ttlSeconds !== undefined ? new Date(now.getTime() + opts.ttlSeconds * 1000) : undefined);
|
|
97
|
+
if (!expires)
|
|
98
|
+
throw new Error('intent: give ttlSeconds or expiresAt');
|
|
99
|
+
// Refuse unknown scope fields rather than dropping them: whoever wrote one meant to limit something
|
|
100
|
+
for (const k of Object.keys(opts.scope ?? {}))
|
|
101
|
+
if (!SCOPE_KEYS.includes(k))
|
|
102
|
+
throw new Error(`intent: unknown scope field "${k}"`);
|
|
103
|
+
const unsigned = {
|
|
104
|
+
id: randomBytes(16).toString('hex'),
|
|
105
|
+
goal: opts.goal,
|
|
106
|
+
scope: normalizeScope(opts.scope),
|
|
107
|
+
issuedAt: now.toISOString(),
|
|
108
|
+
expiresAt: expires.toISOString(),
|
|
109
|
+
...(opts.agent !== undefined ? { agent: opts.agent } : {}),
|
|
110
|
+
issuer: verifyKeyOf(key),
|
|
111
|
+
};
|
|
112
|
+
validate(unsigned);
|
|
113
|
+
return { ...unsigned, sig: sign(key, signedBytes(unsigned), INTENT_CONTEXT) };
|
|
114
|
+
}
|
|
115
|
+
const sameKey = (a, b) => Buffer.from(verifyKeyBytes(a)).equals(Buffer.from(verifyKeyBytes(b)));
|
|
116
|
+
/**
|
|
117
|
+
* Is this capsule authentic, from a trusted issuer, and current? The issuer
|
|
118
|
+
* key must match one of `trusted` byte for byte. Never throws.
|
|
119
|
+
*/
|
|
120
|
+
export function verifyIntent(c, opts) {
|
|
121
|
+
try {
|
|
122
|
+
const { sig, ...unsigned } = c;
|
|
123
|
+
validate(unsigned);
|
|
124
|
+
if (!opts.trusted.some((k) => sameKey(k, c.issuer)))
|
|
125
|
+
return { ok: false, reason: `intent capsule ${c.id} was issued by key ${keyIdOf(c.issuer)}, which is not trusted` };
|
|
126
|
+
if (!verify(c.issuer, signedBytes(unsigned), sig, INTENT_CONTEXT))
|
|
127
|
+
return { ok: false, reason: `intent capsule ${c.id} has an invalid signature: it was changed after it was issued` };
|
|
128
|
+
const now = (opts.now ?? new Date()).getTime();
|
|
129
|
+
if (now < Date.parse(c.issuedAt) - SKEW_MS)
|
|
130
|
+
return { ok: false, reason: `intent capsule ${c.id} is not valid until ${c.issuedAt}` };
|
|
131
|
+
if (now >= Date.parse(c.expiresAt))
|
|
132
|
+
return { ok: false, reason: `intent capsule ${c.id} expired at ${c.expiresAt}` };
|
|
133
|
+
return { ok: true, capsule: c };
|
|
134
|
+
}
|
|
135
|
+
catch (err) {
|
|
136
|
+
return { ok: false, reason: `intent capsule is malformed: ${err instanceof Error ? err.message : String(err)}` };
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
// ─── Wire ───────────────────────────────────────────────────────
|
|
140
|
+
const b64 = (u) => Buffer.from(u).toString('base64url');
|
|
141
|
+
/** `yoxall-intent` envelope: the signed body plus `sig`. */
|
|
142
|
+
export function serializeIntent(c) {
|
|
143
|
+
return JSON.stringify({ ...body(c), sig: { ctx: c.sig.context, ed25519: b64(c.sig.ed25519), mldsa: b64(c.sig.mldsa) } }, null, 2);
|
|
144
|
+
}
|
|
145
|
+
export function deserializeIntent(s) {
|
|
146
|
+
const j = JSON.parse(s);
|
|
147
|
+
if (j?._type !== INTENT_TYPE)
|
|
148
|
+
throw new Error(`yoxall/2: expected ${INTENT_TYPE}, got ${j?._type}`);
|
|
149
|
+
if (j._version !== WIRE_VERSION_2)
|
|
150
|
+
throw new Error(`yoxall/2: unsupported version ${j._version}`);
|
|
151
|
+
const sig = j.sig;
|
|
152
|
+
if (!sig || typeof sig.ctx !== 'string' || typeof sig.ed25519 !== 'string' || typeof sig.mldsa !== 'string')
|
|
153
|
+
throw new Error('yoxall/2: missing signature');
|
|
154
|
+
return {
|
|
155
|
+
id: j.id, goal: j.goal, scope: j.scope, issuedAt: j.issuedAt, expiresAt: j.expiresAt,
|
|
156
|
+
...(j.agent !== undefined ? { agent: j.agent } : {}),
|
|
157
|
+
issuer: deserializeVerifyKey(JSON.stringify(j.issuer)),
|
|
158
|
+
sig: { context: sig.ctx, ed25519: new Uint8Array(Buffer.from(sig.ed25519, 'base64url')), mldsa: new Uint8Array(Buffer.from(sig.mldsa, 'base64url')) },
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
//# sourceMappingURL=intent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"intent.js","sourceRoot":"","sources":["../src/intent.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,cAAc,EAAqE,MAAM,UAAU,CAAC;AACjJ,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAErF,MAAM,CAAC,MAAM,cAAc,GAAG,gBAAgB,CAAC;AAC/C,MAAM,CAAC,MAAM,WAAW,GAAG,eAAe,CAAC;AAC3C,MAAM,QAAQ,GAAG,IAAI,CAAC;AACtB,MAAM,WAAW,GAAG,EAAE,CAAC;AACvB,MAAM,SAAS,GAAG,IAAI,CAAC;AACvB,uCAAuC;AACvC,MAAM,OAAO,GAAG,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC;AAwC9B,mEAAmE;AAEnE,SAAS,SAAS,CAAC,CAAU;IAC3B,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;QAAE,OAAO,IAAI,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;IAC/D,IAAI,CAAC,IAAI,OAAO,CAAC,KAAK,QAAQ,EAAE,CAAC;QAC/B,MAAM,CAAC,GAAG,CAA4B,CAAC;QACvC,OAAO,IAAI,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,C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K,KAAK,QAAQ;QAAE,MAAM,IAAI,KAAK,CAAC,6BAA6B,CAAC,CAAC;IAC5J,OAAO;QACL,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC,KAAK,EAAE,QAAQ,EAAE,CAAC,CAAC,QAAQ,EAAE,SAAS,EAAE,CAAC,CAAC,SAAS;QACpF,GAAG,CAAC,CAAC,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACpD,MAAM,EAAE,oBAAoB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;QACtD,GAAG,EAAE,EAAE,OAAO,EAAE,GAAG,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC,EAAE;KACtJ,CAAC;AACJ,CAAC"}
|
package/dist/labels.d.ts
CHANGED
|
@@ -32,7 +32,7 @@ export declare function showBetaBanner(): void;
|
|
|
32
32
|
* Consumed by CLI, by import-time banner, and by test harness.
|
|
33
33
|
*/
|
|
34
34
|
export declare const STATUS: {
|
|
35
|
-
readonly version: '0.
|
|
35
|
+
readonly version: '0.3.0-beta.0';
|
|
36
36
|
readonly wireFormat: 'yoxall/2 (locked through 1.0)';
|
|
37
37
|
readonly audited: false;
|
|
38
38
|
readonly auditPlanned: false;
|
package/dist/labels.js
CHANGED
|
@@ -54,7 +54,7 @@ export function showBetaBanner() {
|
|
|
54
54
|
* Consumed by CLI, by import-time banner, and by test harness.
|
|
55
55
|
*/
|
|
56
56
|
export const STATUS = {
|
|
57
|
-
version: '0.
|
|
57
|
+
version: '0.3.0-beta.0',
|
|
58
58
|
wireFormat: 'yoxall/2 (locked through 1.0)',
|
|
59
59
|
audited: false,
|
|
60
60
|
auditPlanned: false,
|
package/dist/sig.d.ts
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PQ-hybrid signatures: Ed25519 + ML-DSA-65 (NIST FIPS 204).
|
|
3
|
+
*
|
|
4
|
+
* A hybrid signature is valid only if BOTH halves verify. Forging one needs
|
|
5
|
+
* a break of Ed25519 AND of ML-DSA-65: if a quantum computer breaks
|
|
6
|
+
* Ed25519 (Shor), ML-DSA still holds; if a flaw in ML-DSA appears, Ed25519
|
|
7
|
+
* still holds. Long-lived evidence, such as audit receipts, signed policies
|
|
8
|
+
* and intent capsules, needs this: a classical signature made today could be
|
|
9
|
+
* forged once large quantum computers exist ("harvest now, forge later").
|
|
10
|
+
*
|
|
11
|
+
* WHAT EACH HALF SIGNS
|
|
12
|
+
* m' = "weave-yoxall/2 hybrid-sig" ‖ 0x00 ‖ len(ctx) ‖ ctx ‖ SHA-256(pk) ‖ msg
|
|
13
|
+
* ctx: 1–255 bytes naming what is signed ("ward-receipt", "intent-capsule"…),
|
|
14
|
+
* so a signature made for one purpose can't be replayed for another.
|
|
15
|
+
* pk: the hybrid public key, ed25519 ‖ ml-dsa-65 (1984 bytes), so neither
|
|
16
|
+
* half can be moved onto another key pair.
|
|
17
|
+
* Ed25519 signs m'. ML-DSA-65 signs m' with FIPS 204 context
|
|
18
|
+
* "weave-yoxall/2". Because both sign m', not msg, neither half taken out
|
|
19
|
+
* on its own is a valid plain Ed25519 or ML-DSA signature over msg
|
|
20
|
+
* (no stripping).
|
|
21
|
+
*
|
|
22
|
+
* SIGNING
|
|
23
|
+
* Ed25519 is deterministic (RFC 8032). ML-DSA is "hedged" (FIPS 204's
|
|
24
|
+
* default): fresh randomness mixed with the key, so a weak RNG doesn't
|
|
25
|
+
* leak the key, and repeated signatures differ.
|
|
26
|
+
*
|
|
27
|
+
* SIZES
|
|
28
|
+
* Public key: [Ed25519 32B][ML-DSA-65 1952B] = 1984 bytes
|
|
29
|
+
* Secret key: [Ed25519 seed 32B][ML-DSA-65 seed 32B] = 64 bytes (keys are
|
|
30
|
+
* re-derived from the seeds when signing)
|
|
31
|
+
* Signature: [Ed25519 64B][ML-DSA-65 3309B] = 3373 bytes
|
|
32
|
+
*/
|
|
33
|
+
export declare const SIG_ALG = "ed25519+ml-dsa-65";
|
|
34
|
+
export declare const ED25519_PUB = 32;
|
|
35
|
+
export declare const ED25519_SIG = 64;
|
|
36
|
+
export declare const MLDSA_PUB = 1952;
|
|
37
|
+
export declare const MLDSA_SIG = 3309;
|
|
38
|
+
export declare const SEED = 32;
|
|
39
|
+
export interface HybridVerifyKey {
|
|
40
|
+
ed25519PublicKey: Uint8Array;
|
|
41
|
+
mldsaPublicKey: Uint8Array;
|
|
42
|
+
}
|
|
43
|
+
export interface HybridSigningKey extends HybridVerifyKey {
|
|
44
|
+
/** Secret: 32-byte Ed25519 seed */
|
|
45
|
+
ed25519Seed: Uint8Array;
|
|
46
|
+
/** Secret: 32-byte ML-DSA-65 seed (FIPS 204 ξ) */
|
|
47
|
+
mldsaSeed: Uint8Array;
|
|
48
|
+
}
|
|
49
|
+
export interface HybridSignature {
|
|
50
|
+
/** What was signed, as given to sign() */
|
|
51
|
+
context: string;
|
|
52
|
+
ed25519: Uint8Array;
|
|
53
|
+
mldsa: Uint8Array;
|
|
54
|
+
}
|
|
55
|
+
/** Generate a hybrid signing key from fresh randomness. */
|
|
56
|
+
export declare function generateSigningKey(): HybridSigningKey;
|
|
57
|
+
/**
|
|
58
|
+
* Rebuild a signing key from its two 32-byte seeds (also how test vectors
|
|
59
|
+
* are made). The seeds are the whole secret: keep them as secret as the key.
|
|
60
|
+
*/
|
|
61
|
+
export declare function signingKeyFromSeeds(ed25519Seed: Uint8Array, mldsaSeed: Uint8Array): HybridSigningKey;
|
|
62
|
+
/** The public half, safe to share. */
|
|
63
|
+
export declare function verifyKeyOf(key: HybridSigningKey | HybridVerifyKey): HybridVerifyKey;
|
|
64
|
+
/** Raw hybrid public key: ed25519 ‖ ml-dsa-65 (1984 bytes). */
|
|
65
|
+
export declare function verifyKeyBytes(key: HybridVerifyKey): Uint8Array;
|
|
66
|
+
/** First 16 hex characters of SHA-256 of the hybrid public key. */
|
|
67
|
+
export declare function keyIdOf(key: HybridVerifyKey): string;
|
|
68
|
+
/** Sign `message` for the purpose named by `context` (1–255 bytes, e.g. "ward-receipt"). */
|
|
69
|
+
export declare function sign(key: HybridSigningKey, message: Uint8Array, context: string): HybridSignature;
|
|
70
|
+
/**
|
|
71
|
+
* Sign with caller-supplied ML-DSA randomness. For known-answer test vectors
|
|
72
|
+
* only: real signing goes through sign(). Not exported from the package index.
|
|
73
|
+
*/
|
|
74
|
+
export declare function signWith(key: HybridSigningKey, message: Uint8Array, context: string, mldsaRandomness: Uint8Array): HybridSignature;
|
|
75
|
+
/**
|
|
76
|
+
* True only if both halves verify for this key, message and context.
|
|
77
|
+
* Never throws for a bad or malformed signature: it returns false.
|
|
78
|
+
*/
|
|
79
|
+
export declare function verify(key: HybridVerifyKey, message: Uint8Array, signature: HybridSignature, context: string): boolean;
|
|
80
|
+
//# sourceMappingURL=sig.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sig.d.ts","sourceRoot":"","sources":["../src/sig.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAKH,eAAO,MAAM,OAAO,sBAAsB,CAAC;AAI3C,eAAO,MAAM,WAAW,KAAK,CAAC;AAC9B,eAAO,MAAM,WAAW,KAAK,CAAC;AAC9B,eAAO,MAAM,SAAS,OAAO,CAAC;AAC9B,eAAO,MAAM,SAAS,OAAO,CAAC;AAC9B,eAAO,MAAM,IAAI,KAAK,CAAC;AAEvB,MAAM,WAAW,eAAe;IAC9B,gBAAgB,EAAE,UAAU,CAAC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id signatures: Ed25519 + ML-DSA-65 (NIST FIPS 204).
|
|
3
|
+
*
|
|
4
|
+
* A hybrid signature is valid only if BOTH halves verify. Forging one needs
|
|
5
|
+
* a break of Ed25519 AND of ML-DSA-65: if a quantum computer breaks
|
|
6
|
+
* Ed25519 (Shor), ML-DSA still holds; if a flaw in ML-DSA appears, Ed25519
|
|
7
|
+
* still holds. Long-lived evidence, such as audit receipts, signed policies
|
|
8
|
+
* and intent capsules, needs this: a classical signature made today could be
|
|
9
|
+
* forged once large quantum computers exist ("harvest now, forge later").
|
|
10
|
+
*
|
|
11
|
+
* WHAT EACH HALF SIGNS
|
|
12
|
+
* m' = "weave-yoxall/2 hybrid-sig" ‖ 0x00 ‖ len(ctx) ‖ ctx ‖ SHA-256(pk) ‖ msg
|
|
13
|
+
* ctx: 1–255 bytes naming what is signed ("ward-receipt", "intent-capsule"…),
|
|
14
|
+
* so a signature made for one purpose can't be replayed for another.
|
|
15
|
+
* pk: the hybrid public key, ed25519 ‖ ml-dsa-65 (1984 bytes), so neither
|
|
16
|
+
* half can be moved onto another key pair.
|
|
17
|
+
* Ed25519 signs m'. ML-DSA-65 signs m' with FIPS 204 context
|
|
18
|
+
* "weave-yoxall/2". Because both sign m', not msg, neither half taken out
|
|
19
|
+
* on its own is a valid plain Ed25519 or ML-DSA signature over msg
|
|
20
|
+
* (no stripping).
|
|
21
|
+
*
|
|
22
|
+
* SIGNING
|
|
23
|
+
* Ed25519 is deterministic (RFC 8032). ML-DSA is "hedged" (FIPS 204's
|
|
24
|
+
* default): fresh randomness mixed with the key, so a weak RNG doesn't
|
|
25
|
+
* leak the key, and repeated signatures differ.
|
|
26
|
+
*
|
|
27
|
+
* SIZES
|
|
28
|
+
* Public key: [Ed25519 32B][ML-DSA-65 1952B] = 1984 bytes
|
|
29
|
+
* Secret key: [Ed25519 seed 32B][ML-DSA-65 seed 32B] = 64 bytes (keys are
|
|
30
|
+
* re-derived from the seeds when signing)
|
|
31
|
+
* Signature: [Ed25519 64B][ML-DSA-65 3309B] = 3373 bytes
|
|
32
|
+
*/
|
|
33
|
+
import { createHash, createPrivateKey, createPublicKey, randomBytes, sign as edSign, verify as edVerify } from 'node:crypto';
|
|
34
|
+
import { ml_dsa65 } from '@noble/post-quantum/ml-dsa.js';
|
|
35
|
+
export const SIG_ALG = 'ed25519+ml-dsa-65';
|
|
36
|
+
const PREFIX = new TextEncoder().encode('weave-yoxall/2 hybrid-sig');
|
|
37
|
+
const MLDSA_CONTEXT = new TextEncoder().encode('weave-yoxall/2');
|
|
38
|
+
export const ED25519_PUB = 32;
|
|
39
|
+
export const ED25519_SIG = 64;
|
|
40
|
+
export const MLDSA_PUB = 1952;
|
|
41
|
+
export const MLDSA_SIG = 3309;
|
|
42
|
+
export const SEED = 32;
|
|
43
|
+
// ─── Keys ───────────────────────────────────────────────────────
|
|
44
|
+
const ED_PKCS8 = Buffer.from('302e020100300506032b657004220420', 'hex');
|
|
45
|
+
const ED_SPKI = Buffer.from('302a300506032b6570032100', 'hex');
|
|
46
|
+
const edPrivate = (seed) => createPrivateKey({ key: Buffer.concat([ED_PKCS8, Buffer.from(seed)]), format: 'der', type: 'pkcs8' });
|
|
47
|
+
const edPublic = (pub) => createPublicKey({ key: Buffer.concat([ED_SPKI, Buffer.from(pub)]), format: 'der', type: 'spki' });
|
|
48
|
+
function edPublicFromSeed(seed) {
|
|
49
|
+
const der = createPublicKey(edPrivate(seed)).export({ type: 'spki', format: 'der' });
|
|
50
|
+
return new Uint8Array(der.subarray(der.length - ED25519_PUB));
|
|
51
|
+
}
|
|
52
|
+
/** Generate a hybrid signing key from fresh randomness. */
|
|
53
|
+
export function generateSigningKey() {
|
|
54
|
+
return signingKeyFromSeeds(randomBytes(SEED), randomBytes(SEED));
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Rebuild a signing key from its two 32-byte seeds (also how test vectors
|
|
58
|
+
* are made). The seeds are the whole secret: keep them as secret as the key.
|
|
59
|
+
*/
|
|
60
|
+
export function signingKeyFromSeeds(ed25519Seed, mldsaSeed) {
|
|
61
|
+
if (ed25519Seed.length !== SEED || mldsaSeed.length !== SEED)
|
|
62
|
+
throw new Error(`yoxall sig: seeds must be ${SEED} bytes each`);
|
|
63
|
+
const ml = ml_dsa65.keygen(new Uint8Array(mldsaSeed));
|
|
64
|
+
return {
|
|
65
|
+
ed25519Seed: new Uint8Array(ed25519Seed),
|
|
66
|
+
mldsaSeed: new Uint8Array(mldsaSeed),
|
|
67
|
+
ed25519PublicKey: edPublicFromSeed(ed25519Seed),
|
|
68
|
+
mldsaPublicKey: ml.publicKey,
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
/** The public half, safe to share. */
|
|
72
|
+
export function verifyKeyOf(key) {
|
|
73
|
+
return { ed25519PublicKey: new Uint8Array(key.ed25519PublicKey), mldsaPublicKey: new Uint8Array(key.mldsaPublicKey) };
|
|
74
|
+
}
|
|
75
|
+
/** Raw hybrid public key: ed25519 ‖ ml-dsa-65 (1984 bytes). */
|
|
76
|
+
export function verifyKeyBytes(key) {
|
|
77
|
+
return concat(key.ed25519PublicKey, key.mldsaPublicKey);
|
|
78
|
+
}
|
|
79
|
+
/** First 16 hex characters of SHA-256 of the hybrid public key. */
|
|
80
|
+
export function keyIdOf(key) {
|
|
81
|
+
return createHash('sha256').update(verifyKeyBytes(key)).digest('hex').slice(0, 16);
|
|
82
|
+
}
|
|
83
|
+
// ─── Sign / verify ──────────────────────────────────────────────
|
|
84
|
+
function contextBytes(context) {
|
|
85
|
+
const c = new TextEncoder().encode(context);
|
|
86
|
+
if (c.length < 1 || c.length > 255)
|
|
87
|
+
throw new Error('yoxall sig: context must be 1–255 bytes');
|
|
88
|
+
return c;
|
|
89
|
+
}
|
|
90
|
+
/** m' = PREFIX ‖ 0x00 ‖ len(ctx) ‖ ctx ‖ SHA-256(pk) ‖ msg */
|
|
91
|
+
function representative(key, ctx, message) {
|
|
92
|
+
const pkHash = createHash('sha256').update(verifyKeyBytes(key)).digest();
|
|
93
|
+
return concat(PREFIX, Uint8Array.of(0, ctx.length), ctx, pkHash, message);
|
|
94
|
+
}
|
|
95
|
+
/** Sign `message` for the purpose named by `context` (1–255 bytes, e.g. "ward-receipt"). */
|
|
96
|
+
export function sign(key, message, context) {
|
|
97
|
+
return signWith(key, message, context, randomBytes(32));
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Sign with caller-supplied ML-DSA randomness. For known-answer test vectors
|
|
101
|
+
* only: real signing goes through sign(). Not exported from the package index.
|
|
102
|
+
*/
|
|
103
|
+
export function signWith(key, message, context, mldsaRandomness) {
|
|
104
|
+
const ctx = contextBytes(context);
|
|
105
|
+
const m = representative(key, ctx, message);
|
|
106
|
+
const ed = new Uint8Array(edSign(null, m, edPrivate(key.ed25519Seed)));
|
|
107
|
+
const { secretKey } = ml_dsa65.keygen(new Uint8Array(key.mldsaSeed));
|
|
108
|
+
const ml = ml_dsa65.sign(m, secretKey, { context: MLDSA_CONTEXT, extraEntropy: new Uint8Array(mldsaRandomness) });
|
|
109
|
+
secretKey.fill(0);
|
|
110
|
+
return { context, ed25519: ed, mldsa: ml };
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* True only if both halves verify for this key, message and context.
|
|
114
|
+
* Never throws for a bad or malformed signature: it returns false.
|
|
115
|
+
*/
|
|
116
|
+
export function verify(key, message, signature, context) {
|
|
117
|
+
try {
|
|
118
|
+
if (signature.context !== context)
|
|
119
|
+
return false;
|
|
120
|
+
if (key.ed25519PublicKey.length !== ED25519_PUB || key.mldsaPublicKey.length !== MLDSA_PUB)
|
|
121
|
+
return false;
|
|
122
|
+
if (signature.ed25519.length !== ED25519_SIG || signature.mldsa.length !== MLDSA_SIG)
|
|
123
|
+
return false;
|
|
124
|
+
const m = representative(key, contextBytes(context), message);
|
|
125
|
+
// Evaluate both, so the time taken doesn't reveal which half failed
|
|
126
|
+
const edOk = edVerify(null, m, edPublic(key.ed25519PublicKey), signature.ed25519);
|
|
127
|
+
const mlOk = ml_dsa65.verify(signature.mldsa, m, key.mldsaPublicKey, { context: MLDSA_CONTEXT });
|
|
128
|
+
return edOk && mlOk;
|
|
129
|
+
}
|
|
130
|
+
catch {
|
|
131
|
+
return false;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
function concat(...parts) {
|
|
135
|
+
const out = new Uint8Array(parts.reduce((n, p) => n + p.length, 0));
|
|
136
|
+
let o = 0;
|
|
137
|
+
for (const p of parts) {
|
|
138
|
+
out.set(p, o);
|
|
139
|
+
o += p.length;
|
|
140
|
+
}
|
|
141
|
+
return out;
|
|
142
|
+
}
|
|
143
|
+
//# sourceMappingURL=sig.js.map
|
package/dist/sig.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sig.js","sourceRoot":"","sources":["../src/sig.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,eAAe,EAAE,WAAW,EAAE,IAAI,IAAI,MAAM,EAAE,MAAM,IAAI,QAAQ,EAAE,MAAM,aAAa,CAAC;AAC7H,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AAEzD,MAAM,CAAC,MAAM,OAAO,GAAG,mBAAmB,CAAC;AAC3C,MAAM,MAAM,GAAG,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,2BAA2B,CAAC,CAAC;AACrE,MAAM,aAAa,GAAG,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC;AAEjE,MAAM,CAAC,MAAM,WAAW,GAAG,EAAE,CAAC;AAC9B,MAAM,CAAC,MAAM,WAAW,GAAG,EAAE,CAAC;AAC9B,MAAM,CAAC,MAAM,SAAS,GAAG,IAAI,CAAC;AAC9B,MAAM,CAAC,MAAM,SAAS,GAAG,IAAI,CAAC;AAC9B,MAAM,CAAC,MAAM,IAAI,GAAG,EAAE,CAAC;AAqBvB,mEA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E,CAAC,CAAC,CAAC,CAAC;IACpE,IAAI,CAAC,GAAG,CAAC,CAAC;IACV,KAAK,MAAM,CAAC,IAAI,KAAK,EAAE,CAAC;QAAC,GAAG,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QAAC,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC;IAAC,CAAC;IACxD,OAAO,GAAG,CAAC;AACb,CAAC"}
|
package/dist/wire.d.ts
CHANGED
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
*/
|
|
12
12
|
import type { SealedMessage } from './sealed.js';
|
|
13
13
|
import type { DoubleRatchetSession, RatchetMessage } from './double-ratchet.js';
|
|
14
|
+
import { type HybridVerifyKey, type HybridSigningKey, type HybridSignature } from './sig.js';
|
|
14
15
|
export declare const WIRE_VERSION_2 = "yoxall/2";
|
|
15
16
|
export declare function serializeSealed(m: SealedMessage): string;
|
|
16
17
|
export declare function deserializeSealed(s: string): SealedMessage;
|
|
@@ -18,4 +19,15 @@ export declare function serializeRatchetMessage(m: RatchetMessage): string;
|
|
|
18
19
|
export declare function deserializeRatchetMessage(s: string): RatchetMessage;
|
|
19
20
|
export declare function serializeSession(s: DoubleRatchetSession): string;
|
|
20
21
|
export declare function deserializeSession(str: string): DoubleRatchetSession;
|
|
22
|
+
/** Public: `yoxall-sig-pub` */
|
|
23
|
+
export declare function serializeVerifyKey(k: HybridVerifyKey): string;
|
|
24
|
+
export declare function deserializeVerifyKey(s: string): HybridVerifyKey;
|
|
25
|
+
/** SECRET: `yoxall-sig-secret`. Holds both seeds; store it like any private key. */
|
|
26
|
+
export declare function serializeSigningKey(k: HybridSigningKey): string;
|
|
27
|
+
export declare function deserializeSigningKey(s: string): HybridSigningKey;
|
|
28
|
+
/** `yoxall-sig`. keyId names the signer's key, for lookup only: verify() is what checks it. */
|
|
29
|
+
export declare function serializeSignature(sig: HybridSignature, signer: HybridVerifyKey): string;
|
|
30
|
+
export declare function deserializeSignature(s: string): HybridSignature & {
|
|
31
|
+
keyId?: string;
|
|
32
|
+
};
|
|
21
33
|
//# sourceMappingURL=wire.d.ts.map
|
package/dist/wire.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wire.d.ts","sourceRoot":"","sources":["../src/wire.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,KAAK,EAAE,aAAa,EAAY,MAAM,aAAa,CAAC;AAC3D,OAAO,KAAK,EAAE,oBAAoB,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"wire.d.ts","sourceRoot":"","sources":["../src/wire.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,KAAK,EAAE,aAAa,EAAY,MAAM,aAAa,CAAC;AAC3D,OAAO,KAAK,EAAE,oBAAoB,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAChF,OAAO,EAA+F,KAAK,eAAe,EAAE,KAAK,gBAAgB,EAAE,KAAK,eAAe,EAAE,MAAM,UAAU,CAAC;AAE1L,eAAO,MAAM,cAAc,aAAa,CAAC;AA4BzC,wBAAgB,eAAe,CAAC,CAAC,EAAE,aAAa,GAAG,MAAM,CAExD;AAED,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,MAAM,GAAG,aAAa,CAI1D;AAID,wBAAgB,uBAAuB,CAAC,CAAC,EAAE,cAAc,GAAG,MAAM,CAUjE;AAED,wBAAgB,yBAAyB,CAAC,CAAC,EAAE,MAAM,GAAG,cAAc,CAQnE;AAID,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,oBAAoB,GAAG,MAAM,CAoBhE;AAED,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,oBAAoB,CAmBpE;AAKD,+BAA+B;AAC/B,wBAAgB,kBAAkB,CAAC,CAAC,EAAE,eAAe,GAAG,MAAM,CAE7D;AAED,wBAAgB,oBAAoB,CAAC,CAAC,EAAE,MAAM,GAAG,eAAe,CAM/D;AAED,oFAAoF;AACpF,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,gBAAgB,GAAG,MAAM,CAE/D;AAED,wBAAgB,qBAAqB,CAAC,CAAC,EAAE,MAAM,GAAG,gBAAgB,CAMjE;AAED,+FAA+F;AAC/F,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,eAAe,EAAE,MAAM,EAAE,eAAe,GAAG,MAAM,CAExF;AAED,wBAAgB,oBAAoB,CAAC,CAAC,EAAE,MAAM,GAAG,eAAe,GAAG;IAAE,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAKpF"}
|
package/dist/wire.js
CHANGED
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
* v0.1 envelopes (`_version: "yoxall/0.1.0-beta.0"`) are still readable
|
|
10
10
|
* through serialize.ts and PQCipher.
|
|
11
11
|
*/
|
|
12
|
+
import { SIG_ALG, ED25519_PUB, ED25519_SIG, MLDSA_PUB, MLDSA_SIG, SEED, signingKeyFromSeeds, keyIdOf } from './sig.js';
|
|
12
13
|
export const WIRE_VERSION_2 = 'yoxall/2';
|
|
13
14
|
const b64 = (u) => Buffer.from(u).toString('base64url');
|
|
14
15
|
function u8(s, field, len) {
|
|
@@ -111,4 +112,43 @@ export function deserializeSession(str) {
|
|
|
111
112
|
pendingHandshake: j.pendingHandshake ? kemIn(j.pendingHandshake) : null,
|
|
112
113
|
};
|
|
113
114
|
}
|
|
115
|
+
// ─── Hybrid signatures (added in 0.3.0-beta.0; new types, nothing changed) ──
|
|
116
|
+
/** Public: `yoxall-sig-pub` */
|
|
117
|
+
export function serializeVerifyKey(k) {
|
|
118
|
+
return JSON.stringify({ _type: 'yoxall-sig-pub', _version: WIRE_VERSION_2, alg: SIG_ALG, keyId: keyIdOf(k), ed25519: b64(k.ed25519PublicKey), mldsa: b64(k.mldsaPublicKey) });
|
|
119
|
+
}
|
|
120
|
+
export function deserializeVerifyKey(s) {
|
|
121
|
+
const j = parse(s, 'yoxall-sig-pub');
|
|
122
|
+
if (j.alg !== SIG_ALG)
|
|
123
|
+
throw new Error(`yoxall/2: unknown signature algorithm ${j.alg}`);
|
|
124
|
+
const k = { ed25519PublicKey: u8(j.ed25519, 'ed25519', ED25519_PUB), mldsaPublicKey: u8(j.mldsa, 'mldsa', MLDSA_PUB) };
|
|
125
|
+
if (j.keyId !== undefined && j.keyId !== keyIdOf(k))
|
|
126
|
+
throw new Error('yoxall/2: keyId does not match the key');
|
|
127
|
+
return k;
|
|
128
|
+
}
|
|
129
|
+
/** SECRET: `yoxall-sig-secret`. Holds both seeds; store it like any private key. */
|
|
130
|
+
export function serializeSigningKey(k) {
|
|
131
|
+
return JSON.stringify({ _type: 'yoxall-sig-secret', _version: WIRE_VERSION_2, alg: SIG_ALG, keyId: keyIdOf(k), ed25519Seed: b64(k.ed25519Seed), mldsaSeed: b64(k.mldsaSeed) });
|
|
132
|
+
}
|
|
133
|
+
export function deserializeSigningKey(s) {
|
|
134
|
+
const j = parse(s, 'yoxall-sig-secret');
|
|
135
|
+
if (j.alg !== SIG_ALG)
|
|
136
|
+
throw new Error(`yoxall/2: unknown signature algorithm ${j.alg}`);
|
|
137
|
+
const k = signingKeyFromSeeds(u8(j.ed25519Seed, 'ed25519Seed', SEED), u8(j.mldsaSeed, 'mldsaSeed', SEED));
|
|
138
|
+
if (j.keyId !== undefined && j.keyId !== keyIdOf(k))
|
|
139
|
+
throw new Error('yoxall/2: keyId does not match the seeds');
|
|
140
|
+
return k;
|
|
141
|
+
}
|
|
142
|
+
/** `yoxall-sig`. keyId names the signer's key, for lookup only: verify() is what checks it. */
|
|
143
|
+
export function serializeSignature(sig, signer) {
|
|
144
|
+
return JSON.stringify({ _type: 'yoxall-sig', _version: WIRE_VERSION_2, alg: SIG_ALG, ctx: sig.context, keyId: keyIdOf(signer), ed25519: b64(sig.ed25519), mldsa: b64(sig.mldsa) });
|
|
145
|
+
}
|
|
146
|
+
export function deserializeSignature(s) {
|
|
147
|
+
const j = parse(s, 'yoxall-sig');
|
|
148
|
+
if (j.alg !== SIG_ALG)
|
|
149
|
+
throw new Error(`yoxall/2: unknown signature algorithm ${j.alg}`);
|
|
150
|
+
if (typeof j.ctx !== 'string')
|
|
151
|
+
throw new Error('yoxall/2: missing field "ctx"');
|
|
152
|
+
return { context: j.ctx, ed25519: u8(j.ed25519, 'ed25519', ED25519_SIG), mldsa: u8(j.mldsa, 'mldsa', MLDSA_SIG), ...(typeof j.keyId === 'string' ? { keyId: j.keyId } : {}) };
|
|
153
|
+
}
|
|
114
154
|
//# sourceMappingURL=wire.js.map
|
package/dist/wire.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wire.js","sourceRoot":"","sources":["../src/wire.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;
|
|
1
|
+
{"version":3,"file":"wire.js","sourceRoot":"","sources":["../src/wire.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAKH,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,SAAS,EAAE,SAAS,EAAE,IAAI,EAAE,mBAAmB,EAAE,OAAO,EAAqE,MAAM,UAAU,CAAC;AAE1L,MAAM,CAAC,MAAM,cAAc,GAAG,UAAU,CAAC;AAEzC,MAAM,GAAG,GAAG,CAAC,CAAa,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;AACpE,SAAS,EAAE,CAAC,CAAU,EAAE,KAAa,EAAE,GAAY;IACjD,IAAI,OAAO,CAAC,KAAK,QAAQ;QAAE,MAAM,IAAI,KAAK,CAAC,4BAA4B,KAAK,GAAG,CAAC,CAAC;IACjF,MAAM,GAAG,GAAG,IAAI,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC;IACxD,IAAI,GAAG,KAAK,SAAS,IAAI,GAAG,CAAC,MAAM,KAAK,GAAG;QAAE,MAAM,IAAI,KA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AI,KAAK,CAAC,+BAA+B,CAAC,CAAC;IAChF,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC,GAAG,EAAE,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,EAAE,SAAS,EAAE,WAAW,CAAC,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,EAAE,OAAO,EAAE,SAAS,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC;AAChL,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@weave_protocol/yoxallismus",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0-beta.0",
|
|
4
4
|
"description": "EXPERIMENTAL post-quantum cryptographic composition layer for AI agents: hybrid X25519 + ML-KEM-768, sealed boxes, cascade AEAD, Signal-style Double Ratchet, locked yoxall/2 wire format. NOT AUDITED. Use only for research and development.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -20,7 +20,8 @@
|
|
|
20
20
|
"exports": {
|
|
21
21
|
".": {
|
|
22
22
|
"types": "./dist/index.d.ts",
|
|
23
|
-
"import": "./dist/index.js"
|
|
23
|
+
"import": "./dist/index.js",
|
|
24
|
+
"default": "./dist/index.js"
|
|
24
25
|
}
|
|
25
26
|
},
|
|
26
27
|
"scripts": {
|
|
@@ -55,7 +56,7 @@
|
|
|
55
56
|
"@noble/post-quantum": "^0.7.1"
|
|
56
57
|
},
|
|
57
58
|
"devDependencies": {
|
|
58
|
-
"@types/node": "^26.6.
|
|
59
|
+
"@types/node": "^26.6.11",
|
|
59
60
|
"typescript": "^7.0.2"
|
|
60
61
|
}
|
|
61
62
|
}
|