@cello-protocol/crypto 0.0.17 → 0.0.19

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.
@@ -6,7 +6,7 @@
6
6
  * - ThresholdSignature: result type
7
7
  * - FrostThresholdSigner: FROST/Ed25519 implementation
8
8
  * - MockThresholdSigner: test double confirming the swap point
9
- * - CONTEXT_SESSION_ESTABLISHMENT / CONTEXT_SEAL: domain context constants
9
+ * - CONTEXT_SESSION_ESTABLISHMENT / CONTEXT_SEAL / CONTEXT_PRIMARY_RELEASE: domain context constants
10
10
  *
11
11
  * Note: bootstrapKeyShares and clearTestShares are test-only — NOT exported
12
12
  * from this barrel. Test files import them directly from
@@ -18,6 +18,6 @@
18
18
  * the production package surface.
19
19
  */
20
20
  export type { IThresholdSigner, ThresholdSignature, ThresholdSignatureOk, ThresholdSignatureError, FrostThresholdSignerConfig, FrostContext, BootstrapResult, } from "./types.js";
21
- export { CONTEXT_SESSION_ESTABLISHMENT, CONTEXT_SEAL, } from "./types.js";
21
+ export { CONTEXT_SESSION_ESTABLISHMENT, CONTEXT_SEAL, CONTEXT_PRIMARY_RELEASE, } from "./types.js";
22
22
  export { FrostThresholdSigner, MockThresholdSigner, } from "./frost-threshold-signer.js";
23
23
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/frost/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,YAAY,EACV,gBAAgB,EAChB,kBAAkB,EAClB,oBAAoB,EACpB,uBAAuB,EACvB,0BAA0B,EAC1B,YAAY,EACZ,eAAe,GAChB,MAAM,YAAY,CAAC;AAEpB,OAAO,EACL,6BAA6B,EAC7B,YAAY,GACb,MAAM,YAAY,CAAC;AAEpB,OAAO,EACL,oBAAoB,EACpB,mBAAmB,GACpB,MAAM,6BAA6B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/frost/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,YAAY,EACV,gBAAgB,EAChB,kBAAkB,EAClB,oBAAoB,EACpB,uBAAuB,EACvB,0BAA0B,EAC1B,YAAY,EACZ,eAAe,GAChB,MAAM,YAAY,CAAC;AAEpB,OAAO,EACL,6BAA6B,EAC7B,YAAY,EACZ,uBAAuB,GACxB,MAAM,YAAY,CAAC;AAEpB,OAAO,EACL,oBAAoB,EACpB,mBAAmB,GACpB,MAAM,6BAA6B,CAAC"}
@@ -6,7 +6,7 @@
6
6
  * - ThresholdSignature: result type
7
7
  * - FrostThresholdSigner: FROST/Ed25519 implementation
8
8
  * - MockThresholdSigner: test double confirming the swap point
9
- * - CONTEXT_SESSION_ESTABLISHMENT / CONTEXT_SEAL: domain context constants
9
+ * - CONTEXT_SESSION_ESTABLISHMENT / CONTEXT_SEAL / CONTEXT_PRIMARY_RELEASE: domain context constants
10
10
  *
11
11
  * Note: bootstrapKeyShares and clearTestShares are test-only — NOT exported
12
12
  * from this barrel. Test files import them directly from
@@ -17,6 +17,6 @@
17
17
  * directly from ./stubs.js and ./types.js to keep test infrastructure out of
18
18
  * the production package surface.
19
19
  */
20
- export { CONTEXT_SESSION_ESTABLISHMENT, CONTEXT_SEAL, } from "./types.js";
20
+ export { CONTEXT_SESSION_ESTABLISHMENT, CONTEXT_SEAL, CONTEXT_PRIMARY_RELEASE, } from "./types.js";
21
21
  export { FrostThresholdSigner, MockThresholdSigner, } from "./frost-threshold-signer.js";
22
22
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/frost/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAYH,OAAO,EACL,6BAA6B,EAC7B,YAAY,GACb,MAAM,YAAY,CAAC;AAEpB,OAAO,EACL,oBAAoB,EACpB,mBAAmB,GACpB,MAAM,6BAA6B,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/frost/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAYH,OAAO,EACL,6BAA6B,EAC7B,YAAY,EACZ,uBAAuB,GACxB,MAAM,YAAY,CAAC;AAEpB,OAAO,EACL,oBAAoB,EACpB,mBAAmB,GACpB,MAAM,6BAA6B,CAAC"}
@@ -6,9 +6,10 @@
6
6
  * Design decisions:
