@did-btcr2/method 0.37.0 → 0.39.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 (245) hide show
  1. package/dist/.tsbuildinfo +1 -1
  2. package/dist/browser.js +47868 -34771
  3. package/dist/browser.mjs +47867 -34770
  4. package/dist/cjs/index.js +462 -6060
  5. package/dist/esm/core/beacon/beacon.js +101 -10
  6. package/dist/esm/core/beacon/beacon.js.map +1 -1
  7. package/dist/esm/core/beacon/fee-estimator.js +12 -27
  8. package/dist/esm/core/beacon/fee-estimator.js.map +1 -1
  9. package/dist/esm/core/did-sender-resolver.js +26 -0
  10. package/dist/esm/core/did-sender-resolver.js.map +1 -0
  11. package/dist/esm/index.js +3 -17
  12. package/dist/esm/index.js.map +1 -1
  13. package/dist/types/core/beacon/beacon.d.ts +59 -3
  14. package/dist/types/core/beacon/beacon.d.ts.map +1 -1
  15. package/dist/types/core/beacon/fee-estimator.d.ts +10 -37
  16. package/dist/types/core/beacon/fee-estimator.d.ts.map +1 -1
  17. package/dist/types/core/did-sender-resolver.d.ts +14 -0
  18. package/dist/types/core/did-sender-resolver.d.ts.map +1 -0
  19. package/dist/types/index.d.ts +2 -16
  20. package/dist/types/index.d.ts.map +1 -1
  21. package/package.json +6 -5
  22. package/src/core/beacon/beacon.ts +131 -12
  23. package/src/core/beacon/fee-estimator.ts +15 -49
  24. package/src/core/did-sender-resolver.ts +25 -0
  25. package/src/index.ts +3 -17
  26. package/dist/esm/core/aggregation/beacon-strategy.js +0 -76
  27. package/dist/esm/core/aggregation/beacon-strategy.js.map +0 -1
  28. package/dist/esm/core/aggregation/cohort.js +0 -316
  29. package/dist/esm/core/aggregation/cohort.js.map +0 -1
  30. package/dist/esm/core/aggregation/conditions.js +0 -102
  31. package/dist/esm/core/aggregation/conditions.js.map +0 -1
  32. package/dist/esm/core/aggregation/errors.js +0 -22
  33. package/dist/esm/core/aggregation/errors.js.map +0 -1
  34. package/dist/esm/core/aggregation/fallback-spend.js +0 -132
  35. package/dist/esm/core/aggregation/fallback-spend.js.map +0 -1
  36. package/dist/esm/core/aggregation/logger.js +0 -15
  37. package/dist/esm/core/aggregation/logger.js.map +0 -1
  38. package/dist/esm/core/aggregation/messages/base.js +0 -36
  39. package/dist/esm/core/aggregation/messages/base.js.map +0 -1
  40. package/dist/esm/core/aggregation/messages/bodies.js +0 -149
  41. package/dist/esm/core/aggregation/messages/bodies.js.map +0 -1
  42. package/dist/esm/core/aggregation/messages/constants.js +0 -37
  43. package/dist/esm/core/aggregation/messages/constants.js.map +0 -1
  44. package/dist/esm/core/aggregation/messages/factories.js +0 -139
  45. package/dist/esm/core/aggregation/messages/factories.js.map +0 -1
  46. package/dist/esm/core/aggregation/messages/guards.js +0 -40
  47. package/dist/esm/core/aggregation/messages/guards.js.map +0 -1
  48. package/dist/esm/core/aggregation/messages/index.js +0 -6
  49. package/dist/esm/core/aggregation/messages/index.js.map +0 -1
  50. package/dist/esm/core/aggregation/participant.js +0 -588
  51. package/dist/esm/core/aggregation/participant.js.map +0 -1
  52. package/dist/esm/core/aggregation/phases.js +0 -45
  53. package/dist/esm/core/aggregation/phases.js.map +0 -1
  54. package/dist/esm/core/aggregation/recovery-policy.js +0 -156
  55. package/dist/esm/core/aggregation/recovery-policy.js.map +0 -1
  56. package/dist/esm/core/aggregation/recovery-spend.js +0 -106
  57. package/dist/esm/core/aggregation/recovery-spend.js.map +0 -1
  58. package/dist/esm/core/aggregation/runner/aggregation-runner.js +0 -74
  59. package/dist/esm/core/aggregation/runner/aggregation-runner.js.map +0 -1
  60. package/dist/esm/core/aggregation/runner/events.js +0 -2
  61. package/dist/esm/core/aggregation/runner/events.js.map +0 -1
  62. package/dist/esm/core/aggregation/runner/index.js +0 -6
  63. package/dist/esm/core/aggregation/runner/index.js.map +0 -1
  64. package/dist/esm/core/aggregation/runner/participant-runner.js +0 -407
  65. package/dist/esm/core/aggregation/runner/participant-runner.js.map +0 -1
  66. package/dist/esm/core/aggregation/runner/service-runner.js +0 -694
  67. package/dist/esm/core/aggregation/runner/service-runner.js.map +0 -1
  68. package/dist/esm/core/aggregation/runner/typed-emitter.js +0 -80
  69. package/dist/esm/core/aggregation/runner/typed-emitter.js.map +0 -1
  70. package/dist/esm/core/aggregation/service.js +0 -774
  71. package/dist/esm/core/aggregation/service.js.map +0 -1
  72. package/dist/esm/core/aggregation/signer.js +0 -33
  73. package/dist/esm/core/aggregation/signer.js.map +0 -1
  74. package/dist/esm/core/aggregation/signing-session.js +0 -195
  75. package/dist/esm/core/aggregation/signing-session.js.map +0 -1
  76. package/dist/esm/core/aggregation/transport/didcomm.js +0 -41
  77. package/dist/esm/core/aggregation/transport/didcomm.js.map +0 -1
  78. package/dist/esm/core/aggregation/transport/error.js +0 -12
  79. package/dist/esm/core/aggregation/transport/error.js.map +0 -1
  80. package/dist/esm/core/aggregation/transport/factory.js +0 -29
  81. package/dist/esm/core/aggregation/transport/factory.js.map +0 -1
  82. package/dist/esm/core/aggregation/transport/http/client.js +0 -350
  83. package/dist/esm/core/aggregation/transport/http/client.js.map +0 -1
  84. package/dist/esm/core/aggregation/transport/http/envelope.js +0 -126
  85. package/dist/esm/core/aggregation/transport/http/envelope.js.map +0 -1
  86. package/dist/esm/core/aggregation/transport/http/errors.js +0 -11
  87. package/dist/esm/core/aggregation/transport/http/errors.js.map +0 -1
  88. package/dist/esm/core/aggregation/transport/http/inbox-buffer.js +0 -45
  89. package/dist/esm/core/aggregation/transport/http/inbox-buffer.js.map +0 -1
  90. package/dist/esm/core/aggregation/transport/http/index.js +0 -12
  91. package/dist/esm/core/aggregation/transport/http/index.js.map +0 -1
  92. package/dist/esm/core/aggregation/transport/http/nonce-cache.js +0 -38
  93. package/dist/esm/core/aggregation/transport/http/nonce-cache.js.map +0 -1
  94. package/dist/esm/core/aggregation/transport/http/protocol.js +0 -28
  95. package/dist/esm/core/aggregation/transport/http/protocol.js.map +0 -1
  96. package/dist/esm/core/aggregation/transport/http/rate-limiter.js +0 -45
  97. package/dist/esm/core/aggregation/transport/http/rate-limiter.js.map +0 -1
  98. package/dist/esm/core/aggregation/transport/http/request-auth.js +0 -100
  99. package/dist/esm/core/aggregation/transport/http/request-auth.js.map +0 -1
  100. package/dist/esm/core/aggregation/transport/http/server.js +0 -481
  101. package/dist/esm/core/aggregation/transport/http/server.js.map +0 -1
  102. package/dist/esm/core/aggregation/transport/http/sse-stream.js +0 -110
  103. package/dist/esm/core/aggregation/transport/http/sse-stream.js.map +0 -1
  104. package/dist/esm/core/aggregation/transport/http/sse-writer.js +0 -25
  105. package/dist/esm/core/aggregation/transport/http/sse-writer.js.map +0 -1
  106. package/dist/esm/core/aggregation/transport/in-memory.js +0 -149
  107. package/dist/esm/core/aggregation/transport/in-memory.js.map +0 -1
  108. package/dist/esm/core/aggregation/transport/index.js +0 -8
  109. package/dist/esm/core/aggregation/transport/index.js.map +0 -1
  110. package/dist/esm/core/aggregation/transport/nostr.js +0 -491
  111. package/dist/esm/core/aggregation/transport/nostr.js.map +0 -1
  112. package/dist/esm/core/aggregation/transport/transport.js +0 -2
  113. package/dist/esm/core/aggregation/transport/transport.js.map +0 -1
  114. package/dist/types/core/aggregation/beacon-strategy.d.ts +0 -56
  115. package/dist/types/core/aggregation/beacon-strategy.d.ts.map +0 -1
  116. package/dist/types/core/aggregation/cohort.d.ts +0 -182
  117. package/dist/types/core/aggregation/cohort.d.ts.map +0 -1
  118. package/dist/types/core/aggregation/conditions.d.ts +0 -86
  119. package/dist/types/core/aggregation/conditions.d.ts.map +0 -1
  120. package/dist/types/core/aggregation/errors.d.ts +0 -14
  121. package/dist/types/core/aggregation/errors.d.ts.map +0 -1
  122. package/dist/types/core/aggregation/fallback-spend.d.ts +0 -94
  123. package/dist/types/core/aggregation/fallback-spend.d.ts.map +0 -1
  124. package/dist/types/core/aggregation/logger.d.ts +0 -22
  125. package/dist/types/core/aggregation/logger.d.ts.map +0 -1
  126. package/dist/types/core/aggregation/messages/base.d.ts +0 -58
  127. package/dist/types/core/aggregation/messages/base.d.ts.map +0 -1
  128. package/dist/types/core/aggregation/messages/bodies.d.ts +0 -177
  129. package/dist/types/core/aggregation/messages/bodies.d.ts.map +0 -1
  130. package/dist/types/core/aggregation/messages/constants.d.ts +0 -31
  131. package/dist/types/core/aggregation/messages/constants.d.ts.map +0 -1
  132. package/dist/types/core/aggregation/messages/factories.d.ts +0 -217
  133. package/dist/types/core/aggregation/messages/factories.d.ts.map +0 -1
  134. package/dist/types/core/aggregation/messages/guards.d.ts +0 -11
  135. package/dist/types/core/aggregation/messages/guards.d.ts.map +0 -1
  136. package/dist/types/core/aggregation/messages/index.d.ts +0 -6
  137. package/dist/types/core/aggregation/messages/index.d.ts.map +0 -1
  138. package/dist/types/core/aggregation/participant.d.ts +0 -162
  139. package/dist/types/core/aggregation/participant.d.ts.map +0 -1
  140. package/dist/types/core/aggregation/phases.d.ts +0 -55
  141. package/dist/types/core/aggregation/phases.d.ts.map +0 -1
  142. package/dist/types/core/aggregation/recovery-policy.d.ts +0 -132
  143. package/dist/types/core/aggregation/recovery-policy.d.ts.map +0 -1
  144. package/dist/types/core/aggregation/recovery-spend.d.ts +0 -94
  145. package/dist/types/core/aggregation/recovery-spend.d.ts.map +0 -1
  146. package/dist/types/core/aggregation/runner/aggregation-runner.d.ts +0 -66
  147. package/dist/types/core/aggregation/runner/aggregation-runner.d.ts.map +0 -1
  148. package/dist/types/core/aggregation/runner/events.d.ts +0 -147
  149. package/dist/types/core/aggregation/runner/events.d.ts.map +0 -1
  150. package/dist/types/core/aggregation/runner/index.d.ts +0 -6
  151. package/dist/types/core/aggregation/runner/index.d.ts.map +0 -1
  152. package/dist/types/core/aggregation/runner/participant-runner.d.ts +0 -122
  153. package/dist/types/core/aggregation/runner/participant-runner.d.ts.map +0 -1
  154. package/dist/types/core/aggregation/runner/service-runner.d.ts +0 -211
  155. package/dist/types/core/aggregation/runner/service-runner.d.ts.map +0 -1
  156. package/dist/types/core/aggregation/runner/typed-emitter.d.ts +0 -41
  157. package/dist/types/core/aggregation/runner/typed-emitter.d.ts.map +0 -1
  158. package/dist/types/core/aggregation/service.d.ts +0 -177
  159. package/dist/types/core/aggregation/service.d.ts.map +0 -1
  160. package/dist/types/core/aggregation/signer.d.ts +0 -50
  161. package/dist/types/core/aggregation/signer.d.ts.map +0 -1
  162. package/dist/types/core/aggregation/signing-session.d.ts +0 -81
  163. package/dist/types/core/aggregation/signing-session.d.ts.map +0 -1
  164. package/dist/types/core/aggregation/transport/didcomm.d.ts +0 -23
  165. package/dist/types/core/aggregation/transport/didcomm.d.ts.map +0 -1
  166. package/dist/types/core/aggregation/transport/error.d.ts +0 -8
  167. package/dist/types/core/aggregation/transport/error.d.ts.map +0 -1
  168. package/dist/types/core/aggregation/transport/factory.d.ts +0 -28
  169. package/dist/types/core/aggregation/transport/factory.d.ts.map +0 -1
  170. package/dist/types/core/aggregation/transport/http/client.d.ts +0 -48
  171. package/dist/types/core/aggregation/transport/http/client.d.ts.map +0 -1
  172. package/dist/types/core/aggregation/transport/http/envelope.d.ts +0 -64
  173. package/dist/types/core/aggregation/transport/http/envelope.d.ts.map +0 -1
  174. package/dist/types/core/aggregation/transport/http/errors.d.ts +0 -9
  175. package/dist/types/core/aggregation/transport/http/errors.d.ts.map +0 -1
  176. package/dist/types/core/aggregation/transport/http/inbox-buffer.d.ts +0 -32
  177. package/dist/types/core/aggregation/transport/http/inbox-buffer.d.ts.map +0 -1
  178. package/dist/types/core/aggregation/transport/http/index.d.ts +0 -12
  179. package/dist/types/core/aggregation/transport/http/index.d.ts.map +0 -1
  180. package/dist/types/core/aggregation/transport/http/nonce-cache.d.ts +0 -26
  181. package/dist/types/core/aggregation/transport/http/nonce-cache.d.ts.map +0 -1
  182. package/dist/types/core/aggregation/transport/http/protocol.d.ts +0 -53
  183. package/dist/types/core/aggregation/transport/http/protocol.d.ts.map +0 -1
  184. package/dist/types/core/aggregation/transport/http/rate-limiter.d.ts +0 -41
  185. package/dist/types/core/aggregation/transport/http/rate-limiter.d.ts.map +0 -1
  186. package/dist/types/core/aggregation/transport/http/request-auth.d.ts +0 -50
  187. package/dist/types/core/aggregation/transport/http/request-auth.d.ts.map +0 -1
  188. package/dist/types/core/aggregation/transport/http/server.d.ts +0 -110
  189. package/dist/types/core/aggregation/transport/http/server.d.ts.map +0 -1
  190. package/dist/types/core/aggregation/transport/http/sse-stream.d.ts +0 -34
  191. package/dist/types/core/aggregation/transport/http/sse-stream.d.ts.map +0 -1
  192. package/dist/types/core/aggregation/transport/http/sse-writer.d.ts +0 -12
  193. package/dist/types/core/aggregation/transport/http/sse-writer.d.ts.map +0 -1
  194. package/dist/types/core/aggregation/transport/in-memory.d.ts +0 -64
  195. package/dist/types/core/aggregation/transport/in-memory.d.ts.map +0 -1
  196. package/dist/types/core/aggregation/transport/index.d.ts +0 -8
  197. package/dist/types/core/aggregation/transport/index.d.ts.map +0 -1
  198. package/dist/types/core/aggregation/transport/nostr.d.ts +0 -153
  199. package/dist/types/core/aggregation/transport/nostr.d.ts.map +0 -1
  200. package/dist/types/core/aggregation/transport/transport.d.ts +0 -62
  201. package/dist/types/core/aggregation/transport/transport.d.ts.map +0 -1
  202. package/src/core/aggregation/beacon-strategy.ts +0 -142
  203. package/src/core/aggregation/cohort.ts +0 -415
  204. package/src/core/aggregation/conditions.ts +0 -172
  205. package/src/core/aggregation/errors.ts +0 -25
  206. package/src/core/aggregation/fallback-spend.ts +0 -223
  207. package/src/core/aggregation/logger.ts +0 -33
  208. package/src/core/aggregation/messages/base.ts +0 -80
  209. package/src/core/aggregation/messages/bodies.ts +0 -328
  210. package/src/core/aggregation/messages/constants.ts +0 -40
  211. package/src/core/aggregation/messages/factories.ts +0 -297
  212. package/src/core/aggregation/messages/guards.ts +0 -61
  213. package/src/core/aggregation/messages/index.ts +0 -5
  214. package/src/core/aggregation/participant.ts +0 -779
  215. package/src/core/aggregation/phases.ts +0 -91
  216. package/src/core/aggregation/recovery-policy.ts +0 -237
  217. package/src/core/aggregation/recovery-spend.ts +0 -192
  218. package/src/core/aggregation/runner/aggregation-runner.ts +0 -118
  219. package/src/core/aggregation/runner/events.ts +0 -129
  220. package/src/core/aggregation/runner/index.ts +0 -5
  221. package/src/core/aggregation/runner/participant-runner.ts +0 -488
  222. package/src/core/aggregation/runner/service-runner.ts +0 -866
  223. package/src/core/aggregation/runner/typed-emitter.ts +0 -87
  224. package/src/core/aggregation/service.ts +0 -1000
  225. package/src/core/aggregation/signer.ts +0 -67
  226. package/src/core/aggregation/signing-session.ts +0 -290
  227. package/src/core/aggregation/transport/didcomm.ts +0 -59
  228. package/src/core/aggregation/transport/error.ts +0 -13
  229. package/src/core/aggregation/transport/factory.ts +0 -65
  230. package/src/core/aggregation/transport/http/client.ts +0 -409
  231. package/src/core/aggregation/transport/http/envelope.ts +0 -204
  232. package/src/core/aggregation/transport/http/errors.ts +0 -11
  233. package/src/core/aggregation/transport/http/inbox-buffer.ts +0 -53
  234. package/src/core/aggregation/transport/http/index.ts +0 -11
  235. package/src/core/aggregation/transport/http/nonce-cache.ts +0 -43
  236. package/src/core/aggregation/transport/http/protocol.ts +0 -57
  237. package/src/core/aggregation/transport/http/rate-limiter.ts +0 -75
  238. package/src/core/aggregation/transport/http/request-auth.ts +0 -164
  239. package/src/core/aggregation/transport/http/server.ts +0 -615
  240. package/src/core/aggregation/transport/http/sse-stream.ts +0 -121
  241. package/src/core/aggregation/transport/http/sse-writer.ts +0 -23
  242. package/src/core/aggregation/transport/in-memory.ts +0 -178
  243. package/src/core/aggregation/transport/index.ts +0 -7
  244. package/src/core/aggregation/transport/nostr.ts +0 -576
  245. package/src/core/aggregation/transport/transport.ts +0 -79
