@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
@@ -11,7 +11,7 @@ export type TransportType = 'nostr' | 'didcomm' | 'http';
11
11
  * shared by all registered actors. Each actor registers its own DID and keys;
12
12
  * the transport resolves the correct identity when sending or receiving messages.
13
13
  *
14
- * The transport is a pure passthrough it knows nothing about the aggregation
14
+ * The transport is a pure passthrough: it knows nothing about the aggregation
15
15
  * protocol. It only signs/encrypts outgoing messages with the sender's keys and
16
16
  * dispatches incoming messages to the correct actor's registered handler.
17
17
  *
@@ -19,7 +19,7 @@ export type TransportType = 'nostr' | 'didcomm' | 'http';
19
19
  */
20
20
  export interface Transport {
21
21
  name: string;
22
- /** Start the underlying transport (idempotent only starts once). */
22
+ /** Start the underlying transport (idempotent, only starts once). */
23
23
  start(): void;
24
24
  /** Register an actor (service or participant) with this transport. */
25
25
  registerActor(did: string, keys: SchnorrKeyPair): void;
@@ -48,14 +48,14 @@ export interface Transport {
48
48
  * message is satisfied).
49
49
  *
50
50
  * Useful for broadcasts on transports that don't reliably backfill
51
- * historical events to late subscribers (many Nostr relays) republishing
51
+ * historical events to late subscribers (many Nostr relays): republishing
52
52
  * gives late joiners a window in which to discover the message. The first
53
53
  * publish is synchronous-ish (fired before the method returns).
54
54
  *
55
55
  * Callers specify `recipient` only for directed messages; for broadcasts
56
56
  * it is omitted.
57
57
  *
58
- * @returns A stop function. Idempotent safe to call more than once.
58
+ * @returns A stop function. Idempotent, safe to call more than once.
59
59
  */
60
60
  publishRepeating(message: BaseMessage, sender: string, intervalMs: number, recipient?: string): () => void;
61
61
  }
