@did-btcr2/method 0.36.0 → 0.37.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.
Files changed (164) hide show
  1. package/dist/.tsbuildinfo +1 -1
  2. package/dist/browser.js +1371 -260
  3. package/dist/browser.mjs +1371 -260
  4. package/dist/cjs/index.js +1464 -343
  5. package/dist/esm/core/aggregation/beacon-strategy.js +19 -6
  6. package/dist/esm/core/aggregation/beacon-strategy.js.map +1 -1
  7. package/dist/esm/core/aggregation/cohort.js +142 -33
  8. package/dist/esm/core/aggregation/cohort.js.map +1 -1
  9. package/dist/esm/core/aggregation/conditions.js +27 -0
  10. package/dist/esm/core/aggregation/conditions.js.map +1 -1
  11. package/dist/esm/core/aggregation/fallback-spend.js +132 -0
  12. package/dist/esm/core/aggregation/fallback-spend.js.map +1 -0
  13. package/dist/esm/core/aggregation/messages/base.js.map +1 -1
  14. package/dist/esm/core/aggregation/messages/bodies.js +46 -1
  15. package/dist/esm/core/aggregation/messages/bodies.js.map +1 -1
  16. package/dist/esm/core/aggregation/messages/constants.js +11 -0
  17. package/dist/esm/core/aggregation/messages/constants.js.map +1 -1
  18. package/dist/esm/core/aggregation/messages/factories.js +27 -1
  19. package/dist/esm/core/aggregation/messages/factories.js.map +1 -1
  20. package/dist/esm/core/aggregation/messages/guards.js +4 -1
  21. package/dist/esm/core/aggregation/messages/guards.js.map +1 -1
  22. package/dist/esm/core/aggregation/participant.js +218 -18
  23. package/dist/esm/core/aggregation/participant.js.map +1 -1
  24. package/dist/esm/core/aggregation/phases.js +6 -0
  25. package/dist/esm/core/aggregation/phases.js.map +1 -1
  26. package/dist/esm/core/aggregation/recovery-policy.js +156 -0
  27. package/dist/esm/core/aggregation/recovery-policy.js.map +1 -0
  28. package/dist/esm/core/aggregation/recovery-spend.js +106 -0
  29. package/dist/esm/core/aggregation/recovery-spend.js.map +1 -0
  30. package/dist/esm/core/aggregation/runner/aggregation-runner.js +11 -3
  31. package/dist/esm/core/aggregation/runner/aggregation-runner.js.map +1 -1
  32. package/dist/esm/core/aggregation/runner/participant-runner.js +106 -19
  33. package/dist/esm/core/aggregation/runner/participant-runner.js.map +1 -1
  34. package/dist/esm/core/aggregation/runner/service-runner.js +409 -195
  35. package/dist/esm/core/aggregation/runner/service-runner.js.map +1 -1
  36. package/dist/esm/core/aggregation/service.js +221 -11
  37. package/dist/esm/core/aggregation/service.js.map +1 -1
  38. package/dist/esm/core/aggregation/signing-session.js +3 -3
  39. package/dist/esm/core/aggregation/signing-session.js.map +1 -1
  40. package/dist/esm/core/aggregation/transport/http/envelope.js +3 -3
  41. package/dist/esm/core/aggregation/transport/http/inbox-buffer.js +1 -1
  42. package/dist/esm/core/aggregation/transport/http/nonce-cache.js +1 -1
  43. package/dist/esm/core/aggregation/transport/http/rate-limiter.js +1 -1
  44. package/dist/esm/core/aggregation/transport/http/request-auth.js +1 -1
  45. package/dist/esm/core/aggregation/transport/http/server.js +1 -1
  46. package/dist/esm/core/aggregation/transport/http/sse-stream.js +1 -1
  47. package/dist/esm/core/aggregation/transport/http/sse-writer.js +1 -1
  48. package/dist/esm/core/aggregation/transport/in-memory.js +1 -1
  49. package/dist/esm/core/aggregation/transport/nostr.js +6 -6
  50. package/dist/esm/core/beacon/beacon.js +15 -10
  51. package/dist/esm/core/beacon/beacon.js.map +1 -1
  52. package/dist/esm/core/beacon/cas-beacon.js +6 -6
  53. package/dist/esm/core/beacon/cas-beacon.js.map +1 -1
  54. package/dist/esm/core/beacon/singleton-beacon.js +2 -2
  55. package/dist/esm/core/beacon/singleton-beacon.js.map +1 -1
  56. package/dist/esm/core/beacon/smt-beacon.js +3 -3
  57. package/dist/esm/core/beacon/smt-beacon.js.map +1 -1
  58. package/dist/esm/core/resolver.js +8 -8
  59. package/dist/esm/core/resolver.js.map +1 -1
  60. package/dist/esm/core/updater.js +6 -6
  61. package/dist/esm/core/updater.js.map +1 -1
  62. package/dist/esm/did-btcr2.js +2 -2
  63. package/dist/esm/index.js +3 -0
  64. package/dist/esm/index.js.map +1 -1
  65. package/dist/types/core/aggregation/beacon-strategy.d.ts +8 -4
  66. package/dist/types/core/aggregation/beacon-strategy.d.ts.map +1 -1
  67. package/dist/types/core/aggregation/cohort.d.ts +88 -17
  68. package/dist/types/core/aggregation/cohort.d.ts.map +1 -1
  69. package/dist/types/core/aggregation/conditions.d.ts +28 -0
  70. package/dist/types/core/aggregation/conditions.d.ts.map +1 -1
  71. package/dist/types/core/aggregation/fallback-spend.d.ts +94 -0
  72. package/dist/types/core/aggregation/fallback-spend.d.ts.map +1 -0
  73. package/dist/types/core/aggregation/logger.d.ts +1 -1
  74. package/dist/types/core/aggregation/messages/base.d.ts +6 -0
  75. package/dist/types/core/aggregation/messages/base.d.ts.map +1 -1
  76. package/dist/types/core/aggregation/messages/bodies.d.ts +50 -2
  77. package/dist/types/core/aggregation/messages/bodies.d.ts.map +1 -1
  78. package/dist/types/core/aggregation/messages/constants.d.ts +8 -0
  79. package/dist/types/core/aggregation/messages/constants.d.ts.map +1 -1
  80. package/dist/types/core/aggregation/messages/factories.d.ts +40 -0
  81. package/dist/types/core/aggregation/messages/factories.d.ts.map +1 -1
  82. package/dist/types/core/aggregation/messages/guards.d.ts.map +1 -1
  83. package/dist/types/core/aggregation/participant.d.ts +47 -4
  84. package/dist/types/core/aggregation/participant.d.ts.map +1 -1
  85. package/dist/types/core/aggregation/phases.d.ts +8 -2
  86. package/dist/types/core/aggregation/phases.d.ts.map +1 -1
  87. package/dist/types/core/aggregation/recovery-policy.d.ts +132 -0
  88. package/dist/types/core/aggregation/recovery-policy.d.ts.map +1 -0
  89. package/dist/types/core/aggregation/recovery-spend.d.ts +94 -0
  90. package/dist/types/core/aggregation/recovery-spend.d.ts.map +1 -0
  91. package/dist/types/core/aggregation/runner/aggregation-runner.d.ts +13 -3
  92. package/dist/types/core/aggregation/runner/aggregation-runner.d.ts.map +1 -1
  93. package/dist/types/core/aggregation/runner/events.d.ts +48 -16
  94. package/dist/types/core/aggregation/runner/events.d.ts.map +1 -1
  95. package/dist/types/core/aggregation/runner/participant-runner.d.ts +23 -14
  96. package/dist/types/core/aggregation/runner/participant-runner.d.ts.map +1 -1
  97. package/dist/types/core/aggregation/runner/service-runner.d.ts +102 -23
  98. package/dist/types/core/aggregation/runner/service-runner.d.ts.map +1 -1
  99. package/dist/types/core/aggregation/service.d.ts +26 -2
  100. package/dist/types/core/aggregation/service.d.ts.map +1 -1
  101. package/dist/types/core/aggregation/signing-session.d.ts +2 -2
  102. package/dist/types/core/aggregation/signing-session.d.ts.map +1 -1
  103. package/dist/types/core/aggregation/transport/http/envelope.d.ts +3 -3
  104. package/dist/types/core/aggregation/transport/http/inbox-buffer.d.ts +1 -1
  105. package/dist/types/core/aggregation/transport/http/nonce-cache.d.ts +1 -1
  106. package/dist/types/core/aggregation/transport/http/rate-limiter.d.ts +1 -1
  107. package/dist/types/core/aggregation/transport/http/request-auth.d.ts +1 -1
  108. package/dist/types/core/aggregation/transport/http/server.d.ts +1 -1
  109. package/dist/types/core/aggregation/transport/http/sse-stream.d.ts +2 -2
  110. package/dist/types/core/aggregation/transport/http/sse-writer.d.ts +1 -1
  111. package/dist/types/core/aggregation/transport/in-memory.d.ts +1 -1
  112. package/dist/types/core/aggregation/transport/nostr.d.ts +4 -4
  113. package/dist/types/core/aggregation/transport/transport.d.ts +4 -4
  114. package/dist/types/core/aggregation/transport/transport.d.ts.map +1 -1
  115. package/dist/types/core/beacon/beacon.d.ts +7 -7
  116. package/dist/types/core/beacon/beacon.d.ts.map +1 -1
  117. package/dist/types/core/beacon/cas-beacon.d.ts +2 -2
  118. package/dist/types/core/beacon/interfaces.d.ts +1 -1
  119. package/dist/types/core/resolver.d.ts +3 -3
  120. package/dist/types/core/updater.d.ts +4 -4
  121. package/dist/types/did-btcr2.d.ts +2 -2
  122. package/dist/types/index.d.ts +3 -0
  123. package/dist/types/index.d.ts.map +1 -1
  124. package/package.json +4 -4
  125. package/src/core/aggregation/beacon-strategy.ts +27 -9
  126. package/src/core/aggregation/cohort.ts +171 -35
  127. package/src/core/aggregation/conditions.ts +56 -0
  128. package/src/core/aggregation/fallback-spend.ts +223 -0
  129. package/src/core/aggregation/logger.ts +1 -1
  130. package/src/core/aggregation/messages/base.ts +6 -0
  131. package/src/core/aggregation/messages/bodies.ts +94 -1
  132. package/src/core/aggregation/messages/constants.ts +12 -0
  133. package/src/core/aggregation/messages/factories.ts +57 -0
  134. package/src/core/aggregation/messages/guards.ts +6 -0
  135. package/src/core/aggregation/participant.ts +264 -20
  136. package/src/core/aggregation/phases.ts +9 -0
  137. package/src/core/aggregation/recovery-policy.ts +237 -0
  138. package/src/core/aggregation/recovery-spend.ts +192 -0
  139. package/src/core/aggregation/runner/aggregation-runner.ts +27 -5
  140. package/src/core/aggregation/runner/events.ts +47 -19
  141. package/src/core/aggregation/runner/participant-runner.ts +113 -31
  142. package/src/core/aggregation/runner/service-runner.ts +484 -203
  143. package/src/core/aggregation/service.ts +260 -14
  144. package/src/core/aggregation/signing-session.ts +3 -3
  145. package/src/core/aggregation/transport/http/envelope.ts +3 -3
  146. package/src/core/aggregation/transport/http/inbox-buffer.ts +1 -1
  147. package/src/core/aggregation/transport/http/nonce-cache.ts +1 -1
  148. package/src/core/aggregation/transport/http/rate-limiter.ts +1 -1
  149. package/src/core/aggregation/transport/http/request-auth.ts +1 -1
  150. package/src/core/aggregation/transport/http/server.ts +1 -1
  151. package/src/core/aggregation/transport/http/sse-stream.ts +2 -2
  152. package/src/core/aggregation/transport/http/sse-writer.ts +1 -1
  153. package/src/core/aggregation/transport/in-memory.ts +1 -1
  154. package/src/core/aggregation/transport/nostr.ts +6 -6
  155. package/src/core/aggregation/transport/transport.ts +4 -4
  156. package/src/core/beacon/beacon.ts +16 -11
  157. package/src/core/beacon/cas-beacon.ts +7 -7
  158. package/src/core/beacon/interfaces.ts +1 -1
  159. package/src/core/beacon/singleton-beacon.ts +2 -2
  160. package/src/core/beacon/smt-beacon.ts +3 -3
  161. package/src/core/resolver.ts +8 -8
  162. package/src/core/updater.ts +6 -6
  163. package/src/did-btcr2.ts +2 -2
  164. package/src/index.ts +3 -0
