@did-btcr2/method 0.26.0 → 0.28.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 (297) hide show
  1. package/README.md +118 -236
  2. package/dist/.tsbuildinfo +1 -1
  3. package/dist/browser.js +27665 -23764
  4. package/dist/browser.mjs +27665 -23764
  5. package/dist/cjs/index.js +2661 -2239
  6. package/dist/esm/core/aggregation/cohort.js +178 -0
  7. package/dist/esm/core/aggregation/cohort.js.map +1 -0
  8. package/dist/esm/core/aggregation/errors.js +22 -0
  9. package/dist/esm/core/aggregation/errors.js.map +1 -0
  10. package/dist/esm/core/{beacon/aggregation/cohort → aggregation}/messages/base.js +0 -1
  11. package/dist/esm/core/aggregation/messages/base.js.map +1 -0
  12. package/dist/esm/core/aggregation/messages/constants.js +26 -0
  13. package/dist/esm/core/aggregation/messages/constants.js.map +1 -0
  14. package/dist/esm/core/aggregation/messages/factories.js +113 -0
  15. package/dist/esm/core/aggregation/messages/factories.js.map +1 -0
  16. package/dist/esm/core/aggregation/messages/guards.js +37 -0
  17. package/dist/esm/core/aggregation/messages/guards.js.map +1 -0
  18. package/dist/esm/core/aggregation/messages/index.js +5 -0
  19. package/dist/esm/core/aggregation/messages/index.js.map +1 -0
  20. package/dist/esm/core/aggregation/participant.js +376 -0
  21. package/dist/esm/core/aggregation/participant.js.map +1 -0
  22. package/dist/esm/core/aggregation/phases.js +39 -0
  23. package/dist/esm/core/aggregation/phases.js.map +1 -0
  24. package/dist/esm/core/aggregation/runner/events.js +2 -0
  25. package/dist/esm/core/aggregation/runner/events.js.map +1 -0
  26. package/dist/esm/core/aggregation/runner/index.js +5 -0
  27. package/dist/esm/core/aggregation/runner/index.js.map +1 -0
  28. package/dist/esm/core/aggregation/runner/participant-runner.js +286 -0
  29. package/dist/esm/core/aggregation/runner/participant-runner.js.map +1 -0
  30. package/dist/esm/core/aggregation/runner/service-runner.js +290 -0
  31. package/dist/esm/core/aggregation/runner/service-runner.js.map +1 -0
  32. package/dist/esm/core/aggregation/runner/typed-emitter.js +80 -0
  33. package/dist/esm/core/aggregation/runner/typed-emitter.js.map +1 -0
  34. package/dist/esm/core/aggregation/service.js +416 -0
  35. package/dist/esm/core/aggregation/service.js.map +1 -0
  36. package/dist/esm/core/aggregation/signing-session.js +133 -0
  37. package/dist/esm/core/aggregation/signing-session.js.map +1 -0
  38. package/dist/esm/core/aggregation/transport/didcomm.js +32 -0
  39. package/dist/esm/core/aggregation/transport/didcomm.js.map +1 -0
  40. package/dist/esm/core/aggregation/transport/error.js +12 -0
  41. package/dist/esm/core/aggregation/transport/error.js.map +1 -0
  42. package/dist/esm/core/aggregation/transport/factory.js +20 -0
  43. package/dist/esm/core/aggregation/transport/factory.js.map +1 -0
  44. package/dist/esm/core/aggregation/transport/index.js +6 -0
  45. package/dist/esm/core/aggregation/transport/index.js.map +1 -0
  46. package/dist/esm/core/aggregation/transport/nostr.js +262 -0
  47. package/dist/esm/core/aggregation/transport/nostr.js.map +1 -0
  48. package/dist/esm/core/aggregation/transport/transport.js +2 -0
  49. package/dist/esm/core/aggregation/transport/transport.js.map +1 -0
  50. package/dist/esm/core/beacon/beacon.js +80 -0
  51. package/dist/esm/core/beacon/beacon.js.map +1 -1
  52. package/dist/esm/core/beacon/cas-beacon.js +15 -56
  53. package/dist/esm/core/beacon/cas-beacon.js.map +1 -1
  54. package/dist/esm/core/beacon/error.js +0 -10
  55. package/dist/esm/core/beacon/error.js.map +1 -1
  56. package/dist/esm/core/beacon/fee-estimator.js +30 -0
  57. package/dist/esm/core/beacon/fee-estimator.js.map +1 -0
  58. package/dist/esm/core/beacon/singleton-beacon.js +10 -53
  59. package/dist/esm/core/beacon/singleton-beacon.js.map +1 -1
  60. package/dist/esm/core/beacon/smt-beacon.js +85 -9
  61. package/dist/esm/core/beacon/smt-beacon.js.map +1 -1
  62. package/dist/esm/core/identifier.js +13 -0
  63. package/dist/esm/core/identifier.js.map +1 -1
  64. package/dist/esm/core/resolver.js +9 -0
  65. package/dist/esm/core/resolver.js.map +1 -1
  66. package/dist/esm/core/updater.js +269 -0
  67. package/dist/esm/core/updater.js.map +1 -0
  68. package/dist/esm/did-btcr2.js +30 -42
  69. package/dist/esm/did-btcr2.js.map +1 -1
  70. package/dist/esm/index.js +16 -25
  71. package/dist/esm/index.js.map +1 -1
  72. package/dist/types/core/aggregation/cohort.d.ts +94 -0
  73. package/dist/types/core/aggregation/cohort.d.ts.map +1 -0
  74. package/dist/types/core/aggregation/errors.d.ts +14 -0
  75. package/dist/types/core/aggregation/errors.d.ts.map +1 -0
  76. package/dist/types/core/{beacon/aggregation/cohort → aggregation}/messages/base.d.ts +7 -1
  77. package/dist/types/core/aggregation/messages/base.d.ts.map +1 -0
  78. package/dist/types/core/aggregation/messages/constants.d.ts +23 -0
  79. package/dist/types/core/aggregation/messages/constants.d.ts.map +1 -0
  80. package/dist/types/core/aggregation/messages/factories.d.ts +177 -0
  81. package/dist/types/core/aggregation/messages/factories.d.ts.map +1 -0
  82. package/dist/types/core/aggregation/messages/guards.d.ts +11 -0
  83. package/dist/types/core/aggregation/messages/guards.d.ts.map +1 -0
  84. package/dist/types/core/aggregation/messages/index.d.ts +5 -0
  85. package/dist/types/core/aggregation/messages/index.d.ts.map +1 -0
  86. package/dist/types/core/aggregation/participant.d.ts +101 -0
  87. package/dist/types/core/aggregation/participant.d.ts.map +1 -0
  88. package/dist/types/core/aggregation/phases.d.ts +49 -0
  89. package/dist/types/core/aggregation/phases.d.ts.map +1 -0
  90. package/dist/types/core/aggregation/runner/events.d.ts +89 -0
  91. package/dist/types/core/aggregation/runner/events.d.ts.map +1 -0
  92. package/dist/types/core/aggregation/runner/index.d.ts +5 -0
  93. package/dist/types/core/aggregation/runner/index.d.ts.map +1 -0
  94. package/dist/types/core/aggregation/runner/participant-runner.d.ts +111 -0
  95. package/dist/types/core/aggregation/runner/participant-runner.d.ts.map +1 -0
  96. package/dist/types/core/aggregation/runner/service-runner.d.ts +102 -0
  97. package/dist/types/core/aggregation/runner/service-runner.d.ts.map +1 -0
  98. package/dist/types/core/aggregation/runner/typed-emitter.d.ts +41 -0
  99. package/dist/types/core/aggregation/runner/typed-emitter.d.ts.map +1 -0
  100. package/dist/types/core/aggregation/service.d.ts +112 -0
  101. package/dist/types/core/aggregation/service.d.ts.map +1 -0
  102. package/dist/types/core/aggregation/signing-session.d.ts +69 -0
  103. package/dist/types/core/aggregation/signing-session.d.ts.map +1 -0
  104. package/dist/types/core/aggregation/transport/didcomm.d.ts +20 -0
  105. package/dist/types/core/aggregation/transport/didcomm.d.ts.map +1 -0
  106. package/dist/types/core/{beacon/aggregation/communication → aggregation/transport}/error.d.ts +2 -2
  107. package/dist/types/core/aggregation/transport/error.d.ts.map +1 -0
  108. package/dist/types/core/aggregation/transport/factory.d.ts +13 -0
  109. package/dist/types/core/aggregation/transport/factory.d.ts.map +1 -0
  110. package/dist/types/core/aggregation/transport/index.d.ts +6 -0
  111. package/dist/types/core/aggregation/transport/index.d.ts.map +1 -0
  112. package/dist/types/core/aggregation/transport/nostr.d.ts +55 -0
  113. package/dist/types/core/aggregation/transport/nostr.d.ts.map +1 -0
  114. package/dist/types/core/aggregation/transport/transport.d.ts +37 -0
  115. package/dist/types/core/aggregation/transport/transport.d.ts.map +1 -0
  116. package/dist/types/core/beacon/beacon.d.ts +37 -2
  117. package/dist/types/core/beacon/beacon.d.ts.map +1 -1
  118. package/dist/types/core/beacon/cas-beacon.d.ts +19 -7
  119. package/dist/types/core/beacon/cas-beacon.d.ts.map +1 -1
  120. package/dist/types/core/beacon/error.d.ts +0 -6
  121. package/dist/types/core/beacon/error.d.ts.map +1 -1
  122. package/dist/types/core/beacon/fee-estimator.d.ts +40 -0
  123. package/dist/types/core/beacon/fee-estimator.d.ts.map +1 -0
  124. package/dist/types/core/beacon/interfaces.d.ts +8 -0
  125. package/dist/types/core/beacon/interfaces.d.ts.map +1 -1
  126. package/dist/types/core/beacon/singleton-beacon.d.ts +9 -2
  127. package/dist/types/core/beacon/singleton-beacon.d.ts.map +1 -1
  128. package/dist/types/core/beacon/smt-beacon.d.ts +27 -7
  129. package/dist/types/core/beacon/smt-beacon.d.ts.map +1 -1
  130. package/dist/types/core/identifier.d.ts +8 -0
  131. package/dist/types/core/identifier.d.ts.map +1 -1
  132. package/dist/types/core/interfaces.d.ts +2 -2
  133. package/dist/types/core/resolver.d.ts +11 -1
  134. package/dist/types/core/resolver.d.ts.map +1 -1
  135. package/dist/types/core/updater.d.ts +178 -0
  136. package/dist/types/core/updater.d.ts.map +1 -0
  137. package/dist/types/did-btcr2.d.ts +23 -23
  138. package/dist/types/did-btcr2.d.ts.map +1 -1
  139. package/dist/types/index.d.ts +11 -25
  140. package/dist/types/index.d.ts.map +1 -1
  141. package/package.json +31 -30
  142. package/src/core/aggregation/cohort.ts +247 -0
  143. package/src/core/aggregation/errors.ts +25 -0
  144. package/src/core/{beacon/aggregation/cohort → aggregation}/messages/base.ts +8 -3
  145. package/src/core/aggregation/messages/constants.ts +28 -0
  146. package/src/core/aggregation/messages/factories.ts +240 -0
  147. package/src/core/aggregation/messages/guards.ts +55 -0
  148. package/src/core/aggregation/messages/index.ts +4 -0
  149. package/src/core/aggregation/participant.ts +510 -0
  150. package/src/core/aggregation/phases.ts +82 -0
  151. package/src/core/aggregation/runner/events.ts +77 -0
  152. package/src/core/aggregation/runner/index.ts +4 -0
  153. package/src/core/aggregation/runner/participant-runner.ts +364 -0
  154. package/src/core/aggregation/runner/service-runner.ts +365 -0
  155. package/src/core/aggregation/runner/typed-emitter.ts +87 -0
  156. package/src/core/aggregation/service.ts +547 -0
  157. package/src/core/aggregation/signing-session.ts +209 -0
  158. package/src/core/aggregation/transport/didcomm.ts +42 -0
  159. package/src/core/aggregation/transport/error.ts +13 -0
  160. package/src/core/aggregation/transport/factory.ts +29 -0
  161. package/src/core/aggregation/transport/index.ts +5 -0
  162. package/src/core/aggregation/transport/nostr.ts +333 -0
  163. package/src/core/aggregation/transport/transport.ts +46 -0
  164. package/src/core/beacon/beacon.ts +122 -2
  165. package/src/core/beacon/cas-beacon.ts +28 -76
  166. package/src/core/beacon/error.ts +0 -12
  167. package/src/core/beacon/fee-estimator.ts +52 -0
  168. package/src/core/beacon/interfaces.ts +10 -1
  169. package/src/core/beacon/singleton-beacon.ts +14 -75
  170. package/src/core/beacon/smt-beacon.ts +109 -11
  171. package/src/core/identifier.ts +17 -0
  172. package/src/core/interfaces.ts +2 -2
  173. package/src/core/resolver.ts +25 -2
  174. package/src/core/updater.ts +415 -0
  175. package/src/did-btcr2.ts +36 -66
  176. package/src/index.ts +17 -30
  177. package/dist/esm/core/beacon/aggregation/cohort/index.js +0 -237
  178. package/dist/esm/core/beacon/aggregation/cohort/index.js.map +0 -1
  179. package/dist/esm/core/beacon/aggregation/cohort/messages/base.js.map +0 -1
  180. package/dist/esm/core/beacon/aggregation/cohort/messages/constants.js +0 -11
  181. package/dist/esm/core/beacon/aggregation/cohort/messages/constants.js.map +0 -1
  182. package/dist/esm/core/beacon/aggregation/cohort/messages/index.js +0 -98
  183. package/dist/esm/core/beacon/aggregation/cohort/messages/index.js.map +0 -1
  184. package/dist/esm/core/beacon/aggregation/cohort/messages/keygen/cohort-advert.js +0 -31
  185. package/dist/esm/core/beacon/aggregation/cohort/messages/keygen/cohort-advert.js.map +0 -1
  186. package/dist/esm/core/beacon/aggregation/cohort/messages/keygen/cohort-ready.js +0 -29
  187. package/dist/esm/core/beacon/aggregation/cohort/messages/keygen/cohort-ready.js.map +0 -1
  188. package/dist/esm/core/beacon/aggregation/cohort/messages/keygen/opt-in-accept.js +0 -27
  189. package/dist/esm/core/beacon/aggregation/cohort/messages/keygen/opt-in-accept.js.map +0 -1
  190. package/dist/esm/core/beacon/aggregation/cohort/messages/keygen/opt-in.js +0 -23
  191. package/dist/esm/core/beacon/aggregation/cohort/messages/keygen/opt-in.js.map +0 -1
  192. package/dist/esm/core/beacon/aggregation/cohort/messages/keygen/subscribe.js +0 -28
  193. package/dist/esm/core/beacon/aggregation/cohort/messages/keygen/subscribe.js.map +0 -1
  194. package/dist/esm/core/beacon/aggregation/cohort/messages/sign/aggregated-nonce.js +0 -29
  195. package/dist/esm/core/beacon/aggregation/cohort/messages/sign/aggregated-nonce.js.map +0 -1
  196. package/dist/esm/core/beacon/aggregation/cohort/messages/sign/authorization-request.js +0 -30
  197. package/dist/esm/core/beacon/aggregation/cohort/messages/sign/authorization-request.js.map +0 -1
  198. package/dist/esm/core/beacon/aggregation/cohort/messages/sign/nonce-contribution.js +0 -30
  199. package/dist/esm/core/beacon/aggregation/cohort/messages/sign/nonce-contribution.js.map +0 -1
  200. package/dist/esm/core/beacon/aggregation/cohort/messages/sign/request-signature.js +0 -30
  201. package/dist/esm/core/beacon/aggregation/cohort/messages/sign/request-signature.js.map +0 -1
  202. package/dist/esm/core/beacon/aggregation/cohort/messages/sign/signature-authorization.js +0 -31
  203. package/dist/esm/core/beacon/aggregation/cohort/messages/sign/signature-authorization.js.map +0 -1
  204. package/dist/esm/core/beacon/aggregation/cohort/status.js +0 -8
  205. package/dist/esm/core/beacon/aggregation/cohort/status.js.map +0 -1
  206. package/dist/esm/core/beacon/aggregation/communication/adapter/did-comm.js +0 -121
  207. package/dist/esm/core/beacon/aggregation/communication/adapter/did-comm.js.map +0 -1
  208. package/dist/esm/core/beacon/aggregation/communication/adapter/nostr.js +0 -245
  209. package/dist/esm/core/beacon/aggregation/communication/adapter/nostr.js.map +0 -1
  210. package/dist/esm/core/beacon/aggregation/communication/error.js +0 -12
  211. package/dist/esm/core/beacon/aggregation/communication/error.js.map +0 -1
  212. package/dist/esm/core/beacon/aggregation/communication/factory.js +0 -21
  213. package/dist/esm/core/beacon/aggregation/communication/factory.js.map +0 -1
  214. package/dist/esm/core/beacon/aggregation/communication/service.js +0 -2
  215. package/dist/esm/core/beacon/aggregation/communication/service.js.map +0 -1
  216. package/dist/esm/core/beacon/aggregation/coordinator.js +0 -343
  217. package/dist/esm/core/beacon/aggregation/coordinator.js.map +0 -1
  218. package/dist/esm/core/beacon/aggregation/participant.js +0 -435
  219. package/dist/esm/core/beacon/aggregation/participant.js.map +0 -1
  220. package/dist/esm/core/beacon/aggregation/session/index.js +0 -244
  221. package/dist/esm/core/beacon/aggregation/session/index.js.map +0 -1
  222. package/dist/esm/core/beacon/aggregation/session/status.js +0 -11
  223. package/dist/esm/core/beacon/aggregation/session/status.js.map +0 -1
  224. package/dist/esm/core/update.js +0 -112
  225. package/dist/esm/core/update.js.map +0 -1
  226. package/dist/types/core/beacon/aggregation/cohort/index.d.ts +0 -136
  227. package/dist/types/core/beacon/aggregation/cohort/index.d.ts.map +0 -1
  228. package/dist/types/core/beacon/aggregation/cohort/messages/base.d.ts.map +0 -1
  229. package/dist/types/core/beacon/aggregation/cohort/messages/constants.d.ts +0 -11
  230. package/dist/types/core/beacon/aggregation/cohort/messages/constants.d.ts.map +0 -1
  231. package/dist/types/core/beacon/aggregation/cohort/messages/index.d.ts +0 -65
  232. package/dist/types/core/beacon/aggregation/cohort/messages/index.d.ts.map +0 -1
  233. package/dist/types/core/beacon/aggregation/cohort/messages/keygen/cohort-advert.d.ts +0 -29
  234. package/dist/types/core/beacon/aggregation/cohort/messages/keygen/cohort-advert.d.ts.map +0 -1
  235. package/dist/types/core/beacon/aggregation/cohort/messages/keygen/cohort-ready.d.ts +0 -26
  236. package/dist/types/core/beacon/aggregation/cohort/messages/keygen/cohort-ready.d.ts.map +0 -1
  237. package/dist/types/core/beacon/aggregation/cohort/messages/keygen/opt-in-accept.d.ts +0 -24
  238. package/dist/types/core/beacon/aggregation/cohort/messages/keygen/opt-in-accept.d.ts.map +0 -1
  239. package/dist/types/core/beacon/aggregation/cohort/messages/keygen/opt-in.d.ts +0 -20
  240. package/dist/types/core/beacon/aggregation/cohort/messages/keygen/opt-in.d.ts.map +0 -1
  241. package/dist/types/core/beacon/aggregation/cohort/messages/keygen/subscribe.d.ts +0 -25
  242. package/dist/types/core/beacon/aggregation/cohort/messages/keygen/subscribe.d.ts.map +0 -1
  243. package/dist/types/core/beacon/aggregation/cohort/messages/sign/aggregated-nonce.d.ts +0 -25
  244. package/dist/types/core/beacon/aggregation/cohort/messages/sign/aggregated-nonce.d.ts.map +0 -1
  245. package/dist/types/core/beacon/aggregation/cohort/messages/sign/authorization-request.d.ts +0 -26
  246. package/dist/types/core/beacon/aggregation/cohort/messages/sign/authorization-request.d.ts.map +0 -1
  247. package/dist/types/core/beacon/aggregation/cohort/messages/sign/nonce-contribution.d.ts +0 -26
  248. package/dist/types/core/beacon/aggregation/cohort/messages/sign/nonce-contribution.d.ts.map +0 -1
  249. package/dist/types/core/beacon/aggregation/cohort/messages/sign/request-signature.d.ts +0 -26
  250. package/dist/types/core/beacon/aggregation/cohort/messages/sign/request-signature.d.ts.map +0 -1
  251. package/dist/types/core/beacon/aggregation/cohort/messages/sign/signature-authorization.d.ts +0 -27
  252. package/dist/types/core/beacon/aggregation/cohort/messages/sign/signature-authorization.d.ts.map +0 -1
  253. package/dist/types/core/beacon/aggregation/cohort/status.d.ts +0 -8
  254. package/dist/types/core/beacon/aggregation/cohort/status.d.ts.map +0 -1
  255. package/dist/types/core/beacon/aggregation/communication/adapter/did-comm.d.ts +0 -89
  256. package/dist/types/core/beacon/aggregation/communication/adapter/did-comm.d.ts.map +0 -1
  257. package/dist/types/core/beacon/aggregation/communication/adapter/nostr.d.ts +0 -103
  258. package/dist/types/core/beacon/aggregation/communication/adapter/nostr.d.ts.map +0 -1
  259. package/dist/types/core/beacon/aggregation/communication/error.d.ts.map +0 -1
  260. package/dist/types/core/beacon/aggregation/communication/factory.d.ts +0 -10
  261. package/dist/types/core/beacon/aggregation/communication/factory.d.ts.map +0 -1
  262. package/dist/types/core/beacon/aggregation/communication/service.d.ts +0 -36
  263. package/dist/types/core/beacon/aggregation/communication/service.d.ts.map +0 -1
  264. package/dist/types/core/beacon/aggregation/coordinator.d.ts +0 -116
  265. package/dist/types/core/beacon/aggregation/coordinator.d.ts.map +0 -1
  266. package/dist/types/core/beacon/aggregation/participant.d.ts +0 -192
  267. package/dist/types/core/beacon/aggregation/participant.d.ts.map +0 -1
  268. package/dist/types/core/beacon/aggregation/session/index.d.ts +0 -156
  269. package/dist/types/core/beacon/aggregation/session/index.d.ts.map +0 -1
  270. package/dist/types/core/beacon/aggregation/session/status.d.ts +0 -11
  271. package/dist/types/core/beacon/aggregation/session/status.d.ts.map +0 -1
  272. package/dist/types/core/update.d.ts +0 -52
  273. package/dist/types/core/update.d.ts.map +0 -1
  274. package/src/core/beacon/aggregation/cohort/index.ts +0 -305
  275. package/src/core/beacon/aggregation/cohort/messages/constants.ts +0 -12
  276. package/src/core/beacon/aggregation/cohort/messages/index.ts +0 -143
  277. package/src/core/beacon/aggregation/cohort/messages/keygen/cohort-advert.ts +0 -44
  278. package/src/core/beacon/aggregation/cohort/messages/keygen/cohort-ready.ts +0 -40
  279. package/src/core/beacon/aggregation/cohort/messages/keygen/opt-in-accept.ts +0 -35
  280. package/src/core/beacon/aggregation/cohort/messages/keygen/opt-in.ts +0 -34
  281. package/src/core/beacon/aggregation/cohort/messages/keygen/subscribe.ts +0 -36
  282. package/src/core/beacon/aggregation/cohort/messages/sign/aggregated-nonce.ts +0 -39
  283. package/src/core/beacon/aggregation/cohort/messages/sign/authorization-request.ts +0 -40
  284. package/src/core/beacon/aggregation/cohort/messages/sign/nonce-contribution.ts +0 -40
  285. package/src/core/beacon/aggregation/cohort/messages/sign/request-signature.ts +0 -40
  286. package/src/core/beacon/aggregation/cohort/messages/sign/signature-authorization.ts +0 -41
  287. package/src/core/beacon/aggregation/cohort/status.ts +0 -7
  288. package/src/core/beacon/aggregation/communication/adapter/did-comm.ts +0 -148
  289. package/src/core/beacon/aggregation/communication/adapter/nostr.ts +0 -323
  290. package/src/core/beacon/aggregation/communication/error.ts +0 -13
  291. package/src/core/beacon/aggregation/communication/factory.ts +0 -25
  292. package/src/core/beacon/aggregation/communication/service.ts +0 -42
  293. package/src/core/beacon/aggregation/coordinator.ts +0 -419
  294. package/src/core/beacon/aggregation/participant.ts +0 -517
  295. package/src/core/beacon/aggregation/session/index.ts +0 -301
  296. package/src/core/beacon/aggregation/session/status.ts +0 -18
  297. package/src/core/update.ts +0 -158
