@did-btcr2/method 0.26.0 → 0.27.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 (282) hide show
  1. package/README.md +86 -233
  2. package/dist/.tsbuildinfo +1 -1
  3. package/dist/browser.js +24111 -20342
  4. package/dist/browser.mjs +24111 -20342
  5. package/dist/cjs/index.js +2463 -2174
  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 +282 -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/index.js +14 -24
  67. package/dist/esm/index.js.map +1 -1
  68. package/dist/types/core/aggregation/cohort.d.ts +94 -0
  69. package/dist/types/core/aggregation/cohort.d.ts.map +1 -0
  70. package/dist/types/core/aggregation/errors.d.ts +14 -0
  71. package/dist/types/core/aggregation/errors.d.ts.map +1 -0
  72. package/dist/types/core/{beacon/aggregation/cohort → aggregation}/messages/base.d.ts +7 -1
  73. package/dist/types/core/aggregation/messages/base.d.ts.map +1 -0
  74. package/dist/types/core/aggregation/messages/constants.d.ts +23 -0
  75. package/dist/types/core/aggregation/messages/constants.d.ts.map +1 -0
  76. package/dist/types/core/aggregation/messages/factories.d.ts +177 -0
  77. package/dist/types/core/aggregation/messages/factories.d.ts.map +1 -0
  78. package/dist/types/core/aggregation/messages/guards.d.ts +11 -0
  79. package/dist/types/core/aggregation/messages/guards.d.ts.map +1 -0
  80. package/dist/types/core/aggregation/messages/index.d.ts +5 -0
  81. package/dist/types/core/aggregation/messages/index.d.ts.map +1 -0
  82. package/dist/types/core/aggregation/participant.d.ts +101 -0
  83. package/dist/types/core/aggregation/participant.d.ts.map +1 -0
  84. package/dist/types/core/aggregation/phases.d.ts +49 -0
  85. package/dist/types/core/aggregation/phases.d.ts.map +1 -0
  86. package/dist/types/core/aggregation/runner/events.d.ts +89 -0
  87. package/dist/types/core/aggregation/runner/events.d.ts.map +1 -0
  88. package/dist/types/core/aggregation/runner/index.d.ts +5 -0
  89. package/dist/types/core/aggregation/runner/index.d.ts.map +1 -0
  90. package/dist/types/core/aggregation/runner/participant-runner.d.ts +107 -0
  91. package/dist/types/core/aggregation/runner/participant-runner.d.ts.map +1 -0
  92. package/dist/types/core/aggregation/runner/service-runner.d.ts +102 -0
  93. package/dist/types/core/aggregation/runner/service-runner.d.ts.map +1 -0
  94. package/dist/types/core/aggregation/runner/typed-emitter.d.ts +41 -0
  95. package/dist/types/core/aggregation/runner/typed-emitter.d.ts.map +1 -0
  96. package/dist/types/core/aggregation/service.d.ts +112 -0
  97. package/dist/types/core/aggregation/service.d.ts.map +1 -0
  98. package/dist/types/core/aggregation/signing-session.d.ts +69 -0
  99. package/dist/types/core/aggregation/signing-session.d.ts.map +1 -0
  100. package/dist/types/core/aggregation/transport/didcomm.d.ts +20 -0
  101. package/dist/types/core/aggregation/transport/didcomm.d.ts.map +1 -0
  102. package/dist/types/core/{beacon/aggregation/communication → aggregation/transport}/error.d.ts +2 -2
  103. package/dist/types/core/aggregation/transport/error.d.ts.map +1 -0
  104. package/dist/types/core/aggregation/transport/factory.d.ts +13 -0
  105. package/dist/types/core/aggregation/transport/factory.d.ts.map +1 -0
  106. package/dist/types/core/aggregation/transport/index.d.ts +6 -0
  107. package/dist/types/core/aggregation/transport/index.d.ts.map +1 -0
  108. package/dist/types/core/aggregation/transport/nostr.d.ts +55 -0
  109. package/dist/types/core/aggregation/transport/nostr.d.ts.map +1 -0
  110. package/dist/types/core/aggregation/transport/transport.d.ts +37 -0
  111. package/dist/types/core/aggregation/transport/transport.d.ts.map +1 -0
  112. package/dist/types/core/beacon/beacon.d.ts +37 -2
  113. package/dist/types/core/beacon/beacon.d.ts.map +1 -1
  114. package/dist/types/core/beacon/cas-beacon.d.ts +19 -7
  115. package/dist/types/core/beacon/cas-beacon.d.ts.map +1 -1
  116. package/dist/types/core/beacon/error.d.ts +0 -6
  117. package/dist/types/core/beacon/error.d.ts.map +1 -1
  118. package/dist/types/core/beacon/fee-estimator.d.ts +40 -0
  119. package/dist/types/core/beacon/fee-estimator.d.ts.map +1 -0
  120. package/dist/types/core/beacon/interfaces.d.ts +8 -0
  121. package/dist/types/core/beacon/interfaces.d.ts.map +1 -1
  122. package/dist/types/core/beacon/singleton-beacon.d.ts +9 -2
  123. package/dist/types/core/beacon/singleton-beacon.d.ts.map +1 -1
  124. package/dist/types/core/beacon/smt-beacon.d.ts +27 -7
  125. package/dist/types/core/beacon/smt-beacon.d.ts.map +1 -1
  126. package/dist/types/core/identifier.d.ts +8 -0
  127. package/dist/types/core/identifier.d.ts.map +1 -1
  128. package/dist/types/core/interfaces.d.ts +2 -2
  129. package/dist/types/core/resolver.d.ts +11 -1
  130. package/dist/types/core/resolver.d.ts.map +1 -1
  131. package/dist/types/index.d.ts +9 -24
  132. package/dist/types/index.d.ts.map +1 -1
  133. package/package.json +31 -30
  134. package/src/core/aggregation/cohort.ts +247 -0
  135. package/src/core/aggregation/errors.ts +25 -0
  136. package/src/core/{beacon/aggregation/cohort → aggregation}/messages/base.ts +8 -3
  137. package/src/core/aggregation/messages/constants.ts +28 -0
  138. package/src/core/aggregation/messages/factories.ts +240 -0
  139. package/src/core/aggregation/messages/guards.ts +55 -0
  140. package/src/core/aggregation/messages/index.ts +4 -0
  141. package/src/core/aggregation/participant.ts +510 -0
  142. package/src/core/aggregation/phases.ts +82 -0
  143. package/src/core/aggregation/runner/events.ts +77 -0
  144. package/src/core/aggregation/runner/index.ts +4 -0
  145. package/src/core/aggregation/runner/participant-runner.ts +360 -0
  146. package/src/core/aggregation/runner/service-runner.ts +365 -0
  147. package/src/core/aggregation/runner/typed-emitter.ts +87 -0
  148. package/src/core/aggregation/service.ts +547 -0
  149. package/src/core/aggregation/signing-session.ts +209 -0
  150. package/src/core/aggregation/transport/didcomm.ts +42 -0
  151. package/src/core/aggregation/transport/error.ts +13 -0
  152. package/src/core/aggregation/transport/factory.ts +29 -0
  153. package/src/core/aggregation/transport/index.ts +5 -0
  154. package/src/core/aggregation/transport/nostr.ts +333 -0
  155. package/src/core/aggregation/transport/transport.ts +46 -0
  156. package/src/core/beacon/beacon.ts +122 -2
  157. package/src/core/beacon/cas-beacon.ts +28 -76
  158. package/src/core/beacon/error.ts +0 -12
  159. package/src/core/beacon/fee-estimator.ts +52 -0
  160. package/src/core/beacon/interfaces.ts +10 -1
  161. package/src/core/beacon/singleton-beacon.ts +14 -75
  162. package/src/core/beacon/smt-beacon.ts +109 -11
  163. package/src/core/identifier.ts +17 -0
  164. package/src/core/interfaces.ts +2 -2
  165. package/src/core/resolver.ts +25 -2
  166. package/src/index.ts +15 -29
  167. package/dist/esm/core/beacon/aggregation/cohort/index.js +0 -237
  168. package/dist/esm/core/beacon/aggregation/cohort/index.js.map +0 -1
  169. package/dist/esm/core/beacon/aggregation/cohort/messages/base.js.map +0 -1
  170. package/dist/esm/core/beacon/aggregation/cohort/messages/constants.js +0 -11
  171. package/dist/esm/core/beacon/aggregation/cohort/messages/constants.js.map +0 -1
  172. package/dist/esm/core/beacon/aggregation/cohort/messages/index.js +0 -98
  173. package/dist/esm/core/beacon/aggregation/cohort/messages/index.js.map +0 -1
  174. package/dist/esm/core/beacon/aggregation/cohort/messages/keygen/cohort-advert.js +0 -31
  175. package/dist/esm/core/beacon/aggregation/cohort/messages/keygen/cohort-advert.js.map +0 -1
  176. package/dist/esm/core/beacon/aggregation/cohort/messages/keygen/cohort-ready.js +0 -29
  177. package/dist/esm/core/beacon/aggregation/cohort/messages/keygen/cohort-ready.js.map +0 -1
  178. package/dist/esm/core/beacon/aggregation/cohort/messages/keygen/opt-in-accept.js +0 -27
  179. package/dist/esm/core/beacon/aggregation/cohort/messages/keygen/opt-in-accept.js.map +0 -1
  180. package/dist/esm/core/beacon/aggregation/cohort/messages/keygen/opt-in.js +0 -23
  181. package/dist/esm/core/beacon/aggregation/cohort/messages/keygen/opt-in.js.map +0 -1
  182. package/dist/esm/core/beacon/aggregation/cohort/messages/keygen/subscribe.js +0 -28
  183. package/dist/esm/core/beacon/aggregation/cohort/messages/keygen/subscribe.js.map +0 -1
  184. package/dist/esm/core/beacon/aggregation/cohort/messages/sign/aggregated-nonce.js +0 -29
  185. package/dist/esm/core/beacon/aggregation/cohort/messages/sign/aggregated-nonce.js.map +0 -1
  186. package/dist/esm/core/beacon/aggregation/cohort/messages/sign/authorization-request.js +0 -30
  187. package/dist/esm/core/beacon/aggregation/cohort/messages/sign/authorization-request.js.map +0 -1
  188. package/dist/esm/core/beacon/aggregation/cohort/messages/sign/nonce-contribution.js +0 -30
  189. package/dist/esm/core/beacon/aggregation/cohort/messages/sign/nonce-contribution.js.map +0 -1
  190. package/dist/esm/core/beacon/aggregation/cohort/messages/sign/request-signature.js +0 -30
  191. package/dist/esm/core/beacon/aggregation/cohort/messages/sign/request-signature.js.map +0 -1
  192. package/dist/esm/core/beacon/aggregation/cohort/messages/sign/signature-authorization.js +0 -31
  193. package/dist/esm/core/beacon/aggregation/cohort/messages/sign/signature-authorization.js.map +0 -1
  194. package/dist/esm/core/beacon/aggregation/cohort/status.js +0 -8
  195. package/dist/esm/core/beacon/aggregation/cohort/status.js.map +0 -1
  196. package/dist/esm/core/beacon/aggregation/communication/adapter/did-comm.js +0 -121
  197. package/dist/esm/core/beacon/aggregation/communication/adapter/did-comm.js.map +0 -1
  198. package/dist/esm/core/beacon/aggregation/communication/adapter/nostr.js +0 -245
  199. package/dist/esm/core/beacon/aggregation/communication/adapter/nostr.js.map +0 -1
  200. package/dist/esm/core/beacon/aggregation/communication/error.js +0 -12
  201. package/dist/esm/core/beacon/aggregation/communication/error.js.map +0 -1
  202. package/dist/esm/core/beacon/aggregation/communication/factory.js +0 -21
  203. package/dist/esm/core/beacon/aggregation/communication/factory.js.map +0 -1
  204. package/dist/esm/core/beacon/aggregation/communication/service.js +0 -2
  205. package/dist/esm/core/beacon/aggregation/communication/service.js.map +0 -1
  206. package/dist/esm/core/beacon/aggregation/coordinator.js +0 -343
  207. package/dist/esm/core/beacon/aggregation/coordinator.js.map +0 -1
  208. package/dist/esm/core/beacon/aggregation/participant.js +0 -435
  209. package/dist/esm/core/beacon/aggregation/participant.js.map +0 -1
  210. package/dist/esm/core/beacon/aggregation/session/index.js +0 -244
  211. package/dist/esm/core/beacon/aggregation/session/index.js.map +0 -1
  212. package/dist/esm/core/beacon/aggregation/session/status.js +0 -11
  213. package/dist/esm/core/beacon/aggregation/session/status.js.map +0 -1
  214. package/dist/types/core/beacon/aggregation/cohort/index.d.ts +0 -136
  215. package/dist/types/core/beacon/aggregation/cohort/index.d.ts.map +0 -1
  216. package/dist/types/core/beacon/aggregation/cohort/messages/base.d.ts.map +0 -1
  217. package/dist/types/core/beacon/aggregation/cohort/messages/constants.d.ts +0 -11
  218. package/dist/types/core/beacon/aggregation/cohort/messages/constants.d.ts.map +0 -1
  219. package/dist/types/core/beacon/aggregation/cohort/messages/index.d.ts +0 -65
  220. package/dist/types/core/beacon/aggregation/cohort/messages/index.d.ts.map +0 -1
  221. package/dist/types/core/beacon/aggregation/cohort/messages/keygen/cohort-advert.d.ts +0 -29
  222. package/dist/types/core/beacon/aggregation/cohort/messages/keygen/cohort-advert.d.ts.map +0 -1
  223. package/dist/types/core/beacon/aggregation/cohort/messages/keygen/cohort-ready.d.ts +0 -26
  224. package/dist/types/core/beacon/aggregation/cohort/messages/keygen/cohort-ready.d.ts.map +0 -1
  225. package/dist/types/core/beacon/aggregation/cohort/messages/keygen/opt-in-accept.d.ts +0 -24
  226. package/dist/types/core/beacon/aggregation/cohort/messages/keygen/opt-in-accept.d.ts.map +0 -1
  227. package/dist/types/core/beacon/aggregation/cohort/messages/keygen/opt-in.d.ts +0 -20
  228. package/dist/types/core/beacon/aggregation/cohort/messages/keygen/opt-in.d.ts.map +0 -1
  229. package/dist/types/core/beacon/aggregation/cohort/messages/keygen/subscribe.d.ts +0 -25
  230. package/dist/types/core/beacon/aggregation/cohort/messages/keygen/subscribe.d.ts.map +0 -1
  231. package/dist/types/core/beacon/aggregation/cohort/messages/sign/aggregated-nonce.d.ts +0 -25
  232. package/dist/types/core/beacon/aggregation/cohort/messages/sign/aggregated-nonce.d.ts.map +0 -1
  233. package/dist/types/core/beacon/aggregation/cohort/messages/sign/authorization-request.d.ts +0 -26
  234. package/dist/types/core/beacon/aggregation/cohort/messages/sign/authorization-request.d.ts.map +0 -1
  235. package/dist/types/core/beacon/aggregation/cohort/messages/sign/nonce-contribution.d.ts +0 -26
  236. package/dist/types/core/beacon/aggregation/cohort/messages/sign/nonce-contribution.d.ts.map +0 -1
  237. package/dist/types/core/beacon/aggregation/cohort/messages/sign/request-signature.d.ts +0 -26
  238. package/dist/types/core/beacon/aggregation/cohort/messages/sign/request-signature.d.ts.map +0 -1
  239. package/dist/types/core/beacon/aggregation/cohort/messages/sign/signature-authorization.d.ts +0 -27
  240. package/dist/types/core/beacon/aggregation/cohort/messages/sign/signature-authorization.d.ts.map +0 -1
  241. package/dist/types/core/beacon/aggregation/cohort/status.d.ts +0 -8
  242. package/dist/types/core/beacon/aggregation/cohort/status.d.ts.map +0 -1
  243. package/dist/types/core/beacon/aggregation/communication/adapter/did-comm.d.ts +0 -89
  244. package/dist/types/core/beacon/aggregation/communication/adapter/did-comm.d.ts.map +0 -1
  245. package/dist/types/core/beacon/aggregation/communication/adapter/nostr.d.ts +0 -103
  246. package/dist/types/core/beacon/aggregation/communication/adapter/nostr.d.ts.map +0 -1
  247. package/dist/types/core/beacon/aggregation/communication/error.d.ts.map +0 -1
  248. package/dist/types/core/beacon/aggregation/communication/factory.d.ts +0 -10
  249. package/dist/types/core/beacon/aggregation/communication/factory.d.ts.map +0 -1
  250. package/dist/types/core/beacon/aggregation/communication/service.d.ts +0 -36
  251. package/dist/types/core/beacon/aggregation/communication/service.d.ts.map +0 -1
  252. package/dist/types/core/beacon/aggregation/coordinator.d.ts +0 -116
  253. package/dist/types/core/beacon/aggregation/coordinator.d.ts.map +0 -1
  254. package/dist/types/core/beacon/aggregation/participant.d.ts +0 -192
  255. package/dist/types/core/beacon/aggregation/participant.d.ts.map +0 -1
  256. package/dist/types/core/beacon/aggregation/session/index.d.ts +0 -156
  257. package/dist/types/core/beacon/aggregation/session/index.d.ts.map +0 -1
  258. package/dist/types/core/beacon/aggregation/session/status.d.ts +0 -11
  259. package/dist/types/core/beacon/aggregation/session/status.d.ts.map +0 -1
  260. package/src/core/beacon/aggregation/cohort/index.ts +0 -305
  261. package/src/core/beacon/aggregation/cohort/messages/constants.ts +0 -12
  262. package/src/core/beacon/aggregation/cohort/messages/index.ts +0 -143
  263. package/src/core/beacon/aggregation/cohort/messages/keygen/cohort-advert.ts +0 -44
  264. package/src/core/beacon/aggregation/cohort/messages/keygen/cohort-ready.ts +0 -40
  265. package/src/core/beacon/aggregation/cohort/messages/keygen/opt-in-accept.ts +0 -35
  266. package/src/core/beacon/aggregation/cohort/messages/keygen/opt-in.ts +0 -34
  267. package/src/core/beacon/aggregation/cohort/messages/keygen/subscribe.ts +0 -36
  268. package/src/core/beacon/aggregation/cohort/messages/sign/aggregated-nonce.ts +0 -39
  269. package/src/core/beacon/aggregation/cohort/messages/sign/authorization-request.ts +0 -40
  270. package/src/core/beacon/aggregation/cohort/messages/sign/nonce-contribution.ts +0 -40
  271. package/src/core/beacon/aggregation/cohort/messages/sign/request-signature.ts +0 -40
  272. package/src/core/beacon/aggregation/cohort/messages/sign/signature-authorization.ts +0 -41
  273. package/src/core/beacon/aggregation/cohort/status.ts +0 -7
  274. package/src/core/beacon/aggregation/communication/adapter/did-comm.ts +0 -148
  275. package/src/core/beacon/aggregation/communication/adapter/nostr.ts +0 -323
  276. package/src/core/beacon/aggregation/communication/error.ts +0 -13
  277. package/src/core/beacon/aggregation/communication/factory.ts +0 -25
  278. package/src/core/beacon/aggregation/communication/service.ts +0 -42
  279. package/src/core/beacon/aggregation/coordinator.ts +0 -419
  280. package/src/core/beacon/aggregation/participant.ts +0 -517
  281. package/src/core/beacon/aggregation/session/index.ts +0 -301
  282. package/src/core/beacon/aggregation/session/status.ts +0 -18