@@ -1 +1 @@
1
- {"version":3,"file":"transport.d.ts","sourceRoot":"","sources":["../../../../../src/core/aggregation/transport/transport.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAEvD,M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7F,uEAAuE;IACvE,wBAAwB,CAAC,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAEtE;;;;OAIG;IACH,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IAEnC,6EAA6E;IAC7E,WAAW,CAAC,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAErF;;;;;;;;;;;;;;;OAeG;IACH,gBAAgB,CACd,OAAO,EAAE,WAAW,EACpB,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,MAAM,EAClB,SAAS,CAAC,EAAE,MAAM,GACjB,MAAM,IAAI,CAAC;CACf"}
@@ -9,25 +9,25 @@ import type { FeeEstimator } from './fee-estimator.js';
9
9
  import type { BeaconService, BeaconSignal } from './interfaces.js';
10
10
  /**
11
11
  * Singleton beacon script kinds. Per the did:btcr2 spec, deterministic DID documents
12
- * include three beacon services: P2PKH, P2WPKH, and P2TR (taproot key-path) all
12
+ * include three beacon services: P2PKH, P2WPKH, and P2TR (taproot key-path), all
13
13
  * derived from the genesis secp256k1 public key. The singleton broadcast path must
14
14
  * support signing for all three.
15
15
  */
16
16
  export type SingletonScriptKind = 'p2pkh' | 'p2wpkh' | 'p2tr';
17
17
  /**
18
- * Conservative vsize estimate for a 1-input P2TR key-path 1 P2TR change + 1 OP_RETURN(32) tx.
18
+ * Conservative vsize estimate for a 1-input P2TR key-path to 1 P2TR change + 1 OP_RETURN(32) tx.
19
19
  * Stripped 137 + witness ≈ 68 (marker + flag + stack-count + sig-len + 64 BIP-340 sig).
20
20
  * Weight = 137*4 + 68 = 616, vsize ≈ 154, rounded to 160 for headroom.
21
21
  */
22
22
  export declare const P2TR_BEACON_TX_VSIZE = 160;
23
23
  /**
24
- * Conservative vsize estimate for a 1-input P2WPKH 1 P2WPKH change + 1 OP_RETURN(32) tx.
24
+ * Conservative vsize estimate for a 1-input P2WPKH to 1 P2WPKH change + 1 OP_RETURN(32) tx.
25
25
  * Stripped 125 + witness ≈ 110 (worst-case DER ECDSA sig 72 + sighash byte + 33 pubkey + framing).
26
26
  * vsize = ceil((125*4 + 110) / 4) ≈ 153, rounded to 155.
27
27
  */
28
28
  export declare const P2WPKH_BEACON_TX_VSIZE = 155;
29
29
  /**
30
- * Conservative vsize estimate for a 1-input P2PKH 1 P2PKH change + 1 OP_RETURN(32) tx.
30
+ * Conservative vsize estimate for a 1-input P2PKH to 1 P2PKH change + 1 OP_RETURN(32) tx.
31
31
  * Legacy (non-segwit): scriptSig carries the full sig+pubkey (~108 bytes), no witness
32
32
  * discount. Stripped ≈ 4 nVer + 1 vin-count + (32+4+1+108+4) input + 1 vout-count +
33
33
  * 34 P2PKH-change + 43 OP_RETURN + 4 nLockTime ≈ 236 bytes. vsize = 236, rounded to 240.
@@ -97,7 +97,7 @@ export declare function opReturnScript(signalBytes: Uint8Array): Uint8Array;
97
97
  * signing session consumes (via {@link SigningTxData}).
98
98
  *
99
99
  * This is the reusable counterpart to {@link SinglePartyBeacon.buildSignAndBroadcast}'s internal
100
- * construction step the aggregation path must produce an unsigned tx because the
100
+ * construction step: the aggregation path must produce an unsigned tx because the
101
101
  * signature comes from a MuSig2 round, not a local secret key.
102
102
  *
103
103
  * @param opts Parameters including the cohort's aggregate internal pubkey.
@@ -170,7 +170,7 @@ export declare abstract class SinglePartyBeacon {
170
170
  *
171
171
  * Composed from the three extracted phases ({@link buildSinglePartyTx},
172
172
  * {@link signSinglePartyTx}, {@link broadcastRawTx}) so each piece can be exercised
173
- * in isolation. Aggregation beacons use {@link buildAggregationBeaconTx} instead
173
+ * in isolation. Aggregation beacons use {@link buildAggregationBeaconTx} instead:
174
174
  * the multi-party path can't share the signing phase, but the tx-construction
175
175
  * plumbing (UTXO fetch + OP_RETURN output + change output) is shared.
176
176
  *
@@ -187,7 +187,7 @@ export declare abstract class SinglePartyBeacon {
187
187
  *
188
188
  * Detects the beacon address script kind (P2PKH / P2WPKH / P2TR) and configures
189
189
  * the input accordingly. Validates that the signer's pubkey produces the beacon
190
- * address under that script kind without this check, a misconfigured caller
190
+ * address under that script kind: without this check, a misconfigured caller
191
191
  * would burn a real UTXO on a tx that fails at broadcast. Fees are computed from
192
192
  * the per-kind {@link SINGLETON_BEACON_TX_VSIZE} constant, avoiding any probe-sign
193
193
  * round-trip.
@@ -1 +1 @@
1
- {"version":3,"file":"beacon.d.ts","sourceRoot":"","sources":["../../../../src/core/beacon/beacon.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrF,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAEjD,OAAO,EAA4D,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAC1G,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAC1D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAG/C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAKnE;;;;;GAKG;AACH,MAAM,MAAM,mBAAmB,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,CAAC;AAE9D;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,MAAM,CAAC;AAExC;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,MAAM,CAAC;AAE1C;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,MAAM,CAAC;AAEzC,iEAAiE;AACjE,eAAO,MAAM,yBAAyB,EAAE,QAAQ,CAAC,MAAM,CAAC,mBAAmB,EAA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iBAAiB,EAC1B,OAAO,CAAC,EAAE,gBAAgB,GACzB,OAAO,CAAC,iBAAiB,CAAC;IAE7B;;;;;;;;;;;;;;;;;OAiBG;cACa,qBAAqB,CACnC,WAAW,EAAE,UAAU,EACvB,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,iBAAiB,EAC1B,OAAO,CAAC,EAAE,gBAAgB,GACzB,OAAO,CAAC,MAAM,CAAC;IAWlB;;;;;;;;;OASG;cACa,kBAAkB,CAAC,IAAI,EAAE;QACvC,WAAW,EAAE,UAAU,CAAC;QACxB,aAAa,EAAE,MAAM,CAAC;QACtB,IAAI,EAAE,WAAW,CAAC;QAClB,WAAW,EAAE,UAAU,CAAC;QACxB,MAAM,EAAE,MAAM,CAAC;QACf,OAAO,EAAE,iBAAiB,CAAC;QAC3B,YAAY,EAAE,YAAY,CAAC;KAC5B,GAAG,OAAO,CAAC,YAAY,CAAC;IA0EzB;;;OAGG;cACa,iBAAiB,CAAC,IAAI,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAOtF;;OAEG;cACa,cAAc,CAAC,OAAO,EAAE,iBAAiB,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;CAG5F"}
@@ -7,7 +7,7 @@ import type { BroadcastOptions } from './beacon.js';
7
7
  import { SinglePartyBeacon } from './beacon.js';
8
8
  import type { BeaconService, BeaconSignal, CasPublishFn } from './interfaces.js';
9
9
  /**
10
- * CAS-specific broadcast options extends {@link BroadcastOptions} with an optional
10
+ * CAS-specific broadcast options: extends {@link BroadcastOptions} with an optional
11
11
  * `casPublish` callback used to publish the CAS Announcement off-chain after the
12
12
  * OP_RETURN signal is broadcast.
13
13
  */
@@ -18,7 +18,7 @@ export interface CASBroadcastOptions extends BroadcastOptions {
18
18
  * Implements {@link https://dcdpr.github.io/did-btcr2/terminology.html#cas-beacon | CAS Beacon}.
19
19
  *
20
20
  * A CAS (Content-Addressed Store) Beacon aggregates updates for multiple DIDs
21
- * into a single CAS Announcement a mapping of DIDs to their update hashes.
21
+ * into a single CAS Announcement: a mapping of DIDs to their update hashes.
22
22
  * The hash of the CAS Announcement is broadcast on-chain via OP_RETURN.
23
23
  * During resolution, the CAS Announcement is retrieved from the sidecar (or CAS)
24
24
  * and used to look up the individual signed update for the DID being resolved.
@@ -62,7 +62,7 @@ export interface BeaconSignal {
62
62
  * The method package defines this type; the api layer provides the implementation
63
63
  * (e.g., via CasApi.publish backed by IPFS/Helia).
64
64
  *
65
- * @param announcement The CAS Announcement object (DID update hash mapping).
65
+ * @param announcement The CAS Announcement object (DID to update hash mapping).
66
66
  */
67
67
  export type CasPublishFn = (announcement: Record<string, string>) => Promise<void>;
68
68
  //# sourceMappingURL=interfaces.d.ts.map
@@ -99,7 +99,7 @@ export interface BeaconProcessResult {
99
99
  export declare class Resolver {
100
100
  #private;
101
101
  /**
102
- * @internal Use {@link DidBtcr2.resolve} to create instances.
102
+ * @internal Use {@link DidBtcr2.resolve} to create instances.
103
103
  */
104
104
  constructor(didComponents: DidComponents, sidecarData: SidecarData, currentDocument: DidDocument | null, options?: {
105
105
  versionId?: string;
@@ -153,8 +153,8 @@ export declare class Resolver {
153
153
  private static applyUpdate;
154
154
  /**
155
155
  * Advance the state machine. Returns either:
156
- * - `{ status: 'action-required', needs }` caller must provide data via {@link provide}
157
- * - `{ status: 'resolved', result }` resolution complete
156
+ * - `{ status: 'action-required', needs }` - caller must provide data via {@link provide}
157
+ * - `{ status: 'resolved', result }` - resolution complete
158
158
  *
159
159
  * Analogous to Rust's `Resolver::resolve()`.
160
160
  */
@@ -93,7 +93,7 @@ export interface UpdaterParams {
93
93
  beaconService: BeaconService;
94
94
  }
95
95
  /**
96
- * Sans-I/O state machine for did:btcr2 updates the counterpart to {@link Resolver}.
96
+ * Sans-I/O state machine for did:btcr2 updates: the counterpart to {@link Resolver}.
97
97
  *
98
98
  * Created by {@link DidBtcr2.update} (the factory). The caller drives the update by
99
99
  * repeatedly calling {@link advance} and {@link provide}:
@@ -139,7 +139,7 @@ export interface UpdaterParams {
139
139
  export declare class Updater {
140
140
  #private;
141
141
  /**
142
- * @internal Use {@link DidBtcr2.update} to create instances.
142
+ * @internal Use {@link DidBtcr2.update} to create instances.
143
143
  */
144
144
  constructor(params: UpdaterParams);
145
145
  /**
@@ -175,8 +175,8 @@ export declare class Updater {
175
175
  static announce(beaconService: BeaconService, update: SignedBTCR2Update, signer: Signer, bitcoin: BitcoinConnection): Promise<SignedBTCR2Update>;
176
176
  /**
177
177
  * Advance the state machine. Returns either:
178
- * - `{ status: 'action-required', needs }` caller must provide data via {@link provide}
179
- * - `{ status: 'complete', result }` update is signed and broadcast
178
+ * - `{ status: 'action-required', needs }` caller must provide data via {@link provide}
179
+ * - `{ status: 'complete', result }` update is signed and broadcast
180
180
  */
181
181
  advance(): UpdaterState;
182
182
  /**
@@ -74,8 +74,8 @@ export declare class DidBtcr2 implements DidMethod {
74
74
  *
75
75
  * Factory method that validates the update parameters and returns a sans-I/O
76
76
  * {@link Updater} state machine. The caller drives the updater through its
77
- * phases (Construct Sign Broadcast Complete) by calling `advance()` and
78
- * `provide()`. The method package performs **zero I/O** signing key retrieval
77
+ * phases (Construct -> Sign -> Broadcast -> Complete) by calling `advance()` and
78
+ * `provide()`. The method package performs **zero I/O**: signing key retrieval
79
79
  * (or KMS delegation) and the on-chain broadcast are the caller's responsibility.
80
80
  *
81
81
  * For a fully-wired version with Bitcoin broadcast and key handling, see
@@ -2,6 +2,9 @@ export * from './core/aggregation/service.js';
2
2
  export * from './core/aggregation/participant.js';
3
3
  export * from './core/aggregation/signer.js';
4
4
  export * from './core/aggregation/conditions.js';
5
+ export * from './core/aggregation/recovery-policy.js';
6
+ export * from './core/aggregation/recovery-spend.js';
7
+ export * from './core/aggregation/fallback-spend.js';
5
8
  export * from './core/aggregation/cohort.js';
6
9
  export * from './core/aggregation/signing-session.js';
7
10
  export * from './core/aggregation/phases.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AACA,cAAc,+BAA+B,CAAC;AAC9C,cAAc,mCAAmC,CAAC;AAClD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,kCAAkC,CAAC;AACjD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,uCAAuC,CAAC;AACtD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,uCAAuC,CAAC;AACtD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,sCAAsC,CAAC;AACrD,cAAc,uCAAuC,CAAC;AACtD,cAAc,oCAAoC,CAAC;AAGnD,cAAc,yBAAyB,CAAC;AACxC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,wBAAwB,CAAC;AACvC,cAAc,0BAA0B,CAAC;AACzC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,mCAAmC,CAAC;AAClD,cAAc,mCAAmC,CAAC;AAClD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,wBAAwB,CAAC;AAGvC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAGlC,cAAc,qBAAqB,CAAC;AACpC,cAAc,iCAAiC,CAAC;AAChD,cAAc,yBAAyB,CAAC;AAGxC,cAAc,gBAAgB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AACA,cAAc,+BAA+B,CAAC;AAC9C,cAAc,mCAAmC,CAAC;AAClD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,kCAAkC,CAAC;AACjD,cAAc,uCAAuC,CAAC;AACtD,cAAc,sCAAsC,CAAC;AACrD,cAAc,sCAAsC,CAAC;AACrD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,uCAAuC,CAAC;AACtD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,uCAAuC,CAAC;AACtD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,sCAAsC,CAAC;AACrD,cAAc,uCAAuC,CAAC;AACtD,cAAc,oCAAoC,CAAC;AAGnD,cAAc,yBAAyB,CAAC;AACxC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,wBAAwB,CAAC;AACvC,cAAc,0BAA0B,CAAC;AACzC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,mCAAmC,CAAC;AAClD,cAAc,mCAAmC,CAAC;AAClD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,wBAAwB,CAAC;AAGvC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAGlC,cAAc,qBAAqB,CAAC;AACpC,cAAc,iCAAiC,CAAC;AAChD,cAAc,yBAAyB,CAAC;AAGxC,cAAc,gBAAgB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@did-btcr2/method",
3
- "version": "0.36.1",
3
+ "version": "0.37.0",
4
4
  "type": "module",
5
5
  "description": "Reference implementation for the did:btcr2 DID method written in TypeScript and JavaScript. did:btcr2 is a censorship resistant DID Method using the Bitcoin blockchain as a Verifiable Data Registry to announce changes to the DID document. This is the core method implementation for the did-btcr2-js monorepo.",
6
6
  "main": "./dist/cjs/index.js",
@@ -81,10 +81,10 @@
81
81
  "multiformats": "^13.4.2",
82
82
  "nostr-tools": "^2.23.3",
83
83
  "@did-btcr2/bitcoin": "^0.6.0",
84
- "@did-btcr2/keypair": "^0.13.1",
85
- "@did-btcr2/smt": "^0.3.0",
86
84
  "@did-btcr2/common": "^9.1.0",
87
- "@did-btcr2/cryptosuite": "^8.0.0"
85
+ "@did-btcr2/smt": "^0.3.0",
86
+ "@did-btcr2/cryptosuite": "^8.0.0",
87
+ "@did-btcr2/keypair": "^0.13.1"
88
88
  },
89
89
  "devDependencies": {
90
90
  "@eslint/js": "^9.39.4",
@@ -43,13 +43,17 @@ export interface AggregateBeaconStrategy {
43
43
 
44
44
  /**
45
45
  * Participant: verify the aggregated data they received reflects their own
46
- * submitted update. Pure function returns matches + sidecar fields for
47
- * the caller to store.
46
+ * slot. A submitter (`included: true`) checks its update is included; a
47
+ * decliner (`included: false`, cooperative non-inclusion) checks its
48
+ * non-inclusion slot instead (absence from the CAS map, or an SMT
49
+ * non-inclusion proof). `submittedUpdate`/`expectedHash` are present only for a
50
+ * submitter. Pure function: returns matches + sidecar fields for the caller.
48
51
  */
49
52
  validateParticipantView(params: {
50
53
  participantDid: string;
51
- submittedUpdate: SignedBTCR2Update;
52
- expectedHash: string;
54
+ included: boolean;
55
+ submittedUpdate?: SignedBTCR2Update;
56
+ expectedHash?: string;
53
57
  body: BaseBody;
54
58
  }): BeaconValidationResult;
55
59
  }
@@ -65,9 +69,13 @@ const CAS_STRATEGY: AggregateBeaconStrategy = {
65
69
  return { casAnnouncement: cohort.casAnnouncement };
66
70
  },
67
71
 
68
- validateParticipantView({ participantDid, expectedHash, body }) {
72
+ validateParticipantView({ participantDid, included, expectedHash, body }) {
69
73
  const casAnnouncement = body.casAnnouncement;
70
74
  if(!casAnnouncement) return { matches: false };
75
+ if(!included) {
76
+ // Cooperative non-inclusion: the decliner must be ABSENT from the map.
77
+ return { matches: !(participantDid in casAnnouncement), casAnnouncement };
78
+ }
71
79
  return {
72
80
  matches : casAnnouncement[participantDid] === expectedHash,
73
81
  casAnnouncement,
@@ -87,9 +95,20 @@ const SMT_STRATEGY: AggregateBeaconStrategy = {
87
95
  return { smtProof: proof as unknown as Record<string, unknown> | undefined };
88
96
  },
89
97
 
90
- validateParticipantView({ participantDid, submittedUpdate, body }) {
98
+ validateParticipantView({ participantDid, included, submittedUpdate, body }) {
91
99
  const smtProof = body.smtProof as unknown as SerializedSMTProof | undefined;
92
- if(!smtProof?.updateId || !smtProof?.nonce) return { matches: false };
100
+ const index = didToIndex(participantDid);
101
+
102
+ if(!included) {
103
+ // Cooperative non-inclusion: the proof has a nonce but no updateId by
104
+ // construction. The leaf is SHA-256(SHA-256(nonce)); do NOT run the
105
+ // inclusion-only updateId guard (a missing updateId is correct here).
106
+ if(!smtProof?.nonce || smtProof?.updateId) return { matches: false, smtProof };
107
+ const candidateHash = blockHash(blockHash(base64UrlToHash(smtProof.nonce)));
108
+ return { matches: verifySerializedProof(smtProof, index, candidateHash), smtProof };
109
+ }
110
+
111
+ if(!smtProof?.updateId || !smtProof?.nonce || !submittedUpdate) return { matches: false, smtProof };
93
112
  // Verify updateId matches the canonicalized update hash. Proof hash fields
94
113
  // are base64url (no padding) per the SMT Proof spec.
95
114
  const canonicalBytes = new TextEncoder().encode(canonicalize(submittedUpdate as unknown as Record<string, unknown>));
@@ -97,8 +116,7 @@ const SMT_STRATEGY: AggregateBeaconStrategy = {
97
116
  if(smtProof.updateId !== expectedUpdateId) {
98
117
  return { matches: false, smtProof };
99
118
  }
100
- // Verify Merkle inclusion
101
- const index = didToIndex(participantDid);
119
+ // Verify Merkle inclusion. The leaf is SHA-256(SHA-256(nonce) || SHA-256(update)).
102
120
  const candidateHash = blockHash(blockHash(base64UrlToHash(smtProof.nonce)), base64UrlToHash(smtProof.updateId));
103
121
  return {
104
122
  matches : verifySerializedProof(smtProof, index, candidateHash),