@@ -1,244 +0,0 @@
1
- import * as musig2 from '@scure/btc-signer/musig2';
2
- import { Transaction } from 'bitcoinjs-lib';
3
- import { AggregateBeaconError } from '../../error.js';
4
- import { BeaconCohortAuthorizationRequestMessage } from '../cohort/messages/sign/authorization-request.js';
5
- import { SIGNING_SESSION_STATUS } from './status.js';
6
- /**
7
- * Convert a big-endian byte array into a bigint.
8
- * @param bytes - The input Uint8Array representing a big-endian integer.
9
- * @returns The integer value as a bigint.
10
- */
11
- export function bigEndianToInt(bytes) {
12
- return bytes.reduce((num, b) => (num << 8n) + BigInt(b), 0n);
13
- }
14
- /**
15
- * Convert a bigint to a big-endian Uint8Array of specified length.
16
- * @param xInit - The bigint to convert.
17
- * @param length - The desired length of the output array in bytes.
18
- * @returns A Uint8Array representing the bigint in big-endian form.
19
- */
20
- export function intToBigEndian(xInit, length) {
21
- let x = xInit;
22
- const result = new Uint8Array(length);
23
- for (let i = length - 1; i >= 0; i--) {
24
- result[i] = Number(x & 0xffn);
25
- x >>= 8n;
26
- }
27
- return result;
28
- }
29
- export class BeaconCohortSigningSession {
30
- /**
31
- * Unique identifier for the signing session.
32
- * @type {string}
33
- */
34
- id;
35
- /**
36
- * DID of the coordinator.
37
- * @type {AggregateBeaconCohort}
38
- */
39
- cohort;
40
- /**
41
- * Pending transaction to be signed.
42
- * @type {Transaction}
43
- */
44
- pendingTx;
45
- /**
46
- * Map of nonce contributions from participants.
47
- * @type {Map<PublicKeyHex, Nonce>}
48
- */
49
- nonceContributions = new Map();
50
- /**
51
- * Aggregated nonce from all participants.
52
- * @type {Uint8Array}
53
- */
54
- aggregatedNonce;
55
- /**
56
- * Map of partial signatures from participants.
57
- * @type {Map<string, Uint8Array>}
58
- */
59
- partialSignatures = new Map();
60
- /**
61
- * Final signature for the transaction.
62
- * @type {Uint8Array}
63
- */
64
- signature;
65
- /**
66
- * Current status of the signing session.
67
- * @type {SIGNING_SESSION_STATUS_TYPE}
68
- */
69
- status;
70
- /**
71
- * Map of processed requests from participants.
72
- * @type {Record<string, string>}
73
- */
74
- processedRequests;
75
- /**
76
- * Secrets for nonces contributed by participants.
77
- * @type {Array<bigint>}
78
- */
79
- nonceSecrets;
80
- /**
81
- * Musig2 session for signing operations.
82
- * @type {musig2.Session}
83
- */
84
- musig2Session;
85
- /**
86
- * Creates a new instance of BeaconCohortSigningSession.
87
- * @param {SigningSession} params Parameters to initialize the signing session.
88
- * @param {Transaction} params.pendingTx The pending transaction to be signed.
89
- * @param {string} [params.id] Optional unique identifier for the signing session. If not provided, a new UUID will be generated.
90
- * @param {AggregateBeaconCohort} [params.cohort] The cohort associated with the signing session.
91
- * @param {Record<string, string>} [params.processedRequests] Map of processed requests from participants.
92
- * @param {SIGNING_SESSION_STATUS_TYPE} [params.status] The current status of the signing session. Defaults to AWAITING_NONCE_CONTRIBUTIONS.
93
- */
94
- constructor({ id, cohort, pendingTx, processedRequests, status }) {
95
- this.id = id || crypto.randomUUID();
96
- this.cohort = cohort;
97
- this.pendingTx = pendingTx;
98
- this.processedRequests = processedRequests || {};
99
- this.status = status || SIGNING_SESSION_STATUS.AWAITING_NONCE_CONTRIBUTIONS;
100
- }
101
- /**
102
- * Gets the authorization request message for a participant.
103
- * @param {string} to The public key of the participant to whom the request is sent.
104
- * @param {string} from The public key of the participant sending the request.
105
- * @returns {AuthorizationRequest} The authorization request message.
106
- */
107
- getAuthorizationRequest(to, from) {
108
- const txHex = this.pendingTx instanceof Transaction ? this.pendingTx?.toHex() : this.pendingTx;
109
- return new BeaconCohortAuthorizationRequestMessage({
110
- to,
111
- from,
112
- sessionId: this.id,
113
- cohortId: this.cohort?.id,
114
- pendingTx: txHex,
115
- });
116
- }
117
- /**
118
- * Adds a nonce contribution from a participant to the session.
119
- * @param {string} from The public key of the participant contributing the nonce.
120
- * @param {Array<string>} nonceContribution The nonce contribution from the participant.
121
- * @throws {Error} If the session is not awaiting nonce contributions or if the contribution is invalid.
122
- */
123
- addNonceContribution(from, nonceContribution) {
124
- if (this.status !== SIGNING_SESSION_STATUS.AWAITING_NONCE_CONTRIBUTIONS) {
125
- throw new AggregateBeaconError(`Nonce contributions already received. Current status: ${this.status}`);
126
- }
127
- if (nonceContribution.length !== 2) {
128
- throw new AggregateBeaconError(`Invalid nonce contribution. Expected 2 points, received ${nonceContribution.length}.`);
129
- }
130
- if (this.nonceContributions.get(from)) {
131
- console.warn(`WARNING: Nonce contribution already received from ${from}.`);
132
- }
133
- this.nonceContributions.set(from, nonceContribution);
134
- if (this.nonceContributions.size === this.cohort?.participants.length) {
135
- this.status = SIGNING_SESSION_STATUS.NONCE_CONTRIBUTIONS_RECEIVED;
136
- }
137
- }
138
- /**
139
- * Generates the aggregated nonce from all nonce contributions for the session.
140
- * @returns {Uint8Array} The aggregated nonce.
141
- * @throws {AggregateBeaconError} If not all nonce contributions have been received.
142
- */
143
- generateAggregatedNonce() {
144
- if (this.status !== SIGNING_SESSION_STATUS.NONCE_CONTRIBUTIONS_RECEIVED) {
145
- const missing = this.cohort?.participants.length - this.nonceContributions.size;
146
- throw new AggregateBeaconError(`Missing ${missing} nonce contributions. ` +
147
- `Received ${this.cohort?.participants.length} of ${this.nonceContributions.size} nonce contributions. ` +
148
- `Current status: ${this.status}`, 'NONCE_CONTRIBUTION_ERROR', this.toJSON());
149
- }
150
- const sortedPubkeys = musig2.sortKeys(this.cohort.cohortKeys);
151
- const keyAggContext = musig2.keyAggregate(sortedPubkeys);
152
- const aggPubkey = musig2.keyAggExport(keyAggContext);
153
- this.aggregatedNonce = musig2.nonceAggregate(this.cohort.cohortKeys.map(key => musig2.nonceGen(key, undefined, aggPubkey, this.cohort.trMerkleRoot).public));
154
- this.musig2Session = new musig2.Session(this.aggregatedNonce, this.cohort.cohortKeys, this.cohort.trMerkleRoot);
155
- return this.aggregatedNonce;
156
- }
157
- /**
158
- * Adds a partial signature from a participant to the session.
159
- * @param {string} from The public key of the participant contributing the partial signature.
160
- * @param {Uint8Array} partialSignature The partial signature from the participant.
161
- */
162
- addPartialSignature(from, partialSignature) {
163
- if (this.status !== SIGNING_SESSION_STATUS.AWAITING_PARTIAL_SIGNATURES) {
164
- throw new AggregateBeaconError(`Partial signatures not expected. Current status: ${this.status}`);
165
- }
166
- if (this.partialSignatures.get(from)) {
167
- console.warn(`WARNING: Partial signature already received from ${from}.`);
168
- }
169
- this.partialSignatures.set(from, partialSignature);
170
- }
171
- /**
172
- * Generates the final signature from all partial signatures.
173
- * @returns {Uint8Array} The final aggregated signature.
174
- */
175
- async generateFinalSignature() {
176
- if (this.status !== SIGNING_SESSION_STATUS.PARTIAL_SIGNATURES_RECEIVED) {
177
- throw new AggregateBeaconError(`Partial signatures not received. Current status: ${this.status}`);
178
- }
179
- const inputIdx = (this.pendingTx?.ins?.length || 0) - 1;
180
- if (inputIdx < 0) {
181
- throw new AggregateBeaconError('No inputs in the pending transaction to sign.');
182
- }
183
- const prevoutScript = this.pendingTx?.ins[inputIdx].script;
184
- if (!prevoutScript) {
185
- throw new AggregateBeaconError('Previous output script is missing for the input to sign.');
186
- }
187
- const sigSum = [...this.partialSignatures.values()].reduce((sum, sig) => sum + bigEndianToInt(sig), 0n);
188
- console.info(`Aggregated Signature computed: ${sigSum}`);
189
- this.aggregatedNonce ??= this.generateAggregatedNonce();
190
- const session = new musig2.Session(this.aggregatedNonce, this.cohort.cohortKeys, this.cohort.trMerkleRoot);
191
- this.signature = session.partialSigAgg([...this.partialSignatures.values()]);
192
- return this.signature;
193
- }
194
- /**
195
- * Generates a partial signature for the session using the participant's secret key.
196
- * @param {Uint8Array} participantSk The secret key of the participant.
197
- * @returns {Uint8Array} The partial signature generated by the participant.
198
- */
199
- generatePartialSignature(participantSk) {
200
- if (!this.aggregatedNonce) {
201
- throw new AggregateBeaconError('Aggregated nonce is not available. Please generate it first.');
202
- }
203
- const sigHash = this.pendingTx?.hashForSignature(0, this.pendingTx?.ins[0].script, Transaction.SIGHASH_DEFAULT);
204
- if (!sigHash) {
205
- throw new AggregateBeaconError('Signature hash is not available. Please ensure the transaction is properly set up.');
206
- }
207
- const session = new musig2.Session(this.aggregatedNonce, this.cohort.cohortKeys, this.cohort.trMerkleRoot);
208
- return session.sign(this.aggregatedNonce, participantSk);
209
- }
210
- /**
211
- * Converts the signing session instance to a JSON object representation.
212
- * @returns {BeaconCohortSigningSession} The JSON object representation of the signing session.
213
- */
214
- toJSON() {
215
- return {
216
- id: this.id,
217
- cohort: this.cohort,
218
- pendingTx: this.pendingTx,
219
- nonceContributions: this.nonceContributions,
220
- aggregatedNonce: this.aggregatedNonce,
221
- partialSignatures: this.partialSignatures,
222
- signature: this.signature,
223
- status: this.status,
224
- processedRequests: this.processedRequests,
225
- nonceSecrets: this.nonceSecrets,
226
- musig2Session: this.musig2Session
227
- };
228
- }
229
- /**
230
- * Checks if the signing session is a completed state.
231
- * @returns {boolean} True if the session is complete, false otherwise.
232
- */
233
- isComplete() {
234
- return this.status === SIGNING_SESSION_STATUS.SIGNATURE_COMPLETE;
235
- }
236
- /**
237
- * Checks if the signing session is in a failed state.
238
- * @returns {boolean} True if the session has failed, false otherwise.
239
- */
240
- isFailed() {
241
- return this.status === SIGNING_SESSION_STATUS.FAILED;
242
- }
243
- }
244
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../src/core/beacon/aggregation/session/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,0BAA0B,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAEtD,OAAO,EAAE,uCAAuC,EAAE,MAAM,kDAAkD,CAAC;AAE3G,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAErD;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAAC,KAAiB;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;IAC3D,CAAC;IAED;;;OAGG;IACI,MAAM;QACX,OAAO;YACL,EAAE,EAAmB,IAAI,CAAC,EAAE;YAC5B,MAAM,EAAe,IAAI,CAAC,MAAM;YAChC,SAAS,EAAY,IAAI,CAAC,SAAS;YACnC,kBAAkB,EAAG,IAAI,CAAC,kBAAkB;YAC5C,eAAe,EAAM,IAAI,CAAC,eAAe;YACzC,iBAAiB,EAAI,IAAI,CAAC,iBAAiB;YAC3C,SAAS,EAAY,IAAI,CAAC,SAAS;YACnC,MAAM,EAAe,IAAI,CAAC,MAAM;YAChC,iBAAiB,EAAI,IAAI,CAAC,iBAAiB;YAC3C,YAAY,EAAS,IAAI,CAAC,YAAY;YACtC,aAAa,EAAQ,IAAI,CAAC,aAAa;SACxC,CAAC;IACJ,CAAC;IAED;;;OAGG;IACI,UAAU;QACf,OAAO,IAAI,CAAC,MAAM,KAAK,sBAAsB,CAAC,kBAAkB,CAAC;IACnE,CAAC;IAED;;;OAGG;IACI,QAAQ;QACb,OAAO,IAAI,CAAC,MAAM,KAAK,sBAAsB,CAAC,MAAM,CAAC;IACvD,CAAC;CACF"}
@@ -1,11 +0,0 @@
1
- export var SIGNING_SESSION_STATUS;
2
- (function (SIGNING_SESSION_STATUS) {
3
- SIGNING_SESSION_STATUS["AWAITING_NONCE_CONTRIBUTIONS"] = "AWAITING_NONCE_CONTRIBUTIONS";
4
- SIGNING_SESSION_STATUS["NONCE_CONTRIBUTION_SENT"] = "NONCE_CONTRIBUTION_SENT";
5
- SIGNING_SESSION_STATUS["NONCE_CONTRIBUTIONS_RECEIVED"] = "NONCE_CONTRIBUTIONS_RECEIVED";
6
- SIGNING_SESSION_STATUS["AWAITING_PARTIAL_SIGNATURES"] = "AWAITING_PARTIAL_SIGNATURES";
7
- SIGNING_SESSION_STATUS["PARTIAL_SIGNATURES_RECEIVED"] = "PARTIAL_SIGNATURES_RECEIVED";
8
- SIGNING_SESSION_STATUS["SIGNATURE_COMPLETE"] = "SIGNATURE_COMPLETE";
9
- SIGNING_SESSION_STATUS["FAILED"] = "FAILED";
10
- })(SIGNING_SESSION_STATUS || (SIGNING_SESSION_STATUS = {}));
11
- //# sourceMappingURL=status.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"status.js","sourceRoot":"","sources":["../../../../../../src/core/beacon/aggregation/session/status.ts"],"names":[],"mappings":"AASA,MAAM,CAAN,IAAY,sBAQX;AARD,WAAY,sBAAsB;IAC9B,uFAA6D,CAAA;IAC7D,6EAAmD,CAAA;IACnD,uFAA6D,CAAA;IAC7D,qFAA2D,CAAA;IAC3D,qFAA2D,CAAA;IAC3D,mEAAyC,CAAA;IACzC,2CAAiB,CAAA;AACrB,CAAC,EARW,sBAAsB,KAAtB,sBAAsB,QAQjC"}
@@ -1,112 +0,0 @@
1
- import { canonicalHash, INVALID_DID_UPDATE, JSONPatch, UpdateError } from '@did-btcr2/common';
2
- import { SchnorrMultikey } from '@did-btcr2/cryptosuite';
3
- import { DidDocument } from '../utils/did-document.js';
4
- import { BeaconFactory } from './beacon/factory.js';
5
- /**
6
- * Implements {@link https://dcdpr.github.io/did-btcr2/operations/update.html | 7.3 Update}.
7
- *
8
- * An update to a did:btcr2 document is an invoked capability using the ZCAP-LD
9
- * data format, signed by a verificationMethod that has the authority to make
10
- * the update as specified in the previous DID document. Capability invocations
11
- * for updates MUST be authorized using Data Integrity following the
12
- * bip340-jcs-2025 cryptosuite with a proofPurpose of capabilityInvocation.
13
- *
14
- * @class Update
15
- * @type {Update}
16
- */
17
- export class Update {
18
- /**
19
- * Implements subsection {@link https://dcdpr.github.io/did-btcr2/operations/update.html#construct-btcr2-unsigned-update | 7.3.b Construct BTCR2 Unsigned Update}.
20
- * This process constructs a BTCR2 Unsigned Update conformant to the spec template.
21
- *
22
- * @param {Btcr2DidDocument} sourceDocument The source DID document to be updated.
23
- * @param {PatchOperation[]} patches The array of JSON Patch operations to apply to the sourceDocument.
24
- * @param {number} sourceVersionId The version ID of the source document.
25
- * @returns {UnsignedBTCR2Update} The constructed UnsignedBTCR2Update object.
26
- * @throws {UpdateError} InvalidDid if sourceDocument.id does not match identifier.
27
- */
28
- static construct(sourceDocument, patches, sourceVersionId) {
29
- // Initialize an unsigned update conformant to btcr2 spec.
30
- const unsignedUpdate = {
31
- '@context': [
32
- 'https://w3id.org/security/v2',
33
- 'https://w3id.org/zcap/v1',
34
- 'https://w3id.org/json-ld-patch/v1',
35
- 'https://btcr2.dev/context/v1'
36
- ],
37
- patch: patches,
38
- targetHash: '',
39
- targetVersionId: sourceVersionId + 1,
40
- sourceHash: canonicalHash(sourceDocument),
41
- };
42
- // Apply all JSON patches to sourceDocument.
43
- const targetDocument = JSONPatch.apply(sourceDocument, patches);
44
- try {
45
- // Ensure the targetDocument is conformant to DID Core v1.1.
46
- DidDocument.isValid(targetDocument);
47
- }
48
- catch (error) {
49
- // If validation fails, throw an UpdateError with INVALID_DID_UPDATE.
50
- throw new UpdateError('Error validating targetDocument: ' + (error instanceof Error ? error.message : String(error)), INVALID_DID_UPDATE, targetDocument);
51
- }
52
- // Set the targetHash by canonicalizing the targetDocument and encoding it in base64url.
53
- unsignedUpdate.targetHash = canonicalHash(targetDocument);
54
- // Return unsignedUpdate.
55
- return unsignedUpdate;
56
- }
57
- /**
58
- * Implements subsection {@link http://dcdpr.github.io/did-btcr2/operations/update.html#construct-btcr2-signed-update | 7.3.c Construct BTCR2 Signed Update }.
59
- * This process constructs a BTCR2 Signed Update from a BTCR2 Unsigned Update.
60
- *
61
- * @param {string} did The did-btcr2 identifier to derive the root capability from
62
- * @param {UnsignedBTCR2Update} unsignedUpdate The updatePayload object to be signed
63
- * @param {DidVerificationMethod} verificationMethod The verificationMethod object to be used for signing
64
- * @returns {SignedBTCR2Update} Did update payload secured with a proof => SignedBTCR2Update
65
- * @throws {UpdateError} if the privateKeyBytes are invalid
66
- */
67
- static sign(did, unsignedUpdate, verificationMethod, secretKey) {
68
- // Parse the controller from the verificationMethod
69
- const controller = verificationMethod.controller;
70
- // Parse the fragment from the vmId
71
- const id = verificationMethod.id.slice(verificationMethod.id.indexOf('#'));
72
- // Construct a Schnorr Multikey
73
- const multikey = SchnorrMultikey.fromSecretKey(id, controller, secretKey);
74
- // Define the Data Integrity proof config
75
- const config = {
76
- '@context': [
77
- 'https://w3id.org/security/v2',
78
- 'https://w3id.org/zcap/v1',
79
- 'https://w3id.org/json-ld-patch/v1',
80
- 'https://btcr2.dev/context/v1'
81
- ],
82
- cryptosuite: 'bip340-jcs-2025',
83
- type: 'DataIntegrityProof',
84
- verificationMethod: verificationMethod.id,
85
- proofPurpose: 'capabilityInvocation',
86
- capability: `urn:zcap:root:${encodeURIComponent(did)}`,
87
- capabilityAction: 'Write',
88
- };
89
- // Go from multikey => cryptosuite => diproof
90
- const diproof = multikey.toCryptosuite().toDataIntegrityProof();
91
- // Use the config to add a proof to the unsigned update
92
- return diproof.addProof(unsignedUpdate, config);
93
- }
94
- /**
95
- * Implements subsection {@link https://dcdpr.github.io/did-btcr2/operations/update.html#announce-did-update | 7.3.d Announce DID Update}.
96
- * BTCR2 Signed Updates are announced to the Bitcoin blockchain depending on the Beacon Type.
97
- * @param {BeaconService} beaconService The BeaconService object representing the funded beacon to announce the update to.
98
- * @param {SignedBTCR2Update} update The signed update object to be announced.
99
- * @param {KeyBytes} secretKey The private key used to sign the update for announcement.
100
- * @returns {SignedBTCR2Update} The SignedBTCR2Update object containing data to validate the Beacon Signal
101
- * @throws {UpdateError} if the beaconService type is invalid
102
- */
103
- static async announce(beaconService, update, secretKey, bitcoin) {
104
- // Establish a beacon object
105
- const beacon = BeaconFactory.establish(beaconService);
106
- // Broadcast the update
107
- const result = await beacon.broadcastSignal(update, secretKey, bitcoin);
108
- // Return the sidecarData
109
- return result;
110
- }
111
- }
112
- //# sourceMappingURL=update.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"update.js","sourceRoot":"","sources":["../../../src/core/update.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,aAAa,EACb,kBAAkB,EAClB,SAAS,EAC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-1,136 +0,0 @@
1
- import { BeaconCohortSigningSession } from '../session/index.js';
2
- import { BeaconCohortReadyMessage } from './messages/keygen/cohort-ready.js';
3
- import type { BeaconCohortRequestSignatureMessage } from './messages/sign/request-signature.js';
4
- import type { COHORT_STATUS_TYPE } from './status.js';
5
- export type Musig2CohortObject = {
6
- id?: string;
7
- coordinatorDid?: string;
8
- minParticipants?: number;
9
- status?: COHORT_STATUS_TYPE;
10
- network: string;
11
- beaconType?: string;
12
- };
13
- export interface BeaconCohort {
14
- id?: string;
15
- coordinatorDid: string;
16
- minParticipants: number;
17
- status: COHORT_STATUS_TYPE;
18
- network: string;
19
- pendingSignatureRequests?: Record<string, string>;
20
- participants?: Array<string>;
21
- cohortKeys?: Array<Uint8Array>;
22
- trMerkleRoot?: Uint8Array;
23
- beaconAddress?: string;
24
- }
25
- export declare class AggregateBeaconCohort implements BeaconCohort {
26
- /**
27
- * Unique identifier for the cohort.
28
- * @type {string}
29
- */
30
- id: string;
31
- /**
32
- * DID of the coordinator.
33
- * @type {string}
34
- */
35
- coordinatorDid: string;
36
- /**
37
- * Minimum number of participants required to finalize the cohort.
38
- * @type {number}
39
- */
40
- minParticipants: number;
41
- /**
42
- * Status of the cohort.
43
- * @type {string}
44
- */
45
- status: COHORT_STATUS_TYPE;
46
- /**
47
- * Network on which the cohort operates (e.g., 'mainnet', 'testnet').
48
- * @type {string}
49
- */
50
- network: string;
51
- /**
52
- * Pending signature requests, mapping participant DIDs to their pending signatures.
53
- * @type {Record<string, string>}
54
- */
55
- pendingSignatureRequests: Record<string, string>;
56
- /**
57
- * List of participant DIDs.
58
- * @type {Array<string>}
59
- */
60
- participants: Array<string>;
61
- /**
62
- * List of cohort keys.
63
- * @type {Array<Uint8Array>}
64
- */
65
- _cohortKeys: Array<Uint8Array>;
66
- /**
67
- * Taproot Merkle root for the cohort.
68
- * @type {Uint8Array}
69
- */
70
- trMerkleRoot: Uint8Array;
71
- /**
72
- * Beacon address for the cohort, calculated from the Taproot multisig.
73
- * @type {string}
74
- */
75
- beaconAddress: string;
76
- /**
77
- * Type of beacon used in the cohort (default is 'SMTBeacon').
78
- * @type {string}
79
- */
80
- beaconType: string;
81
- /**
82
- * Creates a new Musig2Cohort instance.
83
- * @param {Musig2CohortObject} params Parameters for initializing the cohort.
84
- * @param {string} [params.id] Optional unique identifier for the cohort. If not provided, a random UUID will be generated.
85
- * @param {number} params.minParticipants Minimum number of participants required to finalize the cohort.
86
- * @param {string} [params.coordinatorDid] DID of the coordinator managing the cohort.
87
- * @param {string} params.status Initial status of the cohort (e.g., 'PENDING', 'COHORT_SET').
88
- * @param {string} params.network Network on which the cohort operates (e.g., 'mainnet', 'testnet').
89
- */
90
- constructor({ id, minParticipants, coordinatorDid, status, network, beaconType }: Musig2CohortObject);
91
- set cohortKeys(keys: Array<Uint8Array>);
92
- validateCohort(participantKeys: Array<string>, cohortKeys: Array<string>, beaconAddress: string): void;
93
- /**
94
- * Finalizes the cohort by checking if the minimum number of participants is met.
95
- * If the minimum is met, it sets the status to 'COHORT_SET_STATUS' and calculates the beacon address.
96
- * @throws {BeaconCoordinatorError} If the number of participants is less than the minimum required.
97
- * @returns {void}
98
- */
99
- finalize(): void;
100
- /**
101
- * Calculates the beacon Taproot multisig address for the cohort using participant keys.
102
- * @returns {string} The Taproot address for the cohort.
103
- * @throws {BeaconCoordinatorError} If the Taproot address cannot be calculated.
104
- */
105
- calulateBeaconAddress(): string;
106
- /**
107
- * Generates a CohortReadyMessage to be sent to participants when the cohort is set.
108
- * @param {string} to The DID of the participant to whom the message is sent.
109
- * @param {string} from The DID of the coordinator sending the message.
110
- * @returns {BeaconCohortReadyMessage} The CohortReadyMessage containing the cohort details.
111
- */
112
- getCohortReadyMessage(to: string, from: string): BeaconCohortReadyMessage;
113
- /**
114
- * Adds a signature request to the pending requests for the cohort.
115
- * @param {BeaconCohortRequestSignatureMessage} message The signature request message to add.
116
- * @throws {Error} If a signature request from the same participant already exists.
117
- */
118
- addSignatureRequest(message: BeaconCohortRequestSignatureMessage): void;
119
- /**
120
- * Validates a signature request message to ensure it is from a participant in the cohort.
121
- * @param {BeaconCohortRequestSignatureMessage} message The signature request message to validate.
122
- * @returns {boolean} True if the message is valid, false otherwise.
123
- */
124
- validateSignatureRequest(message: BeaconCohortRequestSignatureMessage): boolean;
125
- /**
126
- * Starts a signing session for the cohort.
127
- * @returns {BeaconCohortSigningSession} The request signature message for the signing session.
128
- */
129
- startSigningSession(): BeaconCohortSigningSession;
130
- /**
131
- * Converts the cohort instance to a JSON object representation.
132
- * @returns {BeaconCohort} The JSON object representation of the cohort.
133
- */
134
- toJSON(): BeaconCohort;
135
- }
136
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/core/beacon/aggregation/cohort/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,0BAA0B,EAAE,MAAM,qBAAqB,CAAC;AACjE,OAAO,EAAE,wBAAwB,EAAE,MAAM,mCAAmC,CAAC;AAC7E,OAAO,KAAK,EAAE,mCAAmC,EAAE,MAAM,sCAAsC,CAAC;AAChG,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAGtD,MAAM,MAAM,kBAAkB,GAAG;IAC7B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,MAAM,CAAC,EAAE,kBAAkB,CAAC;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;CACvB,CAAA;AAED,MAAM,WAAW,YAAY;IAC3B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,cAAc,EAAE,MAAM,CAAC;IACvB,eAAe,EAAE,MAAM,CAAC;IACxB,MAAM,EAAE,kBAAkB,CAAC;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,wBAAwB,CAAC,EAAE,MAAM,CAA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;OAKG;IACI,qBAAqB,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,wBAAwB;IAahF;;;;OAIG;IACI,mBAAmB,CAAC,OAAO,EAAE,mCAAmC,GAAG,IAAI;IAY9E;;;;OAIG;IACI,wBAAwB,CAAC,OAAO,EAAE,mCAAmC,GAAG,OAAO;IAetF;;;OAGG;IACI,mBAAmB,IAAI,0BAA0B;IAcxD;;;OAGG;IACI,MAAM,IAAI,YAAY;CAc9B"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../../../../../../src/core/beacon/aggregation/cohort/messages/base.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,cAAc,yBAAyB,CAAC;AAErD,MAAM,MAAM,QAAQ,GAAG;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,aAAa,CAAC,EAAE,UAAU,CAAC;IAC3B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,UAAU,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC;IAC/B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,eAAe,CAAC,EAAE,UAAU,CAAC;IAC7B,iBAAiB,CAAC,EAAE,UAAU,CAAC;IAC/B,gBAAgB,CAAC,EAAE,UAAU,CAAC;IAC9B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,IAAI,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,QAAQ,CAAC;CACjB,CAAC;AAEF,qBAAa,WAAW;IACf,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,QAAQ,CAAC;gBAEX,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,IAAI;IAO1C;;;OAGG;IACI,MAAM,IAAI,IAAI;CAQtB"}
@@ -1,11 +0,0 @@
1
- export declare const BEACON_COHORT_MESSAGE_PREFIX = "https://btcr2.dev";
2
- export declare const BEACON_COHORT_ADVERT = "https://btcr2.dev/musig2/keygen/beacon/cohort_advert";
3
- export declare const BEACON_COHORT_OPT_IN = "https://btcr2.dev/musig2/keygen/beacon/cohort_opt_in";
4
- export declare const BEACON_COHORT_OPT_IN_ACCEPT = "https://btcr2.dev/musig2/keygen/beacon/cohort_opt_in_accept";
5
- export declare const BEACON_COHORT_READY = "https://btcr2.dev/musig2/keygen/beacon/cohort_ready";
6
- export declare const BEACON_COHORT_REQUEST_SIGNATURE = "https://btcr2.dev/musig2/sign/beacon/cohort_request_signature";
7
- export declare const BEACON_COHORT_AUTHORIZATION_REQUEST = "https://btcr2.dev/musig2/sign/beacon/cohort_authorization_request";
8
- export declare const BEACON_COHORT_NONCE_CONTRIBUTION = "https://btcr2.dev/musig2/sign/beacon/cohort_nonce_contribution";
9
- export declare const BEACON_COHORT_AGGREGATED_NONCE = "https://btcr2.dev/musig2/sign/beacon/cohort_aggregated_nonce";
10
- export declare const BEACON_COHORT_SIGNATURE_AUTHORIZATION = "https://btcr2.dev/musig2/sign/beacon/cohort_signature_authorization";
11
- //# sourceMappingURL=constants.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../../../../src/core/beacon/aggregation/cohort/messages/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,4BAA4B,sBAAsB,CAAC;AAEhE,eAAO,MAAM,oBAAoB,yDAAuE,CAAC;AACzG,eAAO,MAAM,oBAAoB,yDAAuE,CAAC;AACzG,eAAO,MAAM,2BAA2B,gEAA8E,CAAC;AACvH,eAAO,MAAM,mBAAmB,wDAAsE,CAAC;AAEvG,eAAO,MAAM,+BAA+B,kEAAgF,CAAC;AAC7H,eAAO,MAAM,mCAAmC,sEAAoF,CAAC;AACrI,eAAO,MAAM,gCAAgC,mEAAiF,CAAC;AAC/H,eAAO,MAAM,8BAA8B,iEAA+E,CAAC;AAC3H,eAAO,MAAM,qCAAqC,wEAAsF,CAAC"}
@@ -1,65 +0,0 @@
1
- import type { CohortAdvertMessage } from './keygen/cohort-advert.js';
2
- import type { CohortReadyMessage } from './keygen/cohort-ready.js';
3
- import type { CohortOptInAcceptMessage } from './keygen/opt-in-accept.js';
4
- import type { CohortOptInMessage } from './keygen/opt-in.js';
5
- import type { CohortSubscribeMessage } from './keygen/subscribe.js';
6
- import type { CohortAggregatedNonceMessage } from './sign/aggregated-nonce.js';
7
- import type { CohortAuthorizationRequestMessage } from './sign/authorization-request.js';
8
- import type { CohortNonceContributionMessage } from './sign/nonce-contribution.js';
9
- import type { CohortRequestSignatureMessage } from './sign/request-signature.js';
10
- import type { CohortSignatureAuthorizationMessage } from './sign/signature-authorization.js';
11
- export type KeyGenMessageType = CohortAdvertMessage | CohortReadyMessage | CohortOptInMessage | CohortOptInAcceptMessage | CohortSubscribeMessage;
12
- export type SignMessageType = CohortAggregatedNonceMessage | CohortAuthorizationRequestMessage | CohortNonceContributionMessage | CohortRequestSignatureMessage | CohortSignatureAuthorizationMessage;
13
- export type AggregateBeaconMessageType = KeyGenMessageType | SignMessageType;
14
- /**
15
- * AggregateBeaconMessage is a utility class that provides constants and type checks
16
- * for various message types used in the aggregate beacon communication protocol.
17
- * It includes methods to validate message types and retrieve message types from objects.
18
- * @class AggregateBeaconMessage
19
- * @type {AggregateBeaconMessageType}
20
- */
21
- export declare class AggregateBeaconMessage {
22
- static BEACON_COHORT_ADVERT: string;
23
- static BEACON_COHORT_OPT_IN: string;
24
- static BEACON_COHORT_READY: string;
25
- static BEACON_COHORT_OPT_IN_ACCEPT: string;
26
- static BEACON_COHORT_KEY_GEN_MESSAGES: Map<string, string>;
27
- static BEACON_COHORT_REQUEST_SIGNATURE: string;
28
- static BEACON_COHORT_AUTHORIZATION_REQUEST: string;
29
- static BEACON_COHORT_NONCE_CONTRIBUTION: string;
30
- static BEACON_COHORT_AGGREGATED_NONCE: string;
31
- static BEACON_COHORT_SIGNATURE_AUTHORIZATION: string;
32
- static BEACON_COHORT_SIGN_MESSAGES: Map<string, string>;
33
- static ALL_MESSAGES: string[];
34
- /**
35
- * Checks if the name provided is a valid message name.
36
- * @param {string} type - The type of the message.
37
- * @returns
38
- */
39
- static isValidType(type: string): boolean;
40
- /**
41
- * Get the message value based on the type.
42
- * @param {string} type - The type (or name) of the message.
43
- * @returns {string | undefined} - The corresponding type value.
44
- */
45
- static getMessageValueByType(type: string): string | undefined;
46
- /**
47
- * Checks if the provided type is a valid AggregateBeaconMessageType.
48
- * @param {string} type - The message type to check.
49
- * @returns {boolean} - Returns true if the type is valid, otherwise false.
50
- */
51
- static isValidValue(type: string): boolean;
52
- /**
53
- * Checks if the provided type is a valid KeyGenMessageType.
54
- * @param {string} value - The message type to check.
55
- * @returns {boolean} - Returns true if the type is a key generation message type, otherwise false.
56
- */
57
- static isKeyGenMessageValue(value: string): boolean;
58
- /**
59
- * Checks if the provided type is a valid SignMessageType.
60
- * @param {string} value - The message type to check.
61
- * @returns {boolean} - Returns true if the type is a sign message type, otherwise false.
62
- */
63
- static isSignMessageValue(value: string): boolean;
64
- }
65
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../src/core/beacon/aggregation/cohort/messages/index.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AACrE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AACnE,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,2B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