@did-btcr2/method 0.36.1 → 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 +1060 -96
  3. package/dist/browser.mjs +1060 -96
  4. package/dist/cjs/index.js +1153 -179
  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 +210 -21
  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 +74 -22
  33. package/dist/esm/core/aggregation/runner/participant-runner.js.map +1 -1
  34. package/dist/esm/core/aggregation/runner/service-runner.js +97 -9
  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 +41 -7
  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 +28 -7
  94. package/dist/types/core/aggregation/runner/events.d.ts.map +1 -1
  95. package/dist/types/core/aggregation/runner/participant-runner.d.ts +3 -3
  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 +28 -3
  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 +255 -23
  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 +26 -7
  141. package/src/core/aggregation/runner/participant-runner.ts +75 -23
  142. package/src/core/aggregation/runner/service-runner.ts +120 -10
  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
@@ -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,5 +1,5 @@
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
4
  /**
5
5
  * Sidecar data a participant keeps when a cohort completes from its
@@ -12,9 +12,11 @@ export interface CohortCompleteInfo {
12
12
  cohortId: string;
13
13
  beaconAddress: string;
14
14
  beaconType: string;
15
- /** DID base64url update hash. Populated only for CAS beacons. */
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. */
16
18
  casAnnouncement?: Record<string, string>;
17
- /** Merkle inclusion proof for this participant's slot. Populated only for SMT beacons. */
19
+ /** Inclusion proof (submitter) or non-inclusion proof (decliner) for this slot. Populated only for SMT beacons. */
18
20
  smtProof?: SerializedSMTProof;
19
21
  }