@@ -15,7 +15,7 @@ export interface CohortAdvert extends CohortConditions {
15
15
  network: string;
16
16
  serviceCommunicationPk: Uint8Array;
17
17
  }
18
- /** Joined cohort info available after the cohort is finalized. */
18
+ /** Joined cohort info, available after the cohort is finalized. */
19
19
  export interface JoinedCohortInfo {
20
20
  cohortId: string;
21
21
  serviceDid: string;
@@ -29,8 +29,11 @@ export interface PendingValidation {
29
29
  signalBytesHex: string;
30
30
  casAnnouncement?: Record<string, string>;
31
31
  smtProof?: SerializedSMTProof;
32
+ /** Canonical hash of this participant's update; empty for a decliner. */
32
33
  expectedHash: string;
33
34
  matches: boolean;
35
+ /** True if this participant submitted an update; false if it declined (non-inclusion). */
36
+ included: boolean;
34
37
  }
35
38
  /** Pending signing request (UI: review tx for approval). */
36
39
  export interface PendingSigningRequest {
@@ -41,6 +44,20 @@ export interface PendingSigningRequest {
41
44
  prevOutScriptHex: string;
42
45
  prevOutValue: string;
43
46
  }
47
+ /**
48
+ * Pending fallback signing request (UI: review the fallback spend for approval).
49
+ * The service fell back to the k-of-n script path; the member signs the SAME
50
+ * beacon transaction over the fallback script-path sighash (ADR 042).
51
+ */
52
+ export interface PendingFallbackRequest {
53
+ cohortId: string;
54
+ sessionId: string;
55
+ pendingTxHex: string;
56
+ prevOutScriptHex: string;
57
+ prevOutValue: string;
58
+ /** Fallback leaf script, hex (advisory; the member recomputes it from its own cohort). */
59
+ fallbackLeafScriptHex: string;
60
+ }
44
61
  export interface AggregationParticipantParams {
45
62
  did: string;
46
63
  /**
@@ -68,7 +85,7 @@ export declare class AggregationParticipant {
68
85
  get publicKey(): Uint8Array;
69
86
  /**
70
87
  * Process an incoming message. Updates internal state but never produces
71
- * outgoing messages those come exclusively from action methods.
88
+ * outgoing messages: those come exclusively from action methods.
72
89
  */
73
90
  receive(message: BaseMessage): void;
74
91
  /** Cohorts the participant has discovered but not yet joined. */
@@ -78,15 +95,31 @@ export declare class AggregationParticipant {
78
95
  * Returns the opt-in message to send.
79
96
  */
80
97
  joinCohort(cohortId: string): BaseMessage[];
81
- /** Cohorts that have been finalized beacon address available. */
98
+ /** Cohorts that have been finalized: beacon address available. */
82
99
  get joinedCohorts(): ReadonlyMap<string, JoinedCohortInfo>;
83
100
  /**
84
101
  * User action: submit a signed BTCR2 update for inclusion in the cohort's
85
102
  * aggregated signal.
86
103
  */
87
104
  submitUpdate(cohortId: string, signedUpdate: SignedBTCR2Update): BaseMessage[];
105
+ /**
106
+ * User action: decline to submit an update this round (cooperative
107
+ * non-inclusion). The member stays in the cohort and still signs; it will be
108
+ * absent from the CAS Announcement Map, or carry a non-inclusion leaf in the
109
+ * SMT. Returns the SUBMIT_NONINCLUDED message to send.
110
+ */
111
+ declineUpdate(cohortId: string): BaseMessage[];
88
112
  /** Aggregated data awaiting user validation. */
89
113
  get pendingValidations(): ReadonlyMap<string, PendingValidation>;
114
+ /**
115
+ * The validated aggregated data retained for a cohort, regardless of phase.
116
+ * Unlike {@link pendingValidations} (which lists only cohorts still awaiting
117
+ * the validate decision), this returns the stored validation, including the
118
+ * participant's sidecar (the CAS Announcement map or its SMT inclusion proof),
119
+ * so it is still readable once the cohort reaches Complete. Returns
120
+ * undefined before aggregated data has been received.
121
+ */
122
+ getValidation(cohortId: string): PendingValidation | undefined;
90
123
  /**
91
124
  * User action: approve aggregated data and send validation ack.
92
125
  */
@@ -103,10 +136,20 @@ export declare class AggregationParticipant {
103
136
  approveNonce(cohortId: string): BaseMessage[];
104
137
  /**
105
138
  * User action: generate and return the partial signature.
106
- * In most UIs this is automatic after AwaitingPartialSig but exposing it
139
+ * In most UIs this is automatic after AwaitingPartialSig, but exposing it
107
140
  * as an explicit action lets the client UI confirm before signing if desired.
108
141
  */
109
142
  generatePartialSignature(cohortId: string): BaseMessage[];
143
+ /** Fallback signing requests awaiting user approval (UI: review the fallback spend). */
144
+ get pendingFallbackRequests(): ReadonlyMap<string, PendingFallbackRequest>;
145
+ /**
146
+ * User action: authorize the fallback spend. Recomputes the k-of-n fallback
147
+ * leaf from the member's OWN cohort state (not the service-provided script),
148
+ * computes the BIP-341 script-path sighash over the requested transaction, and
149
+ * returns a standalone BIP-340 signature (no nonce round). The member completes
150
+ * once it has contributed; the service needs only k of these.
151
+ */
152
+ approveFallback(cohortId: string): BaseMessage[];
110
153
  getCohortPhase(cohortId: string): ParticipantCohortPhaseType | undefined;
111
154
  /**
112
155
  * Zeroize any retained MuSig2 secret nonces across all cohorts. The raw
@@ -1 +1 @@
1
- {"version":3,"file":"participant.d.ts","sourceRoot":"","sources":["../../../../src/core/aggregation/participant.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,KAAK,EAAE,kBAAkB,EAAC,MAAM,gBAAgB,CAAC;AAKxD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAExD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAkBtD,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,aAAa,CAAC;AAE9D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAGrD;;;;GAIG;AACH,MAAM,WAAW,YAAa,SAAQ,gBAAgB;IACpD,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,sBAAsB,EAAE,UAAU,CAAC;CACpC;AAED,oEAAoE;AACpE,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC;CAC/B;AAED,iFAAiF;AACjF,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,MAAM,CAAC;IACj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I,YAAY,IAAI,IAAI;CAK5B"}
@@ -8,7 +8,7 @@
8
8
  * The signing session has its own phase enum because MuSig2 signing is a
9
9
  * sub-protocol within the larger aggregation protocol.
10
10
  */
11
- export type ServiceCohortPhaseType = 'Created' | 'Advertised' | 'CohortSet' | 'CollectingUpdates' | 'UpdatesCollected' | 'DataDistributed' | 'Validated' | 'SigningStarted' | 'NoncesCollected' | 'AwaitingPartialSigs' | 'Complete' | 'Failed';
11
+ export type ServiceCohortPhaseType = 'Created' | 'Advertised' | 'CohortSet' | 'CollectingUpdates' | 'UpdatesCollected' | 'DataDistributed' | 'Validated' | 'SigningStarted' | 'NoncesCollected' | 'AwaitingPartialSigs' | 'FallbackRequested' | 'Complete' | 'Failed';
12
12
  export declare enum ServiceCohortPhase {
13
13
  Created = "Created",
14
14
  Advertised = "Advertised",
@@ -20,20 +20,26 @@ export declare enum ServiceCohortPhase {
20
20
  SigningStarted = "SigningStarted",
21
21
  NoncesCollected = "NoncesCollected",
22
22
  AwaitingPartialSigs = "AwaitingPartialSigs",
23
+ /** Optimistic n-of-n key path abandoned; collecting k-of-n fallback signatures (ADR 042). */
24
+ FallbackRequested = "FallbackRequested",
23
25
  Complete = "Complete",
24
26
  Failed = "Failed"
25
27
  }
26
- export type ParticipantCohortPhaseType = 'Discovered' | 'OptedIn' | 'CohortReady' | 'UpdateSubmitted' | 'AwaitingValidation' | 'ValidationSent' | 'AwaitingSigning' | 'NonceSent' | 'AwaitingPartialSig' | 'Complete' | 'Failed';
28
+ export type ParticipantCohortPhaseType = 'Discovered' | 'OptedIn' | 'CohortReady' | 'UpdateSubmitted' | 'NonIncluded' | 'AwaitingValidation' | 'ValidationSent' | 'AwaitingSigning' | 'NonceSent' | 'AwaitingPartialSig' | 'AwaitingFallbackSig' | 'Complete' | 'Failed';
27
29
  export declare enum ParticipantCohortPhase {
28
30
  Discovered = "Discovered",
29
31
  OptedIn = "OptedIn",
30
32
  CohortReady = "CohortReady",
31
33
  UpdateSubmitted = "UpdateSubmitted",
34
+ /** Member declined to submit an update this round (cooperative non-inclusion); still signs. */
35
+ NonIncluded = "NonIncluded",
32
36
  AwaitingValidation = "AwaitingValidation",
33
37
  ValidationSent = "ValidationSent",
34
38
  AwaitingSigning = "AwaitingSigning",
35
39
  NonceSent = "NonceSent",
36
40
  AwaitingPartialSig = "AwaitingPartialSig",
41
+ /** Service fell back to the k-of-n script path; member can sign the fallback (ADR 042). */
42
+ AwaitingFallbackSig = "AwaitingFallbackSig",
37
43
  Complete = "Complete",
38
44
  Failed = "Failed"
39
45
  }
@@ -1 +1 @@
1
- {"version":3,"file":"phases.d.ts","sourceRoot":"","sources":["../../../../src/core/aggregation/phases.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,MAAM,MAAM,sBAAsB,GAC9B,SAAS,GACT,YAAY,GACZ,WAAW,GACX,mBAAmB,GACnB,kBAAkB,GAClB,iBAAiB,GACjB,WAAW,GACX,gBAAgB,GAChB,iBAAiB,GACjB,qBAAqB,GACrB,UAAU,GACV,QAAQ,CAAC;AAEb,oBAAY,kBAAkB;IAC5B,OAAO,YAAY;IACnB,UAAU,eAAe;IACzB,SAAS,cAAc;IACvB,iBAAiB,sBAAsB;IACvC,gBAAgB,qBAAqB;IACrC,eAAe,oBAAoB;IACnC,SAAS,cAAc;IACvB,cAAc,mBAAmB;IACjC,eAAe,oBAAoB;IACnC,mBAAmB,wBAAwB;IAC3C,QAAQ,aAAa;IACrB,MAAM,WAAW;CAClB;AAED,MAAM,MAAM,0BAA0B,GAClC,YAAY,GACZ,SAAS,GACT,aAAa,GACb,iBAAiB,GACjB,oBAAoB,GACpB,gBAAgB,GAChB,iBAAiB,GACjB,WAAW,GACX,oBAAoB,GACpB,UAAU,GACV,QAAQ,CAAC;AAEb,oBAAY,sBAAsB;IAChC,UAAU,eAAe;IACzB,OAAO,YAAY;IACnB,WAAW,gBAAgB;IAC3B,eAAe,oBAAoB;IACnC,kBAAkB,uBAAuB;IACzC,cAAc,mBAAmB;IACjC,eAAe,oBAAoB;IACnC,SAAS,cAAc;IACvB,kBAAkB,uBAAuB;IACzC,QAAQ,aAAa;IACrB,MAAM,WAAW;CAClB;AAED,MAAM,MAAM,uBAAuB,GAC/B,4BAA4B,GAC5B,4BAA4B,GAC5B,2BAA2B,GAC3B,2BAA2B,GAC3B,UAAU,GACV,QAAQ,CAAC;AAEb,oBAAY,mBAAmB;IAC7B,0BAA0B,+BAA+B;IACzD,0BAA0B,+BAA+B;IACzD,yBAAyB,8BAA8B;IACvD,yBAAyB,8BAA8B;IACvD,QAAQ,aAAa;IACrB,MAAM,WAAW;CAClB"}
1
+ {"version":3,"file":"phases.d.ts","sourceRoot":"","sources":["../../../../src/core/aggregation/phases.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,MAAM,MAAM,sBAAsB,GAC9B,SAAS,GACT,YAAY,GACZ,WAAW,GACX,mBAAmB,GACnB,kBAAkB,GAClB,iBAAiB,GACjB,WAAW,GACX,gBAAgB,GAChB,iBAAiB,GACjB,qBAAqB,GACrB,mBAAmB,GACnB,UAAU,GACV,QAAQ,CAAC;AAEb,oBAAY,kBAAkB;IAC5B,OAAO,YAAY;IACnB,UAAU,eAAe;IACzB,SAAS,cAAc;IACvB,iBAAiB,sBAAsB;IACvC,gBAAgB,qBAAqB;IACrC,eAAe,oBAAoB;IACnC,SAAS,cAAc;IACvB,cAAc,mBAAmB;IACjC,eAAe,oBAAoB;IACnC,mBAAmB,wBAAwB;IAC3C,6FAA6F;IAC7F,iBAAiB,sBAAsB;IACvC,QAAQ,aAAa;IACrB,MAAM,WAAW;CAClB;AAED,MAAM,MAAM,0BAA0B,GAClC,YAAY,GACZ,SAAS,GACT,aAAa,GACb,iBAAiB,GACjB,aAAa,GACb,oBAAoB,GACpB,gBAAgB,GAChB,iBAAiB,GACjB,WAAW,GACX,oBAAoB,GACpB,qBAAqB,GACrB,UAAU,GACV,QAAQ,CAAC;AAEb,oBAAY,sBAAsB;IAChC,UAAU,eAAe;IACzB,OAAO,YAAY;IACnB,WAAW,gBAAgB;IAC3B,eAAe,oBAAoB;IACnC,+FAA+F;IAC/F,WAAW,gBAAgB;IAC3B,kBAAkB,uBAAuB;IACzC,cAAc,mBAAmB;IACjC,eAAe,oBAAoB;IACnC,SAAS,cAAc;IACvB,kBAAkB,uBAAuB;IACzC,2FAA2F;IAC3F,mBAAmB,wBAAwB;IAC3C,QAAQ,aAAa;IACrB,MAAM,WAAW;CAClB;AAED,MAAM,MAAM,uBAAuB,GAC/B,4BAA4B,GAC5B,4BAA4B,GAC5B,2BAA2B,GAC3B,2BAA2B,GAC3B,UAAU,GACV,QAAQ,CAAC;AAEb,oBAAY,mBAAmB;IAC7B,0BAA0B,+BAA+B;IACzD,0BAA0B,+BAA+B;IACzD,yBAAyB,8BAA8B;IACvD,yBAAyB,8BAA8B;IACvD,QAAQ,aAAa;IACrB,MAAM,WAAW;CAClB"}
@@ -0,0 +1,132 @@
1
+ /**
2
+ * Recovery policy for aggregate beacon outputs.
3
+ *
4
+ * An aggregate beacon UTXO is a Taproot output whose key path is the cohort's
5
+ * n-of-n MuSig2 aggregate key. A key-path-only output can be spent only with a
6
+ * signature from every cohort member, so a single missing signer would lock the
7
+ * funds forever. To prevent that, the output commits to a script tree with two
8
+ * leaves:
9
+ * - a k-of-n fallback leaf (`p2tr_ms`, BIP-342 CHECKSIGADD): any k cohort members
10
+ * can still push the announcement through if some signers go missing, so the
11
+ * beacon stays live without waiting out the timelock.
12
+ * - a CSV recovery leaf: after a relative-timelock delay the funder can reclaim
13
+ * the UTXO unilaterally with its own recovery key, so funds are never
14
+ * permanently stranded even if fewer than k members remain.
15
+ *
16
+ * This module is the seam between the funding model and the concrete script
17
+ * leaves. Only `operator-funded` is implemented today (the k-of-n fallback leaf
18
+ * plus one CSV leaf keyed to the operator's recovery key). A future
19
+ * `participant-funded` model can be added as another case returning
20
+ * per-participant refund leaves, without touching the cohort, service, or
21
+ * signing code. See ADR 042.
22
+ */
23
+ /**
24
+ * Who funds the beacon UTXO and holds the recovery path.
25
+ * - `operator-funded`: the service operator funds the UTXO and holds a single
26
+ * CSV recovery key. Implemented.
27
+ * - `participant-funded`: reserved for per-participant funding with
28
+ * per-participant refund leaves. Not implemented.
29
+ */
30
+ export type FundingModel = 'operator-funded' | 'participant-funded';
31
+ /** Default funding model when an advert/config leaves it unspecified. */
32
+ export declare const DEFAULT_FUNDING_MODEL: FundingModel;
33
+ /**
34
+ * Default relative-timelock (in blocks) before operator recovery is spendable.
35
+ * About one day at 10-minute blocks. Operators set their own per-cohort value;
36
+ * this is only a convenience default for callers.
37
+ */
38
+ export declare const DEFAULT_RECOVERY_SEQUENCE = 144;
39
+ /**
40
+ * Maximum allowed `recoverySequence`, 0xffff (65535 blocks, about 455 days).
41
+ *
42
+ * The value is a BIP-68 block-based relative timelock and is placed directly in
43
+ * the spending input's nSequence. BIP-68 only uses the low 16 bits as the value
44
+ * when the type flag (bit 22) is clear, so constraining to [1, 0xffff] keeps the
45
+ * timelock block-based and, critically, leaves the disable flag (bit 31) clear.
46
+ * A value with bit 31 set would disable CHECKSEQUENCEVERIFY entirely, letting the
47
+ * recovery key spend with no delay; an upper bound of 0xffff makes that
48
+ * unrepresentable.
49
+ */
50
+ export declare const MAX_RECOVERY_SEQUENCE = 65535;
51
+ /** Inputs needed to build the CSV recovery leaf. */
52
+ export interface RecoveryPolicyParams {
53
+ /** Operator recovery key, x-only (32 bytes). Spends the recovery leaf via CHECKSIG. */
54
+ recoveryKey: Uint8Array;
55
+ /**
56
+ * Relative-timelock value (BIP-68 nSequence) the recovery spend must wait,
57
+ * encoded into the leaf as `<recoverySequence> CHECKSEQUENCEVERIFY`.
58
+ */
59
+ recoverySequence: number;
60
+ }
61
+ /** Inputs needed to build the k-of-n fallback leaf. */
62
+ export interface FallbackPolicyParams {
63
+ /**
64
+ * The cohort's participant public keys (compressed secp256k1, 33 bytes each).
65
+ * Sorted internally per BIP-327 and reduced to x-only so the leaf is
66
+ * deterministic regardless of the order keys are supplied in.
67
+ */
68
+ cohortKeys: Uint8Array[];
69
+ /**
70
+ * Number of signers (k) the fallback leaf requires, 1..n. This is the
71
+ * resolved threshold; callers that carry an advertised-or-default value should
72
+ * resolve it with {@link resolveFallbackThreshold} first.
73
+ */
74
+ fallbackThreshold: number;
75
+ }
76
+ /** All inputs the beacon output's script tree commits to (fallback leaf + recovery leaf). */
77
+ export interface BeaconLeafParams extends RecoveryPolicyParams, FallbackPolicyParams {
78
+ }
79
+ /** A single Taproot script-tree leaf, spent at the default tapscript leaf version (0xc0). */
80
+ export interface TaprootScriptLeaf {
81
+ script: Uint8Array;
82
+ }
83
+ /** BIP-341 default tapscript leaf version. */
84
+ export declare const TAPROOT_LEAF_VERSION = 192;
85
+ /**
86
+ * BIP-341 tapleaf hash: `taggedHash("TapLeaf", leafVersion || compactSize(len) || script)`.
87
+ * Used to key a script-path signature to its leaf when assembling the witness
88
+ * for a script-path spend (the fallback and recovery spend builders).
89
+ */
90
+ export declare function tapLeafHash(script: Uint8Array, leafVersion?: number): Uint8Array;
91
+ /**
92
+ * Resolve the effective fallback threshold k from an advertised value and the
93
+ * cohort size n. When unadvertised it defaults to n-1 (tolerate one missing or
94
+ * defecting signer, the cheapest useful fallback witness), floored at 1. Both
95
+ * the service and every participant resolve this identically so they derive the
96
+ * same beacon address.
97
+ */
98
+ export declare function resolveFallbackThreshold(advertised: number | undefined, n: number): number;
99
+ /**
100
+ * Build the k-of-n fallback leaf script: a BIP-342 `p2tr_ms` CHECKSIGADD
101
+ * multisig over the cohort's x-only keys. Any k members can spend this leaf to
102
+ * push the announcement through when the optimistic n-of-n key path stalls.
103
+ *
104
+ * The keys are sorted per BIP-327 (matching the MuSig2 internal-key ordering)
105
+ * and reduced to x-only, so the leaf is identical for every party that builds it.
106
+ */
107
+ export declare function buildFallbackLeaf(params: FallbackPolicyParams): Uint8Array;
108
+ /**
109
+ * Build the CSV recovery leaf script:
110
+ * `<recoverySequence> CHECKSEQUENCEVERIFY DROP <recoveryKey> CHECKSIG`.
111
+ *
112
+ * After `recoverySequence` blocks (relative to the UTXO's confirmation) the
113
+ * holder of `recoveryKey` can spend the output via the script path.
114
+ */
115
+ export declare function buildRecoveryScript(params: RecoveryPolicyParams): Uint8Array;
116
+ /**
117
+ * Build the Taproot script-tree leaves for a funding model. The returned leaves
118
+ * are the script tree the beacon output key commits to alongside the cohort's
119
+ * MuSig2 internal key.
120
+ *
121
+ * Canonical leaf order is fallback (k-of-n, leaf A) then CSV recovery (leaf B).
122
+ * For the current two-leaf tree the Merkle root is order-invariant (a TapBranch
123
+ * sorts its two child hashes), but fixing the order keeps the construction
124
+ * deterministic and reviewable, and is consensus-affecting should the tree ever
125
+ * grow past two leaves.
126
+ *
127
+ * @throws {AggregationCohortError} when the funding model is reserved (e.g.
128
+ * `participant-funded`) or unknown, or when the fallback/recovery params are
129
+ * invalid.
130
+ */
131
+ export declare function buildRecoveryLeaves(fundingModel: FundingModel, params: BeaconLeafParams): TaprootScriptLeaf[];
132
+ //# sourceMappingURL=recovery-policy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"recovery-policy.d.ts","sourceRoot":"","sources":["../../../../src/core/aggregation/recovery-policy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAQH;;;;;;GAMG;AACH,MAAM,MAAM,YAAY,GAAG,iBAAiB,GAAG,oBAAoB,CAAC;AAEpE,yEAAyE;AACzE,eAAO,MAAM,qBAAqB,EAAE,YAAgC,CAAC;AAErE;;;;GAIG;AACH,eAAO,MAAM,yBAAyB,MAAM,CAAC;AAE7C;;;;;;;;;;GAUG;AACH,eAAO,MAAM,qBAAqB,QAAS,CAAC;AAE5C,oDAAoD;AACpD,MAAM,WAAW,oBAAoB;IACnC,uFAAuF;IACvF,WAAW,EAAE,UAAU,CAAC;IACxB;;;OAGG;IACH,gBAAgB,EAAE,MAAM,CAAC;CAC1B;AAED,uDAAuD;AACvD,MAAM,WAAW,oBAAoB;IACnC;;;;OAIG;IACH,UAAU,EAAE,UAAU,EAAE,CAAC;IACzB;;;;OAIG;IACH,iBAAiB,EAAE,MAAM,CAAC;CAC3B;AAED,6FAA6F;AAC7F,MAAM,WAAW,gBAAiB,SAAQ,oBAAoB,EAAE,oBAAoB;CAAG;AAEvF,6FAA6F;AAC7F,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,UAAU,CAAC;CACpB;AAED,8CAA8C;AAC9C,eAAO,MAAM,oBAAoB,MAAO,CAAC;AASzC;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,UAAU,EAAE,WAAW,GAAE,MAA6B,GAAG,UAAU,CAKtG;AAED;;;;;;GAMG;AACH,wBAAgB,wBAAwB,CAAC,UAAU,EAAE,MAAM,GAAG,SAAS,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAE1F;AA0BD;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,oBAAoB,GAAG,UAAU,CAI1E;AAiBD;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,oBAAoB,GAAG,UAAU,CAS5E;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,mBAAmB,CACjC,YAAY,EAAE,YAAY,EAC1B,MAAM,EAAE,gBAAgB,GACvB,iBAAiB,EAAE,CAkBrB"}
@@ -0,0 +1,94 @@
1
+ /**
2
+ * Recovery spend builder for aggregate beacon outputs.
3
+ *
4
+ * An aggregate beacon UTXO is a Taproot output whose key path is the cohort's
5
+ * n-of-n MuSig2 aggregate key and whose script path carries a timelocked
6
+ * recovery leaf (see {@link ./recovery-policy.ts} and ADR 042). When the
7
+ * optimistic cooperative key-path spend cannot complete (a missing or defecting
8
+ * signer), the funder reclaims the UTXO via the recovery leaf after the
9
+ * relative-timelock delay.
10
+ *
11
+ * This module builds and signs that script-path spend. It is pure with respect
12
+ * to the network: it takes a UTXO reference plus the cohort and recovery
13
+ * parameters and returns a finalized {@link Transaction}; broadcasting and
14
+ * confirmation are the caller's concern. The recovery key path is a single
15
+ * BIP-340 Schnorr signature, so unlike the MuSig2 key path it can be driven by
16
+ * an opaque or HSM-backed signer.
17
+ *
18
+ * The relative timelock is enforced by consensus (BIP-68/112): the spend is only
19
+ * valid once the UTXO has `recoverySequence` confirmations, and the input's
20
+ * nSequence is set accordingly. The transaction version is 2 so BIP-68 applies.
21
+ */
22
+ import { Transaction } from '@scure/btc-signer';
23
+ import type { FundingModel } from './recovery-policy.js';
24
+ /** Reference to the beacon UTXO being recovered. */
25
+ export interface BeaconUtxoRef {
26
+ /** Transaction id (Esplora display-order hex), as returned by the REST UTXO endpoint. */
27
+ txid: string;
28
+ /** Output index within that transaction. */
29
+ vout: number;
30
+ /** Value of the beacon UTXO in satoshis. */
31
+ value: bigint;
32
+ }
33
+ /** Inputs to {@link buildRecoverySpend}. */
34
+ export interface RecoverySpendParams {
35
+ /**
36
+ * The cohort's participant public keys (compressed secp256k1). Sorted
37
+ * internally per BIP-327 so the reconstructed internal key matches the one the
38
+ * beacon address was derived from.
39
+ */
40
+ cohortKeys: Uint8Array[];
41
+ /** Operator recovery secret key (32 bytes). Its x-only public key must equal {@link recoveryKey}. */
42
+ recoverySecretKey: Uint8Array;
43
+ /** Operator recovery key, x-only (32 bytes), as committed in the recovery leaf. */
44
+ recoveryKey: Uint8Array;
45
+ /** Relative-timelock (BIP-68 nSequence) the recovery leaf enforces. */
46
+ recoverySequence: number;
47
+ /**
48
+ * The advertised k of the k-of-n fallback leaf the beacon output also commits
49
+ * to, or omit to use the same n-1 default the cohort applies. Resolved against
50
+ * `cohortKeys.length` exactly as the cohort does, so the reconstructed script
51
+ * tree and control block match the funded address.
52
+ */
53
+ fallbackThreshold?: number;
54
+ /** Funding model governing the recovery leaves. Defaults to 'operator-funded'. */
55
+ fundingModel?: FundingModel;
56
+ /** Bitcoin network name (bitcoin/mainnet, mutinynet, signet, testnet, regtest). */
57
+ network: string;
58
+ /**
59
+ * The beacon UTXO being recovered.
60
+ *
61
+ * Precondition: the on-chain output at this `txid:vout` MUST have been funded
62
+ * to the beacon address derived from these same `cohortKeys`, `recoveryKey`,
63
+ * `recoverySequence`, and `fundingModel`. If it was funded under different
64
+ * parameters the reconstructed `witnessUtxo.script` will not match the chain,
65
+ * the signature will be invalid, and the spend will be rejected. Pass
66
+ * {@link beaconAddress} to assert this reconstruction up front.
67
+ */
68
+ utxo: BeaconUtxoRef;
69
+ /** Address receiving the recovered funds. */
70
+ destinationAddress: string;
71
+ /** Absolute fee (satoshis) deducted from the recovered value. */
72
+ fee: bigint;
73
+ /**
74
+ * Optional: the cohort's funded beacon address. When provided, the builder
75
+ * asserts that the address it reconstructs from the cohort and recovery params
76
+ * equals it, catching a caller mismatch before producing an unspendable tx.
77
+ */
78
+ beaconAddress?: string;
79
+ }
80
+ /**
81
+ * Build and sign a script-path recovery spend of an aggregate beacon UTXO.
82
+ *
83
+ * Reconstructs the same Taproot output the cohort funded (MuSig2 internal key +
84
+ * recovery script tree), spends it through the recovery leaf with the operator's
85
+ * recovery key, and finalizes the witness (signature + leaf script + control
86
+ * block). The returned transaction is ready to broadcast once the UTXO has
87
+ * `recoverySequence` confirmations.
88
+ *
89
+ * @throws {AggregationCohortError} when the recovery secret key does not match
90
+ * the committed recovery key, when there are no cohort keys, or when the fee
91
+ * exceeds the UTXO value.
92
+ */
93
+ export declare function buildRecoverySpend(params: RecoverySpendParams): Transaction;
94
+ //# sourceMappingURL=recovery-spend.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"recovery-spend.d.ts","sourceRoot":"","sources":["../../../../src/core/aggregation/recovery-spend.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAIH,OAAO,EAAQ,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGtD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAGzD,oDAAoD;AACpD,MAAM,WAAW,aAAa;IAC5B,yFAAyF;IACzF,IAAI,EAAE,MAAM,CAAC;IACb,4CAA4C;IAC5C,IAAI,EAAE,MAAM,CAAC;IACb,4CAA4C;IAC5C,KAAK,EAAE,MAAM,CAAC;CACf;AAED,4CAA4C;AAC5C,MAAM,WAAW,mBAAmB;IAClC;;;;OAIG;IACH,UAAU,EAAE,UAAU,EAAE,CAAC;IACzB,qGAAqG;IACrG,iBAAiB,EAAE,UAAU,CAAC;IAC9B,mFAAmF;IACnF,WAAW,EAAE,UAAU,CAAC;IACxB,uEAAuE;IACvE,gBAAgB,EAAE,MAAM,CAAC;IACzB;;;;;OAKG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,kFAAkF;IAClF,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,mFAAmF;IACnF,OAAO,EAAE,MAAM,CAAC;IAChB;;;;;;;;;OASG;IACH,IAAI,EAAE,aAAa,CAAC;IACpB,6CAA6C;IAC7C,kBAAkB,EAAE,MAAM,CAAC;IAC3B,iEAAiE;IACjE,GAAG,EAAE,MAAM,CAAC;IACZ;;;;OAIG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAaD;;;;;;;;;;;;GAYG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,mBAAmB,GAAG,WAAW,CA+E3E"}
@@ -13,10 +13,20 @@ export interface SoloCohortOptions {
13
13
  service: SoloActor;
14
14
  /** The single participant identity (the lone signer of the cohort). */
15
15
  participant: SoloActor;
16
- /** Bitcoin network and beacon type (`'CASBeacon'` | `'SMTBeacon'`) for the cohort. */
16
+ /**
17
+ * Bitcoin network and beacon type (`'CASBeacon'` | `'SMTBeacon'`) for the
18
+ * cohort. Recovery params are optional here: in a solo run the service actor
19
+ * is the operator and holds full keys, so when `recoveryKey` is omitted the
20
+ * service's own x-only key is used as the CSV recovery key (it can actually
21
+ * perform the recovery), with {@link DEFAULT_RECOVERY_SEQUENCE} as the delay.
22
+ */
17
23
  config: {
18
24
  network: string;
19
25
  beaconType: string;
26
+ /** Operator recovery key, x-only (64-hex). Defaults to the service actor's x-only key. */
27
+ recoveryKey?: string;
28
+ /** Relative-timelock (BIP-68) before recovery is spendable. Defaults to {@link DEFAULT_RECOVERY_SEQUENCE}. */
29
+ recoverySequence?: number;
20
30
  };
21
31
  /** Provide the participant's signed BTCR2 update for the cohort. */
22
32
  onProvideUpdate: OnProvideUpdate;
@@ -39,8 +49,8 @@ export declare class AggregationRunner {
39
49
  *
40
50
  * One party plays both the coordinating service and the lone participant,
41
51
  * connected over an {@link InMemoryTransport} (no relay or HTTP server). This
42
- * makes the single-participant aggregate-beacon path the N=1 corner of the
43
- * two-axis beacon matrix (see ADR 037) first-class, useful for generating
52
+ * makes the single-participant aggregate-beacon path (the N=1 corner of the
53
+ * two-axis beacon matrix, see ADR 037) first-class, useful for generating
44
54
  * and reproducing single-participant aggregate test vectors.
45
55
  *
46
56
  * The service advertises a cohort with `minParticipants: 1`; the participant
@@ -1 +1 @@
1
- {"version":3,"file":"aggregation-runner.d.ts","sourceRoot":"","sources":["../../../../../src/core/aggregation/runner/aggregation-runner.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAGvD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE/D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAE3D,oFAAoF;AACpF,MAAM,WAAW,SAAS;IACxB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,cAAc,CAAC;CACtB;AAED,kDAAkD;AAClD,MAAM,WAAW,iBAAiB;IAChC,yCAAyC;IACzC,OAAO,EAAE,SAAS,CAAC;IACnB,uEAAuE;IACvE,WAAW,EAAE,SAAS,CAAC;IACvB,sFAAsF;IACtF,MAAM,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAE,CAAC;IAChD,oEAAoE;IACpE,eAAe,EAAE,eAAe,CAAC;IACjC,6DAA6D;IAC7D,eAAe,EAAE,eAAe,CAAC;IACjC,2DAA2D;IAC3D,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,6CAA6C;IAC7C,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED;;;;GAIG;AACH,qBAAa,iBAAiB;IAC5B;;;;;;;;;;;;;;;;;OAiBG;WACU,IAAI,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,iBAAiB,CAAC;CAuC1E"}
1
+ {"version":3,"file":"aggregation-runner.d.ts","sourceRoot":"","sources":["../../../../../src/core/aggregation/runner/aggregation-runner.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAGzD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAGvD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE/D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAE3D,oFAAoF;AACpF,MAAM,WAAW,SAAS;IACxB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,cAAc,CAAC;CACtB;AAED,kDAAkD;AAClD,MAAM,WAAW,iBAAiB;IAChC,yCAAyC;IACzC,OAAO,EAAE,SAAS,CAAC;IACnB,uEAAuE;IACvE,WAAW,EAAE,SAAS,CAAC;IACvB;;;;;;OAMG;IACH,MAAM,EAAE;QACN,OAAO,EAAE,MAAM,CAAC;QAChB,UAAU,EAAE,MAAM,CAAC;QACnB,0FAA0F;QAC1F,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,8GAA8G;QAC9G,gBAAgB,CAAC,EAAE,MAAM,CAAC;KAC3B,CAAC;IACF,oEAAoE;IACpE,eAAe,EAAE,eAAe,CAAC;IACjC,6DAA6D;IAC7D,eAAe,EAAE,eAAe,CAAC;IACjC,2DAA2D;IAC3D,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,6CAA6C;IAC7C,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED;;;;GAIG;AACH,qBAAa,iBAAiB;IAC5B;;;;;;;;;;;;;;;;;OAiBG;WACU,IAAI,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,iBAAiB,CAAC;CA8C1E"}
@@ -1,6 +1,24 @@
1
1
  import type { SerializedSMTProof } from '@did-btcr2/smt';
2
- import type { CohortAdvert, PendingSigningRequest, PendingValidation } from '../participant.js';
2
+ import type { CohortAdvert, PendingFallbackRequest, PendingSigningRequest, PendingValidation } from '../participant.js';
3
3
  import type { AggregationResult, PendingOptIn, Rejection } from '../service.js';
4
+ /**
5
+ * Sidecar data a participant keeps when a cohort completes from its
6
+ * perspective: the cohort's beacon coordinates plus the off-chain artifact it
7
+ * needs for future DID resolution (the CAS Announcement map for CAS beacons, or
8
+ * the SMT inclusion proof for SMT beacons). Emitted via `cohort-complete` and
9
+ * returned by the participant runner's join helpers.
10
+ */
11
+ export interface CohortCompleteInfo {
12
+ cohortId: string;
13
+ beaconAddress: string;
14
+ beaconType: string;
15
+ /** True if this participant submitted an update; false if it declined (non-inclusion). */
16
+ included: boolean;
17
+ /** DID to base64url update hash. Populated only for CAS beacons. */
18
+ casAnnouncement?: Record<string, string>;
19
+ /** Inclusion proof (submitter) or non-inclusion proof (decliner) for this slot. Populated only for SMT beacons. */
20
+ smtProof?: SerializedSMTProof;
21
+ }
4
22
  /**
5
23
  * AggregationServiceRunner events are emitted by the AggregationServiceRunner to signal important
6
24
  * milestones and actions during the aggregation process. They can be listened to by external code
@@ -15,15 +33,17 @@ export type AggregationServiceEvents = {
15
33
  'opt-in-received': [PendingOptIn];
16
34
  /** A participant has been accepted into the cohort. */
17
35
  'participant-accepted': [{
36
+ cohortId: string;
18
37
  participantDid: string;
19
38
  }];
20
- /** Keygen has been finalized beacon address is now available. */
39
+ /** Keygen has been finalized: beacon address is now available. */
21
40
  'keygen-complete': [{
22
41
  cohortId: string;
23
42
  beaconAddress: string;
24
43
  }];
25
44
  /** A participant has submitted a signed update. */
26
45
  'update-received': [{
46
+ cohortId: string;
27
47
  participantDid: string;
28
48
  }];
29
49
  /**
@@ -40,18 +60,30 @@ export type AggregationServiceEvents = {
40
60
  }];
41
61
  /** A participant has acknowledged validation (approved or rejected). */
42
62
  'validation-received': [{
63
+ cohortId: string;
43
64
  participantDid: string;
44
65
  approved: boolean;
45
66
  }];
46
- /** Signing has started auth requests sent to participants. */
67
+ /** Signing has started: auth requests sent to participants. */
47
68
  'signing-started': [{
69
+ cohortId: string;
70
+ sessionId: string;
71
+ }];
72
+ /**
73
+ * The optimistic n-of-n key path was abandoned and the k-of-n fallback
74
+ * (script-path) signing round started (ADR 042). After this, the cohort
75
+ * completes via the fallback once k members sign.
76
+ */
77
+ 'fallback-started': [{
78
+ cohortId: string;
48
79
  sessionId: string;
49
80
  }];
50
81
  /** A participant has contributed their MuSig2 nonce. */
51
82
  'nonce-received': [{
83
+ cohortId: string;
52
84
  participantDid: string;
53
85
  }];
54
- /** Signing complete final aggregated signature is ready to broadcast. */
86
+ /** Signing complete: final aggregated signature is ready to broadcast. */
55
87
  'signing-complete': [AggregationResult];
56
88
  /** Cohort transitioned to Failed phase (e.g. a participant rejected validation). */
57
89
  'cohort-failed': [{
@@ -74,7 +106,7 @@ export type AggregationParticipantEvents = {
74
106
  'cohort-joined': [{
75
107
  cohortId: string;
76
108
  }];
77
- /** Cohort keygen is complete beacon address is now available. */
109
+ /** Cohort keygen is complete: beacon address is now available. */
78
110
  'cohort-ready': [{
79
111
  cohortId: string;
80
112
  beaconAddress: string;
@@ -83,27 +115,27 @@ export type AggregationParticipantEvents = {
83
115
  'update-submitted': [{
84
116
  cohortId: string;
85
117
  }];
118
+ /** Participant declined to submit an update this round (cooperative non-inclusion). */
119
+ 'update-declined': [{
120
+ cohortId: string;
121
+ }];
86
122
  /** Aggregated data has arrived for validation. Fires before the validate callback. */
87
123
  'validation-requested': [PendingValidation];
88
124
  /** Signing request has arrived. Fires before the sign approval callback. */
89
125
  'signing-requested': [PendingSigningRequest];
126
+ /**
127
+ * A fallback (k-of-n script-path) signing request has arrived because the
128
+ * service abandoned the optimistic key path (ADR 042). Fires before the sign
129
+ * approval callback; approving signs the fallback spend.
130
+ */
131
+ 'fallback-requested': [PendingFallbackRequest];
90
132
  /**
91
133
  * Cohort signing is complete from this participant's perspective.
92
134
  * Includes the aggregated sidecar data the participant needs to keep for
93
135
  * future DID resolution: the CAS Announcement map (for CAS beacons) or the
94
136
  * SMT inclusion proof (for SMT beacons).
95
137
  */
96
- 'cohort-complete': [
97
- {
98
- cohortId: string;
99
- beaconAddress: string;
100
- beaconType: string;
101
- /** DID → base64url update hash. Populated only for CAS beacons. */
102
- casAnnouncement?: Record<string, string>;
103
- /** Merkle inclusion proof for this participant's slot. Populated only for SMT beacons. */
104
- smtProof?: SerializedSMTProof;
105
- }
106
- ];
138
+ 'cohort-complete': [CohortCompleteInfo];
107
139
  /** Cohort failed (rejected validation, signing error, etc.). */
108
140
  'cohort-failed': [{
109
141
  cohortId: string;
@@ -1 +1 @@
1
- {"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../../../../src/core/aggregation/runner/events.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,KAAK,EAAE,YAAY,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAChG,OAAO,KAAK,EAAE,iBAAiB,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAEhF;;;;GAIG;AACH,MAAM,MAAM,wBAAwB,GAAG;IACrC,kEAAkE;IAClE,mBAAmB,EAAE,CAAC;QAAE,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAE5C,6EAA6E;IAC7E,iBAAiB,EAAE,CAAC,YAAY,CAAC,CAAC;IAElC,uDAAu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