@@ -1,415 +0,0 @@
1
- import { getNetwork } from '@did-btcr2/bitcoin';
2
- import { canonicalHash, canonicalize, hash } from '@did-btcr2/common';
3
- import type { SignedBTCR2Update } from '@did-btcr2/cryptosuite';
4
- import type { SerializedSMTProof, TreeEntry } from '@did-btcr2/smt';
5
- import { BTCR2MerkleTree } from '@did-btcr2/smt';
6
- import { schnorr } from '@noble/curves/secp256k1.js';
7
- import { concatBytes, hexToBytes, randomBytes } from '@noble/hashes/utils';
8
- import { p2tr } from '@scure/btc-signer';
9
- import { keyAggExport, keyAggregate, sortKeys } from '@scure/btc-signer/musig2';
10
- import type { CASAnnouncement } from '../types.js';
11
- import { AggregationCohortError } from './errors.js';
12
- import type { FundingModel } from './recovery-policy.js';
13
- import { DEFAULT_FUNDING_MODEL, buildRecoveryLeaves, resolveFallbackThreshold } from './recovery-policy.js';
14
-
15
- export type AggregationCohortParams = {
16
- id?: string;
17
- serviceDid?: string;
18
- minParticipants?: number;
19
- network: string;
20
- beaconType?: string;
21
- /** Operator recovery key, x-only (32 bytes). Required to compute the beacon address. */
22
- recoveryKey?: Uint8Array;
23
- /** Relative-timelock (BIP-68 nSequence) before recovery is spendable. Required to compute the beacon address. */
24
- recoverySequence?: number;
25
- /** Funding model governing the recovery leaves. Defaults to 'operator-funded'. */
26
- fundingModel?: FundingModel;
27
- /** Advertised k of the k-of-n fallback leaf. Absent defaults to n-1 at address computation. */
28
- fallbackThreshold?: number;
29
- };
30
-
31
- /**
32
- * Represents an Aggregation Cohort: a set of Aggregation Participants who
33
- * submitted cryptographic material to an Aggregation Service to coordinate
34
- * signing of a shared n-of-n MuSig2 Bitcoin transaction.
35
- *
36
- * This is a pure data class: it holds cohort state and provides computation
37
- * helpers (key aggregation, CAS Announcement building, SMT tree building).
38
- * It performs no I/O and emits no messages. Both AggregationService and
39
- * AggregationParticipant create their own AggregationCohort instances to
40
- * track their respective views of the cohort state.
41
- *
42
- * @class AggregationCohort
43
- */
44
- export class AggregationCohort {
45
- /** Unique identifier for the cohort. */
46
- id: string;
47
-
48
- /** DID of the Aggregation Service managing this cohort. */
49
- serviceDid: string;
50
-
51
- /** Minimum number of participants required to finalize the cohort. */
52
- minParticipants: number;
53
-
54
- /** Network on which the cohort operates (mainnet, mutinynet, etc.). */
55
- network: string;
56
-
57
- /** Type of beacon used in the cohort: 'CASBeacon' or 'SMTBeacon'. */
58
- beaconType: string;
59
-
60
- /** List of participant DIDs that have been accepted into the cohort. */
61
- participants: Array<string> = [];
62
-
63
- /**
64
- * Mapping from participant DID to their compressed secp256k1 public key.
65
- * Distinct from {@link cohortKeys} (which is sorted per BIP-327): this lets
66
- * callers look up a participant's key without knowing their position in the
67
- * sorted array. Populated by the service at `acceptParticipant` time.
68
- */
69
- participantKeys: Map<string, Uint8Array> = new Map();
70
-
71
- /** Sorted list of cohort participants' compressed public keys. */
72
- #cohortKeys: Array<Uint8Array> = [];
73
-
74
- /**
75
- * BIP-341 TapTweak scalar: `taggedHash("TapTweak", internalPubkey || tapMerkleRoot)`.
76
- * The beacon output is an internal key (the MuSig2 aggregate) plus a script
77
- * tree (the recovery leaves), so the tweak commits to the tree's Merkle root.
78
- * The MuSig2 signing session applies this as an x-only tweak; a value that does
79
- * not match the root the funded address was derived from silently yields an
80
- * invalid key-path signature.
81
- */
82
- tapTweak: Uint8Array = new Uint8Array();
83
-
84
- /** The n-of-n MuSig2 aggregate internal key, x-only (32 bytes), set by computeBeaconAddress(). */
85
- internalKey: Uint8Array = new Uint8Array();
86
-
87
- /** BIP-341 Taproot Merkle root of the recovery script tree, set by computeBeaconAddress(). */
88
- tapMerkleRoot: Uint8Array = new Uint8Array();
89
-
90
- /** Operator recovery key, x-only (32 bytes). Used to build the CSV recovery leaf. */
91
- recoveryKey?: Uint8Array;
92
-
93
- /** Relative-timelock (BIP-68 nSequence) before the recovery leaf is spendable. */
94
- recoverySequence?: number;
95
-
96
- /** Funding model governing the recovery leaves (default 'operator-funded'). */
97
- fundingModel: FundingModel;
98
-
99
- /**
100
- * Advertised k of the k-of-n fallback leaf, or undefined to default to n-1 at
101
- * address computation. Read the resolved value via {@link effectiveFallbackThreshold}.
102
- */
103
- fallbackThreshold?: number;
104
-
105
- /** The Taproot beacon address: key path is the MuSig2 aggregate, script path is fallback + recovery. */
106
- beaconAddress: string = '';
107
-
108
- /** Pending DID updates submitted by participants, keyed by DID. */
109
- pendingUpdates: Map<string, SignedBTCR2Update> = new Map();
110
-
111
- /**
112
- * Participant DIDs that explicitly declined to submit an update this round
113
- * (cooperative non-inclusion). A decliner is absent from the CAS Announcement
114
- * Map and carries a non-inclusion leaf in the SMT, yet still signs. Kept
115
- * disjoint from {@link pendingUpdates} so CAS correctness holds by construction.
116
- */
117
- nonIncluded: Set<string> = new Set();
118
-
119
- /** CAS Beacon Announcement Map (DID to updateHash), set by buildCASAnnouncement(). */
120
- casAnnouncement?: CASAnnouncement;
121
-
122
- /** Per-participant SMT proofs, set by buildSMTTree(). */
123
- smtProofs?: Map<string, SerializedSMTProof>;
124
-
125
- /** Signal bytes (32 bytes) for OP_RETURN: SHA-256 of CAS announcement OR SMT root. */
126
- signalBytes?: Uint8Array;
127
-
128
- /** Set of participant DIDs that have approved the aggregated data. */
129
- validationAcks: Set<string> = new Set();
130
-
131
- /** Set of participant DIDs that have rejected the aggregated data. */
132
- validationRejections: Set<string> = new Set();
133
-
134
- constructor({ id, minParticipants, serviceDid, network, beaconType, recoveryKey, recoverySequence, fundingModel, fallbackThreshold }: AggregationCohortParams) {
135
- this.id = id || crypto.randomUUID();
136
- // `?? 2` (not `|| 2`) so a deliberately-passed 0 is preserved rather than
137
- // silently coerced; the service rejects an invalid count at createCohort.
138
- this.minParticipants = minParticipants ?? 2;
139
- this.serviceDid = serviceDid || '';
140
- this.network = network;
141
- this.beaconType = beaconType || 'CASBeacon';
142
- this.recoveryKey = recoveryKey;
143
- this.recoverySequence = recoverySequence;
144
- this.fundingModel = fundingModel ?? DEFAULT_FUNDING_MODEL;
145
- this.fallbackThreshold = fallbackThreshold;
146
- }
147
-
148
- /** Sorted cohort keys (sorted on assignment per BIP-327). */
149
- get cohortKeys(): Array<Uint8Array> {
150
- return this.#cohortKeys;
151
- }
152
-
153
- set cohortKeys(keys: Array<Uint8Array>) {
154
- this.#cohortKeys = sortKeys(keys);
155
- }
156
-
157
- /**
158
- * The resolved k of the k-of-n fallback leaf: the advertised
159
- * {@link fallbackThreshold}, or n-1 (floored at 1) when unadvertised, where n is
160
- * the current cohort size. This is the value the beacon address commits to and
161
- * the spend builders must reproduce. Returns 0 before any cohort keys are set.
162
- */
163
- public get effectiveFallbackThreshold(): number {
164
- if(this.#cohortKeys.length === 0) return 0;
165
- return resolveFallbackThreshold(this.fallbackThreshold, this.#cohortKeys.length);
166
- }
167
-
168
- /**
169
- * Computes the Taproot beacon address from the cohort keys and recovery params.
170
- *
171
- * The output's key path is the n-of-n MuSig2 aggregate of the cohort keys; its
172
- * script path is the recovery tree (a CSV recovery leaf so a missing signer
173
- * cannot permanently lock the UTXO). Sets `internalKey`, `tapMerkleRoot`, and
174
- * the `tapTweak` the MuSig2 session must apply for the key-path spend.
175
- *
176
- * The tweak is derived from the Merkle root the address was built with (read
177
- * back from the payment), never recomputed by hand, so the MuSig2 key-path
178
- * signature is guaranteed to validate against the funded address.
179
- */
180
- public computeBeaconAddress(): string {
181
- if(this.#cohortKeys.length === 0) {
182
- throw new AggregationCohortError(
183
- 'Cannot compute beacon address: no cohort keys.',
184
- 'NO_COHORT_KEYS', { cohortId: this.id }
185
- );
186
- }
187
- if(!this.recoveryKey || this.recoveryKey.length === 0 || this.recoverySequence === undefined) {
188
- throw new AggregationCohortError(
189
- 'Cannot compute beacon address: missing recovery key or sequence.',
190
- 'NO_RECOVERY_PARAMS', { cohortId: this.id }
191
- );
192
- }
193
- const keyAggContext = keyAggregate(this.#cohortKeys);
194
- const aggPubkey = keyAggExport(keyAggContext);
195
-
196
- // The beacon output commits to the script tree (k-of-n fallback leaf + CSV
197
- // recovery leaf) alongside the MuSig2 internal key. Derive the address for
198
- // the cohort's network. Without the network arg p2tr defaults to mainnet, so
199
- // a mutinynet/signet/regtest cohort would otherwise advertise a `bc1p...`
200
- // address that no participant can fund.
201
- const leaves = buildRecoveryLeaves(this.fundingModel, {
202
- recoveryKey : this.recoveryKey,
203
- recoverySequence : this.recoverySequence,
204
- cohortKeys : this.#cohortKeys,
205
- fallbackThreshold : resolveFallbackThreshold(this.fallbackThreshold, this.#cohortKeys.length),
206
- });
207
- // allowUnknownOutputs: the CSV recovery leaf is a custom script, not one of
208
- // p2tr's recognized templates (tr_ns/tr_ms), so the template check must be
209
- // waived. The leaf hash (and thus the address) is computed from the raw
210
- // script bytes regardless.
211
- const payment = p2tr(aggPubkey, leaves, getNetwork(this.network), true);
212
-
213
- // BIP-341: the key-path tweak commits to the script tree's Merkle root.
214
- // taggedHash("TapTweak", internalPubkey || tapMerkleRoot). Use the root the
215
- // library committed to (payment.tapMerkleRoot) so the tweak matches the
216
- // funded address byte-for-byte.
217
- this.internalKey = aggPubkey;
218
- this.tapMerkleRoot = payment.tapMerkleRoot;
219
- this.tapTweak = schnorr.utils.taggedHash('TapTweak', concatBytes(aggPubkey, payment.tapMerkleRoot));
220
-
221
- if(!payment.address) {
222
- throw new AggregationCohortError(
223
- 'Failed to compute Taproot address',
224
- 'BEACON_ADDRESS_ERROR', { cohortId: this.id }
225
- );
226
- }
227
- this.beaconAddress = payment.address;
228
- return payment.address;
229
- }
230
-
231
- /**
232
- * Validates that the participant's key is in the cohort and the beacon address
233
- * matches the locally-computed one. Used by participants to verify cohort ready
234
- * messages from the service.
235
- */
236
- public validateMembership(
237
- participantPkHex: string,
238
- cohortKeysHex: Array<string>,
239
- expectedBeaconAddress: string
240
- ): void {
241
- if(!cohortKeysHex.includes(participantPkHex)) {
242
- throw new AggregationCohortError(
243
- `Participant key not found in cohort ${this.id}.`,
244
- 'COHORT_VALIDATION_ERROR', { cohortId: this.id, participantPkHex }
245
- );
246
- }
247
- this.cohortKeys = cohortKeysHex.map(k => hexToBytes(k));
248
- const computed = this.computeBeaconAddress();
249
- if(computed !== expectedBeaconAddress) {
250
- throw new AggregationCohortError(
251
- `Computed beacon address ${computed} does not match expected ${expectedBeaconAddress}.`,
252
- 'BEACON_ADDRESS_MISMATCH', { cohortId: this.id, computed, expected: expectedBeaconAddress }
253
- );
254
- }
255
- }
256
-
257
- /**
258
- * Returns the position of a participant's public key in the sorted
259
- * {@link cohortKeys} array, or -1 if the participant is not in the cohort.
260
- * Required by MuSig2 partial-sig verification which indexes by signer position.
261
- */
262
- public indexOfParticipant(did: string): number {
263
- const pk = this.participantKeys.get(did);
264
- if(!pk) return -1;
265
- return this.#cohortKeys.findIndex(k =>
266
- k.length === pk.length && k.every((b, i) => b === pk[i])
267
- );
268
- }
269
-
270
- public addUpdate(participantDid: string, signedUpdate: SignedBTCR2Update): void {
271
- if(!this.participants.includes(participantDid)) {
272
- throw new AggregationCohortError(
273
- `Participant ${participantDid} is not in cohort ${this.id}.`,
274
- 'UNKNOWN_PARTICIPANT', { cohortId: this.id, participantDid }
275
- );
276
- }
277
- this.pendingUpdates.set(participantDid, signedUpdate);
278
- }
279
-
280
- /**
281
- * Record that a participant declined to submit an update this round
282
- * (cooperative non-inclusion). The member stays in the cohort and still signs.
283
- */
284
- public addNonInclusion(participantDid: string): void {
285
- if(!this.participants.includes(participantDid)) {
286
- throw new AggregationCohortError(
287
- `Participant ${participantDid} is not in cohort ${this.id}.`,
288
- 'UNKNOWN_PARTICIPANT', { cohortId: this.id, participantDid }
289
- );
290
- }
291
- // A DID cannot both submit and decline. The service guards re-submission, but
292
- // keep the invariant local so the response gate and builders stay consistent.
293
- if(this.pendingUpdates.has(participantDid)) {
294
- throw new AggregationCohortError(
295
- `Participant ${participantDid} already submitted an update; cannot also decline.`,
296
- 'CONFLICTING_RESPONSE', { cohortId: this.id, participantDid }
297
- );
298
- }
299
- this.nonIncluded.add(participantDid);
300
- }
301
-
302
- public hasAllUpdates(): boolean {
303
- return this.pendingUpdates.size === this.participants.length;
304
- }
305
-
306
- /**
307
- * True when every participant has responded for this round, either with an
308
- * update or with an explicit non-inclusion. This is the aggregation gate when
309
- * non-inclusion is in play; it generalizes {@link hasAllUpdates} the same way
310
- * {@link hasAllValidationResponses} generalizes a unanimous ack.
311
- */
312
- public hasAllResponses(): boolean {
313
- return this.pendingUpdates.size + this.nonIncluded.size === this.participants.length;
314
- }
315
-
316
- /**
317
- * Builds a CAS Announcement Map from collected updates.
318
- * Maps each participant DID to base64url canonical hash of their signed update.
319
- * Computes signal bytes as SHA-256 of canonicalized announcement.
320
- *
321
- * Members who declined (cooperative non-inclusion) are naturally absent from
322
- * the map: the body iterates {@link pendingUpdates}, which never holds a
323
- * decliner. Absence from the map is exactly the CAS non-inclusion signal.
324
- */
325
- public buildCASAnnouncement(): CASAnnouncement {
326
- if(!this.hasAllResponses()) {
327
- throw new AggregationCohortError(
328
- 'Cannot build CAS Announcement: not all participants have responded.',
329
- 'INCOMPLETE_RESPONSES', { cohortId: this.id, updates: this.pendingUpdates.size, declined: this.nonIncluded.size, total: this.participants.length }
330
- );
331
- }
332
- const announcement: CASAnnouncement = {};
333
- for(const [did, signedUpdate] of this.pendingUpdates) {
334
- announcement[did] = canonicalHash(signedUpdate);
335
- }
336
- this.casAnnouncement = announcement;
337
- this.signalBytes = hash(canonicalize(announcement));
338
- return announcement;
339
- }
340
-
341
- /**
342
- * Builds an SMT tree with one leaf per participant.
343
- *
344
- * A member who submitted an update gets an inclusion leaf
345
- * (SHA-256(SHA-256(nonce) || SHA-256(update))); a member who declined gets a
346
- * non-inclusion leaf (SHA-256(SHA-256(nonce)), the `signedUpdate` entry field
347
- * omitted). The cohort mints each member's nonce and returns it inside that
348
- * member's serialized proof, so a decliner can self-validate its own
349
- * non-inclusion slot and the resolver can recompute the leaf. Stores
350
- * per-participant proofs and the SMT root as signalBytes.
351
- */
352
- public buildSMTTree(): Map<string, SerializedSMTProof> {
353
- if(!this.hasAllResponses()) {
354
- throw new AggregationCohortError(
355
- 'Cannot build SMT tree: not all participants have responded.',
356
- 'INCOMPLETE_RESPONSES', { cohortId: this.id, updates: this.pendingUpdates.size, declined: this.nonIncluded.size, total: this.participants.length }
357
- );
358
- }
359
- const tree = new BTCR2MerkleTree();
360
- const entries: TreeEntry[] = [];
361
- const encoder = new TextEncoder();
362
-
363
- // Slot every participant: an inclusion leaf for submitters, a non-inclusion
364
- // leaf (signedUpdate omitted) for decliners.
365
- for(const did of this.participants) {
366
- const nonce = randomBytes(32);
367
- const signedUpdate = this.pendingUpdates.get(did);
368
- if(signedUpdate) {
369
- entries.push({ did, nonce, signedUpdate: encoder.encode(canonicalize(signedUpdate)) });
370
- } else {
371
- entries.push({ did, nonce });
372
- }
373
- }
374
-
375
- tree.addEntries(entries);
376
- tree.finalize();
377
-
378
- this.signalBytes = tree.rootHash;
379
- this.smtProofs = new Map();
380
- for(const did of this.participants) {
381
- this.smtProofs.set(did, tree.proof(did));
382
- }
383
- return this.smtProofs;
384
- }
385
-
386
- public addValidation(participantDid: string, approved: boolean): void {
387
- if(!this.participants.includes(participantDid)) {
388
- throw new AggregationCohortError(
389
- `Unknown participant ${participantDid} in cohort ${this.id}.`,
390
- 'UNKNOWN_PARTICIPANT', { cohortId: this.id, participantDid }
391
- );
392
- }
393
- if(approved) {
394
- this.validationAcks.add(participantDid);
395
- } else {
396
- this.validationRejections.add(participantDid);
397
- }
398
- }
399
-
400
- /**
401
- * True when every participant has either approved or rejected the aggregated data.
402
- */
403
- public hasAllValidationResponses(): boolean {
404
- return this.validationAcks.size + this.validationRejections.size === this.participants.length;
405
- }
406
-
407
- /**
408
- * True when all participants approved. Note: differs from {@link hasAllValidationResponses},
409
- * this returns false if any participant rejected, even if all responses are in.
410
- */
411
- public isFullyValidated(): boolean {
412
- return this.validationRejections.size === 0
413
- && this.validationAcks.size === this.participants.length;
414
- }
415
- }
@@ -1,172 +0,0 @@
1
- /**
2
- * Cohort conditions: the constraints an Aggregation Service advertises for a
3
- * cohort (did:btcr2 spec, "Step 1: Create Aggregation Cohort"). See ADR 039.
4
- *
5
- * The spec frames these as an optional menu ("the Aggregation Service can define
6
- * conditions such as ..."), so only `beaconType` and `minParticipants` are
7
- * required here; every other condition is optional and, when absent, means
8
- * unconstrained.
9
- *
10
- * Enforcement is staged (ADR 039): `beaconType` and the participant bounds are
11
- * enforced by the state machine now; DIDs-per-participant, timing/cadence, and
12
- * the pending-update trigger are modeled and advertised here but enforced when
13
- * the multi-cohort (AGG-4) and non-inclusion (AGG-5) tracks land. The two cost
14
- * conditions are advertised metadata only - the protocol performs no payment or
15
- * settlement (consistent with ADR 008).
16
- */
17
-
18
- import type { FundingModel } from './recovery-policy.js';
19
- import { MAX_RECOVERY_SEQUENCE } from './recovery-policy.js';
20
-
21
- /** Beacon types that support aggregation (singleton is single-party only, per ADR 037). */
22
- export const KNOWN_BEACON_TYPES = ['CASBeacon', 'SMTBeacon'] as const;
23
-
24
- /** Funding models an operator may advertise. Only 'operator-funded' is implemented (ADR 042). */
25
- export const KNOWN_FUNDING_MODELS = ['operator-funded', 'participant-funded'] as const;
26
-
27
- /**
28
- * An advertised price. `unit` is operator-defined (the spec does not specify a
29
- * currency); `basis` distinguishes a per-DID from a per-participant charge for
30
- * "cost per announcement". Advertised only - never settled by the protocol.
31
- */
32
- export interface CohortCost {
33
- amount: number;
34
- unit: string;
35
- basis?: 'per-did' | 'per-participant';
36
- }
37
-
38
- /** The seven spec cohort conditions. Only beaconType + minParticipants are required. */
39
- export interface CohortConditions {
40
- /** 1. Beacon mechanism: 'CASBeacon' or 'SMTBeacon'. Enforced. */
41
- beaconType: string;
42
- /** 2. Lower bound on cohort size. Enforced (finalize floor). */
43
- minParticipants: number;
44
- /** 2. Upper bound on cohort size. Enforced (accept/finalize ceiling). */
45
- maxParticipants?: number;
46
- /** 3. Lower bound on DIDs a participant may register. Advertised; enforcement staged (AGG-5). */
47
- minDidsPerParticipant?: number;
48
- /** 3. Upper bound on DIDs a participant may register. Advertised; enforcement staged (AGG-5). */
49
- maxDidsPerParticipant?: number;
50
- /** 4. One-time enrollment price. Advertised only - no settlement. */
51
- costOfEnrollment?: CohortCost;
52
- /** 5. Recurring per-announcement price. Advertised only - no settlement. */
53
- costPerAnnouncement?: CohortCost;
54
- /** 6. Floor on time between announcements (seconds). Advertised; enforcement staged (AGG-4/5). */
55
- minSecondsBetweenAnnouncements?: number;
56
- /** 6. Ceiling on time between announcements (seconds). Advertised; enforcement staged - generalizes the ADR 027 Cohort TTL. */
57
- maxSecondsBetweenAnnouncements?: number;
58
- /** 7. Pending-update count that triggers an announcement. Advertised; enforcement staged (AGG-5) - generalizes hasAllUpdates(). */
59
- pendingUpdateTrigger?: number;
60
- /**
61
- * Who funds the beacon UTXO and holds the recovery path. Defaults to
62
- * 'operator-funded' when absent. See ADR 042.
63
- */
64
- fundingModel?: FundingModel;
65
- /**
66
- * Operator recovery key, x-only (64-character hex / 32 bytes). The beacon
67
- * output commits to a CSV recovery leaf keyed to this key, so a missing signer
68
- * can never permanently lock the funded UTXO. Required (ADR 042).
69
- */
70
- recoveryKey: string;
71
- /**
72
- * Relative-timelock (BIP-68 nSequence, in blocks) before the recovery leaf is
73
- * spendable. Required, >= 1 (ADR 042).
74
- */
75
- recoverySequence: number;
76
- /**
77
- * Number of signers (k) the k-of-n fallback leaf requires, so any k cohort
78
- * members can still announce when the optimistic n-of-n key path stalls
79
- * (graceful liveness, ADR 042). Optional: when absent it defaults to n-1 at
80
- * keygen, where n is the finalized participant count. When advertised it must
81
- * be an integer >= 1 (and <= maxParticipants when that is set); the upper bound
82
- * against the actual cohort size n is enforced at keygen.
83
- */
84
- fallbackThreshold?: number;
85
- }
86
-
87
- /** Validate an optional [min, max] integer pair. */
88
- function checkPair(problems: string[], label: string, min?: number, max?: number): void {
89
- if(min !== undefined && (!Number.isInteger(min) || min < 0)) {
90
- problems.push(`min${label} must be an integer >= 0`);
91
- }
92
- if(max !== undefined && (!Number.isInteger(max) || max < 0)) {
93
- problems.push(`max${label} must be an integer >= 0`);
94
- }
95
- if(min !== undefined && max !== undefined && Number.isInteger(min) && Number.isInteger(max) && max < min) {
96
- problems.push(`max${label} must be >= min${label}`);
97
- }
98
- }
99
-
100
- /** Validate an optional advertised cost. */
101
- function checkCost(problems: string[], label: string, cost?: CohortCost): void {
102
- if(cost === undefined) return;
103
- if(typeof cost.amount !== 'number' || !Number.isFinite(cost.amount) || cost.amount < 0) {
104
- problems.push(`${label}.amount must be a finite number >= 0`);
105
- }
106
- if(typeof cost.unit !== 'string' || cost.unit.length === 0) {
107
- problems.push(`${label}.unit must be a non-empty string`);
108
- }
109
- if(cost.basis !== undefined && cost.basis !== 'per-did' && cost.basis !== 'per-participant') {
110
- problems.push(`${label}.basis must be 'per-did' or 'per-participant'`);
111
- }
112
- }
113
-
114
- /**
115
- * Validate a set of cohort conditions. Returns a list of human-readable problems
116
- * (empty when valid) so the caller can decide how to surface them. Used by
117
- * `createCohort()` to fail fast instead of discovering invalidity at finalize.
118
- */
119
- export function validateCohortConditions(c: CohortConditions): string[] {
120
- const problems: string[] = [];
121
-
122
- if(!(KNOWN_BEACON_TYPES as readonly string[]).includes(c.beaconType)) {
123
- problems.push(`beaconType must be one of ${KNOWN_BEACON_TYPES.join(', ')}`);
124
- }
125
- if(!Number.isInteger(c.minParticipants) || c.minParticipants < 1) {
126
- problems.push('minParticipants must be an integer >= 1');
127
- }
128
- if(c.maxParticipants !== undefined) {
129
- if(!Number.isInteger(c.maxParticipants) || c.maxParticipants < 1) {
130
- problems.push('maxParticipants must be an integer >= 1');
131
- } else if(Number.isInteger(c.minParticipants) && c.maxParticipants < c.minParticipants) {
132
- problems.push('maxParticipants must be >= minParticipants');
133
- }
134
- }
135
-
136
- checkPair(problems, 'DidsPerParticipant', c.minDidsPerParticipant, c.maxDidsPerParticipant);
137
- checkPair(problems, 'SecondsBetweenAnnouncements', c.minSecondsBetweenAnnouncements, c.maxSecondsBetweenAnnouncements);
138
-
139
- if(c.pendingUpdateTrigger !== undefined && (!Number.isInteger(c.pendingUpdateTrigger) || c.pendingUpdateTrigger < 1)) {
140
- problems.push('pendingUpdateTrigger must be an integer >= 1');
141
- }
142
-
143
- // Fallback threshold (k of the k-of-n fallback leaf). Optional; when advertised
144
- // it must be a positive integer and cannot exceed maxParticipants (the binding
145
- // upper bound against the actual cohort size n is checked at keygen, where n is
146
- // known). See ADR 042.
147
- if(c.fallbackThreshold !== undefined) {
148
- if(!Number.isInteger(c.fallbackThreshold) || c.fallbackThreshold < 1) {
149
- problems.push('fallbackThreshold must be an integer >= 1');
150
- } else if(c.maxParticipants !== undefined && Number.isInteger(c.maxParticipants) && c.fallbackThreshold > c.maxParticipants) {
151
- problems.push('fallbackThreshold must be <= maxParticipants');
152
- }
153
- }
154
-
155
- checkCost(problems, 'costOfEnrollment', c.costOfEnrollment);
156
- checkCost(problems, 'costPerAnnouncement', c.costPerAnnouncement);
157
-
158
- // Recovery params: the beacon output's CSV recovery leaf. Required so a
159
- // missing signer can never permanently lock the funded UTXO (ADR 042). The
160
- // key is an x-only (32-byte) Schnorr public key, carried as 64 hex chars.
161
- if(typeof c.recoveryKey !== 'string' || !/^[0-9a-fA-F]{64}$/.test(c.recoveryKey)) {
162
- problems.push('recoveryKey must be a 64-character hex string (x-only public key)');
163
- }
164
- if(!Number.isInteger(c.recoverySequence) || c.recoverySequence < 1 || c.recoverySequence > MAX_RECOVERY_SEQUENCE) {
165
- problems.push(`recoverySequence must be a block-based BIP-68 relative timelock in [1, ${MAX_RECOVERY_SEQUENCE}]`);
166
- }
167
- if(c.fundingModel !== undefined && !(KNOWN_FUNDING_MODELS as readonly string[]).includes(c.fundingModel)) {
168
- problems.push(`fundingModel must be one of ${KNOWN_FUNDING_MODELS.join(', ')}`);
169
- }
170
-
171
- return problems;
172
- }
@@ -1,25 +0,0 @@
1
- import { MethodError } from '@did-btcr2/common';
2
-
3
- export class AggregationServiceError extends MethodError {
4
- constructor(message: string, type: string = 'AggregationServiceError', data?: Record<string, any>) {
5
- super(message, type, data);
6
- }
7
- }
8
-
9
- export class AggregationParticipantError extends MethodError {
10
- constructor(message: string, type: string = 'AggregationParticipantError', data?: Record<string, any>) {
11
- super(message, type, data);
12
- }
13
- }
14
-
15
- export class AggregationCohortError extends MethodError {
16
- constructor(message: string, type: string = 'AggregationCohortError', data?: Record<string, any>) {
17
- super(message, type, data);
18
- }
19
- }
20
-
21
- export class SigningSessionError extends MethodError {
22
- constructor(message: string, type: string = 'SigningSessionError', data?: Record<string, any>) {
23
- super(message, type, data);
24
- }
25
- }