@cello-protocol/crypto 0.0.7 → 0.0.9
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/dist/consortium-keys.d.ts +32 -0
- package/dist/consortium-keys.d.ts.map +1 -0
- package/dist/consortium-keys.js +48 -0
- package/dist/consortium-keys.js.map +1 -0
- package/dist/content-seal.d.ts +46 -0
- package/dist/content-seal.d.ts.map +1 -0
- package/dist/content-seal.js +123 -0
- package/dist/content-seal.js.map +1 -0
- package/dist/ed25519.d.ts +4 -0
- package/dist/ed25519.d.ts.map +1 -1
- package/dist/ed25519.js +9 -0
- package/dist/ed25519.js.map +1 -1
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -1
- package/dist/manifest-test-fixture.d.ts +59 -0
- package/dist/manifest-test-fixture.d.ts.map +1 -0
- package/dist/manifest-test-fixture.js +71 -0
- package/dist/manifest-test-fixture.js.map +1 -0
- package/dist/manifest.d.ts +89 -0
- package/dist/manifest.d.ts.map +1 -0
- package/dist/manifest.js +170 -0
- package/dist/manifest.js.map +1 -0
- package/dist/types.d.ts +8 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* M7-MANIFEST-001 — Consortium officer root key constants.
|
|
3
|
+
*
|
|
4
|
+
* These Ed25519 public keys are the root of trust for consortium manifest
|
|
5
|
+
* threshold signatures. A manifest is valid only if at least CONSORTIUM_THRESHOLD
|
|
6
|
+
* unique officer keys have signed it.
|
|
7
|
+
*
|
|
8
|
+
* Production keys are placeholder zeros until the initial key ceremony is
|
|
9
|
+
* conducted. Test keys are derived from deterministic seeds defined in
|
|
10
|
+
* manifest-test-fixture.ts (AC-011).
|
|
11
|
+
*
|
|
12
|
+
* Crypto reference: RFC 8032 (Ed25519).
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* Production consortium officer root keys.
|
|
16
|
+
*
|
|
17
|
+
* Pre-ceremony placeholder: all zeros. These will be replaced with real
|
|
18
|
+
* Ed25519 public keys after the initial officer key ceremony is conducted.
|
|
19
|
+
* Until then, no production manifest can pass verification — this is by design.
|
|
20
|
+
*/
|
|
21
|
+
export declare const CONSORTIUM_ROOT_KEYS: readonly [string, string, string, string, string];
|
|
22
|
+
/** Minimum number of valid officer signatures required for manifest acceptance. */
|
|
23
|
+
export declare const CONSORTIUM_THRESHOLD = 3;
|
|
24
|
+
/**
|
|
25
|
+
* Test consortium officer root keys — real Ed25519 public keys derived from
|
|
26
|
+
* deterministic fixed seeds in manifest-test-fixture.ts. Completely disjoint
|
|
27
|
+
* from production keys (SI-003).
|
|
28
|
+
*/
|
|
29
|
+
export declare const TEST_CONSORTIUM_ROOT_KEYS: readonly [string, string, string, string, string];
|
|
30
|
+
/** Test threshold — same as production for realistic test coverage. */
|
|
31
|
+
export declare const TEST_CONSORTIUM_THRESHOLD = 3;
|
|
32
|
+
//# sourceMappingURL=consortium-keys.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"consortium-keys.d.ts","sourceRoot":"","sources":["../src/consortium-keys.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAOH;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB,EAAE,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAMzE,CAAC;AAEX,mFAAmF;AACnF,eAAO,MAAM,oBAAoB,IAAI,CAAC;AAItC;;;;GAIG;AACH,eAAO,MAAM,yBAAyB,EAAE,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAM9E,CAAC;AAEX,uEAAuE;AACvE,eAAO,MAAM,yBAAyB,IAAI,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* M7-MANIFEST-001 — Consortium officer root key constants.
|
|
3
|
+
*
|
|
4
|
+
* These Ed25519 public keys are the root of trust for consortium manifest
|
|
5
|
+
* threshold signatures. A manifest is valid only if at least CONSORTIUM_THRESHOLD
|
|
6
|
+
* unique officer keys have signed it.
|
|
7
|
+
*
|
|
8
|
+
* Production keys are placeholder zeros until the initial key ceremony is
|
|
9
|
+
* conducted. Test keys are derived from deterministic seeds defined in
|
|
10
|
+
* manifest-test-fixture.ts (AC-011).
|
|
11
|
+
*
|
|
12
|
+
* Crypto reference: RFC 8032 (Ed25519).
|
|
13
|
+
*/
|
|
14
|
+
import { ed25519 } from "@noble/curves/ed25519.js";
|
|
15
|
+
import { TEST_OFFICER_SEEDS } from "./manifest-test-fixture.js";
|
|
16
|
+
// ─── Production constants ────────────────────────────────────────────────────
|
|
17
|
+
/**
|
|
18
|
+
* Production consortium officer root keys.
|
|
19
|
+
*
|
|
20
|
+
* Pre-ceremony placeholder: all zeros. These will be replaced with real
|
|
21
|
+
* Ed25519 public keys after the initial officer key ceremony is conducted.
|
|
22
|
+
* Until then, no production manifest can pass verification — this is by design.
|
|
23
|
+
*/
|
|
24
|
+
export const CONSORTIUM_ROOT_KEYS = [
|
|
25
|
+
"0".repeat(64),
|
|
26
|
+
"0".repeat(64),
|
|
27
|
+
"0".repeat(64),
|
|
28
|
+
"0".repeat(64),
|
|
29
|
+
"0".repeat(64),
|
|
30
|
+
];
|
|
31
|
+
/** Minimum number of valid officer signatures required for manifest acceptance. */
|
|
32
|
+
export const CONSORTIUM_THRESHOLD = 3;
|
|
33
|
+
// ─── Test constants ──────────────────────────────────────────────────────────
|
|
34
|
+
/**
|
|
35
|
+
* Test consortium officer root keys — real Ed25519 public keys derived from
|
|
36
|
+
* deterministic fixed seeds in manifest-test-fixture.ts. Completely disjoint
|
|
37
|
+
* from production keys (SI-003).
|
|
38
|
+
*/
|
|
39
|
+
export const TEST_CONSORTIUM_ROOT_KEYS = [
|
|
40
|
+
Buffer.from(ed25519.getPublicKey(TEST_OFFICER_SEEDS[0])).toString("hex"),
|
|
41
|
+
Buffer.from(ed25519.getPublicKey(TEST_OFFICER_SEEDS[1])).toString("hex"),
|
|
42
|
+
Buffer.from(ed25519.getPublicKey(TEST_OFFICER_SEEDS[2])).toString("hex"),
|
|
43
|
+
Buffer.from(ed25519.getPublicKey(TEST_OFFICER_SEEDS[3])).toString("hex"),
|
|
44
|
+
Buffer.from(ed25519.getPublicKey(TEST_OFFICER_SEEDS[4])).toString("hex"),
|
|
45
|
+
];
|
|
46
|
+
/** Test threshold — same as production for realistic test coverage. */
|
|
47
|
+
export const TEST_CONSORTIUM_THRESHOLD = 3;
|
|
48
|
+
//# sourceMappingURL=consortium-keys.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"consortium-keys.js","sourceRoot":"","sources":["../src/consortium-keys.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AACnD,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAEhE,gFAAgF;AAEhF;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAsD;IACrF,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC;IACd,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC;IACd,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC;IACd,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC;IACd,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC;CACN,CAAC;AAEX,mFAAmF;AACnF,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC;AAEtC,gFAAgF;AAEhF;;;;GAIG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAsD;IAC1F,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC;IACxE,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC;IACxE,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC;IACxE,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC;IACxE,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC;CAChE,CAAC;AAEX,uEAAuE;AACvE,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CELLO-M7-MSG-001 — recipient content sealed box.
|
|
3
|
+
*
|
|
4
|
+
* E2E-encrypts a content blob to a recipient's stable Ed25519 identity key so that
|
|
5
|
+
* the relay store-and-forward queue holds only ciphertext it cannot read (SI-001).
|
|
6
|
+
*
|
|
7
|
+
* The relay never has any decryption key. Only the holder of the recipient's
|
|
8
|
+
* Ed25519 identity seed can open the blob.
|
|
9
|
+
*
|
|
10
|
+
* ─── Construction ────────────────────────────────────────────────────────────
|
|
11
|
+
*
|
|
12
|
+
* Pseudocode (SPARC Phase P):
|
|
13
|
+
*
|
|
14
|
+
* sealToRecipient(recipientEd25519Pub, plaintext):
|
|
15
|
+
* 1. uPub = edwardsToMontgomery(recipientEd25519Pub) # RFC 7748 §4.1 map
|
|
16
|
+
* 2. ephSk = random X25519 secret # RFC 7748
|
|
17
|
+
* ephPk = X25519 base * ephSk
|
|
18
|
+
* 3. shared = X25519(ephSk, uPub) # ephemeral-static ECDH
|
|
19
|
+
* 4. key = HKDF-SHA256(ikm=shared, salt=ephPk,
|
|
20
|
+
* info="cello-content-park-v1", 32) # RFC 5869
|
|
21
|
+
* 5. iv = random 12 bytes
|
|
22
|
+
* ct||tag = AES-256-GCM(key, iv, plaintext) # NIST SP 800-38D
|
|
23
|
+
* 6. blob = ephPk(32) || iv(12) || ct || tag(16)
|
|
24
|
+
*
|
|
25
|
+
* openSealed(recipientEd25519Seed, blob):
|
|
26
|
+
* 1. ephPk, iv, ctAndTag = split(blob)
|
|
27
|
+
* 2. montSk = clamp(SHA-512(seed)[0:32]) # ed25519 → x25519 scalar
|
|
28
|
+
* 3. shared = X25519(montSk, ephPk)
|
|
29
|
+
* 4. key = HKDF-SHA256(ikm=shared, salt=ephPk, info=..., 32)
|
|
30
|
+
* 5. plaintext = AES-256-GCM-decrypt(key, iv, ct, tag) # null on auth failure
|
|
31
|
+
*
|
|
32
|
+
* Correctness of the Ed25519→X25519 conversion is verified by the round-trip test:
|
|
33
|
+
* the sender converts the recipient's Ed25519 *public* key to a Montgomery
|
|
34
|
+
* u-coordinate; the recipient derives the matching Montgomery *scalar* from its
|
|
35
|
+
* Ed25519 seed; ECDH on both sides yields the same shared secret (RFC 7748 §4.1).
|
|
36
|
+
*/
|
|
37
|
+
/** Fixed bytes prepended before the AEAD ciphertext: ephemeral pubkey + IV. */
|
|
38
|
+
export declare const CONTENT_SEAL_OVERHEAD_BYTES: number;
|
|
39
|
+
/** Encrypt `plaintext` to a recipient identified by their Ed25519 public key. */
|
|
40
|
+
export declare function sealToRecipient(recipientEd25519Pub: Uint8Array, plaintext: Uint8Array): Uint8Array;
|
|
41
|
+
/**
|
|
42
|
+
* Decrypt a sealed blob using the recipient's Ed25519 identity seed.
|
|
43
|
+
* Returns null on any failure (wrong key, tamper, malformed) — never throws.
|
|
44
|
+
*/
|
|
45
|
+
export declare function openSealed(recipientEd25519Seed: Uint8Array, blob: Uint8Array): Uint8Array | null;
|
|
46
|
+
//# sourceMappingURL=content-seal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"content-seal.d.ts","sourceRoot":"","sources":["../src/content-seal.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAaH,+EAA+E;AAC/E,eAAO,MAAM,2BAA2B,QAA2B,CAAC;AAsCpE,iFAAiF;AACjF,wBAAgB,eAAe,CAAC,mBAAmB,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,GAAG,UAAU,CAiBlG;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,oBAAoB,EAAE,UAAU,EAAE,IAAI,EAAE,UAAU,GAAG,UAAU,GAAG,IAAI,CAoBhG"}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CELLO-M7-MSG-001 — recipient content sealed box.
|
|
3
|
+
*
|
|
4
|
+
* E2E-encrypts a content blob to a recipient's stable Ed25519 identity key so that
|
|
5
|
+
* the relay store-and-forward queue holds only ciphertext it cannot read (SI-001).
|
|
6
|
+
*
|
|
7
|
+
* The relay never has any decryption key. Only the holder of the recipient's
|
|
8
|
+
* Ed25519 identity seed can open the blob.
|
|
9
|
+
*
|
|
10
|
+
* ─── Construction ────────────────────────────────────────────────────────────
|
|
11
|
+
*
|
|
12
|
+
* Pseudocode (SPARC Phase P):
|
|
13
|
+
*
|
|
14
|
+
* sealToRecipient(recipientEd25519Pub, plaintext):
|
|
15
|
+
* 1. uPub = edwardsToMontgomery(recipientEd25519Pub) # RFC 7748 §4.1 map
|
|
16
|
+
* 2. ephSk = random X25519 secret # RFC 7748
|
|
17
|
+
* ephPk = X25519 base * ephSk
|
|
18
|
+
* 3. shared = X25519(ephSk, uPub) # ephemeral-static ECDH
|
|
19
|
+
* 4. key = HKDF-SHA256(ikm=shared, salt=ephPk,
|
|
20
|
+
* info="cello-content-park-v1", 32) # RFC 5869
|
|
21
|
+
* 5. iv = random 12 bytes
|
|
22
|
+
* ct||tag = AES-256-GCM(key, iv, plaintext) # NIST SP 800-38D
|
|
23
|
+
* 6. blob = ephPk(32) || iv(12) || ct || tag(16)
|
|
24
|
+
*
|
|
25
|
+
* openSealed(recipientEd25519Seed, blob):
|
|
26
|
+
* 1. ephPk, iv, ctAndTag = split(blob)
|
|
27
|
+
* 2. montSk = clamp(SHA-512(seed)[0:32]) # ed25519 → x25519 scalar
|
|
28
|
+
* 3. shared = X25519(montSk, ephPk)
|
|
29
|
+
* 4. key = HKDF-SHA256(ikm=shared, salt=ephPk, info=..., 32)
|
|
30
|
+
* 5. plaintext = AES-256-GCM-decrypt(key, iv, ct, tag) # null on auth failure
|
|
31
|
+
*
|
|
32
|
+
* Correctness of the Ed25519→X25519 conversion is verified by the round-trip test:
|
|
33
|
+
* the sender converts the recipient's Ed25519 *public* key to a Montgomery
|
|
34
|
+
* u-coordinate; the recipient derives the matching Montgomery *scalar* from its
|
|
35
|
+
* Ed25519 seed; ECDH on both sides yields the same shared secret (RFC 7748 §4.1).
|
|
36
|
+
*/
|
|
37
|
+
import { ed25519, x25519 } from "@noble/curves/ed25519.js";
|
|
38
|
+
import { hkdf } from "@noble/hashes/hkdf.js";
|
|
39
|
+
import { sha256 } from "@noble/hashes/sha2.js";
|
|
40
|
+
import { sha512 } from "@noble/hashes/sha2.js";
|
|
41
|
+
import { createCipheriv, createDecipheriv, randomBytes } from "node:crypto";
|
|
42
|
+
const EPH_PUB_BYTES = 32;
|
|
43
|
+
const IV_BYTES = 12;
|
|
44
|
+
const TAG_BYTES = 16;
|
|
45
|
+
const KEY_BYTES = 32;
|
|
46
|
+
/** Fixed bytes prepended before the AEAD ciphertext: ephemeral pubkey + IV. */
|
|
47
|
+
export const CONTENT_SEAL_OVERHEAD_BYTES = EPH_PUB_BYTES + IV_BYTES;
|
|
48
|
+
const HKDF_INFO = new TextEncoder().encode("cello-content-park-v1");
|
|
49
|
+
const Fp = ed25519.Point.Fp;
|
|
50
|
+
/**
|
|
51
|
+
* Convert an Ed25519 public key (Edwards y) to a Montgomery u-coordinate
|
|
52
|
+
* (RFC 7748 §4.1): u = (1 + y) / (1 - y) mod p.
|
|
53
|
+
* Returns null if the point is invalid or maps to the singular point (y == 1).
|
|
54
|
+
*/
|
|
55
|
+
function edwardsPubToMontgomeryU(edPub) {
|
|
56
|
+
try {
|
|
57
|
+
const pt = ed25519.Point.fromBytes(edPub);
|
|
58
|
+
const y = pt.toAffine().y;
|
|
59
|
+
const denom = Fp.sub(Fp.ONE, y);
|
|
60
|
+
if (Fp.is0(denom))
|
|
61
|
+
return null;
|
|
62
|
+
const u = Fp.div(Fp.add(Fp.ONE, y), denom);
|
|
63
|
+
return Fp.toBytes(u);
|
|
64
|
+
}
|
|
65
|
+
catch {
|
|
66
|
+
return null;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Derive the X25519 (Montgomery) scalar from an Ed25519 seed, per RFC 8032 §5.1.5
|
|
71
|
+
* key-derivation + RFC 7748 clamping. This is the same scalar Ed25519 uses, which
|
|
72
|
+
* is birationally compatible with the public-key conversion above.
|
|
73
|
+
*/
|
|
74
|
+
function ed25519SeedToMontgomeryScalar(seed) {
|
|
75
|
+
const h = sha512(seed.subarray(0, 32));
|
|
76
|
+
const s = h.slice(0, 32);
|
|
77
|
+
s[0] &= 248;
|
|
78
|
+
s[31] &= 127;
|
|
79
|
+
s[31] |= 64;
|
|
80
|
+
return s;
|
|
81
|
+
}
|
|
82
|
+
/** Encrypt `plaintext` to a recipient identified by their Ed25519 public key. */
|
|
83
|
+
export function sealToRecipient(recipientEd25519Pub, plaintext) {
|
|
84
|
+
const uPub = edwardsPubToMontgomeryU(recipientEd25519Pub);
|
|
85
|
+
if (!uPub) {
|
|
86
|
+
throw new Error("content-seal: invalid recipient Ed25519 public key");
|
|
87
|
+
}
|
|
88
|
+
const ephSk = x25519.utils.randomSecretKey();
|
|
89
|
+
const ephPk = x25519.getPublicKey(ephSk);
|
|
90
|
+
const shared = x25519.getSharedSecret(ephSk, uPub);
|
|
91
|
+
const key = hkdf(sha256, shared, ephPk, HKDF_INFO, KEY_BYTES);
|
|
92
|
+
const iv = new Uint8Array(randomBytes(IV_BYTES));
|
|
93
|
+
const cipher = createCipheriv("aes-256-gcm", Buffer.from(key), Buffer.from(iv));
|
|
94
|
+
const ct = Buffer.concat([cipher.update(Buffer.from(plaintext)), cipher.final()]);
|
|
95
|
+
const tag = cipher.getAuthTag();
|
|
96
|
+
return new Uint8Array(Buffer.concat([Buffer.from(ephPk), Buffer.from(iv), ct, tag]));
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Decrypt a sealed blob using the recipient's Ed25519 identity seed.
|
|
100
|
+
* Returns null on any failure (wrong key, tamper, malformed) — never throws.
|
|
101
|
+
*/
|
|
102
|
+
export function openSealed(recipientEd25519Seed, blob) {
|
|
103
|
+
if (blob.length < CONTENT_SEAL_OVERHEAD_BYTES + TAG_BYTES)
|
|
104
|
+
return null;
|
|
105
|
+
try {
|
|
106
|
+
const ephPk = blob.subarray(0, EPH_PUB_BYTES);
|
|
107
|
+
const iv = blob.subarray(EPH_PUB_BYTES, EPH_PUB_BYTES + IV_BYTES);
|
|
108
|
+
const ctAndTag = blob.subarray(EPH_PUB_BYTES + IV_BYTES);
|
|
109
|
+
const ct = ctAndTag.subarray(0, ctAndTag.length - TAG_BYTES);
|
|
110
|
+
const tag = ctAndTag.subarray(ctAndTag.length - TAG_BYTES);
|
|
111
|
+
const montSk = ed25519SeedToMontgomeryScalar(recipientEd25519Seed);
|
|
112
|
+
const shared = x25519.getSharedSecret(montSk, ephPk);
|
|
113
|
+
const key = hkdf(sha256, shared, ephPk, HKDF_INFO, KEY_BYTES);
|
|
114
|
+
const decipher = createDecipheriv("aes-256-gcm", Buffer.from(key), Buffer.from(iv));
|
|
115
|
+
decipher.setAuthTag(Buffer.from(tag));
|
|
116
|
+
const pt = Buffer.concat([decipher.update(Buffer.from(ct)), decipher.final()]);
|
|
117
|
+
return new Uint8Array(pt);
|
|
118
|
+
}
|
|
119
|
+
catch {
|
|
120
|
+
return null;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
//# sourceMappingURL=content-seal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"content-seal.js","sourceRoot":"","sources":["../src/content-seal.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAC7C,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE5E,MAAM,aAAa,GAAG,EAAE,CAAC;AACzB,MAAM,QAAQ,GAAG,EAAE,CAAC;AACpB,MAAM,SAAS,GAAG,EAAE,CAAC;AACrB,MAAM,SAAS,GAAG,EAAE,CAAC;AAErB,+EAA+E;AAC/E,MAAM,CAAC,MAAM,2BAA2B,GAAG,aAAa,GAAG,QAAQ,CAAC;AAEpE,MAAM,SAAS,GAAG,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,uBAAuB,CAAC,CAAC;AAEpE,MAAM,EAAE,GAAG,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;AAE5B;;;;GAIG;AACH,SAAS,uBAAuB,CAAC,KAAiB;IAChD,IAAI,CAAC;QACH,MAAM,EAAE,GAAG,OAAO,CAAC,KAAK,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;QAC1C,MAAM,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC;QAC1B,MAAM,KAAK,GAAG,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;QAChC,IAAI,EAAE,C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AAC,QAAQ,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;QAE3D,MAAM,MAAM,GAAG,6BAA6B,CAAC,oBAAoB,CAAC,CAAC;QACnE,MAAM,MAAM,GAAG,MAAM,CAAC,eAAe,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;QACrD,MAAM,GAAG,GAAG,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC;QAE9D,MAAM,QAAQ,GAAG,gBAAgB,CAAC,aAAa,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;QACpF,QAAQ,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;QACtC,MAAM,EAAE,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,EAAE,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;QAC/E,OAAO,IAAI,UAAU,CAAC,EAAE,CAAC,CAAC;IAC5B,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC"}
|
package/dist/ed25519.d.ts
CHANGED
|
@@ -5,6 +5,8 @@ export declare class InMemoryKeyProvider implements KeyProvider {
|
|
|
5
5
|
constructor(seed: Uint8Array);
|
|
6
6
|
getPublicKey(): Promise<PublicKey>;
|
|
7
7
|
sign(data: Uint8Array): Promise<Signature>;
|
|
8
|
+
/** CELLO-M7-MSG-001: open a content-park sealed blob addressed to this identity key. */
|
|
9
|
+
openContentSeal(blob: Uint8Array): Promise<Uint8Array | null>;
|
|
8
10
|
toJSON(): Record<string, string>;
|
|
9
11
|
toString(): string;
|
|
10
12
|
[INSPECT](): string;
|
|
@@ -15,6 +17,8 @@ export declare class FileKeyProvider implements KeyProvider {
|
|
|
15
17
|
static load(path: string): Promise<FileKeyProvider>;
|
|
16
18
|
getPublicKey(): Promise<PublicKey>;
|
|
17
19
|
sign(data: Uint8Array): Promise<Signature>;
|
|
20
|
+
/** CELLO-M7-MSG-001: open a content-park sealed blob addressed to this identity key. */
|
|
21
|
+
openContentSeal(blob: Uint8Array): Promise<Uint8Array | null>;
|
|
18
22
|
toJSON(): Record<string, unknown>;
|
|
19
23
|
toString(): string;
|
|
20
24
|
[INSPECT](): string;
|
package/dist/ed25519.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ed25519.d.ts","sourceRoot":"","sources":["../src/ed25519.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"ed25519.d.ts","sourceRoot":"","sources":["../src/ed25519.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAGpE,QAAA,MAAM,OAAO,eAA2C,CAAC;AAOzD,qBAAa,mBAAoB,YAAW,WAAW;;gBAIzC,IAAI,EAAE,UAAU;IAMtB,YAAY,IAAI,OAAO,CAAC,SAAS,CAAC;IAIlC,IAAI,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,SAAS,CAAC;IAIhD,wFAAwF;IAClF,eAAe,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC;IAInE,MAAM,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IAIhC,QAAQ,IAAI,MAAM;IAIlB,CAAC,OAAO,CAAC,IAAI,MAAM;CAGpB;AAED,qBAAa,eAAgB,YAAW,WAAW;;IAGjD,OAAO;WAIM,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC;IAuDnD,YAAY,IAAI,OAAO,CAAC,SAAS,CAAC;IAIlC,IAAI,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,SAAS,CAAC;IAIhD,wFAAwF;IAClF,eAAe,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC;IAInE,MAAM,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAIjC,QAAQ,IAAI,MAAM;IAIlB,CAAC,OAAO,CAAC,IAAI,MAAM;CAGpB;AAED,wBAAgB,eAAe,IAAI,mBAAmB,CAErD;AAED,wBAAgB,MAAM,CAAC,SAAS,EAAE,SAAS,EAAE,IAAI,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,GAAG,OAAO,CAM5F"}
|
package/dist/ed25519.js
CHANGED
|
@@ -2,6 +2,7 @@ import { ed25519 } from "@noble/curves/ed25519.js";
|
|
|
2
2
|
import { randomBytes } from "@noble/hashes/utils.js";
|
|
3
3
|
import { readFile, rename, mkdir, open as fsOpen } from "node:fs/promises";
|
|
4
4
|
import { dirname, join } from "node:path";
|
|
5
|
+
import { openSealed } from "./content-seal.js";
|
|
5
6
|
const INSPECT = Symbol.for("nodejs.util.inspect.custom");
|
|
6
7
|
const KEY_FILE_MAGIC = new Uint8Array([0xce, 0x11, 0x0e, 0x01]); // "CELLO\x01"
|
|
7
8
|
const KEY_FILE_VERSION = 1;
|
|
@@ -23,6 +24,10 @@ export class InMemoryKeyProvider {
|
|
|
23
24
|
async sign(data) {
|
|
24
25
|
return ed25519.sign(data, this.#seed);
|
|
25
26
|
}
|
|
27
|
+
/** CELLO-M7-MSG-001: open a content-park sealed blob addressed to this identity key. */
|
|
28
|
+
async openContentSeal(blob) {
|
|
29
|
+
return openSealed(this.#seed, blob);
|
|
30
|
+
}
|
|
26
31
|
toJSON() {
|
|
27
32
|
return { type: "InMemoryKeyProvider", publicKey: Buffer.from(this.#publicKey).toString("hex") };
|
|
28
33
|
}
|
|
@@ -96,6 +101,10 @@ export class FileKeyProvider {
|
|
|
96
101
|
async sign(data) {
|
|
97
102
|
return this.#inner.sign(data);
|
|
98
103
|
}
|
|
104
|
+
/** CELLO-M7-MSG-001: open a content-park sealed blob addressed to this identity key. */
|
|
105
|
+
async openContentSeal(blob) {
|
|
106
|
+
return this.#inner.openContentSeal(blob);
|
|
107
|
+
}
|
|
99
108
|
toJSON() {
|
|
100
109
|
return { type: "FileKeyProvider", publicKey: this.#inner.toJSON().publicKey };
|
|
101
110
|
}
|
package/dist/ed25519.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ed25519.js","sourceRoot":"","sources":["../src/ed25519.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,IAAI,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC3E,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"ed25519.js","sourceRoot":"","sources":["../src/ed25519.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,IAAI,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC3E,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAE1C,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAE/C,MAAM,OAAO,GAAG,MAAM,CAAC,GAAG,CAAC,4BAA4B,CAAC,CAAC;AACzD,MAAM,cAAc,GAAG,IAAI,UAAU,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC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AE,IAAI,EAAE,SAAS,CAAC,CAAC;IACpD,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -11,4 +11,10 @@ export { verifyFrostSignature } from "./frost/frost-threshold-signer.js";
|
|
|
11
11
|
export { ed25519_FROST } from "@noble/curves/ed25519.js";
|
|
12
12
|
export { buildCheckpointTbs, computeCheckpointHash } from "./checkpoint.js";
|
|
13
13
|
export { buildRelayRegistrationTbs, verifyRelayRegistrationSignature } from "./relay-registration.js";
|
|
14
|
+
export { sealToRecipient, openSealed, CONTENT_SEAL_OVERHEAD_BYTES } from "./content-seal.js";
|
|
15
|
+
export type { ManifestVerifyResult, ManifestVerifyDiagnostics, ManifestVerifySkipReason, ManifestVerifySkippedEntry, ConsortiumManifestInput } from "./manifest.js";
|
|
16
|
+
export { canonicalManifestBody, verifyManifest } from "./manifest.js";
|
|
17
|
+
export { CONSORTIUM_ROOT_KEYS, CONSORTIUM_THRESHOLD, TEST_CONSORTIUM_ROOT_KEYS, TEST_CONSORTIUM_THRESHOLD, } from "./consortium-keys.js";
|
|
18
|
+
export type { TestConsortiumNode, MakeTestManifestOpts } from "./manifest-test-fixture.js";
|
|
19
|
+
export { makeTestManifest, TEST_DIRECTORY_NODE_KEYPAIR } from "./manifest-test-fixture.js";
|
|
14
20
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,WAAW,EAAE,SAAS,EAAE,SAAS,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AACzF,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAC7F,YAAY,EAAE,cAAc,EAAE,cAAc,EAAE,YAAY,EAAE,gB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CAAC;AAC3F,OAAO,EAAE,gBAAgB,EAAE,2BAA2B,EAAE,MAAM,4BAA4B,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -11,4 +11,9 @@ export { ed25519_FROST } from "@noble/curves/ed25519.js";
|
|
|
11
11
|
export { buildCheckpointTbs, computeCheckpointHash } from "./checkpoint.js";
|
|
12
12
|
// FEDERATION-003: relay registration TBS and signature verification
|
|
13
13
|
export { buildRelayRegistrationTbs, verifyRelayRegistrationSignature } from "./relay-registration.js";
|
|
14
|
+
// M7-MSG-001: recipient content sealed box (E2E encryption for parked content)
|
|
15
|
+
export { sealToRecipient, openSealed, CONTENT_SEAL_OVERHEAD_BYTES } from "./content-seal.js";
|
|
16
|
+
export { canonicalManifestBody, verifyManifest } from "./manifest.js";
|
|
17
|
+
export { CONSORTIUM_ROOT_KEYS, CONSORTIUM_THRESHOLD, TEST_CONSORTIUM_ROOT_KEYS, TEST_CONSORTIUM_THRESHOLD, } from "./consortium-keys.js";
|
|
18
|
+
export { makeTestManifest, TEST_DIRECTORY_NODE_KEYPAIR } from "./manifest-test-fixture.js";
|
|
14
19
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAE7F,OAAO,EACL,wBAAwB,EACxB,oBAAoB,EACpB,WAAW,EACX,oBAAoB,EACpB,SAAS,EACT,WAAW,EACX,iBAAiB,GAClB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,QAAQ,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAE3F,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAU3F,OAA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AAM,yBAAyB,CAAC;AAEtG,+EAA+E;AAC/E,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,2BAA2B,EAAE,MAAM,mBAAmB,CAAC;AAI7F,OAAO,EAAE,qBAAqB,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACtE,OAAO,EACL,oBAAoB,EACpB,oBAAoB,EACpB,yBAAyB,EACzB,yBAAyB,GAC1B,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,gBAAgB,EAAE,2BAA2B,EAAE,MAAM,4BAA4B,CAAC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* M7-MANIFEST-001 / M7-MANIFEST-002 — Test fixture for consortium manifest creation.
|
|
3
|
+
*
|
|
4
|
+
* Provides makeTestManifest() which creates a fully-signed ConsortiumManifest
|
|
5
|
+
* using deterministic test officer keys. The manifest is signed with officer
|
|
6
|
+
* indices 0, 1, 2 (meeting the threshold of 3).
|
|
7
|
+
*
|
|
8
|
+
* The private keys (TEST_OFFICER_SEEDS) are defined here and NOT exported from
|
|
9
|
+
* the package index (AC-011). They are only available via direct import of this
|
|
10
|
+
* file for internal test use.
|
|
11
|
+
*
|
|
12
|
+
* Crypto reference: RFC 8032 (Ed25519).
|
|
13
|
+
*/
|
|
14
|
+
import type { ConsortiumManifestInput } from "./manifest.js";
|
|
15
|
+
/**
|
|
16
|
+
* Deterministic test officer seeds (private keys). Used to derive
|
|
17
|
+
* TEST_CONSORTIUM_ROOT_KEYS and to sign test manifests.
|
|
18
|
+
*
|
|
19
|
+
* NOT exported from the package index — only from this file for internal use.
|
|
20
|
+
*/
|
|
21
|
+
export declare const TEST_OFFICER_SEEDS: readonly [Uint8Array, Uint8Array, Uint8Array, Uint8Array, Uint8Array];
|
|
22
|
+
/** Node entry for makeTestManifest input. Structurally matches ConsortiumNode from protocol-types. */
|
|
23
|
+
export type TestConsortiumNode = {
|
|
24
|
+
nodeId: string;
|
|
25
|
+
pubkey: string;
|
|
26
|
+
region: string;
|
|
27
|
+
provider: "aws" | "gcp" | "azure";
|
|
28
|
+
endpoint: string;
|
|
29
|
+
};
|
|
30
|
+
export interface MakeTestManifestOpts {
|
|
31
|
+
version?: number;
|
|
32
|
+
notBefore?: string;
|
|
33
|
+
expires?: string;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Create a test ConsortiumManifest signed by officers 0, 1, 2.
|
|
37
|
+
*
|
|
38
|
+
* Pseudocode:
|
|
39
|
+
* 1. Build the manifest body with provided nodes and optional overrides.
|
|
40
|
+
* 2. Compute canonical body bytes via canonicalManifestBody.
|
|
41
|
+
* 3. Sign with TEST_OFFICER_SEEDS[0], [1], [2] using Ed25519 (RFC 8032).
|
|
42
|
+
* 4. Return the complete manifest with 3 valid signatures.
|
|
43
|
+
*/
|
|
44
|
+
export declare function makeTestManifest(nodes: TestConsortiumNode[], opts?: MakeTestManifestOpts): ConsortiumManifestInput;
|
|
45
|
+
/**
|
|
46
|
+
* Deterministic test directory node keypair for step-5 challenge signing tests.
|
|
47
|
+
*
|
|
48
|
+
* Derived from SHA-256("cello-test-directory-node-key-0") as a 32-byte seed.
|
|
49
|
+
* This seed is DISTINCT from TEST_OFFICER_SEEDS (0x01..0x05) — it is NOT an
|
|
50
|
+
* officer key. It represents a directory node's per-node Ed25519 signing key.
|
|
51
|
+
*
|
|
52
|
+
* Crypto reference: RFC 8032 (Ed25519).
|
|
53
|
+
* Seed derivation: SHA-256("cello-test-directory-node-key-0") — deterministic.
|
|
54
|
+
*/
|
|
55
|
+
export declare const TEST_DIRECTORY_NODE_KEYPAIR: {
|
|
56
|
+
readonly privateKeyHex: "707a125efaed6d467e8cac1758b3a87af260a5b9c7a6f0d6a74d364c1d5dacd9";
|
|
57
|
+
readonly publicKeyHex: "b93092dd6bf675c00a895abc05503dfd1214a170a2d945d97bab81fd5cfe6a1b";
|
|
58
|
+
};
|
|
59
|
+
//# sourceMappingURL=manifest-test-fixture.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manifest-test-fixture.d.ts","sourceRoot":"","sources":["../src/manifest-test-fixture.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAIH,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAE7D;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,EAAE,SAAS,CAAC,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,CAM3F,CAAC;AAEX,sGAAsG;AACtG,MAAM,MAAM,kBAAkB,GAAG;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,KAAK,GAAG,KAAK,GAAG,OAAO,CAAC;IAClC,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,MAAM,WAAW,oBAAoB;IACnC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,kBAAkB,EAAE,EAC3B,IAAI,CAAC,EAAE,oBAAoB,GAC1B,uBAAuB,CAoBzB;AAID;;;;;;;;;GASG;AACH,eAAO,MAAM,2BAA2B;;;CAG9B,CAAC"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* M7-MANIFEST-001 / M7-MANIFEST-002 — Test fixture for consortium manifest creation.
|
|
3
|
+
*
|
|
4
|
+
* Provides makeTestManifest() which creates a fully-signed ConsortiumManifest
|
|
5
|
+
* using deterministic test officer keys. The manifest is signed with officer
|
|
6
|
+
* indices 0, 1, 2 (meeting the threshold of 3).
|
|
7
|
+
*
|
|
8
|
+
* The private keys (TEST_OFFICER_SEEDS) are defined here and NOT exported from
|
|
9
|
+
* the package index (AC-011). They are only available via direct import of this
|
|
10
|
+
* file for internal test use.
|
|
11
|
+
*
|
|
12
|
+
* Crypto reference: RFC 8032 (Ed25519).
|
|
13
|
+
*/
|
|
14
|
+
import { ed25519 } from "@noble/curves/ed25519.js";
|
|
15
|
+
import { canonicalManifestBody } from "./manifest.js";
|
|
16
|
+
/**
|
|
17
|
+
* Deterministic test officer seeds (private keys). Used to derive
|
|
18
|
+
* TEST_CONSORTIUM_ROOT_KEYS and to sign test manifests.
|
|
19
|
+
*
|
|
20
|
+
* NOT exported from the package index — only from this file for internal use.
|
|
21
|
+
*/
|
|
22
|
+
export const TEST_OFFICER_SEEDS = [
|
|
23
|
+
new Uint8Array(32).fill(0x01),
|
|
24
|
+
new Uint8Array(32).fill(0x02),
|
|
25
|
+
new Uint8Array(32).fill(0x03),
|
|
26
|
+
new Uint8Array(32).fill(0x04),
|
|
27
|
+
new Uint8Array(32).fill(0x05),
|
|
28
|
+
];
|
|
29
|
+
/**
|
|
30
|
+
* Create a test ConsortiumManifest signed by officers 0, 1, 2.
|
|
31
|
+
*
|
|
32
|
+
* Pseudocode:
|
|
33
|
+
* 1. Build the manifest body with provided nodes and optional overrides.
|
|
34
|
+
* 2. Compute canonical body bytes via canonicalManifestBody.
|
|
35
|
+
* 3. Sign with TEST_OFFICER_SEEDS[0], [1], [2] using Ed25519 (RFC 8032).
|
|
36
|
+
* 4. Return the complete manifest with 3 valid signatures.
|
|
37
|
+
*/
|
|
38
|
+
export function makeTestManifest(nodes, opts) {
|
|
39
|
+
const manifest = {
|
|
40
|
+
version: opts?.version ?? 1,
|
|
41
|
+
not_before: opts?.notBefore ?? "2026-01-01T00:00:00Z",
|
|
42
|
+
expires: opts?.expires ?? "2027-01-01T00:00:00Z",
|
|
43
|
+
nodes: nodes,
|
|
44
|
+
signatures: [],
|
|
45
|
+
};
|
|
46
|
+
// Compute canonical body for signing
|
|
47
|
+
const body = canonicalManifestBody(manifest);
|
|
48
|
+
// Sign with officers 0, 1, 2 — meeting threshold of 3
|
|
49
|
+
const signatures = [0, 1, 2].map((idx) => ({
|
|
50
|
+
officerIndex: idx,
|
|
51
|
+
signature: Buffer.from(ed25519.sign(body, TEST_OFFICER_SEEDS[idx])).toString("hex"),
|
|
52
|
+
}));
|
|
53
|
+
manifest.signatures = signatures;
|
|
54
|
+
return manifest;
|
|
55
|
+
}
|
|
56
|
+
// ─── M7-MANIFEST-002: Test directory node keypair ────────────────────────────
|
|
57
|
+
/**
|
|
58
|
+
* Deterministic test directory node keypair for step-5 challenge signing tests.
|
|
59
|
+
*
|
|
60
|
+
* Derived from SHA-256("cello-test-directory-node-key-0") as a 32-byte seed.
|
|
61
|
+
* This seed is DISTINCT from TEST_OFFICER_SEEDS (0x01..0x05) — it is NOT an
|
|
62
|
+
* officer key. It represents a directory node's per-node Ed25519 signing key.
|
|
63
|
+
*
|
|
64
|
+
* Crypto reference: RFC 8032 (Ed25519).
|
|
65
|
+
* Seed derivation: SHA-256("cello-test-directory-node-key-0") — deterministic.
|
|
66
|
+
*/
|
|
67
|
+
export const TEST_DIRECTORY_NODE_KEYPAIR = {
|
|
68
|
+
privateKeyHex: "707a125efaed6d467e8cac1758b3a87af260a5b9c7a6f0d6a74d364c1d5dacd9",
|
|
69
|
+
publicKeyHex: "b93092dd6bf675c00a895abc05503dfd1214a170a2d945d97bab81fd5cfe6a1b",
|
|
70
|
+
};
|
|
71
|
+
//# sourceMappingURL=manifest-test-fixture.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manifest-test-fixture.js","sourceRoot":"","sources":["../src/manifest-test-fixture.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AACnD,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAGtD;;;;;GAKG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAA0E;IACvG,IAAI,UAAU,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,C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@ -0,0 +1,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* M7-MANIFEST-001 — Consortium manifest verification.
|
|
3
|
+
*
|
|
4
|
+
* Provides canonical serialization and threshold signature verification for
|
|
5
|
+
* ConsortiumManifest instances. The verification logic:
|
|
6
|
+
*
|
|
7
|
+
* 1. Computes the canonical body bytes (all fields except `signatures`,
|
|
8
|
+
* object keys sorted lexicographically at every nesting level, no whitespace,
|
|
9
|
+
* UTF-8 encoded).
|
|
10
|
+
* 2. For each signature entry, verifies it against the officer key at the
|
|
11
|
+
* specified index.
|
|
12
|
+
* 3. Counts only unique valid officer indices — duplicates count once.
|
|
13
|
+
* 4. Returns ok: true if unique valid count >= threshold.
|
|
14
|
+
*
|
|
15
|
+
* Security properties:
|
|
16
|
+
* - Out-of-bounds officer indices are silently skipped (AC-008).
|
|
17
|
+
* - Malformed hex is caught gracefully, never throws (AC-009).
|
|
18
|
+
* - Duplicate officer indices count as 1 (SI-001).
|
|
19
|
+
* - Canonical serialization is insertion-order independent (SI-002).
|
|
20
|
+
*
|
|
21
|
+
* Crypto reference: RFC 8032 (Ed25519).
|
|
22
|
+
*/
|
|
23
|
+
/**
|
|
24
|
+
* Structural type for ConsortiumManifest — compatible with
|
|
25
|
+
* @cello-protocol/protocol-types without creating a circular dependency
|
|
26
|
+
* (protocol-types depends on crypto).
|
|
27
|
+
*/
|
|
28
|
+
export interface ConsortiumManifestInput {
|
|
29
|
+
version: number;
|
|
30
|
+
not_before: string;
|
|
31
|
+
expires: string;
|
|
32
|
+
nodes: readonly Record<string, unknown>[];
|
|
33
|
+
signatures: readonly {
|
|
34
|
+
officerIndex: number;
|
|
35
|
+
signature: string;
|
|
36
|
+
}[];
|
|
37
|
+
[key: string]: unknown;
|
|
38
|
+
}
|
|
39
|
+
export type ManifestVerifySkipReason = "out_of_bounds" | "duplicate" | "malformed_signature" | "malformed_key" | "verification_failed";
|
|
40
|
+
export interface ManifestVerifySkippedEntry {
|
|
41
|
+
index: number;
|
|
42
|
+
reason: ManifestVerifySkipReason;
|
|
43
|
+
error?: string;
|
|
44
|
+
}
|
|
45
|
+
export interface ManifestVerifyDiagnostics {
|
|
46
|
+
threshold: number;
|
|
47
|
+
validOfficers: number[];
|
|
48
|
+
skippedEntries: ManifestVerifySkippedEntry[];
|
|
49
|
+
}
|
|
50
|
+
export type ManifestVerifyResult = {
|
|
51
|
+
ok: true;
|
|
52
|
+
signerCount: number;
|
|
53
|
+
} | {
|
|
54
|
+
ok: false;
|
|
55
|
+
reason: "manifest_signature_invalid";
|
|
56
|
+
detail: string;
|
|
57
|
+
diagnostics: ManifestVerifyDiagnostics;
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* Produce the canonical byte representation of a manifest body for signing.
|
|
61
|
+
*
|
|
62
|
+
* Pseudocode (RFC 8032 — signing input):
|
|
63
|
+
* 1. Copy all fields from manifest EXCEPT `signatures`.
|
|
64
|
+
* 2. Sort object keys lexicographically at EVERY nesting level (recursive).
|
|
65
|
+
* 3. Serialize as JSON with no whitespace and no trailing newline.
|
|
66
|
+
* 4. Encode as UTF-8 bytes.
|
|
67
|
+
*
|
|
68
|
+
* The resulting bytes are the message that officers sign with Ed25519.
|
|
69
|
+
*/
|
|
70
|
+
export declare function canonicalManifestBody(manifest: ConsortiumManifestInput): Uint8Array;
|
|
71
|
+
/**
|
|
72
|
+
* Verify a consortium manifest against a set of officer root keys.
|
|
73
|
+
*
|
|
74
|
+
* Pseudocode (RFC 8032 — Ed25519 verification):
|
|
75
|
+
* 1. Compute canonical body bytes via canonicalManifestBody.
|
|
76
|
+
* 2. For each signature entry in manifest.signatures:
|
|
77
|
+
* a. If officerIndex is out of bounds (< 0 or >= rootKeys.length), skip.
|
|
78
|
+
* b. Decode the hex signature to bytes. If malformed, skip.
|
|
79
|
+
* c. Decode the root key at officerIndex to bytes. If malformed, skip.
|
|
80
|
+
* d. Verify: ed25519.verify(signature, body, publicKey).
|
|
81
|
+
* e. If valid AND officerIndex not already in verified set, add it (SI-001).
|
|
82
|
+
* f. If valid BUT officerIndex already verified, mark as duplicate.
|
|
83
|
+
* 3. If |verified signers| >= threshold → { ok: true, signerCount }.
|
|
84
|
+
* 4. Otherwise → { ok: false, reason, detail }.
|
|
85
|
+
*
|
|
86
|
+
* This function NEVER throws. All error conditions produce a result value.
|
|
87
|
+
*/
|
|
88
|
+
export declare function verifyManifest(manifest: ConsortiumManifestInput, rootKeys: readonly string[], threshold: number): ManifestVerifyResult;
|
|
89
|
+
//# sourceMappingURL=manifest.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../src/manifest.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAIH;;;;GAIG;AACH,MAAM,WAAW,uBAAuB;IACtC,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC;IAC1C,UAAU,EAAE,SAAS;QAAE,YAAY,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IACnE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAID,MAAM,MAAM,wBAAwB,GAAG,eAAe,GAAG,WAAW,GAAG,qBAAqB,GAAG,eAAe,GAAG,qBAAqB,CAAC;AAEvI,MAAM,WAAW,0BAA0B;IACzC,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,wBAAwB,CAAC;IACjC,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,yBAAyB;IACxC,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,cAAc,EAAE,0BAA0B,EAAE,CAAC;CAC9C;AAED,MAAM,MAAM,oBAAoB,GAC5B;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE,GACjC;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,4BAA4B,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,yBAAyB,CAAA;CAAE,CAAC;AAIhH;;;;;;;;;;GAUG;AACH,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,uBAAuB,GAAG,UAAU,CAcnF;AAmBD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,cAAc,CAC5B,QAAQ,EAAE,uBAAuB,EACjC,QAAQ,EAAE,SAAS,MAAM,EAAE,EAC3B,SAAS,EAAE,MAAM,GAChB,oBAAoB,CA8EtB"}
|
package/dist/manifest.js
ADDED
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* M7-MANIFEST-001 — Consortium manifest verification.
|
|
3
|
+
*
|
|
4
|
+
* Provides canonical serialization and threshold signature verification for
|
|
5
|
+
* ConsortiumManifest instances. The verification logic:
|
|
6
|
+
*
|
|
7
|
+
* 1. Computes the canonical body bytes (all fields except `signatures`,
|
|
8
|
+
* object keys sorted lexicographically at every nesting level, no whitespace,
|
|
9
|
+
* UTF-8 encoded).
|
|
10
|
+
* 2. For each signature entry, verifies it against the officer key at the
|
|
11
|
+
* specified index.
|
|
12
|
+
* 3. Counts only unique valid officer indices — duplicates count once.
|
|
13
|
+
* 4. Returns ok: true if unique valid count >= threshold.
|
|
14
|
+
*
|
|
15
|
+
* Security properties:
|
|
16
|
+
* - Out-of-bounds officer indices are silently skipped (AC-008).
|
|
17
|
+
* - Malformed hex is caught gracefully, never throws (AC-009).
|
|
18
|
+
* - Duplicate officer indices count as 1 (SI-001).
|
|
19
|
+
* - Canonical serialization is insertion-order independent (SI-002).
|
|
20
|
+
*
|
|
21
|
+
* Crypto reference: RFC 8032 (Ed25519).
|
|
22
|
+
*/
|
|
23
|
+
import { ed25519 } from "@noble/curves/ed25519.js";
|
|
24
|
+
// ─── Canonical serialization ─────────────────────────────────────────────────
|
|
25
|
+
/**
|
|
26
|
+
* Produce the canonical byte representation of a manifest body for signing.
|
|
27
|
+
*
|
|
28
|
+
* Pseudocode (RFC 8032 — signing input):
|
|
29
|
+
* 1. Copy all fields from manifest EXCEPT `signatures`.
|
|
30
|
+
* 2. Sort object keys lexicographically at EVERY nesting level (recursive).
|
|
31
|
+
* 3. Serialize as JSON with no whitespace and no trailing newline.
|
|
32
|
+
* 4. Encode as UTF-8 bytes.
|
|
33
|
+
*
|
|
34
|
+
* The resulting bytes are the message that officers sign with Ed25519.
|
|
35
|
+
*/
|
|
36
|
+
export function canonicalManifestBody(manifest) {
|
|
37
|
+
// Step 1: exclude signatures — build body object with all fields except signatures
|
|
38
|
+
const body = {};
|
|
39
|
+
for (const key of Object.keys(manifest)) {
|
|
40
|
+
if (key !== "signatures") {
|
|
41
|
+
body[key] = manifest[key];
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
// Step 2+3: sort keys recursively and serialize
|
|
45
|
+
const json = JSON.stringify(body, sortedReplacer);
|
|
46
|
+
// Step 4: UTF-8 encode
|
|
47
|
+
return new TextEncoder().encode(json);
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* JSON.stringify replacer that sorts object keys lexicographically at every level.
|
|
51
|
+
* Arrays preserve their order (insertion-order independent only for objects).
|
|
52
|
+
*/
|
|
53
|
+
function sortedReplacer(_key, value) {
|
|
54
|
+
if (value !== null && typeof value === "object" && !Array.isArray(value)) {
|
|
55
|
+
const sorted = {};
|
|
56
|
+
for (const k of Object.keys(value).sort()) {
|
|
57
|
+
sorted[k] = value[k];
|
|
58
|
+
}
|
|
59
|
+
return sorted;
|
|
60
|
+
}
|
|
61
|
+
return value;
|
|
62
|
+
}
|
|
63
|
+
// ─── Threshold signature verification ────────────────────────────────────────
|
|
64
|
+
/**
|
|
65
|
+
* Verify a consortium manifest against a set of officer root keys.
|
|
66
|
+
*
|
|
67
|
+
* Pseudocode (RFC 8032 — Ed25519 verification):
|
|
68
|
+
* 1. Compute canonical body bytes via canonicalManifestBody.
|
|
69
|
+
* 2. For each signature entry in manifest.signatures:
|
|
70
|
+
* a. If officerIndex is out of bounds (< 0 or >= rootKeys.length), skip.
|
|
71
|
+
* b. Decode the hex signature to bytes. If malformed, skip.
|
|
72
|
+
* c. Decode the root key at officerIndex to bytes. If malformed, skip.
|
|
73
|
+
* d. Verify: ed25519.verify(signature, body, publicKey).
|
|
74
|
+
* e. If valid AND officerIndex not already in verified set, add it (SI-001).
|
|
75
|
+
* f. If valid BUT officerIndex already verified, mark as duplicate.
|
|
76
|
+
* 3. If |verified signers| >= threshold → { ok: true, signerCount }.
|
|
77
|
+
* 4. Otherwise → { ok: false, reason, detail }.
|
|
78
|
+
*
|
|
79
|
+
* This function NEVER throws. All error conditions produce a result value.
|
|
80
|
+
*/
|
|
81
|
+
export function verifyManifest(manifest, rootKeys, threshold) {
|
|
82
|
+
// A manifest with no nodes is structurally invalid — the consumer has no nodes
|
|
83
|
+
// to connect to and cannot distinguish "empty by design" from "tampered" (AC-003(d)).
|
|
84
|
+
if (manifest.nodes.length === 0) {
|
|
85
|
+
return {
|
|
86
|
+
ok: false,
|
|
87
|
+
reason: "manifest_signature_invalid",
|
|
88
|
+
detail: "manifest contains no nodes",
|
|
89
|
+
diagnostics: { threshold, validOfficers: [], skippedEntries: [] },
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
const body = canonicalManifestBody(manifest);
|
|
93
|
+
const verifiedIndices = new Set();
|
|
94
|
+
const skippedEntries = [];
|
|
95
|
+
for (const entry of manifest.signatures) {
|
|
96
|
+
const { officerIndex, signature } = entry;
|
|
97
|
+
// Skip out-of-bounds indices (AC-008)
|
|
98
|
+
if (officerIndex < 0 || officerIndex >= rootKeys.length) {
|
|
99
|
+
skippedEntries.push({ index: officerIndex, reason: "out_of_bounds" });
|
|
100
|
+
continue;
|
|
101
|
+
}
|
|
102
|
+
// Decode signature hex to bytes (Ed25519 signature = 64 bytes)
|
|
103
|
+
const sigBytes = hexToBytes(signature, 64);
|
|
104
|
+
if (sigBytes === null) {
|
|
105
|
+
skippedEntries.push({ index: officerIndex, reason: "malformed_signature" });
|
|
106
|
+
continue;
|
|
107
|
+
}
|
|
108
|
+
// Decode public key hex to bytes (Ed25519 public key = 32 bytes)
|
|
109
|
+
const pubkeyBytes = hexToBytes(rootKeys[officerIndex], 32);
|
|
110
|
+
if (pubkeyBytes === null) {
|
|
111
|
+
skippedEntries.push({ index: officerIndex, reason: "malformed_key" });
|
|
112
|
+
continue;
|
|
113
|
+
}
|
|
114
|
+
// Verify Ed25519 signature (RFC 8032)
|
|
115
|
+
let isValid = false;
|
|
116
|
+
try {
|
|
117
|
+
isValid = ed25519.verify(sigBytes, body, pubkeyBytes);
|
|
118
|
+
}
|
|
119
|
+
catch (err) {
|
|
120
|
+
skippedEntries.push({ index: officerIndex, reason: "verification_failed", error: err instanceof Error ? err.message : String(err) });
|
|
121
|
+
continue;
|
|
122
|
+
}
|
|
123
|
+
if (!isValid) {
|
|
124
|
+
skippedEntries.push({ index: officerIndex, reason: "verification_failed" });
|
|
125
|
+
continue;
|
|
126
|
+
}
|
|
127
|
+
// Check uniqueness AFTER verification — only first valid sig per officer counts (SI-001)
|
|
128
|
+
if (verifiedIndices.has(officerIndex)) {
|
|
129
|
+
skippedEntries.push({ index: officerIndex, reason: "duplicate" });
|
|
130
|
+
continue;
|
|
131
|
+
}
|
|
132
|
+
verifiedIndices.add(officerIndex);
|
|
133
|
+
}
|
|
134
|
+
const signerCount = verifiedIndices.size;
|
|
135
|
+
if (signerCount >= threshold) {
|
|
136
|
+
return { ok: true, signerCount };
|
|
137
|
+
}
|
|
138
|
+
return {
|
|
139
|
+
ok: false,
|
|
140
|
+
reason: "manifest_signature_invalid",
|
|
141
|
+
detail: `${signerCount} valid of ${threshold} required`,
|
|
142
|
+
diagnostics: {
|
|
143
|
+
threshold,
|
|
144
|
+
validOfficers: Array.from(verifiedIndices).sort((a, b) => a - b),
|
|
145
|
+
skippedEntries,
|
|
146
|
+
},
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
// ─── Internal helpers ────────────────────────────────────────────────────────
|
|
150
|
+
/**
|
|
151
|
+
* Decode a hex string to Uint8Array with expected byte length validation.
|
|
152
|
+
* Returns null if the input is not valid hex or doesn't match expectedBytes.
|
|
153
|
+
* Never throws.
|
|
154
|
+
*/
|
|
155
|
+
function hexToBytes(hex, expectedBytes) {
|
|
156
|
+
if (hex.length !== expectedBytes * 2) {
|
|
157
|
+
return null;
|
|
158
|
+
}
|
|
159
|
+
// Strict hex validation before parsing — parseInt("0g", 16) returns 0 (not NaN),
|
|
160
|
+
// so the NaN check alone does not catch strings with invalid non-leading characters.
|
|
161
|
+
if (!/^[0-9a-fA-F]+$/.test(hex)) {
|
|
162
|
+
return null;
|
|
163
|
+
}
|
|
164
|
+
const bytes = new Uint8Array(expectedBytes);
|
|
165
|
+
for (let i = 0; i < bytes.length; i++) {
|
|
166
|
+
bytes[i] = parseInt(hex.slice(i * 2, i * 2 + 2), 16);
|
|
167
|
+
}
|
|
168
|
+
return bytes;
|
|
169
|
+
}
|
|
170
|
+
//# sourceMappingURL=manifest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manifest.js","sourceRoot":"","sources":["../src/manifest.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AAoCnD,gFAAgF;AAEhF;;;;;;;;;;GAUG;AACH,MAAM,UAAU,qBAAqB,CAAC,QAAiC;IACrE,mFAAmF;IACnF,MAAM,IAAI,GAA4B,EAAE,CAAC;IACzC,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC;QACxC,IAAI,GAAG,KAAK,YAAY,EAAE,CAAC;YACzB,IAAI,CAAC,GAA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OAAO,IAAI,CAAC;IACd,CAAC;IACD,MAAM,KAAK,GAAG,IAAI,UAAU,CAAC,aAAa,CAAC,CAAC;IAC5C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACtC,KAAK,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IACvD,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
package/dist/types.d.ts
CHANGED
|
@@ -3,6 +3,14 @@ export type Signature = Uint8Array;
|
|
|
3
3
|
export interface KeyProvider {
|
|
4
4
|
getPublicKey(): Promise<PublicKey>;
|
|
5
5
|
sign(data: Uint8Array): Promise<Signature>;
|
|
6
|
+
/**
|
|
7
|
+
* CELLO-M7-MSG-001: open a content-park sealed blob addressed to THIS identity key
|
|
8
|
+
* (the receiver-side counterpart of `sealToRecipient`). Returns the plaintext, or
|
|
9
|
+
* null on any failure (wrong key / tamper / malformed). OPTIONAL — only providers
|
|
10
|
+
* that hold the Ed25519 seed (InMemory/File identity keys) implement it; threshold
|
|
11
|
+
* and signing-only providers do not. Callers must feature-detect before use.
|
|
12
|
+
*/
|
|
13
|
+
openContentSeal?(blob: Uint8Array): Promise<Uint8Array | null>;
|
|
6
14
|
}
|
|
7
15
|
export interface KeyFileCorruptError {
|
|
8
16
|
reason: "key_file_corrupt";
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,SAAS,GAAG,UAAU,CAAC;AACnC,MAAM,MAAM,SAAS,GAAG,UAAU,CAAC;AAEnC,MAAM,WAAW,WAAW;IAC1B,YAAY,IAAI,OAAO,CAAC,SAAS,CAAC,CAAC;IACnC,IAAI,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,SAAS,GAAG,UAAU,CAAC;AACnC,MAAM,MAAM,SAAS,GAAG,UAAU,CAAC;AAEnC,MAAM,WAAW,WAAW;IAC1B,YAAY,IAAI,OAAO,CAAC,SAAS,CAAC,CAAC;IACnC,IAAI,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;IAC3C;;;;;;OAMG;IACH,eAAe,CAAC,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC,CAAC;CAChE;AAED,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,kBAAkB,CAAC;IAC3B,OAAO,EAAE,MAAM,CAAC;CACjB"}
|