@weave_protocol/yoxallismus 0.1.0-beta.0 → 0.2.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +69 -33
- package/SECURITY_ADVISORIES.md +45 -2
- package/SKILL.md +4 -2
- package/THREAT_MODEL.md +30 -13
- package/WIRE_FORMAT.md +102 -0
- package/dist/cascade.d.ts +31 -0
- package/dist/cascade.d.ts.map +1 -0
- package/dist/cascade.js +74 -0
- package/dist/cascade.js.map +1 -0
- package/dist/cli.d.ts +1 -1
- package/dist/cli.js +70 -20
- package/dist/cli.js.map +1 -1
- package/dist/double-ratchet.d.ts +106 -0
- package/dist/double-ratchet.d.ts.map +1 -0
- package/dist/double-ratchet.js +238 -0
- package/dist/double-ratchet.js.map +1 -0
- package/dist/index.d.ts +6 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +12 -5
- package/dist/index.js.map +1 -1
- package/dist/kem.d.ts +32 -3
- package/dist/kem.d.ts.map +1 -1
- package/dist/kem.js +73 -20
- package/dist/kem.js.map +1 -1
- package/dist/labels.d.ts +7 -6
- package/dist/labels.d.ts.map +1 -1
- package/dist/labels.js +8 -7
- package/dist/labels.js.map +1 -1
- package/dist/sealed.d.ts +33 -0
- package/dist/sealed.d.ts.map +1 -0
- package/dist/sealed.js +40 -0
- package/dist/sealed.js.map +1 -0
- package/dist/serialize.d.ts +4 -4
- package/dist/serialize.js +4 -4
- package/dist/types.d.ts +1 -1
- package/dist/types.js +1 -1
- package/dist/v1-compat.d.ts +31 -13
- package/dist/v1-compat.d.ts.map +1 -1
- package/dist/v1-compat.js +51 -15
- package/dist/v1-compat.js.map +1 -1
- package/dist/wire.d.ts +21 -0
- package/dist/wire.d.ts.map +1 -0
- package/dist/wire.js +114 -0
- package/dist/wire.js.map +1 -0
- package/package.json +6 -4
package/dist/index.js
CHANGED
|
@@ -18,12 +18,17 @@ export { generateHybridKeypair, encapsulate, decapsulate, publicKeyOf, } from '.
|
|
|
18
18
|
export { aeadEncrypt, aeadDecrypt, aeadEncryptWithNonce, KEY_LEN, NONCE_LEN, TAG_LEN, } from './aead.js';
|
|
19
19
|
// KDF
|
|
20
20
|
export { hkdf, deriveAeadKey, deriveNonce, HKDF_HASH, } from './kdf.js';
|
|
21
|
-
// Ratchet
|
|
21
|
+
// Ratchet (v0.1 symmetric ratchet — deprecated; use initiateSession/acceptSession)
|
|
22
22
|
export { initRatchet, ratchetEncrypt, ratchetDecrypt, } from './ratchet.js';
|
|
23
23
|
// Serialization
|
|
24
24
|
export { serializePublicKey, deserializePublicKey, serializeKeypair, deserializeKeypair, serializeCiphertext, deserializeCiphertext, serializePayload, deserializePayload, } from './serialize.js';
|
|
25
|
-
//
|
|
26
|
-
export {
|
|
25
|
+
// v0.2: sealed boxes, cascade AEAD, double ratchet, locked yoxall/2 wire format
|
|
26
|
+
export { seal, open } from './sealed.js';
|
|
27
|
+
export { cascadeEncrypt, cascadeDecrypt, CASCADE_OVERHEAD } from './cascade.js';
|
|
28
|
+
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';
|
|
30
|
+
// v1 (Hord YoxallismusCipher): detection only, v1 payloads are unrecoverable
|
|
31
|
+
export { readV1, inspectV1, V1PayloadUnrecoverableError } from './v1-compat.js';
|
|
27
32
|
// ─── High-level facade ──────────────────────────────────────────
|
|
28
33
|
import { generateHybridKeypair, encapsulate, decapsulate, publicKeyOf, } from './kem.js';
|
|
29
34
|
import { aeadEncrypt, aeadDecrypt } from './aead.js';
|
|
@@ -48,14 +53,16 @@ export class PQCipher {
|
|
|
48
53
|
* Sender does not need their own keypair for this (KEM is sender-anonymous).
|
|
49
54
|
*/
|
|
50
55
|
static encryptTo(recipientPub, plaintext, associatedData) {
|
|
51
|
-
|
|
56
|
+
// PQCipher is the v0.1 API and keeps the v0.1 combiner so existing
|
|
57
|
+
// data still decrypts. New code should use seal()/open().
|
|
58
|
+
const kem = encapsulate(recipientPub, 1);
|
|
52
59
|
const aeadKey = deriveAeadKey(kem.sharedSecret, 'weave-yoxall v0.1 pqcipher-encrypt');
|
|
53
60
|
const payload = aeadEncrypt(aeadKey, plaintext, associatedData);
|
|
54
61
|
return { ciphertext: kem.ciphertext, payload };
|
|
55
62
|
}
|
|
56
63
|
/** Decrypt a message received from a sender. */
|
|
57
64
|
static decryptFrom(recipientPriv, ciphertext, payload) {
|
|
58
|
-
const sharedSecret = decapsulate(recipientPriv, ciphertext);
|
|
65
|
+
const sharedSecret = decapsulate(recipientPriv, ciphertext, 1);
|
|
59
66
|
const aeadKey = deriveAeadKey(sharedSecret, 'weave-yoxall v0.1 pqcipher-encrypt');
|
|
60
67
|
return aeadDecrypt(aeadKey, payload);
|
|
61
68
|
}
|
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,
|
|
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,GACnB,MAAM,WAAW,CA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E,UAAU,EAAE,CAAC,CAAC,CAAC;QAC/D,MAAM,OAAO,GAAG,aAAa,CAAC,YAAY,EAAE,oCAAoC,CAAC,CAAC;QAClF,OAAO,WAAW,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IACvC,CAAC;IAED,2DAA2D;IAC3D,MAAM,CAAC,gBAAgB,GAAG,gBAAgB,CAAC;IAC3C,MAAM,CAAC,kBAAkB,GAAG,kBAAkB,CAAC;IAC/C,MAAM,CAAC,kBAAkB,GAAG,kBAAkB,CAAC;IAC/C,MAAM,CAAC,oBAAoB,GAAG,oBAAoB,CAAC;IACnD,MAAM,CAAC,gBAAgB,GAAG,gBAAgB,CAAC;IAC3C,MAAM,CAAC,kBAAkB,GAAG,kBAAkB,CAAC;IAC/C,MAAM,CAAC,mBAAmB,GAAG,mBAAmB,CAAC;IACjD,MAAM,CAAC,qBAAqB,GAAG,qBAAqB,CAAC"}
|
package/dist/kem.d.ts
CHANGED
|
@@ -14,13 +14,27 @@
|
|
|
14
14
|
* ships as X25519Kyber768Draft00 in TLS 1.3. The design pattern is
|
|
15
15
|
* well-established; the primitives are NIST-standardized.
|
|
16
16
|
*
|
|
17
|
-
*
|
|
17
|
+
* COMBINERS
|
|
18
|
+
* v2 (default, wire format yoxall/2):
|
|
19
|
+
* ss = HKDF-SHA-256(ikm = ss_mlkem || ss_x25519 || eph_x25519_pub || recip_x25519_pub,
|
|
20
|
+
* salt = 32 zero bytes, info = "weave-yoxall/2 kem-combine")
|
|
21
|
+
* Same shape as X-Wing: binding the X25519 ephemeral and recipient
|
|
22
|
+
* public keys means the combined secret is IND-CCA even if only the
|
|
23
|
+
* X25519 half is relied on. ML-KEM is already IND-CCA, so its
|
|
24
|
+
* ciphertext doesn't need to be hashed in.
|
|
25
|
+
* v1 (legacy, v0.1.0-beta.0): HKDF over ss_x25519 || ss_mlkem, salted
|
|
26
|
+
* with the recipient public keys, without the ephemeral key. Kept
|
|
27
|
+
* only so data from v0.1 can still be decrypted (YOXALL-2026-002).
|
|
28
|
+
*
|
|
29
|
+
* WIRE FORMAT (byte sizes, unchanged since v0.1):
|
|
18
30
|
* Public key: [X25519 32B][ML-KEM-768 pub 1184B] = 1216 bytes
|
|
19
31
|
* Private key: [X25519 32B][ML-KEM-768 priv 2400B] = 2432 bytes
|
|
20
32
|
* Ciphertext: [X25519 eph pub 32B][ML-KEM-768 ct 1088B] = 1120 bytes
|
|
21
33
|
* Shared sec: 32 bytes (HKDF-combined)
|
|
22
34
|
*/
|
|
23
35
|
import type { HybridKeypair, HybridPublicKey, EncapsulationResult, HybridCiphertext } from './types.js';
|
|
36
|
+
/** KEM combiner version: 2 (default) or 1 (legacy v0.1 data only). */
|
|
37
|
+
export type CombinerVersion = 1 | 2;
|
|
24
38
|
/**
|
|
25
39
|
* Generate a fresh hybrid keypair. Both halves are generated with
|
|
26
40
|
* independent randomness from Node's crypto RNG.
|
|
@@ -33,7 +47,13 @@ export declare function generateHybridKeypair(): HybridKeypair;
|
|
|
33
47
|
* - sharedSecret: 32 bytes that both parties will hold
|
|
34
48
|
* - ciphertext: the hybrid KEM output that recipient decapsulates
|
|
35
49
|
*/
|
|
36
|
-
export declare function encapsulate(recipientPub: HybridPublicKey): EncapsulationResult;
|
|
50
|
+
export declare function encapsulate(recipientPub: HybridPublicKey, version?: CombinerVersion): EncapsulationResult;
|
|
51
|
+
/**
|
|
52
|
+
* Deterministic encapsulation from caller-supplied randomness. Used for
|
|
53
|
+
* known-answer test vectors only — NEVER call with non-random inputs in
|
|
54
|
+
* real use. Not exported from the package index.
|
|
55
|
+
*/
|
|
56
|
+
export declare function encapsulateWith(recipientPub: HybridPublicKey, version: CombinerVersion, x25519EphemeralPrivate: Uint8Array, mlkemRandomness: Uint8Array): EncapsulationResult;
|
|
37
57
|
/**
|
|
38
58
|
* Decapsulate a shared secret from a ciphertext using the recipient's
|
|
39
59
|
* private key. Both halves must succeed; either failure means the
|
|
@@ -45,6 +65,15 @@ export declare function encapsulate(recipientPub: HybridPublicKey): Encapsulatio
|
|
|
45
65
|
* shared secret was correct out-of-band (typically via AEAD auth-tag
|
|
46
66
|
* verification on subsequent messages).
|
|
47
67
|
*/
|
|
48
|
-
export declare function decapsulate(recipientPriv: HybridKeypair, ct: HybridCiphertext): Uint8Array;
|
|
68
|
+
export declare function decapsulate(recipientPriv: HybridKeypair, ct: HybridCiphertext, version?: CombinerVersion): Uint8Array;
|
|
49
69
|
export declare function publicKeyOf(kp: HybridKeypair): HybridPublicKey;
|
|
70
|
+
/** Deterministic keypair from seeds — known-answer test vectors only. */
|
|
71
|
+
export declare function keypairFromSeeds(x25519Private: Uint8Array, mlkemSeed: Uint8Array): HybridKeypair;
|
|
72
|
+
/** Raw X25519 Diffie-Hellman on 32-byte keys (used by the double ratchet). */
|
|
73
|
+
export declare function x25519(privateKey: Uint8Array, publicKey: Uint8Array): Uint8Array;
|
|
74
|
+
/** Fresh raw X25519 keypair (used by the double ratchet). */
|
|
75
|
+
export declare function generateX25519(): {
|
|
76
|
+
publicKey: Uint8Array;
|
|
77
|
+
privateKey: Uint8Array;
|
|
78
|
+
};
|
|
50
79
|
//# sourceMappingURL=kem.d.ts.map
|
package/dist/kem.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kem.d.ts","sourceRoot":"","sources":["../src/kem.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"kem.d.ts","sourceRoot":"","sources":["../src/kem.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAIH,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAMxG,sEAAsE;AACtE,MAAM,MAAM,eAAe,GAAG,CAAC,GAAG,CAAC,CAAC;AAmBpC;;;GAGG;AACH,wBAAgB,qBAAqB,IAAI,aAAa,CAoBrD;AAID;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,YAAY,EAAE,eAAe,EAAE,OAAO,GAAE,eAAmB,GAAG,mBAAmB,CAE5G;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAC7B,YAAY,EAAE,eAAe,EAC7B,OAAO,EAAE,eAAe,EACxB,sBAAsB,EAAE,UAAU,EAClC,eAAe,EAAE,UAAU,GAC1B,mBAAmB,CAoCrB;AAID;;;;;;;;;;GAUG;AACH,wBAAgB,WAAW,CAAC,aAAa,EAAE,aAAa,EAAE,EAAE,EAAE,gBAAgB,EAAE,OAAO,GAAE,eAAmB,GAAG,UAAU,CAsBxH;AAID,wBAAgB,WAAW,CAAC,EAAE,EAAE,aAAa,GAAG,eAAe,CAK9D;AAID,yEAAyE;AACzE,wBAAgB,gBAAgB,CAAC,aAAa,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,GAAG,aAAa,CAKhG;AAED,8EAA8E;AAC9E,wBAAgB,MAAM,CAAC,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,GAAG,UAAU,CAKhF;AAED,6DAA6D;AAC7D,wBAAgB,cAAc,IAAI;IAAE,SAAS,EAAE,UAAU,CAAC;IAAC,UAAU,EAAE,UAAU,CAAA;CAAE,CASlF"}
|
package/dist/kem.js
CHANGED
|
@@ -14,7 +14,19 @@
|
|
|
14
14
|
* ships as X25519Kyber768Draft00 in TLS 1.3. The design pattern is
|
|
15
15
|
* well-established; the primitives are NIST-standardized.
|
|
16
16
|
*
|
|
17
|
-
*
|
|
17
|
+
* COMBINERS
|
|
18
|
+
* v2 (default, wire format yoxall/2):
|
|
19
|
+
* ss = HKDF-SHA-256(ikm = ss_mlkem || ss_x25519 || eph_x25519_pub || recip_x25519_pub,
|
|
20
|
+
* salt = 32 zero bytes, info = "weave-yoxall/2 kem-combine")
|
|
21
|
+
* Same shape as X-Wing: binding the X25519 ephemeral and recipient
|
|
22
|
+
* public keys means the combined secret is IND-CCA even if only the
|
|
23
|
+
* X25519 half is relied on. ML-KEM is already IND-CCA, so its
|
|
24
|
+
* ciphertext doesn't need to be hashed in.
|
|
25
|
+
* v1 (legacy, v0.1.0-beta.0): HKDF over ss_x25519 || ss_mlkem, salted
|
|
26
|
+
* with the recipient public keys, without the ephemeral key. Kept
|
|
27
|
+
* only so data from v0.1 can still be decrypted (YOXALL-2026-002).
|
|
28
|
+
*
|
|
29
|
+
* WIRE FORMAT (byte sizes, unchanged since v0.1):
|
|
18
30
|
* Public key: [X25519 32B][ML-KEM-768 pub 1184B] = 1216 bytes
|
|
19
31
|
* Private key: [X25519 32B][ML-KEM-768 priv 2400B] = 2432 bytes
|
|
20
32
|
* Ciphertext: [X25519 eph pub 32B][ML-KEM-768 ct 1088B] = 1120 bytes
|
|
@@ -23,7 +35,16 @@
|
|
|
23
35
|
import { generateKeyPairSync, createPrivateKey, createPublicKey, diffieHellman, randomBytes } from 'node:crypto';
|
|
24
36
|
import { ml_kem768 } from '@noble/post-quantum/ml-kem';
|
|
25
37
|
import { hkdf } from './kdf.js';
|
|
26
|
-
const
|
|
38
|
+
const HYBRID_COMBINE_INFO_V1 = 'weave-yoxall v0.1 pq-hybrid-combine';
|
|
39
|
+
const HYBRID_COMBINE_INFO_V2 = 'weave-yoxall/2 kem-combine';
|
|
40
|
+
function combine(version, x25519Shared, mlkemShared, ephemeralPub, recipient) {
|
|
41
|
+
if (version === 1) {
|
|
42
|
+
const salt = concatBytes(recipient.x25519PublicKey, recipient.mlkemPublicKey);
|
|
43
|
+
return hkdf(concatBytes(x25519Shared, mlkemShared), salt, HYBRID_COMBINE_INFO_V1, 32);
|
|
44
|
+
}
|
|
45
|
+
const ikm = concatAll(mlkemShared, x25519Shared, ephemeralPub, recipient.x25519PublicKey);
|
|
46
|
+
return hkdf(ikm, new Uint8Array(32), HYBRID_COMBINE_INFO_V2, 32);
|
|
47
|
+
}
|
|
27
48
|
// ─── Key generation ─────────────────────────────────────────────
|
|
28
49
|
/**
|
|
29
50
|
* Generate a fresh hybrid keypair. Both halves are generated with
|
|
@@ -56,18 +77,22 @@ export function generateHybridKeypair() {
|
|
|
56
77
|
* - sharedSecret: 32 bytes that both parties will hold
|
|
57
78
|
* - ciphertext: the hybrid KEM output that recipient decapsulates
|
|
58
79
|
*/
|
|
59
|
-
export function encapsulate(recipientPub) {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
80
|
+
export function encapsulate(recipientPub, version = 2) {
|
|
81
|
+
return encapsulateWith(recipientPub, version, randomBytes(32), randomBytes(32));
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Deterministic encapsulation from caller-supplied randomness. Used for
|
|
85
|
+
* known-answer test vectors only — NEVER call with non-random inputs in
|
|
86
|
+
* real use. Not exported from the package index.
|
|
87
|
+
*/
|
|
88
|
+
export function encapsulateWith(recipientPub, version, x25519EphemeralPrivate, mlkemRandomness) {
|
|
89
|
+
// X25519: ephemeral keypair from the supplied private scalar
|
|
66
90
|
const ephemeralPrivObj = createPrivateKey({
|
|
67
|
-
key:
|
|
91
|
+
key: wrapX25519RawAsPkcs8(x25519EphemeralPrivate),
|
|
68
92
|
format: 'der',
|
|
69
93
|
type: 'pkcs8',
|
|
70
94
|
});
|
|
95
|
+
const ephemeralPubRaw = extractX25519RawFromSpki(createPublicKey(ephemeralPrivObj).export({ type: 'spki', format: 'der' }));
|
|
71
96
|
const recipientX25519PubObj = createPublicKey({
|
|
72
97
|
key: wrapX25519RawAsSpki(recipientPub.x25519PublicKey),
|
|
73
98
|
format: 'der',
|
|
@@ -78,13 +103,10 @@ export function encapsulate(recipientPub) {
|
|
|
78
103
|
publicKey: recipientX25519PubObj,
|
|
79
104
|
}));
|
|
80
105
|
// ML-KEM: encapsulate to recipient's ML-KEM public key
|
|
81
|
-
const mlkemResult = ml_kem768.encapsulate(recipientPub.mlkemPublicKey);
|
|
106
|
+
const mlkemResult = ml_kem768.encapsulate(recipientPub.mlkemPublicKey, mlkemRandomness);
|
|
82
107
|
const mlkemSharedSecret = mlkemResult.sharedSecret;
|
|
83
108
|
const mlkemCiphertext = mlkemResult.cipherText;
|
|
84
|
-
|
|
85
|
-
const salt = concatBytes(recipientPub.x25519PublicKey, recipientPub.mlkemPublicKey);
|
|
86
|
-
const ikm = concatBytes(x25519SharedSecret, mlkemSharedSecret);
|
|
87
|
-
const sharedSecret = hkdf(ikm, salt, HYBRID_COMBINE_INFO, 32);
|
|
109
|
+
const sharedSecret = combine(version, x25519SharedSecret, mlkemSharedSecret, ephemeralPubRaw, recipientPub);
|
|
88
110
|
return {
|
|
89
111
|
sharedSecret,
|
|
90
112
|
ciphertext: {
|
|
@@ -105,7 +127,7 @@ export function encapsulate(recipientPub) {
|
|
|
105
127
|
* shared secret was correct out-of-band (typically via AEAD auth-tag
|
|
106
128
|
* verification on subsequent messages).
|
|
107
129
|
*/
|
|
108
|
-
export function decapsulate(recipientPriv, ct) {
|
|
130
|
+
export function decapsulate(recipientPriv, ct, version = 2) {
|
|
109
131
|
// X25519: compute shared secret with ephemeral public + own private
|
|
110
132
|
const recipientPrivObj = createPrivateKey({
|
|
111
133
|
key: wrapX25519RawAsPkcs8(recipientPriv.x25519PrivateKey),
|
|
@@ -123,10 +145,7 @@ export function decapsulate(recipientPriv, ct) {
|
|
|
123
145
|
}));
|
|
124
146
|
// ML-KEM: decapsulate
|
|
125
147
|
const mlkemSharedSecret = ml_kem768.decapsulate(ct.mlkemCiphertext, recipientPriv.mlkemPrivateKey);
|
|
126
|
-
|
|
127
|
-
const salt = concatBytes(recipientPriv.x25519PublicKey, recipientPriv.mlkemPublicKey);
|
|
128
|
-
const ikm = concatBytes(x25519SharedSecret, mlkemSharedSecret);
|
|
129
|
-
return hkdf(ikm, salt, HYBRID_COMBINE_INFO, 32);
|
|
148
|
+
return combine(version, x25519SharedSecret, mlkemSharedSecret, ct.x25519EphemeralPublicKey, recipientPriv);
|
|
130
149
|
}
|
|
131
150
|
// ─── Public-key extraction ──────────────────────────────────────
|
|
132
151
|
export function publicKeyOf(kp) {
|
|
@@ -136,6 +155,40 @@ export function publicKeyOf(kp) {
|
|
|
136
155
|
};
|
|
137
156
|
}
|
|
138
157
|
// ─── Helpers ────────────────────────────────────────────────────
|
|
158
|
+
/** Deterministic keypair from seeds — known-answer test vectors only. */
|
|
159
|
+
export function keypairFromSeeds(x25519Private, mlkemSeed) {
|
|
160
|
+
const priv = createPrivateKey({ key: wrapX25519RawAsPkcs8(x25519Private), format: 'der', type: 'pkcs8' });
|
|
161
|
+
const x25519PublicKey = extractX25519RawFromSpki(createPublicKey(priv).export({ type: 'spki', format: 'der' }));
|
|
162
|
+
const ml = ml_kem768.keygen(mlkemSeed);
|
|
163
|
+
return { x25519PublicKey, x25519PrivateKey: new Uint8Array(x25519Private), mlkemPublicKey: ml.publicKey, mlkemPrivateKey: ml.secretKey };
|
|
164
|
+
}
|
|
165
|
+
/** Raw X25519 Diffie-Hellman on 32-byte keys (used by the double ratchet). */
|
|
166
|
+
export function x25519(privateKey, publicKey) {
|
|
167
|
+
return new Uint8Array(diffieHellman({
|
|
168
|
+
privateKey: createPrivateKey({ key: wrapX25519RawAsPkcs8(privateKey), format: 'der', type: 'pkcs8' }),
|
|
169
|
+
publicKey: createPublicKey({ key: wrapX25519RawAsSpki(publicKey), format: 'der', type: 'spki' }),
|
|
170
|
+
}));
|
|
171
|
+
}
|
|
172
|
+
/** Fresh raw X25519 keypair (used by the double ratchet). */
|
|
173
|
+
export function generateX25519() {
|
|
174
|
+
const k = generateKeyPairSync('x25519', {
|
|
175
|
+
publicKeyEncoding: { type: 'spki', format: 'der' },
|
|
176
|
+
privateKeyEncoding: { type: 'pkcs8', format: 'der' },
|
|
177
|
+
});
|
|
178
|
+
return {
|
|
179
|
+
publicKey: extractX25519RawFromSpki(k.publicKey),
|
|
180
|
+
privateKey: extractX25519RawFromPkcs8(k.privateKey),
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
function concatAll(...parts) {
|
|
184
|
+
const out = new Uint8Array(parts.reduce((n, p) => n + p.length, 0));
|
|
185
|
+
let off = 0;
|
|
186
|
+
for (const p of parts) {
|
|
187
|
+
out.set(p, off);
|
|
188
|
+
off += p.length;
|
|
189
|
+
}
|
|
190
|
+
return out;
|
|
191
|
+
}
|
|
139
192
|
function concatBytes(a, b) {
|
|
140
193
|
const out = new Uint8Array(a.length + b.length);
|
|
141
194
|
out.set(a, 0);
|
package/dist/kem.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kem.js","sourceRoot":"","sources":["../src/kem.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"kem.js","sourceRoot":"","sources":["../src/kem.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAEH,OAAO,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,eAAe,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AACjH,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAEvD,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAEhC,MAAM,sBAAsB,GAAG,qCAAqC,CAAC;AACrE,MAAM,sBAAsB,GAAG,4BAA4B,CAAC;AAK5D,SAAS,OAAO,CACd,OAAwB,EACxB,YAAwB,EACxB,WAAuB,EACvB,YAAwB,EACxB,SAA0B;IAE1B,IAAI,OAAO,KAAK,CAAC,EAAE,CAAC;QAClB,MAAM,IAAI,GAAG,WAAW,CAAC,SAAS,CAAC,eAAe,EAAE,SAAS,CAAC,cAAc,CAAC,CAAC;QAC9E,OAAO,IAAI,CAAC,WAAW,CAAC,YAAY,EAAE,WAAW,CAAC,EAAE,IAAI,EAAE,sBAAsB,EAAE,EAAE,CAAC,CAAC;IACxF,CAAC;IACD,MAAM,GAAG,GAAG,SAAS,CAAC,WAAW,EAAE,YAAY,EAAE,YAAY,EAAE,SAAS,CAAC,eAAe,CAAC,CAAC;IAC1F,OAAO,IAAI,CAAC,GAAG,EAAE,IAAI,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,GAAe;IAC1C,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,kBAAkB,CAAC,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AAC5E,CAAC;AAED,SAAS,oBAAoB,CAAC,GAAe;IAC3C,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,mBAAmB,CAAC,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AAC7E,CAAC"}
|
package/dist/labels.d.ts
CHANGED
|
@@ -32,7 +32,8 @@ 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.2.0-beta.0";
|
|
36
|
+
readonly wireFormat: "yoxall/2 (locked through 1.0)";
|
|
36
37
|
readonly audited: false;
|
|
37
38
|
readonly auditPlanned: false;
|
|
38
39
|
readonly status: "experimental";
|
|
@@ -40,11 +41,11 @@ export declare const STATUS: {
|
|
|
40
41
|
readonly scopeForUse: readonly ["research", "experimentation", "development", "learning post-quantum patterns"];
|
|
41
42
|
readonly scopeForNonUse: readonly ["regulated data (HIPAA, PCI-DSS, SOC2)", "medical records", "financial records", "legal evidence", "production security-critical systems"];
|
|
42
43
|
readonly primitivesUsed: {
|
|
43
|
-
readonly kem: readonly ["X25519 (classical)", "ML-KEM-768 (post-quantum, NIST FIPS 203)"];
|
|
44
|
-
readonly aead: readonly ["AES-256-GCM (Node crypto)"];
|
|
45
|
-
readonly kdf: readonly ["HKDF-SHA-256 (Node crypto)"];
|
|
46
|
-
readonly ratchet: readonly ["
|
|
44
|
+
readonly kem: readonly ["X25519 (classical)", "ML-KEM-768 (post-quantum, NIST FIPS 203)", "X-Wing-style v2 combiner"];
|
|
45
|
+
readonly aead: readonly ["AES-256-GCM (Node crypto)", "cascade: AES-256-GCM inside ChaCha20-Poly1305 (Node crypto)"];
|
|
46
|
+
readonly kdf: readonly ["HKDF-SHA-256 (Node crypto)", "HMAC-SHA-256 chain keys"];
|
|
47
|
+
readonly ratchet: readonly ["Signal Double Ratchet over X25519, seeded by the hybrid KEM"];
|
|
47
48
|
};
|
|
48
|
-
readonly knownLimitations: readonly ["no threshold encryption yet", "no zero-knowledge proofs yet", "no verifiable delay functions yet", "
|
|
49
|
+
readonly knownLimitations: readonly ["no threshold encryption yet", "no zero-knowledge proofs yet", "no verifiable delay functions yet", "double-ratchet DH steps are classical X25519 (PQ only at session start)", "no FHE integration yet", "Yoxallismus v1 (Hord) payloads cannot be decrypted (detector only; YOXALL-2026-003)", "no formal audit performed", "no quantum RNG integration yet"];
|
|
49
50
|
};
|
|
50
51
|
//# sourceMappingURL=labels.d.ts.map
|
package/dist/labels.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"labels.d.ts","sourceRoot":"","sources":["../src/labels.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAkBH;;;GAGG;AACH,wBAAgB,cAAc,IAAI,IAAI,CAKrC;AAED;;;GAGG;AACH,eAAO,MAAM,MAAM
|
|
1
|
+
{"version":3,"file":"labels.d.ts","sourceRoot":"","sources":["../src/labels.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAkBH;;;GAGG;AACH,wBAAgB,cAAc,IAAI,IAAI,CAKrC;AAED;;;GAGG;AACH,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;CAoCT,CAAC"}
|
package/dist/labels.js
CHANGED
|
@@ -54,7 +54,8 @@ 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.2.0-beta.0',
|
|
58
|
+
wireFormat: 'yoxall/2 (locked through 1.0)',
|
|
58
59
|
audited: false,
|
|
59
60
|
auditPlanned: false,
|
|
60
61
|
status: 'experimental',
|
|
@@ -73,18 +74,18 @@ export const STATUS = {
|
|
|
73
74
|
'production security-critical systems',
|
|
74
75
|
],
|
|
75
76
|
primitivesUsed: {
|
|
76
|
-
kem: ['X25519 (classical)', 'ML-KEM-768 (post-quantum, NIST FIPS 203)'],
|
|
77
|
-
aead: ['AES-256-GCM (Node crypto)'],
|
|
78
|
-
kdf: ['HKDF-SHA-256 (Node crypto)'],
|
|
79
|
-
ratchet: ['
|
|
77
|
+
kem: ['X25519 (classical)', 'ML-KEM-768 (post-quantum, NIST FIPS 203)', 'X-Wing-style v2 combiner'],
|
|
78
|
+
aead: ['AES-256-GCM (Node crypto)', 'cascade: AES-256-GCM inside ChaCha20-Poly1305 (Node crypto)'],
|
|
79
|
+
kdf: ['HKDF-SHA-256 (Node crypto)', 'HMAC-SHA-256 chain keys'],
|
|
80
|
+
ratchet: ['Signal Double Ratchet over X25519, seeded by the hybrid KEM'],
|
|
80
81
|
},
|
|
81
82
|
knownLimitations: [
|
|
82
83
|
'no threshold encryption yet',
|
|
83
84
|
'no zero-knowledge proofs yet',
|
|
84
85
|
'no verifiable delay functions yet',
|
|
85
|
-
'
|
|
86
|
+
'double-ratchet DH steps are classical X25519 (PQ only at session start)',
|
|
86
87
|
'no FHE integration yet',
|
|
87
|
-
'
|
|
88
|
+
'Yoxallismus v1 (Hord) payloads cannot be decrypted (detector only; YOXALL-2026-003)',
|
|
88
89
|
'no formal audit performed',
|
|
89
90
|
'no quantum RNG integration yet',
|
|
90
91
|
],
|
package/dist/labels.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"labels.js","sourceRoot":"","sources":["../src/labels.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,MAAM,MAAM,GAAG;IACb,EAAE;IACF,6DAA6D;IAC7D,EAAE;IAC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OAAO;IACxB,WAAW,GAAG,IAAI,CAAC;IACnB,IAAI,OAAO,CAAC,GAAG,CAAC,2BAA2B,KAAK,GAAG;QAAE,OAAO;IAC5D,KAAK,MAAM,IAAI,IAAI,MAAM;QAAE,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC;AAC/D,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG;IACpB,OAAO,EAAE,cAAc;IACvB,UAAU,EAAE,+BAA+B;IAC3C,OAAO,EAAE,KAAK;IACd,YAAY,EAAE,KAAK;IACnB,MAAM,EAAE,cAAc;IACtB,eAAe,EAAE,KAAK;IACtB,WAAW,EAAE;QACX,UAAU;QACV,iBAAiB;QACjB,aAAa;QACb,gCAAgC;KACjC;IACD,cAAc,EAAE;QACd,uCAAuC;QACvC,iBAAiB;QACjB,mBAAmB;QACnB,gBAAgB;QAChB,sCAAsC;KACvC;IACD,cAAc,EAAE;QACd,GAAG,EAAE,CAAC,oBAAoB,EAAE,0CAA0C,EAAE,0BAA0B,CAAC;QACnG,IAAI,EAAE,CAAC,2BAA2B,EAAE,6DAA6D,CAAC;QAClG,GAAG,EAAE,CAAC,4BAA4B,EAAE,yBAAyB,CAAC;QAC9D,OAAO,EAAE,CAAC,6DAA6D,CAAC;KACzE;IACD,gBAAgB,EAAE;QAChB,6BAA6B;QAC7B,8BAA8B;QAC9B,mCAAmC;QACnC,yEAAyE;QACzE,wBAAwB;QACxB,qFAAqF;QACrF,2BAA2B;QAC3B,gCAAgC;KACjC;CACO,CAAC"}
|
package/dist/sealed.d.ts
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sealed boxes (wire format yoxall/2): encrypt to a recipient's hybrid
|
|
3
|
+
* public key, sender-anonymous, one shot.
|
|
4
|
+
*
|
|
5
|
+
* ss = hybrid KEM (v2 combiner) to the recipient
|
|
6
|
+
* key = HKDF(ss, salt = 32 zero bytes, info = "weave-yoxall/2 seal <mode>")
|
|
7
|
+
* body = AES-256-GCM(key, random nonce, pt, aad) mode "aes-256-gcm"
|
|
8
|
+
* | cascadeEncrypt(key, pt, aad) mode "cascade"
|
|
9
|
+
*
|
|
10
|
+
* The caller passes the expected AAD to open(): it is never carried in
|
|
11
|
+
* the message, so a recipient can't be tricked into accepting a message
|
|
12
|
+
* bound to some other context.
|
|
13
|
+
*/
|
|
14
|
+
import type { HybridCiphertext, HybridKeypair, HybridPublicKey } from './types.js';
|
|
15
|
+
export type SealMode = 'aes-256-gcm' | 'cascade';
|
|
16
|
+
export interface SealedMessage {
|
|
17
|
+
version: 2;
|
|
18
|
+
mode: SealMode;
|
|
19
|
+
kem: HybridCiphertext;
|
|
20
|
+
nonce: Uint8Array;
|
|
21
|
+
ciphertext: Uint8Array;
|
|
22
|
+
}
|
|
23
|
+
export interface SealOptions {
|
|
24
|
+
/** Associated data bound to the message; must be passed identically to open(). */
|
|
25
|
+
aad?: Uint8Array;
|
|
26
|
+
/** "cascade" layers AES-256-GCM inside ChaCha20-Poly1305. Default "aes-256-gcm". */
|
|
27
|
+
mode?: SealMode;
|
|
28
|
+
}
|
|
29
|
+
export declare function seal(recipient: HybridPublicKey, plaintext: Uint8Array, opts?: SealOptions): SealedMessage;
|
|
30
|
+
export declare function open(recipient: HybridKeypair, msg: SealedMessage, opts?: {
|
|
31
|
+
aad?: Uint8Array;
|
|
32
|
+
}): Uint8Array;
|
|
33
|
+
//# sourceMappingURL=sealed.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sealed.d.ts","sourceRoot":"","sources":["../src/sealed.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAMnF,MAAM,MAAM,QAAQ,GAAG,aAAa,GAAG,SAAS,CAAC;AAEjD,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,CAAC,CAAC;IACX,IAAI,EAAE,QAAQ,CAAC;IACf,GAAG,EAAE,gBAAgB,CAAC;IACtB,KAAK,EAAE,UAAU,CAAC;IAClB,UAAU,EAAE,UAAU,CAAC;CACxB;AAED,MAAM,WAAW,WAAW;IAC1B,kFAAkF;IAClF,GAAG,CAAC,EAAE,UAAU,CAAC;IACjB,oFAAoF;IACpF,IAAI,CAAC,EAAE,QAAQ,CAAC;CACjB;AAID,wBAAgB,IAAI,CAAC,SAAS,EAAE,eAAe,EAAE,SAAS,EAAE,UAAU,EAAE,IAAI,GAAE,WAAgB,GAAG,aAAa,CAO7G;AAED,wBAAgB,IAAI,CAAC,SAAS,EAAE,aAAa,EAAE,GAAG,EAAE,aAAa,EAAE,IAAI,GAAE;IAAE,GAAG,CAAC,EAAE,UAAU,CAAA;CAAO,GAAG,UAAU,CAS9G"}
|
package/dist/sealed.js
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sealed boxes (wire format yoxall/2): encrypt to a recipient's hybrid
|
|
3
|
+
* public key, sender-anonymous, one shot.
|
|
4
|
+
*
|
|
5
|
+
* ss = hybrid KEM (v2 combiner) to the recipient
|
|
6
|
+
* key = HKDF(ss, salt = 32 zero bytes, info = "weave-yoxall/2 seal <mode>")
|
|
7
|
+
* body = AES-256-GCM(key, random nonce, pt, aad) mode "aes-256-gcm"
|
|
8
|
+
* | cascadeEncrypt(key, pt, aad) mode "cascade"
|
|
9
|
+
*
|
|
10
|
+
* The caller passes the expected AAD to open(): it is never carried in
|
|
11
|
+
* the message, so a recipient can't be tricked into accepting a message
|
|
12
|
+
* bound to some other context.
|
|
13
|
+
*/
|
|
14
|
+
import { encapsulate, decapsulate } from './kem.js';
|
|
15
|
+
import { hkdf } from './kdf.js';
|
|
16
|
+
import { aeadEncrypt, aeadDecrypt } from './aead.js';
|
|
17
|
+
import { cascadeEncrypt, cascadeDecrypt } from './cascade.js';
|
|
18
|
+
const keyFor = (ss, mode) => hkdf(ss, new Uint8Array(32), `weave-yoxall/2 seal ${mode}`, 32);
|
|
19
|
+
export function seal(recipient, plaintext, opts = {}) {
|
|
20
|
+
const mode = opts.mode ?? 'aes-256-gcm';
|
|
21
|
+
if (mode !== 'aes-256-gcm' && mode !== 'cascade')
|
|
22
|
+
throw new Error(`seal: unknown mode "${mode}"`);
|
|
23
|
+
const kem = encapsulate(recipient, 2);
|
|
24
|
+
const key = keyFor(kem.sharedSecret, mode);
|
|
25
|
+
const body = mode === 'cascade' ? cascadeEncrypt(key, plaintext, opts.aad) : aeadEncrypt(key, plaintext, opts.aad);
|
|
26
|
+
return { version: 2, mode, kem: kem.ciphertext, nonce: body.nonce, ciphertext: body.ciphertext };
|
|
27
|
+
}
|
|
28
|
+
export function open(recipient, msg, opts = {}) {
|
|
29
|
+
if (msg.version !== 2)
|
|
30
|
+
throw new Error(`open: unsupported sealed-message version ${msg.version}`);
|
|
31
|
+
const ss = decapsulate(recipient, msg.kem, 2);
|
|
32
|
+
const key = keyFor(ss, msg.mode);
|
|
33
|
+
if (msg.mode === 'cascade')
|
|
34
|
+
return cascadeDecrypt(key, { nonce: msg.nonce, ciphertext: msg.ciphertext }, opts.aad);
|
|
35
|
+
if (msg.mode === 'aes-256-gcm') {
|
|
36
|
+
return aeadDecrypt(key, { nonce: msg.nonce, ciphertext: msg.ciphertext, ...(opts.aad ? { associatedData: opts.aad } : {}) });
|
|
37
|
+
}
|
|
38
|
+
throw new Error(`open: unknown mode "${msg.mode}"`);
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=sealed.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sealed.js","sourceRoot":"","sources":["../src/sealed.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACpD,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAChC,OAAO,EAAE,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C,CAAC;IAClG,MAAM,EAAE,GAAG,WAAW,CAAC,SAAS,EAAE,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;IAC9C,MAAM,GAAG,GAAG,MAAM,CAAC,EAAE,EAAE,GAAG,CAAC,IAAI,CAAC,CAAC;IACjC,IAAI,GAAG,CAAC,IAAI,KAAK,SAAS;QAAE,OAAO,cAAc,CAAC,GAAG,EAAE,EAAE,KAAK,EAAE,GAAG,CAAC,KAAK,EAAE,UAAU,EAAE,GAAG,CAAC,UAAU,EAAE,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC;IACnH,IAAI,GAAG,CAAC,IAAI,KAAK,aAAa,EAAE,CAAC;QAC/B,OAAO,WAAW,CAAC,GAAG,EAAE,EAAE,KAAK,EAAE,GAAG,CAAC,KAAK,EAAE,UAAU,EAAE,GAAG,CAAC,UAAU,EAAE,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,cAAc,EAAE,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;IAC/H,CAAC;IACD,MAAM,IAAI,KAAK,CAAC,uBAAwB,GAAqB,CAAC,IAAI,GAAG,CAAC,CAAC;AACzE,CAAC"}
|
package/dist/serialize.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Legacy wire format yoxall/0.1.0-beta.0 (keys, KEM ciphertexts, payloads).
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
* Key envelopes are unchanged in yoxall/2. The KEM-ciphertext and payload
|
|
5
|
+
* envelopes are kept so v0.1 data stays readable; new data uses the
|
|
6
|
+
* locked yoxall/2 envelopes in wire.ts (spec: WIRE_FORMAT.md).
|
|
7
7
|
*
|
|
8
8
|
* Current format: base64url-encoded JSON envelopes with explicit
|
|
9
9
|
* versioning. Simple, debuggable, forward-compatible via version tag.
|
package/dist/serialize.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Legacy wire format yoxall/0.1.0-beta.0 (keys, KEM ciphertexts, payloads).
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
* Key envelopes are unchanged in yoxall/2. The KEM-ciphertext and payload
|
|
5
|
+
* envelopes are kept so v0.1 data stays readable; new data uses the
|
|
6
|
+
* locked yoxall/2 envelopes in wire.ts (spec: WIRE_FORMAT.md).
|
|
7
7
|
*
|
|
8
8
|
* Current format: base64url-encoded JSON envelopes with explicit
|
|
9
9
|
* versioning. Simple, debuggable, forward-compatible via version tag.
|
package/dist/types.d.ts
CHANGED
package/dist/types.js
CHANGED
package/dist/v1-compat.d.ts
CHANGED
|
@@ -1,19 +1,37 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Yoxallismus v1
|
|
2
|
+
* Yoxallismus v1 (Hord's YoxallismusCipher): detection only.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
* embedded in @weave_protocol/hord. It was never published as a
|
|
6
|
-
* standalone package with a wire format spec.
|
|
4
|
+
* Planned as a read-only decoder, but v1 payloads cannot be decrypted:
|
|
7
5
|
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* -
|
|
6
|
+
* - lock() derives its XOR mask from HMAC(deadboltKey, seed), where
|
|
7
|
+
* seed = SHA-256(tumblerKey ‖ SHA-256(plaintext)). The seed depends on
|
|
8
|
+
* the plaintext and only its first 1-12 bytes reach the header (as
|
|
9
|
+
* tumbler positions, already advanced during encryption).
|
|
10
|
+
* - unlock() rebuilds the mask from the header bytes instead, so Hord's
|
|
11
|
+
* own unlock() never round-trips, and no decoder with the key can
|
|
12
|
+
* recover the remaining 20+ seed bytes short of brute force.
|
|
13
13
|
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
14
|
+
* See SECURITY_ADVISORIES.md YOXALL-2026-003. v1 was also never an
|
|
15
|
+
* encryption scheme: no authentication, deterministic, and permutation
|
|
16
|
+
* plus XOR rather than a cipher. Re-encrypt from the original plaintext
|
|
17
|
+
* with seal() instead.
|
|
17
18
|
*/
|
|
18
|
-
export
|
|
19
|
+
export interface V1HeaderInfo {
|
|
20
|
+
version: 1;
|
|
21
|
+
tumblers: number;
|
|
22
|
+
entropyRatio: number;
|
|
23
|
+
revolving: boolean;
|
|
24
|
+
payloadBytes: number;
|
|
25
|
+
}
|
|
26
|
+
export declare class V1PayloadUnrecoverableError extends Error {
|
|
27
|
+
readonly info: V1HeaderInfo;
|
|
28
|
+
constructor(info: V1HeaderInfo);
|
|
29
|
+
}
|
|
30
|
+
/** Parse a v1 header, or return null if the bytes aren't a v1 payload. */
|
|
31
|
+
export declare function inspectV1(payload: Uint8Array): V1HeaderInfo | null;
|
|
32
|
+
/**
|
|
33
|
+
* Kept for API compatibility. Identifies v1 payloads and always throws:
|
|
34
|
+
* V1PayloadUnrecoverableError for genuine v1 data, Error otherwise.
|
|
35
|
+
*/
|
|
36
|
+
export declare function readV1(payload: Uint8Array | string, _oldKey?: unknown): never;
|
|
19
37
|
//# sourceMappingURL=v1-compat.d.ts.map
|
package/dist/v1-compat.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"v1-compat.d.ts","sourceRoot":"","sources":["../src/v1-compat.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"v1-compat.d.ts","sourceRoot":"","sources":["../src/v1-compat.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,CAAC,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,OAAO,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,qBAAa,2BAA4B,SAAQ,KAAK;aACxB,IAAI,EAAE,YAAY;gBAAlB,IAAI,EAAE,YAAY;CAU/C;AAED,0EAA0E;AAC1E,wBAAgB,SAAS,CAAC,OAAO,EAAE,UAAU,GAAG,YAAY,GAAG,IAAI,CAYlE;AAED;;;GAGG;AACH,wBAAgB,MAAM,CAAC,OAAO,EAAE,UAAU,GAAG,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,GAAG,KAAK,CAK7E"}
|