7
7
  * - `IThresholdSigner` is separate from `KeyProvider`. `KeyProvider` handles K_local
8
8
  * envelope signing; `IThresholdSigner` handles the multi-party threshold ceremony.
9
- * - Two domain context strings are defined (M2 only):
9
+ * - Domain context strings (one per message-type this ceremony machinery signs):
10
10
  * - "cello-frost-session-establishment-v1" — session establishment TBS
11
11
  * - "cello-frost-seal-v1" — conversation seal TBS
12
+ * - "cello-frost-primary-release-v1" — M8C-PRIMARY-1 device-transfer release attestation
12
13
  * - Context is prepended to the TBS before signing to achieve domain separation.
13
14
  * FROST over ed25519 does not support a native context parameter, so we use
14
15
  * a framed encoding: `<context>\0<tbs>`.
@@ -17,7 +18,17 @@
17
18
  */
18
19
  export declare const CONTEXT_SESSION_ESTABLISHMENT: "cello-frost-session-establishment-v1";
19
20
  export declare const CONTEXT_SEAL: "cello-frost-seal-v1";
20
- export type FrostContext = typeof CONTEXT_SESSION_ESTABLISHMENT | typeof CONTEXT_SEAL;
21
+ /**
22
+ * M8C-PRIMARY-1: the old Primary's "share released" attestation during a device-transfer, per
23
+ * docs/planning/user-stories/m8c/M8C-PRIMARY-DESIGN.md (Decision 3, Pass 3). Reuses the existing
24
+ * ceremony machinery unchanged — only a new domain-separation string, so a signature produced for
25
+ * this context can never be replayed as a real seal or session-establishment signature, and vice
26
+ * versa. Requires the signer's OWN local FROST share to be loaded (participateInCeremony throws
27
+ * otherwise) — this is exactly what distinguishes a genuine old Primary (which held the share)
28
+ * from a Standby that received only K_local via pairing and never the share.
29
+ */
30
+ export declare const CONTEXT_PRIMARY_RELEASE: "cello-frost-primary-release-v1";
31
+ export type FrostContext = typeof CONTEXT_SESSION_ESTABLISHMENT | typeof CONTEXT_SEAL | typeof CONTEXT_PRIMARY_RELEASE;
21
32
  export type ThresholdSignatureOk = {
22
33
  readonly ok: true;
23
34
  readonly signature: Uint8Array;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/frost/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAIH,eAAO,MAAM,6BAA6B,EACxC,sCAA+C,CAAC;AAClD,eAAO,MAAM,YAAY,EAAG,qBAA8B,CAAC;AAE3D,MAAM,MAAM,YAAY,GACpB,OAAO,6BAA6B,GACpC,OAAO,YAAY,CAAC;AAIxB,MAAM,MAAM,oBAAoB,GAAG;IACjC,QAAQ,CAAC,EAAE,EAAE,IAAI,CAAC;IAClB,QAAQ,CAAC,SAAS,EAAE,UAAU,CAAC;CAChC,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG;IACpC,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAC;IACnB,QAAQ,CAAC,KAAK,EAAE;QACd,QAAQ,CAAC,MAAM,EACX,2BAA2B,GAC3B,kBAAkB,GAClB,oBAAoB,CAAC;KAC1B,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG,oBAAoB,GAAG,uBAAuB,CAAC;AAIhF,MAAM,MAAM,qBAAqB,GAC7B;IAAE,IAAI,EAAE,kBAAkB,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAC1D;IAAE,IAAI,EAAE,uBAAuB,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAEpE,MAAM,MAAM,wBAAwB,GAAG,CAAC,KAAK,EAAE,qBAAqB,KAAK,IAAI,CAAC;AAI9E;;;;;;;GAOG;AACH,MAAM,WAAW,gBAAgB;IAC/B;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CAAC,EAAE,MAAM,CAAC;IACjC,0EAA0E;IAC1E,QAAQ,CAAC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IACpC,qEAAqE;IACrE,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;CAC9B;AAID;;;;;;GAMG;AACH,MAAM,WAAW,iBAAiB;IAChC,2CAA2C;IAC3C,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IAEpB;;;;OAIG;IACH,WAAW,IAAI,OAAO,CAAC;IAEvB;;;;;;;;;;OAUG;IACH,SAAS,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC,CAAC;IAE9D;;;;OAIG;IACH,kBAAkB,IAAI,OAAO,CAAC,cAAc,CAAC,CAAC;IAE9C;;;;OAIG;IACH,YAAY,CACV,MAAM,EAAE,OAAO,iCAAiC,EAAE,WAAW,EAC7D,GAAG,EAAE,OAAO,iCAAiC,EAAE,WAAW,GACzD,OAAO,CAAC,IAAI,CAAC,CAAC;CAClB;AAED,MAAM,WAAW,cAAc;IAC7B,GAAG,EAAE,OAAO,iCAAiC,EAAE,WAAW,CAAC;IAC3D,cAAc,EAAE,OAAO,iCAAiC,EAAE,gBAAgB,EAAE,CAAC;IAC7E,GAAG,EAAE,UAAU,CAAC;IAChB,gHAAgH;IAChH,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,eAAe,EAAE,OAAO,iCAAiC,EAAE,gBAAgB,CAAC;IAC5E,MAAM,EAAE,OAAO,iCAAiC,EAAE,MAAM,CAAC;CAC1D;AAID,MAAM,WAAW,eAAe;IAC9B;;;;OAIG;IACH,QAAQ,CAAC,aAAa,EAAE,UAAU,CAAC;CACpC"}
@@ -6,9 +6,10 @@
6
6
  * Design decisions:
7
7
  * - `IThresholdSigner` is separate from `KeyProvider`. `KeyProvider` handles K_local
8
8
  * envelope signing; `IThresholdSigner` handles the multi-party threshold ceremony.
9
- * - Two domain context strings are defined (M2 only):
9
+ * - Domain context strings (one per message-type this ceremony machinery signs):
10
10
  * - "cello-frost-session-establishment-v1" — session establishment TBS
11
11
  * - "cello-frost-seal-v1" — conversation seal TBS
12
+ * - "cello-frost-primary-release-v1" — M8C-PRIMARY-1 device-transfer release attestation
12
13
  * - Context is prepended to the TBS before signing to achieve domain separation.
13
14
  * FROST over ed25519 does not support a native context parameter, so we use
14
15
  * a framed encoding: `<context>\0<tbs>`.
@@ -18,4 +19,14 @@
18
19
  // ─── Domain context strings ──────────────────────────────────────────────────
19
20
  export const CONTEXT_SESSION_ESTABLISHMENT = "cello-frost-session-establishment-v1";
20
21
  export const CONTEXT_SEAL = "cello-frost-seal-v1";
22
+ /**
23
+ * M8C-PRIMARY-1: the old Primary's "share released" attestation during a device-transfer, per
24
+ * docs/planning/user-stories/m8c/M8C-PRIMARY-DESIGN.md (Decision 3, Pass 3). Reuses the existing
25
+ * ceremony machinery unchanged — only a new domain-separation string, so a signature produced for
26
+ * this context can never be replayed as a real seal or session-establishment signature, and vice
27
+ * versa. Requires the signer's OWN local FROST share to be loaded (participateInCeremony throws
28
+ * otherwise) — this is exactly what distinguishes a genuine old Primary (which held the share)
29
+ * from a Standby that received only K_local via pairing and never the share.
30
+ */
31
+ export const CONTEXT_PRIMARY_RELEASE = "cello-frost-primary-release-v1";
21
32
  //# sourceMappingURL=types.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/frost/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,gFAAgF;AAEhF,MAAM,CAAC,MAAM,6BAA6B,GACxC,sCAA+C,CAAC;AAClD,MAAM,CAAC,MAAM,YAAY,GAAG,qBAA8B,CAAC"}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/frost/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,gFAAgF;AAEhF,MAAM,CAAC,MAAM,6BAA6B,GACxC,sCAA+C,CAAC;AAClD,MAAM,CAAC,MAAM,YAAY,GAAG,qBAA8B,CAAC;AAC3D;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,gCAAyC,CAAC"}
package/dist/index.d.ts CHANGED
@@ -6,7 +6,7 @@ export { hash, msgLeafHash, nodeHash, ctrlLeafHash, buildRelayAckTbs } from "./h
6
6
  export type { MerkleTree, LeafInput } from "./merkle.js";
7
7
  export { buildMerkleTree, merkleRoot, inclusionProof, verifyInclusion } from "./merkle.js";
8
8
  export type { IThresholdSigner, ThresholdSignature, ThresholdSignatureOk, ThresholdSignatureError, FrostThresholdSignerConfig, FrostContext, BootstrapResult, } from "./frost/index.js";
9
- export { CONTEXT_SESSION_ESTABLISHMENT, CONTEXT_SEAL, FrostThresholdSigner, MockThresholdSigner, } from "./frost/index.js";
9
+ export { CONTEXT_SESSION_ESTABLISHMENT, CONTEXT_SEAL, CONTEXT_PRIMARY_RELEASE, FrostThresholdSigner, MockThresholdSigner, } from "./frost/index.js";
10
10
  export { verifyFrostSignature } from "./frost/frost-threshold-signer.js";
11
11
  export { generateRefreshContribution, verifyRefreshContribution, applyRefresh, } from "./frost/frost-resharing.js";
12
12
  export type { RefreshContribution } from "./frost/frost-resharing.js";
@@ -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,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACpI,YAAY,EAAE,cAAc,EAAE,cAAc,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAClG,OAAO,EACL,wBAAwB,EACxB,oBAAoB,EACpB,WAAW,E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sB,CAAC;AAC9B,YAAY,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAC3F,OAAO,EAAE,gBAAgB,EAAE,2BAA2B,EAAE,MAAM,4BAA4B,CAAC"}
package/dist/index.js CHANGED
@@ -2,7 +2,7 @@ export { InMemoryKeyProvider, FileKeyProvider, generateKeypair, generateKLocalSe
2
2
  export { InMemoryMlDsaKeyProvider, FileMlDsaKeyProvider, mlDsaKeygen, mlDsaKeygenWithBytes, mlDsaSign, mlDsaVerify, mlDsaEnsureLoaded, } from "./ml-dsa.js";
3
3
  export { hash, msgLeafHash, nodeHash, ctrlLeafHash, buildRelayAckTbs } from "./hashing.js";
4
4
  export { buildMerkleTree, merkleRoot, inclusionProof, verifyInclusion } from "./merkle.js";
5
- export { CONTEXT_SESSION_ESTABLISHMENT, CONTEXT_SEAL, FrostThresholdSigner, MockThresholdSigner, } from "./frost/index.js";
5
+ export { CONTEXT_SESSION_ESTABLISHMENT, CONTEXT_SEAL, CONTEXT_PRIMARY_RELEASE, FrostThresholdSigner, MockThresholdSigner, } from "./frost/index.js";
6
6
  // SESSION-004: standalone FROST verify (no signer instance needed — used by counterparty client)
7
7
  export { verifyFrostSignature } from "./frost/frost-threshold-signer.js";
8
8
  // M8B DOD-REFRESH-1: FROST proactive share resharing (PSS) — used by the directory (its own share) and
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,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEpI,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,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AO,EAAE,uBAAuB,EAAE,cAAc,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AACxI,OAAO,EACL,oBAAoB,EACpB,oBAAoB,EACpB,yBAAyB,EACzB,yBAAyB,GAC1B,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,gBAAgB,EAAE,2BAA2B,EAAE,MAAM,4BAA4B,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cello-protocol/crypto",
3
- "version": "0.0.17",
3
+ "version": "0.0.19",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "engines": {
@@ -1,82 +0,0 @@
1
- /**
2
- * In-process directory node stubs for FROST tests.
3
- *
4
- * CELLO-CRYPTO-003
5
- *
6
- * These stubs mimic the behavior of a real directory node's /cello/frost/1.0.0
7
- * protocol handler. They exercise the same ceremony protocol logic as real nodes
8
- * but run in-process for fast, deterministic tests.
9
- *
10
- * Stub configuration options:
11
- * - Normal: responds with valid partial signatures
12
- * - Unreachable: node is not reachable at initiation (caught by pre-ceremony check)
13
- * - Unresponsive: reachable at initiation, but signRound times out (returns null)
14
- * - InvalidResponse: returns random bytes (simulates malformed partial sig)
15
- */
16
- import type { FrostPublic, FrostSecret } from "@noble/curves/abstract/frost.js";
17
- import type { DirectoryNodeStub, StubSignParams, StubCommitment } from "./types.js";
18
- export declare class InProcessDirectoryNodeStub implements DirectoryNodeStub {
19
- #private;
20
- readonly id: string;
21
- constructor(id: string);
22
- /**
23
- * Receive a FROST signing share from the bootstrap ceremony.
24
- * Called by bootstrapKeyShares during setup.
25
- */
26
- receiveShare(secret: FrostSecret, pub: FrostPublic): Promise<void>;
27
- /**
28
- * TEST-ONLY: Return the stored FROST key pair for use by external test harnesses
29
- * (e.g., to inject a share into a FrostDirectoryHandler via injectShareForTest).
30
- *
31
- * This deliberately exposes the raw FrostSecret for test setup purposes.
32
- * MUST NOT be called outside of test code.
33
- */
34
- getShareForTest(): {
35
- secret: FrostSecret;
36
- pub: FrostPublic;
37
- } | null;
38
- /**
39
- * Mark this node as unreachable at ceremony initiation.
40
- * isReachable() will return false, causing the coordinator to exclude
41
- * this node before any rounds begin.
42
- */
43
- setUnreachable(flag: boolean): void;
44
- /**
45
- * Mark this node as unresponsive during signing rounds.
46
- * isReachable() returns true (node is connectable) but signRound returns null
47
- * (simulates a timeout after connection is established).
48
- */
49
- setUnresponsive(flag: boolean): void;
50
- /** Make this stub return random bytes (simulate malformed partial sig) */
51
- setInvalidResponse(flag: boolean): void;
52
- /**
53
- * Returns whether this node is reachable at ceremony initiation.
54
- * The coordinator uses this for the pre-ceremony availability check:
55
- * if fewer than `threshold` nodes are reachable, fail immediately
56
- * with DIRECTORY_BELOW_THRESHOLD.
57
- */
58
- isReachable(): boolean;
59
- /**
60
- * Generate a nonce commitment for the next signing round.
61
- * Called by the coordinator before collecting partial signatures.
62
- * Caches the nonce scalars for use in signRound().
63
- */
64
- generateCommitment(): Promise<StubCommitment>;
65
- /**
66
- * Participate in a signing round.
67
- *
68
- * Uses the nonce cached from the preceding generateCommitment() call.
69
- * Returns a never-resolving Promise to simulate timeout (the coordinator's
70
- * per-node timer will fire first). Returns random bytes to simulate
71
- * an invalid partial sig.
72
- *
73
- * @returns Partial signature bytes, or a hanging Promise (simulate timeout)
74
- */
75
- signRound(params: StubSignParams): Promise<Uint8Array | null>;
76
- }
77
- /**
78
- * Create n in-process directory node stubs.
79
- * Each stub has a unique deterministic ID.
80
- */
81
- export declare function createInProcessStubs(n: number): InProcessDirectoryNodeStub[];
82
- //# sourceMappingURL=stubs.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"stubs.d.ts","sourceRoot":"","sources":["../../src/frost/stubs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAIH,OAAO,KAAK,EACV,WAAW,EACX,WAAW,EAEZ,MAAM,iCAAiC,CAAC;AACzC,OAAO,KAAK,EACV,iBAAiB,EACjB,cAAc,EACd,cAAc,EACf,MAAM,YAAY,CAAC;AAIpB,qBAAa,0BAA2B,YAAW,iBAAiB;;IAClE,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;gBAaR,EAAE,EAAE,MAAM;IAMtB;;;OAGG;IACG,YAAY,CAAC,MAAM,EAAE,WAAW,EAAE,GAAG,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;IAIxE;;;;;;OAMG;IACH,eAAe,IAAI;QAAE,MAAM,EAAE,WAAW,CAAC;QAAC,GAAG,EAAE,WAAW,CAAA;KAAE,GAAG,IAAI;IAMnE;;;;OAIG;IACH,cAAc,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI;IAInC;;;;OAIG;IACH,eAAe,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI;IAIpC,0EAA0E;IAC1E,kBAAkB,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI;IAMvC;;;;;OAKG;IACH,WAAW,IAAI,OAAO;IAQtB;;;;OAIG;IACG,kBAAkB,IAAI,OAAO,CAAC,cAAc,CAAC;IAcnD;;;;;;;;;OASG;IACG,SAAS,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC;CAyCpE;AAID;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,EAAE,MAAM,GAAG,0BAA0B,EAAE,CAM5E"}
@@ -1,157 +0,0 @@
1
- /**
2
- * In-process directory node stubs for FROST tests.
3
- *
4
- * CELLO-CRYPTO-003
5
- *
6
- * These stubs mimic the behavior of a real directory node's /cello/frost/1.0.0
7
- * protocol handler. They exercise the same ceremony protocol logic as real nodes
8
- * but run in-process for fast, deterministic tests.
9
- *
10
- * Stub configuration options:
11
- * - Normal: responds with valid partial signatures
12
- * - Unreachable: node is not reachable at initiation (caught by pre-ceremony check)
13
- * - Unresponsive: reachable at initiation, but signRound times out (returns null)
14
- * - InvalidResponse: returns random bytes (simulates malformed partial sig)
15
- */
16
- import { ed25519_FROST } from "@noble/curves/ed25519.js";
17
- import { randomBytes } from "@noble/hashes/utils.js";
18
- // ─── InProcessDirectoryNodeStub ───────────────────────────────────────────────
19
- export class InProcessDirectoryNodeStub {
20
- id;
21
- // Signing key — received via receiveShare() during bootstrap
22
- #key = null;
23
- // Behavior flags
24
- // #unreachable: not reachable at initiation (isReachable() → false)
25
- #unreachable = false;
26
- // #unresponsive: reachable at initiation, but signRound returns null (timeout simulation)
27
- #unresponsive = false;
28
- // #invalidResponse: returns random bytes on signRound (malformed partial sig)
29
- #invalidResponse = false;
30
- constructor(id) {
31
- this.id = id;
32
- }
33
- // ─── DirectoryNodeStub: receiveShare ─────────────────────────────────────────
34
- /**
35
- * Receive a FROST signing share from the bootstrap ceremony.
36
- * Called by bootstrapKeyShares during setup.
37
- */
38
- async receiveShare(secret, pub) {
39
- this.#key = { secret, pub };
40
- }
41
- /**
42
- * TEST-ONLY: Return the stored FROST key pair for use by external test harnesses
43
- * (e.g., to inject a share into a FrostDirectoryHandler via injectShareForTest).
44
- *
45
- * This deliberately exposes the raw FrostSecret for test setup purposes.
46
- * MUST NOT be called outside of test code.
47
- */
48
- getShareForTest() {
49
- return this.#key;
50
- }
51
- // ─── Test control methods ────────────────────────────────────────────────────
52
- /**
53
- * Mark this node as unreachable at ceremony initiation.
54
- * isReachable() will return false, causing the coordinator to exclude
55
- * this node before any rounds begin.
56
- */
57
- setUnreachable(flag) {
58
- this.#unreachable = flag;
59
- }
60
- /**
61
- * Mark this node as unresponsive during signing rounds.
62
- * isReachable() returns true (node is connectable) but signRound returns null
63
- * (simulates a timeout after connection is established).
64
- */
65
- setUnresponsive(flag) {
66
- this.#unresponsive = flag;
67
- }
68
- /** Make this stub return random bytes (simulate malformed partial sig) */
69
- setInvalidResponse(flag) {
70
- this.#invalidResponse = flag;
71
- }
72
- // ─── DirectoryNodeStub interface ─────────────────────────────────────────────
73
- /**
74
- * Returns whether this node is reachable at ceremony initiation.
75
- * The coordinator uses this for the pre-ceremony availability check:
76
- * if fewer than `threshold` nodes are reachable, fail immediately
77
- * with DIRECTORY_BELOW_THRESHOLD.
78
- */
79
- isReachable() {
80
- return !this.#unreachable;
81
- }
82
- // Cache the pending nonce between generateCommitment() and signRound()
83
- // Per RFC 9591: nonces are one-time-use — consumed after signRound
84
- #pendingNonce = null;
85
- /**
86
- * Generate a nonce commitment for the next signing round.
87
- * Called by the coordinator before collecting partial signatures.
88
- * Caches the nonce scalars for use in signRound().
89
- */
90
- async generateCommitment() {
91
- if (!this.#key) {
92
- throw new Error(`Stub ${this.id} has no key share (not bootstrapped)`);
93
- }
94
- const nonce = ed25519_FROST.commit(this.#key.secret);
95
- // Cache nonce scalars so signRound can use them
96
- this.#pendingNonce = nonce.nonces;
97
- return {
98
- nodeId: this.id,
99
- nonceCommitment: nonce.commitments,
100
- nonces: nonce.nonces,
101
- };
102
- }
103
- /**
104
- * Participate in a signing round.
105
- *
106
- * Uses the nonce cached from the preceding generateCommitment() call.
107
- * Returns a never-resolving Promise to simulate timeout (the coordinator's
108
- * per-node timer will fire first). Returns random bytes to simulate
109
- * an invalid partial sig.
110
- *
111
- * @returns Partial signature bytes, or a hanging Promise (simulate timeout)
112
- */
113
- async signRound(params) {
114
- // Unresponsive: simulate a node that never responds.
115
- // Return a Promise that never resolves — the coordinator's roundTimeoutMs
116
- // timer will fire first, treating this as a timeout.
117
- if (this.#unresponsive) {
118
- return new Promise(() => {
119
- // intentionally never resolve — coordinator timeout fires instead
120
- });
121
- }
122
- if (!this.#key) {
123
- return null;
124
- }
125
- // InvalidResponse: return random bytes (not a valid partial sig)
126
- if (this.#invalidResponse) {
127
- return new Uint8Array(randomBytes(32));
128
- }
129
- // Use the nonce cached from generateCommitment()
130
- if (!this.#pendingNonce) {
131
- // No pending nonce — should not happen in normal ceremony flow
132
- return null;
133
- }
134
- const nonces = this.#pendingNonce;
135
- this.#pendingNonce = null; // consume nonce (one-time use per RFC 9591)
136
- try {
137
- const sig = ed25519_FROST.signShare(this.#key.secret, params.pub, nonces, params.commitmentList, params.msg);
138
- return sig;
139
- }
140
- catch {
141
- return null;
142
- }
143
- }
144
- }
145
- // ─── createInProcessStubs ─────────────────────────────────────────────────────
146
- /**
147
- * Create n in-process directory node stubs.
148
- * Each stub has a unique deterministic ID.
149
- */
150
- export function createInProcessStubs(n) {
151
- return Array.from({ length: n }, (_, i) => {
152
- // Use a stable, deterministic ID that works as a FROST identifier input
153
- const id = `cello-test-node-${i.toString().padStart(4, "0")}`;
154
- return new InProcessDirectoryNodeStub(id);
155
- });
156
- }
157
- //# sourceMappingURL=stubs.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"stubs.js","sourceRoot":"","sources":["../../src/frost/stubs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAYrD,iFAAiF;AAEjF,MAAM,OAAO,0BAA0B;IAC5B,EAAE,CAAS;IAEpB,6DAA6D;IAC7D,IAAI,GAAqD,IAAI,CAAC;IAE9D,iBAAiB;IACjB,oEAAoE;IACpE,YAAY,GAAG,KAAK,CAAC;IACrB,0FAA0F;IAC1F,aAAa,GAAG,KAAK,CAAC;IACtB,8EAA8E;IAC9E,gBAAgB,GAAG,KAAK,CAAC;IAEzB,YAAY,EAAU;QACpB,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;IACf,CAAC;IAED,gFAAgF;IAEhF;;;OAGG;IACH,KAAK,CAAC,YAAY,CAAC,MAAmB,EAAE,GAAgB;QACtD,IAAI,CAAC,IAAI,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC;IAC9B,CAAC;IAED;;;;;;OAMG;IACH,eAAe;QACb,OAAO,IAAI,CAAC,IAAI,CAAC;IACnB,CAAC;IAED,gFAAgF;IAEhF;;;;OAIG;IACH,cAAc,CAAC,IAAa;QAC1B,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC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