@@ -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;IAC9C,OAAO,KAAK,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,IAAI,EAAE,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;AAC/D,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,cAAc,CAAC,KAAa,EAAE,MAAc;IAC1D,IAAI,CAAC,GAAG,KAAK,CAAC;IACd,MAAM,MAAM,GAAG,IAAI,UAAU,CAAC,MAAM,CAAC,CAAC;IACtC,KAAK,IAAI,CAAC,GAAG,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;Q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a,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,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,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AAqB,IAAI,MAAM;IA8BtC;;;;;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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,MAAM,CAAC,YAAY,EAAE,MAAM,EAAE,CAU3B;IAEF;;;;OAIG;IACH,MAAM,CAAC,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAIzC;;;;OAIG;IACH,MAAM,CAAC,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAO9D;;;;OAIG;IACH,MAAM,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAI1C;;;;OAIG;IACH,MAAM,CAAC,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO;IASnD;;;;OAIG;IACH,MAAM,CAAC,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO;CASlD"}
@@ -1,29 +0,0 @@
1
- import type { Maybe } from '@did-btcr2/common';
2
- import { BaseMessage } from '../base.js';
3
- import { BEACON_COHORT_ADVERT } from '../constants.js';
4
- export interface CohortAdvertMessage {
5
- type?: typeof BEACON_COHORT_ADVERT;
6
- id?: string;
7
- from: string;
8
- cohortId: string;
9
- cohortSize: number;
10
- beaconType: string;
11
- network: string;
12
- }
13
- /**
14
- * Represents a message advertising a cohort to potential participants.
15
- * @class BeaconCohortAdvertMessage
16
- * @extends BaseMessage
17
- * @type {BeaconCohortAdvertMessage}
18
- */
19
- export declare class BeaconCohortAdvertMessage extends BaseMessage {
20
- id: string;
21
- constructor({ from, id, cohortId, cohortSize, beaconType, network }: CohortAdvertMessage);
22
- /**
23
- * Initializes a BeaconCohortAdvertMessage from a possible CohortAdvertMessage object.
24
- * @param {CohortAdvertMessage} data The CohortAdvertMessage object to initialize the BeaconCohortAdvertMessage.
25
- * @returns {BeaconCohortAdvertMessage} The new BeaconCohortAdvertMessage.
26
- */
27
- static fromJSON(data: Maybe<CohortAdvertMessage>): BeaconCohortAdvertMessage;
28
- }
29
- //# sourceMappingURL=cohort-advert.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"cohort-advert.d.ts","sourceRoot":"","sources":["../../../../../../../../src/core/beacon/aggregation/cohort/messages/keygen/cohort-advert.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAE/C,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAEvD,MAAM,WAAW,mBAAmB;IAClC,IAAI,CAAC,EAAE,OAAO,oBAAoB,CAAC;IACnC,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;;;;GAKG;AACH,qBAAa,yBAA0B,SAAQ,WAAW;IACjD,EAAE,EAAE,MAAM,CAAC;gBAEN,EAAE,IAAI,EAAE,EAAE,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAU,EAAE,OAAO,EAAE,EAAE,mBAAmB;IAOxF;;;;OAIG;WACW,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC,mBAAmB,CAAC,GAAG,yBAAyB;CAOpF"}
@@ -1,26 +0,0 @@
1
- import type { Maybe } from '@did-btcr2/common';
2
- import { BaseMessage } from '../base.js';
3
- export interface CohortReadyMessage {
4
- type?: string;
5
- to: string;
6
- from: string;
7
- cohortId: string;
8
- beaconAddress: string;
9
- cohortKeys: Array<Uint8Array>;
10
- }
11
- /**
12
- * Represents a message indicating that a cohort has met the required conditions.
13
- * @class BeaconCohortReadyMessage
14
- * @extends BaseMessage
15
- * @type {BeaconCohortReadyMessage}
16
- */
17
- export declare class BeaconCohortReadyMessage extends BaseMessage {
18
- constructor({ from, to, cohortId, beaconAddress, cohortKeys }: CohortReadyMessage);
19
- /**
20
- * Initializes an BeaconCohortReadyMessage from a given OptIn object.
21
- * @param {CohortReadyMessage} data The CohortReadyMessage object to initialize the BeaconCohortReadyMessage.
22
- * @returns {BeaconCohortReadyMessage} The new BeaconCohortReadyMessage.
23
- */
24
- static fromJSON(data: Maybe<CohortReadyMessage>): BeaconCohortReadyMessage;
25
- }
26
- //# sourceMappingURL=cohort-ready.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"cohort-ready.d.ts","sourceRoot":"","sources":["../../../../../../../../src/core/beacon/aggregation/cohort/messages/keygen/cohort-ready.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAE/C,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAGzC,MAAM,WAAW,kBAAkB;IACjC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC;CAC/B;AAED;;;;;GAKG;AACH,qBAAa,wBAAyB,SAAQ,WAAW;gBAC3C,EAAE,IAAI,EAAE,EAAE,EAAE,QAAQ,EAAE,aAAa,EAAE,UAAU,EAAE,EAAE,kBAAkB;IAMjF;;;;OAIG;WACW,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC,kBAAkB,CAAC,GAAG,wBAAwB;CAOlF"}
@@ -1,24 +0,0 @@
1
- import type { Maybe } from '@did-btcr2/common';
2
- import { BaseMessage } from '../base.js';
3
- import { BEACON_COHORT_OPT_IN_ACCEPT } from '../constants.js';
4
- export interface CohortOptInAcceptMessage {
5
- type?: typeof BEACON_COHORT_OPT_IN_ACCEPT;
6
- to: string;
7
- from: string;
8
- }
9
- /**
10
- * Represents a message for a coordinator accepting a participant subscribe to a cohort.
11
- * @class BeaconCohortOptInAcceptMessage
12
- * @extends BaseMessage
13
- * @type {BeaconCohortOptInAcceptMessage}
14
- */
15
- export declare class BeaconCohortOptInAcceptMessage extends BaseMessage {
16
- constructor({ to, from }: CohortOptInAcceptMessage);
17
- /**
18
- * Initializes a BeaconCohortOptInAcceptMessage from a possible CohortOptInAcceptMessage object.
19
- * @param {CohortOptInAcceptMessage} data The CohortOptInAcceptMessage object to initialize the BeaconCohortOptInAcceptMessage.
20
- * @returns {BeaconCohortOptInAcceptMessage} The new BeaconCohortOptInAcceptMessage.
21
- */
22
- static fromJSON(data: Maybe<CohortOptInAcceptMessage>): BeaconCohortOptInAcceptMessage;
23
- }
24
- //# sourceMappingURL=opt-in-accept.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"opt-in-accept.d.ts","sourceRoot":"","sources":["../../../../../../../../src/core/beacon/aggregation/cohort/messages/keygen/opt-in-accept.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAE/C,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,2BAA2B,EAAE,MAAM,iBAAiB,CAAC;AAE9D,MAAM,WAAW,wBAAwB;IACvC,IAAI,CAAC,EAAE,OAAO,2BAA2B,CAAC;IAC1C,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;;;GAKG;AACH,qBAAa,8BAA+B,SAAQ,WAAW;gBACjD,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,wBAAwB;IAIlD;;;;OAIG;WACW,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC,wBAAwB,CAAC,GAAG,8BAA8B;CAO9F"}
@@ -1,20 +0,0 @@
1
- import type { Maybe } from '@did-btcr2/common';
2
- import { BaseMessage } from '../base.js';
3
- import { BEACON_COHORT_OPT_IN } from '../constants.js';
4
- export interface CohortOptInMessage {
5
- type?: typeof BEACON_COHORT_OPT_IN;
6
- to: string;
7
- from: string;
8
- cohortId: string;
9
- participantPk: Uint8Array;
10
- }
11
- export declare class BeaconCohortOptInMessage extends BaseMessage {
12
- constructor({ from, to, cohortId, participantPk }: CohortOptInMessage);
13
- /**
14
- * Initializes a BeaconCohortOptInMessage from a possible CohortOptInMessage object.
15
- * @param {CohortOptInMessage} data The CohortOptInMessage object to initialize the BeaconCohortOptInMessage.
16
- * @returns {BeaconCohortOptInMessage} The new BeaconCohortOptInMessage.
17
- */
18
- static fromJSON(data: Maybe<CohortOptInMessage>): BeaconCohortOptInMessage;
19
- }
20
- //# sourceMappingURL=opt-in.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"opt-in.d.ts","sourceRoot":"","sources":["../../../../../../../../src/core/beacon/aggregation/cohort/messages/keygen/opt-in.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAE/C,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAEvD,MAAM,WAAW,kBAAkB;IACjC,IAAI,CAAC,EAAE,OAAO,oBAAoB,CAAC;IACnC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,UAAU,CAAC;CAC3B;AAED,qBAAa,wBAAyB,SAAQ,WAAW;gBAE3C,EAAE,IAAI,EAAE,EAAE,EAAE,QAAQ,EAAE,aAAa,EAAE,EAAE,kBAAkB;IAMrE;;;;OAIG;WACW,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC,kBAAkB,CAAC,GAAG,wBAAwB;CAOlF"}