20
22
  /**
@@ -34,7 +36,7 @@ export type AggregationServiceEvents = {
34
36
  cohortId: string;
35
37
  participantDid: string;
36
38
  }];
37
- /** Keygen has been finalized beacon address is now available. */
39
+ /** Keygen has been finalized: beacon address is now available. */
38
40
  'keygen-complete': [{
39
41
  cohortId: string;
40
42
  beaconAddress: string;
@@ -62,17 +64,26 @@ export type AggregationServiceEvents = {
62
64
  participantDid: string;
63
65
  approved: boolean;
64
66
  }];
65
- /** Signing has started auth requests sent to participants. */
67
+ /** Signing has started: auth requests sent to participants. */
66
68
  'signing-started': [{
67
69
  cohortId: string;
68
70
  sessionId: string;
69
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;
79
+ sessionId: string;
80
+ }];
70
81
  /** A participant has contributed their MuSig2 nonce. */
71
82
  'nonce-received': [{
72
83
  cohortId: string;
73
84
  participantDid: string;
74
85
  }];
75
- /** Signing complete final aggregated signature is ready to broadcast. */
86
+ /** Signing complete: final aggregated signature is ready to broadcast. */
76
87
  'signing-complete': [AggregationResult];
77
88
  /** Cohort transitioned to Failed phase (e.g. a participant rejected validation). */
78
89
  'cohort-failed': [{
@@ -95,7 +106,7 @@ export type AggregationParticipantEvents = {
95
106
  'cohort-joined': [{
96
107
  cohortId: string;
97
108
  }];
98
- /** Cohort keygen is complete beacon address is now available. */
109
+ /** Cohort keygen is complete: beacon address is now available. */
99
110
  'cohort-ready': [{
100
111
  cohortId: string;
101
112
  beaconAddress: string;
@@ -104,10 +115,20 @@ export type AggregationParticipantEvents = {
104
115
  'update-submitted': [{
105
116
  cohortId: string;
106
117
  }];
118
+ /** Participant declined to submit an update this round (cooperative non-inclusion). */
119
+ 'update-declined': [{
120
+ cohortId: string;
121
+ }];
107
122
  /** Aggregated data has arrived for validation. Fires before the validate callback. */
108
123
  'validation-requested': [PendingValidation];
109
124
  /** Signing request has arrived. Fires before the sign approval callback. */
110
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];
111
132
  /**
112
133
  * Cohort signing is complete from this participant's perspective.
113
134
  * Includes the aggregated sidecar data the participant needs to keep for
@@ -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;;;;;;GAMG;AACH,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,mEAAmE;IACnE,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACzC,0FAA0F;IAC1F,QAAQ,CAAC,EAAE,kBAAkB,CAAC;CAC/B;AAED;;;;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,uDAAuD;IACvD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AAC;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAExD,kCAAkC;IAClC,OAAO,EAAE,CAAC,KAAK,CAAC,CAAC;CAClB,CAAC"}
@@ -11,7 +11,7 @@ export type ShouldJoin = (advert: CohortAdvert) => Promise<boolean>;
11
11
  export type OnProvideUpdate = (info: {
12
12
  cohortId: string;
13
13
  beaconAddress: string;
14
- }) => Promise<SignedBTCR2Update>;
14
+ }) => Promise<SignedBTCR2Update | null>;
15
15
  /** Decision callback: approve or reject aggregated data. */
16
16
  export type OnValidateData = (info: PendingValidation) => Promise<{
17
17
  approved: boolean;
@@ -33,7 +33,7 @@ export interface AggregationParticipantRunnerOptions {
33
33
  shouldJoin?: ShouldJoin;
34
34
  /**
35
35
  * Provide a signed BTCR2 update for the cohort.
36
- * REQUIRED no sensible default.
36
+ * REQUIRED - no sensible default.
37
37
  */
38
38
  onProvideUpdate: OnProvideUpdate;
39
39
  /**
@@ -110,7 +110,7 @@ export declare class AggregationParticipantRunner extends TypedEventEmitter<Aggr
110
110
  *
111
111
  * For an open-ended, long-lived subscriber (no fixed count), construct an
112
112
  * {@link AggregationParticipantRunner} directly, set `shouldJoin`, call
113
- * `start()`, and listen for `cohort-complete` the runner already drives
113
+ * `start()`, and listen for `cohort-complete` - the runner already drives
114
114
  * any number of cohorts concurrently.
115
115
  *
116
116
  * @param options Participant runner options (set `shouldJoin` to select cohorts).
@@ -1 +1 @@
1
- {"version":3,"file":"participant-runner.d.ts","sourceRoot":"","sources":["../../../../../src/core/aggregation/runner/participant-runner.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAUzD,OAAO,KAAK,EACV,YAAY,EACZ,qBAAqB,EACrB,iBAAiB,EAAC,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EACL,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,CAAC;;IAC/F,sEAAsE;IACtE,QAAQ,CAAC,OAAO,EAAE,sBAAsB,CAAC;gBAY7B,OAAO,EAAE,mCAAmC;IAexD;;;OAGG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAI5B,8EAA8E;IAC9E,IAAI,IAAI,IAAI;IA4BZ;;;;OAIG;WACU,SAAS,CACpB,OAAO,EAAE,mCAAmC,GAC3C,OAAO,CAAC,kBAAkB,CAAC;IAY9B;;;;;;;;;;;;;;;OAeG;WACU,YAAY,CACvB,OAAO,EAAE,mCAAmC,EAC5C,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,kBAAkB,EAAE,CAAC;CA+NjC"}
1
+ {"version":3,"file":"participant-runner.d.ts","sourceRoot":"","sources":["../../../../../src/core/aggregation/runner/participant-runner.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAWzD,OAAO,KAAK,EACV,YAAY,EACZ,qBAAqB,EACrB,iBAAiB,EAAC,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EACL,sBAAsB,EACvB,MAAM,mBAAmB,CAAC;AAG3B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,KAAK,EAAE,4BAA4B,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACpF,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAEvD,yEAAyE;AACzE,MAAM,MAAM,UAAU,GAAG,CAAC,MAAM,EAAE,YAAY,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;AAEpE,wEAAwE;AACxE,MAAM,MAAM,eAAe,GAAG,CAAC,IAAI,EAAE;IACnC,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;CACvB,KAAK,OAAO,CAAC,iBAAiB,GAAG,IAAI,CA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?: OnReadyToFinalize;
48
48
  /**
49
49
  * Provide the Bitcoin transaction data to sign.
50
- * REQUIRED no sensible default.
50
+ * REQUIRED - no sensible default.
51
51
  */
52
52
  onProvideTxData: OnProvideTxData;
53
53
  /**
@@ -73,7 +73,7 @@ export interface AggregationServiceRunnerOptions {
73
73
  /**
74
74
  * Re-publish COHORT_ADVERT on this interval until a cohort's keygen is
75
75
  * finalized. Works around relays that don't backfill historical events to
76
- * late subscribers a republish gives late joiners a window to discover the
76
+ * late subscribers - a republish gives late joiners a window to discover the
77
77
  * advert without protocol changes. The first publish is immediate;
78
78
  * subsequent publishes fire every `advertRepeatIntervalMs` until that
79
79
  * cohort's keygen completes, fails, or is stopped. Defaults to
@@ -81,6 +81,16 @@ export interface AggregationServiceRunnerOptions {
81
81
  * once and never retry.
82
82
  */
83
83
  advertRepeatIntervalMs?: number;
84
+ /**
85
+ * When a cohort stalls (phase timeout) while the optimistic n-of-n signing
86
+ * round is in flight, fall back to the k-of-n script path instead of failing
87
+ * the cohort (graceful liveness, ADR 042). Off by default: enabling it trades a
88
+ * cheaper/private key-path spend for a larger script-path spend whenever the
89
+ * optimistic round does not complete in time. A stall outside the signing
90
+ * phases still fails the cohort. Operators can also drive the fallback
91
+ * explicitly via {@link AggregationServiceRunner.triggerFallback}.
92
+ */
93
+ autoFallbackOnStall?: boolean;
84
94
  }
85
95
  /** Default cadence for re-publishing COHORT_ADVERT until keygen completes: 60 seconds. */
86
96
  export declare const DEFAULT_ADVERT_REPEAT_INTERVAL_MS = 60000;
@@ -93,7 +103,7 @@ export declare const DEFAULT_ADVERT_REPEAT_INTERVAL_MS = 60000;
93
103
  *
94
104
  * A single runner is a long-lived multiplexer: it advertises and drives many
95
105
  * cohorts concurrently over one transport. Each advertised cohort owns an
96
- * independent completion promise and fails in isolation a stalled or failed
106
+ * independent completion promise and fails in isolation - a stalled or failed
97
107
  * cohort never settles its siblings (see ADR 040). Use
98
108
  * {@link AggregationServiceRunner.advertiseCohort} for the multi-cohort path;
99
109
  * {@link AggregationServiceRunner.run} is a thin single-cohort convenience over
@@ -170,6 +180,21 @@ export declare class AggregationServiceRunner extends TypedEventEmitter<Aggregat
170
180
  * @returns {Promise<AggregationResult[]>} Results of the cohorts that completed.
171
181
  */
172
182
  runAll(): Promise<AggregationResult[]>;
183
+ /**
184
+ * Abandon the optimistic n-of-n key path for a cohort and collect k-of-n
185
+ * fallback (script-path) signatures instead (ADR 042). Idempotent and safe
186
+ * against the optimistic completion: it commits the cohort to the fallback
187
+ * path synchronously (the `committedPath` latch) before sending anything, so a
188
+ * late optimistic signature can no longer complete-and-broadcast a competing
189
+ * spend of the same UTXO. No-op if the cohort is unknown, already settled, or
190
+ * already committed to a path.
191
+ *
192
+ * Wired automatically to the phase-stall timer when `autoFallbackOnStall` is
193
+ * set; otherwise call it from an operator decision (a UI "fall back now"
194
+ * action). Throws only if the underlying state machine rejects the transition
195
+ * (e.g. signing has not started).
196
+ */
197
+ triggerFallback(cohortId: string): Promise<void>;
173
198
  /**
174
199
  * Stop a single cohort early without affecting the rest of the runner. Drops
175
200
  * the cohort's state machine state; its `completion` promise rejects with a
@@ -1 +1 @@
1
- {"version":3,"file":"service-runner.d.ts","sourceRoot":"","sources":["../../../../../src/core/aggregation/runner/service-runner.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAWzD,OAAO,KAAK,EACV,iBAAiB,EACjB,YAAY,EACZ,YAAY,EACZ,aAAa,EAAC,MAAM,eAAe,CAAC;AACtC,OAAO,EACL,kBAAkB,EACnB,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAEvD,kEAAkE;AAClE,MAAM,MAAM,eAAe,GAAG,CAAC,KAAK,EAAE,Y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AM,CAAC;QAAC,UAAU,EAAE,OAAO,CAAC,iBAAiB,CAAC,CAAA;KAAE;IA6CnG;;;;;;OAMG;IACH,GAAG,IAAI,OAAO,CAAC,iBAAiB,CAAC;IAcjC;;;;;;;;;;OAUG;IACG,MAAM,IAAI,OAAO,CAAC,iBAAiB,EAAE,CAAC;IA+E5C;;;;;;;;;;;;;OAaG;IACG,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IA6EtD;;;;OAIG;IACH,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI;IASlC;;;;OAIG;IACH,IAAI,IAAI,IAAI;CA+Sb"}
@@ -31,8 +31,19 @@ export interface ValidationProgress {
31
31
  /** Final aggregation result for a cohort. */
32
32
  export interface AggregationResult {
33
33
  cohortId: string;
34
+ /**
35
+ * The 64-byte aggregated MuSig2 signature for the optimistic key path. Empty
36
+ * for a `script-path` result: the k-of-n fallback embeds k separate signatures
37
+ * directly in the witness of {@link signedTx}, with no single aggregate sig.
38
+ */
34
39
  signature: Uint8Array;
35
40
  signedTx: Transaction;
41
+ /**
42
+ * Which Taproot spend path produced {@link signedTx}: `key-path` is the
43
+ * optimistic n-of-n MuSig2 spend, `script-path` is the k-of-n fallback (ADR
44
+ * 042). Absent is treated as `key-path` for backward compatibility.
45
+ */
46
+ path?: 'key-path' | 'script-path';
36
47
  }
37
48
  /** Transaction data needed to start a signing session. */
38
49
  export interface SigningTxData {
@@ -95,7 +106,7 @@ export declare class AggregationService {
95
106
  drainRejections(cohortId: string): Array<Rejection>;
96
107
  /**
97
108
  * Create a new cohort with the given config. Returns the cohort ID.
98
- * Cohort starts in `Created` phase call `advertise()` to broadcast.
109
+ * Cohort starts in `Created` phase - call `advertise()` to broadcast.
99
110
  */
100
111
  createCohort(config: CohortConfig): string;
101
112
  /**
@@ -125,7 +136,7 @@ export declare class AggregationService {
125
136
  validationProgress(cohortId: string): ValidationProgress;
126
137
  /**
127
138
  * Start a signing session by creating auth requests for all participants.
128
- * The caller provides the transaction data typically built via
139
+ * The caller provides the transaction data - typically built via
129
140
  * `buildBeaconTransaction()` against a Bitcoin connection.
130
141
  */
131
142
  startSigning(cohortId: string, txData: SigningTxData): BaseMessage[];
@@ -134,6 +145,19 @@ export declare class AggregationService {
134
145
  * Call after `validationProgress(cohortId).approved.size === total`.
135
146
  */
136
147
  sendAggregatedNonce(cohortId: string): BaseMessage[];
148
+ /**
149
+ * Abandon the optimistic n-of-n key path and ask members to authorize the
150
+ * k-of-n fallback (script-path) spend of the SAME beacon transaction (graceful
151
+ * liveness, ADR 042). Reuses the in-flight signing session's transaction and
152
+ * spent output, so the announcement and its outputs are unchanged: only the
153
+ * witness path differs. Returns one FALLBACK_AUTHORIZATION_REQUEST per
154
+ * participant.
155
+ *
156
+ * Callable once optimistic signing has started (the session and its tx exist)
157
+ * and before it completes. A cohort can take exactly one of the two paths: the
158
+ * caller (runner) must commit to fallback and stop driving the optimistic path.
159
+ */
160
+ startFallbackSigning(cohortId: string): BaseMessage[];
137
161
  getResult(cohortId: string): AggregationResult | undefined;
138
162
  getCohortPhase(cohortId: string): ServiceCohortPhaseType | undefined;
139
163
  getCohort(cohortId: string): AggregationCohort | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../../../src/core/aggregation/service.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAEhE,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,oBAAoB,CAAC;AAEvE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAA4B,KAAK,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAElF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAiBtD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MA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AAS;IAI1D;;;;OAIG;IACH,mBAAmB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAIzD,IAAI,OAAO,IAAI,aAAa,CAAC,iBAAiB,CAAC,CAE9C;IAED;;;OAGG;IACH,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI;CAGrC"}
@@ -32,11 +32,11 @@ export declare class BeaconSigningSession {
32
32
  prevOutScripts: Uint8Array[];
33
33
  /** Previous output values for Taproot sighash computation. */
34
34
  prevOutValues: bigint[];
35
- /** Map of participant publicKey-hex public nonce contribution. */
35
+ /** Map of participant publicKey-hex to public nonce contribution. */
36
36
  nonceContributions: Map<PublicKeyHex, Nonce>;
37
37
  /** Aggregated MuSig2 nonce (66 bytes). */
38
38
  aggregatedNonce?: Uint8Array;
39
- /** Map of participant DID partial signature. */
39
+ /** Map of participant DID to partial signature. */
40
40
  partialSignatures: Map<string, Uint8Array>;
41
41
  /** Final 64-byte Schnorr signature. */
42
42
  signature?: Uint8Array;
@@ -1 +1 @@
1
- {"version":3,"file":"signing-session.d.ts","sourceRoot":"","sources":["../../../../src/core/aggregation/signing-session.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGrD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAErD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAG3D,KAAK,YAAY,GAAG,MAAM,CAAC;AAC3B,KAAK,KAAK,GAAG,UAAU,CAAC;AAExB,MAAM,WAAW,oBAAoB;IACnC,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,iBAAiB,CAAC;IAC1B,SAAS,EAAE,WAAW,CAAC;IACvB,cAAc,CAAC,EAAE,UAAU,EAAE,CAAC;IAC9B,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;CAC1B;AAED;;;;;;;;;GASG;AACH,qBAAa,oBAAoB;;IAC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AAoB,CAAC,cAAc,EAAE,MAAM,EAAE,iBAAiB,EAAE,UAAU,GAAG,IAAI;IAgCjF,uBAAuB,IAAI,UAAU;IAYrC,mBAAmB,CAAC,cAAc,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,GAAG,IAAI;IA0BzE,sBAAsB,IAAI,UAAU;IA4D3C;;;OAGG;IACI,yBAAyB,CAAC,oBAAoB,EAAE,UAAU,EAAE,oBAAoB,EAAE,UAAU,GAAG,UAAU;IAOhH;;;;;;;;;OASG;IACI,wBAAwB,CAAC,oBAAoB,EAAE,UAAU,GAAG,UAAU;IAqB7E;;;;;OAKG;IACI,YAAY,IAAI,IAAI;IAOpB,UAAU,IAAI,OAAO;IAIrB,QAAQ,IAAI,OAAO;CAG3B"}
@@ -26,7 +26,7 @@ export interface VerifyEnvelopeOptions {
26
26
  /**
27
27
  * Build a {@link SignedEnvelope} around `message`.
28
28
  *
29
- * Pure function no I/O beyond `randomBytes` for nonce generation (which
29
+ * Pure function - no I/O beyond `randomBytes` for nonce generation (which
30
30
  * uses the platform's cryptographic RNG: `crypto.getRandomValues` in browsers,
31
31
  * `node:crypto` in Node). Deterministic when both `nonce` and `timestamp` are
32
32
  * supplied via {@link SignEnvelopeOptions}.
@@ -40,7 +40,7 @@ export declare function signEnvelope(message: EnvelopeMessage, sender: {
40
40
  * communication public key. Throws {@link HttpTransportError} on any failure;
41
41
  * returns normally on success.
42
42
  *
43
- * Does NOT check nonce uniqueness replay protection is the caller's
43
+ * Does NOT check nonce uniqueness - replay protection is the caller's
44
44
  * responsibility (the server-side transport maintains an LRU cache).
45
45
  */
46
46
  export declare function verifyEnvelope(envelope: SignedEnvelope, senderPk: CompressedSecp256k1PublicKey, opts?: VerifyEnvelopeOptions): void;
@@ -51,7 +51,7 @@ export declare function verifyEnvelope(envelope: SignedEnvelope, senderPk: Compr
51
51
  *
52
52
  * Without this, `JSON.stringify` serializes a `Uint8Array` as an index-keyed
53
53
  * object (`{"0":1,"1":2,...}`), which `canonicalize` then re-parses into a
54
- * plain object the receiver cannot reconstruct the original bytes even
54
+ * plain object - the receiver cannot reconstruct the original bytes even
55
55
  * though the signature still verifies.
56
56
  */
57
57
  export declare function normalizeForWire(value: unknown): unknown;
@@ -12,7 +12,7 @@ export interface StoredEvent {
12
12
  * When a subscriber (re)connects with a `Last-Event-ID` header, the server
13
13
  * uses {@link since} to replay everything that arrived while the subscriber
14
14
  * was disconnected. Events older than the replay window (evicted from the
15
- * ring) are unrecoverable callers should choose `capacity` based on
15
+ * ring) are unrecoverable - callers should choose `capacity` based on
16
16
  * expected message rate × acceptable reconnect window.
17
17
  */
18
18
  export declare class InboxBuffer {
@@ -5,7 +5,7 @@ export interface NonceCacheConfig {
5
5
  /**
6
6
  * Bounded anti-replay cache for `(did, nonce)` pairs.
7
7
  *
8
- * Replay windowing is the caller's responsibility this cache only detects
8
+ * Replay windowing is the caller's responsibility - this cache only detects
9
9
  * duplicates. Callers are expected to reject envelopes/headers whose timestamp
10
10
  * is outside the clock-skew window *before* consulting the cache, so entries
11
11
  * here are always within the protocol's acceptable window.
@@ -29,7 +29,7 @@ export interface RateLimiterConfig {
29
29
  * sender DID). Tokens refill linearly at `rps` up to `burst`. Each `consume`
30
30
  * call atomically debits one token or returns `false` to reject.
31
31
  *
32
- * The limiter is synchronous and deterministic given `nowMs` tests can
32
+ * The limiter is synchronous and deterministic given `nowMs` - tests can
33
33
  * drive it with a fixed clock to exercise exact boundaries.
34
34
  */
35
35
  export declare class RateLimiter {
@@ -32,7 +32,7 @@ export interface BuildRequestAuthOptions {
32
32
  export declare function buildRequestAuth(did: string, keys: SchnorrKeyPair, path: string, opts?: BuildRequestAuthOptions): string;
33
33
  /**
34
34
  * Parse a `BTCR2-Sig` auth header value into its structured fields. Does NOT
35
- * verify the signature call {@link verifyRequestAuth} for that.
35
+ * verify the signature: call {@link verifyRequestAuth} for that.
36
36
  */
37
37
  export declare function parseRequestAuth(headerValue: string): ParsedRequestAuth;
38
38
  export interface VerifyRequestAuthOptions {
@@ -65,7 +65,7 @@ export interface HttpServerTransportConfig {
65
65
  now?: () => number;
66
66
  }
67
67
  /**
68
- * Server-side HTTP transport. Sans-I/O the caller mounts
68
+ * Server-side HTTP transport. Sans-I/O - the caller mounts
69
69
  * {@link handleRequest} and {@link handleSse} under their HTTP framework of
70
70
  * choice; the transport owns only in-memory state (actors, inboxes, advert
71
71
  * cache, replay / rate-limit policies).
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Parsed Server-Sent Events record.
3
3
  *
4
- * Events without a `data` field are never yielded (per the SSE spec only a
4
+ * Events without a `data` field are never yielded (per the SSE spec - only a
5
5
  * blank line that follows at least one `data:` line dispatches an event).
6
6
  */
7
7
  export interface SseEvent {
@@ -23,7 +23,7 @@ export interface SseEvent {
23
23
  * CR-only line terminators are not supported (every mainstream SSE
24
24
  * implementation emits LF or CRLF).
25
25
  *
26
- * Pure, runtime-agnostic works anywhere `ReadableStream<Uint8Array>` and
26
+ * Pure, runtime-agnostic - works anywhere `ReadableStream<Uint8Array>` and
27
27
  * `TextDecoder` exist (browsers and Node 22+).
28
28
  *
29
29
  * The caller owns stream lifecycle: cancellation should be effected via an
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Format an SSE event frame. Pairs with {@link parseSseStream}.
3
3
  *
4
- * Multi-line `data` is split across multiple `data:` lines per the SSE spec
4
+ * Multi-line `data` is split across multiple `data:` lines per the SSE spec -
5
5
  * each embedded `\n` becomes its own line, and the parser rejoins them.
6
6
  *
7
7
  * The returned string includes a trailing blank line (the dispatch marker).
@@ -4,7 +4,7 @@ import type { MessageHandler, Transport } from './transport.js';
4
4
  /**
5
5
  * In-process message bus connecting one or more {@link InMemoryTransport}
6
6
  * instances. Routes broadcasts to every registered actor and directed messages
7
- * to the actor that owns the recipient DID with no relay, server, or network.
7
+ * to the actor that owns the recipient DID, with no relay, server, or network.
8
8
  *
9
9
  * Each delivery does a JSON round-trip (Uint8Array preserved as `__bytes` hex)
10
10
  * so handlers receive an isolated, serialization-faithful copy, exactly as a
@@ -38,9 +38,9 @@ export declare const DEFAULT_BROADCAST_LOOKBACK_MS: number;
38
38
  * sending or receiving.
39
39
  *
40
40
  * Message routing:
41
- * - Keygen messages (COHORT_ADVERT, COHORT_OPT_IN, COHORT_OPT_IN_ACCEPT, COHORT_READY) kind 1 (plaintext)
42
- * - Update messages (SUBMIT_UPDATE, DISTRIBUTE_AGGREGATED_DATA, VALIDATION_ACK) kind 1059 (NIP-44 encrypted)
43
- * - Sign messages kind 1059 (NIP-44 encrypted)
41
+ * - Keygen messages (COHORT_ADVERT, COHORT_OPT_IN, COHORT_OPT_IN_ACCEPT, COHORT_READY) to kind 1 (plaintext)
42
+ * - Update messages (SUBMIT_UPDATE, DISTRIBUTE_AGGREGATED_DATA, VALIDATION_ACK) to kind 1059 (NIP-44 encrypted)
43
+ * - Sign messages to kind 1059 (NIP-44 encrypted)
44
44
  *
45
45
  * @class NostrTransport
46
46
  * @implements {Transport}
@@ -145,7 +145,7 @@ export declare class NostrTransport implements Transport {
145
145
  * backfill historical events to late subscribers: republishing gives late
146
146
  * joiners a window to discover the message without requiring protocol
147
147
  * changes. Relay rate-limit / publish failures inside the interval are
148
- * caught and logged rather than propagated the caller should stop the
148
+ * caught and logged rather than propagated - the caller should stop the
149
149
  * repeater once the protocol condition is satisfied.
150
150
  */
151
151
  publishRepeating(message: BaseMessage, sender: Did, intervalMs: number, recipient?: Did): () => void;