@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
@@ -291,6 +291,23 @@ export class Identifier {
291
291
  return { keyPair: keyPair.exportJSON(), did };
292
292
  }
293
293
 
294
+ /**
295
+ * Extracts the compressed secp256k1 public key from a KEY-type did:btcr2 identifier.
296
+ * @param {string} did The did:btcr2 identifier to extract the public key from.
297
+ * @returns {CompressedSecp256k1PublicKey} The compressed public key.
298
+ * @throws {IdentifierError} If the DID is EXTERNAL type (genesis bytes are a hash, not a pubkey).
299
+ */
300
+ static getPublicKey(did: string): CompressedSecp256k1PublicKey {
301
+ const { idType, genesisBytes } = Identifier.decode(did);
302
+ if(idType !== 'KEY') {
303
+ throw new IdentifierError(
304
+ `Cannot extract public key from EXTERNAL DID: ${did}. EXTERNAL DIDs encode a document hash, not a public key.`,
305
+ INVALID_DID, { did, idType }
306
+ );
307
+ }
308
+ return new CompressedSecp256k1PublicKey(genesisBytes);
309
+ }
310
+
294
311
  /**
295
312
  * Validates a did:btcr2 identifier.
296
313
  * @param {string} identifier The did:btcr2 identifier to validate.
@@ -64,11 +64,11 @@ export interface SMTProof {
64
64
  */
65
65
  id: string;
66
66
  /**
67
- * Optional 256-bit nonce generated for each update. MUST be encoded as a string using the "base64url" [RFC4648] encoding.
67
+ * Optional 256-bit nonce generated for each update. Hex-encoded (64 chars).
68
68
  */
69
69
  nonce?: string;
70
70
  /**
71
- * Optional BTCR2 Signed Update (data structure) hashed with the JSON Document Hashing algorithm.
71
+ * Optional hex-encoded canonical hash of the BTCR2 Signed Update.
72
72
  */
73
73
  updateId?: string;
74
74
  /**
@@ -81,8 +81,17 @@ export interface NeedSignedUpdate {
81
81
  readonly beaconServiceId: string;
82
82
  }
83
83
 
84
+ /** The resolver needs an SMT Proof whose root hash matches smtRootHash. */
85
+ export interface NeedSMTProof {
86
+ readonly kind: 'NeedSMTProof';
87
+ /** Hex-encoded SHA-256 root hash of the Sparse Merkle Tree. */
88
+ readonly smtRootHash: string;
89
+ /** The beacon service that produced this signal. */
90
+ readonly beaconServiceId: string;
91
+ }
92
+
84
93
  /** Discriminated union of all data the resolver may request from the caller. */
85
- export type DataNeed = NeedGenesisDocument | NeedBeaconSignals | NeedCASAnnouncement | NeedSignedUpdate;
94
+ export type DataNeed = NeedGenesisDocument | NeedBeaconSignals | NeedCASAnnouncement | NeedSignedUpdate | NeedSMTProof;
86
95
 
87
96
  /**
88
97
  * Output of {@link Resolver.resolve}. Analogous to Rust's `ResolverState` enum.
@@ -683,7 +692,8 @@ export class Resolver {
683
692
  provide(need: NeedBeaconSignals, data: Map<BeaconService, Array<BeaconSignal>>): void;
684
693
  provide(need: NeedCASAnnouncement, data: CASAnnouncement): void;
685
694
  provide(need: NeedSignedUpdate, data: SignedBTCR2Update): void;
686
- provide(need: DataNeed, data: object | Map<BeaconService, Array<BeaconSignal>> | CASAnnouncement | SignedBTCR2Update): void {
695
+ provide(need: NeedSMTProof, data: SMTProof): void;
696
+ provide(need: DataNeed, data: object | Map<BeaconService, Array<BeaconSignal>> | CASAnnouncement | SignedBTCR2Update | SMTProof): void {
687
697
  switch(need.kind) {
688
698
  case 'NeedGenesisDocument': {
689
699
  this.#providedGenesisDocument = data;
@@ -709,6 +719,19 @@ export class Resolver {
709
719
  this.#sidecarData.updateMap.set(canonicalHash(update, { encoding: 'hex' }), update);
710
720
  break;
711
721
  }
722
+
723
+ case 'NeedSMTProof': {
724
+ const smtNeed = need as NeedSMTProof;
725
+ const proof = data as SMTProof;
726
+ if(proof.id !== smtNeed.smtRootHash) {
727
+ throw new ResolveError(
728
+ `SMT proof root hash mismatch: expected ${smtNeed.smtRootHash}, got ${proof.id}`,
729
+ INVALID_DID_UPDATE, { expected: smtNeed.smtRootHash, actual: proof.id }
730
+ );
731
+ }
732
+ this.#sidecarData.smtMap.set(smtNeed.smtRootHash, proof);
733
+ break;
734
+ }
712
735
  }
713
736
  }
714
737
  }
package/src/index.ts CHANGED
@@ -1,32 +1,15 @@
1
- export * from './core/beacon/aggregation/cohort/index.js';
2
- export * from './core/beacon/aggregation/cohort/status.js';
3
-
4
- export * from './core/beacon/aggregation/cohort/messages/base.js';
5
- export * from './core/beacon/aggregation/cohort/messages/constants.js';
6
- export * from './core/beacon/aggregation/cohort/messages/index.js';
7
- export * from './core/beacon/aggregation/cohort/messages/keygen//subscribe.js';
8
- export * from './core/beacon/aggregation/cohort/messages/keygen/cohort-advert.js';
9
- export * from './core/beacon/aggregation/cohort/messages/keygen/cohort-ready.js';
10
- export * from './core/beacon/aggregation/cohort/messages/keygen/opt-in-accept.js';
11
- export * from './core/beacon/aggregation/cohort/messages/keygen/opt-in.js';
12
- export * from './core/beacon/aggregation/cohort/messages/sign/aggregated-nonce.js';
13
- export * from './core/beacon/aggregation/cohort/messages/sign/authorization-request.js';
14
- export * from './core/beacon/aggregation/cohort/messages/sign/nonce-contribution.js';
15
- export * from './core/beacon/aggregation/cohort/messages/sign/request-signature.js';
16
- export * from './core/beacon/aggregation/cohort/messages/sign/signature-authorization.js';
17
-
18
- export * from './core/beacon/aggregation/communication/adapter/did-comm.js';
19
- export * from './core/beacon/aggregation/communication/adapter/nostr.js';
20
-
21
- export * from './core/beacon/aggregation/communication/error.js';
22
- export * from './core/beacon/aggregation/communication/factory.js';
23
- export * from './core/beacon/aggregation/communication/service.js';
24
-
25
- export * from './core/beacon/aggregation/coordinator.js';
26
- export * from './core/beacon/aggregation/participant.js';
27
- export * from './core/beacon/aggregation/session/index.js';
28
- export * from './core/beacon/aggregation/session/status.js';
29
-
1
+ // Aggregation
2
+ export * from './core/aggregation/service.js';
3
+ export * from './core/aggregation/participant.js';
4
+ export * from './core/aggregation/cohort.js';
5
+ export * from './core/aggregation/signing-session.js';
6
+ export * from './core/aggregation/phases.js';
7
+ export * from './core/aggregation/errors.js';
8
+ export * from './core/aggregation/messages/index.js';
9
+ export * from './core/aggregation/transport/index.js';
10
+ export * from './core/aggregation/runner/index.js';
11
+
12
+ // Beacons
30
13
  export * from './core/beacon/beacon.js';
31
14
  export * from './core/beacon/cas-beacon.js';
32
15
  export * from './core/beacon/error.js';
@@ -37,14 +20,17 @@ export * from './core/beacon/singleton-beacon.js';
37
20
  export * from './core/beacon/smt-beacon.js';
38
21
  export * from './core/beacon/utils.js';
39
22
 
23
+ // Core
40
24
  export * from './core/identifier.js';
41
25
  export * from './core/interfaces.js';
42
26
  export * from './core/resolver.js';
43
27
  export * from './core/types.js';
44
28
  export * from './core/update.js';
45
29
 
30
+ // Utils
46
31
  export * from './utils/appendix.js';
47
32
  export * from './utils/did-document-builder.js';
48
33
  export * from './utils/did-document.js';
49
34
 
35
+ // Facade
50
36
  export * from './did-btcr2.js';
@@ -1,237 +0,0 @@
1
- import { hexToBytes } from '@noble/hashes/utils';
2
- import { keyAggExport, keyAggregate, sortKeys } from '@scure/btc-signer/musig2';
3
- import { payments, Transaction } from 'bitcoinjs-lib';
4
- import { BeaconCoordinatorError } from '../../error.js';
5
- import { BeaconCohortSigningSession } from '../session/index.js';
6
- import { BeaconCohortReadyMessage } from './messages/keygen/cohort-ready.js';
7
- import { COHORT_STATUS } from './status.js';
8
- export class AggregateBeaconCohort {
9
- /**
10
- * Unique identifier for the cohort.
11
- * @type {string}
12
- */
13
- id;
14
- /**
15
- * DID of the coordinator.
16
- * @type {string}
17
- */
18
- coordinatorDid;
19
- /**
20
- * Minimum number of participants required to finalize the cohort.
21
- * @type {number}
22
- */
23
- minParticipants;
24
- /**
25
- * Status of the cohort.
26
- * @type {string}
27
- */
28
- status;
29
- /**
30
- * Network on which the cohort operates (e.g., 'mainnet', 'testnet').
31
- * @type {string}
32
- */
33
- network;
34
- /**
35
- * Pending signature requests, mapping participant DIDs to their pending signatures.
36
- * @type {Record<string, string>}
37
- */
38
- pendingSignatureRequests = {};
39
- /**
40
- * List of participant DIDs.
41
- * @type {Array<string>}
42
- */
43
- participants = new Array();
44
- /**
45
- * List of cohort keys.
46
- * @type {Array<Uint8Array>}
47
- */
48
- _cohortKeys = new Array();
49
- /**
50
- * Taproot Merkle root for the cohort.
51
- * @type {Uint8Array}
52
- */
53
- trMerkleRoot = new Uint8Array();
54
- /**
55
- * Beacon address for the cohort, calculated from the Taproot multisig.
56
- * @type {string}
57
- */
58
- beaconAddress = '';
59
- /**
60
- * Type of beacon used in the cohort (default is 'SMTBeacon').
61
- * @type {string}
62
- */
63
- beaconType;
64
- /**
65
- * Creates a new Musig2Cohort instance.
66
- * @param {Musig2CohortObject} params Parameters for initializing the cohort.
67
- * @param {string} [params.id] Optional unique identifier for the cohort. If not provided, a random UUID will be generated.
68
- * @param {number} params.minParticipants Minimum number of participants required to finalize the cohort.
69
- * @param {string} [params.coordinatorDid] DID of the coordinator managing the cohort.
70
- * @param {string} params.status Initial status of the cohort (e.g., 'PENDING', 'COHORT_SET').
71
- * @param {string} params.network Network on which the cohort operates (e.g., 'mainnet', 'testnet').
72
- */
73
- constructor({ id, minParticipants, coordinatorDid, status, network, beaconType }) {
74
- this.id = id || crypto.randomUUID();
75
- this.minParticipants = minParticipants || 2;
76
- this.coordinatorDid = coordinatorDid || '';
77
- this.status = status || COHORT_STATUS.COHORT_ADVERTISED;
78
- this.network = network;
79
- this.beaconType = beaconType || 'SMTBeacon';
80
- }
81
- set cohortKeys(keys) {
82
- this.cohortKeys = sortKeys(keys);
83
- }
84
- validateCohort(participantKeys, cohortKeys, beaconAddress) {
85
- for (const key of participantKeys) {
86
- if (!cohortKeys.includes(key)) {
87
- this.status = COHORT_STATUS.COHORT_FAILED;
88
- throw new BeaconCoordinatorError(`Participant key ${key} not found in cohort ${this.id}.`, 'COHORT_VALIDATION_ERROR', {
89
- cohortId: this.id,
90
- participantKeys: participantKeys,
91
- cohortKeys: cohortKeys,
92
- beaconAddress: beaconAddress
93
- });
94
- }
95
- }
96
- this.cohortKeys = cohortKeys.map(key => hexToBytes(key));
97
- const calculatedAddress = this.calulateBeaconAddress();
98
- if (calculatedAddress !== beaconAddress) {
99
- this.status = COHORT_STATUS.COHORT_FAILED;
100
- throw new BeaconCoordinatorError(`Calculated beacon address ${calculatedAddress} does not match provided address ${beaconAddress}.`, 'COHORT_ADDRESS_MISMATCH_ERROR', {
101
- cohortId: this.id,
102
- calculatedAddress,
103
- providedAddress: beaconAddress
104
- });
105
- }
106
- this.beaconAddress = beaconAddress;
107
- this.status = COHORT_STATUS.COHORT_SET_STATUS;
108
- }
109
- /**
110
- * Finalizes the cohort by checking if the minimum number of participants is met.
111
- * If the minimum is met, it sets the status to 'COHORT_SET_STATUS' and calculates the beacon address.
112
- * @throws {BeaconCoordinatorError} If the number of participants is less than the minimum required.
113
- * @returns {void}
114
- */
115
- finalize() {
116
- if (this.participants.length < this.minParticipants) {
117
- throw new BeaconCoordinatorError('Not enough participants to finalize the cohort', 'FINALIZE_COHORT_ERROR', {
118
- cohortId: this.id,
119
- participants: this.participants,
120
- minParticipants: this.minParticipants
121
- });
122
- }
123
- this.status = COHORT_STATUS.COHORT_SET_STATUS;
124
- this.beaconAddress = this.calulateBeaconAddress();
125
- }
126
- /**
127
- * Calculates the beacon Taproot multisig address for the cohort using participant keys.
128
- * @returns {string} The Taproot address for the cohort.
129
- * @throws {BeaconCoordinatorError} If the Taproot address cannot be calculated.
130
- */
131
- calulateBeaconAddress() {
132
- const keyAggContext = keyAggregate(this.cohortKeys);
133
- const aggPubkey = keyAggExport(keyAggContext);
134
- const payment = payments.p2tr({ internalPubkey: aggPubkey });
135
- if (!payment.hash) {
136
- throw new BeaconCoordinatorError('Failed to calculate Taproot Merkle root', 'CALCULATE_BEACON_MERKLE_ROOT_ERROR', {
137
- cohortId: this.id,
138
- cohortKeys: this.cohortKeys,
139
- minParticipants: this.minParticipants
140
- });
141
- }
142
- this.trMerkleRoot = payment.hash;
143
- if (!payment.address) {
144
- throw new BeaconCoordinatorError('Failed to calculate Taproot address', 'CALCULATE_BEACON_ADDRESS_ERROR', {
145
- cohortId: this.id,
146
- cohortKeys: this.cohortKeys,
147
- minParticipants: this.minParticipants
148
- });
149
- }
150
- return payment.address;
151
- }
152
- /**
153
- * Generates a CohortReadyMessage to be sent to participants when the cohort is set.
154
- * @param {string} to The DID of the participant to whom the message is sent.
155
- * @param {string} from The DID of the coordinator sending the message.
156
- * @returns {BeaconCohortReadyMessage} The CohortReadyMessage containing the cohort details.
157
- */
158
- getCohortReadyMessage(to, from) {
159
- if (this.status !== COHORT_STATUS.COHORT_SET_STATUS) {
160
- throw new BeaconCoordinatorError('Cohort status not "COHORT_SET".');
161
- }
162
- return new BeaconCohortReadyMessage({
163
- to,
164
- from,
165
- cohortId: this.id,
166
- beaconAddress: this.beaconAddress,
167
- cohortKeys: this.cohortKeys,
168
- });
169
- }
170
- /**
171
- * Adds a signature request to the pending requests for the cohort.
172
- * @param {BeaconCohortRequestSignatureMessage} message The signature request message to add.
173
- * @throws {Error} If a signature request from the same participant already exists.
174
- */
175
- addSignatureRequest(message) {
176
- if (!this.validateSignatureRequest(message)) {
177
- throw new BeaconCoordinatorError(`No signature request from ${message.from} in cohort ${this.id}.`);
178
- }
179
- if (!message.body?.data) {
180
- throw new BeaconCoordinatorError(`No signature data in request from ${message.from} in cohort ${this.id}.`);
181
- }
182
- this.pendingSignatureRequests[message.from] = message.body.data;
183
- }
184
- /**
185
- * Validates a signature request message to ensure it is from a participant in the cohort.
186
- * @param {BeaconCohortRequestSignatureMessage} message The signature request message to validate.
187
- * @returns {boolean} True if the message is valid, false otherwise.
188
- */
189
- validateSignatureRequest(message) {
190
- const cohortId = message.body?.cohortId;
191
- if (cohortId !== this.id) {
192
- console.info(`Signature request for wrong cohort: ${cohortId}.`);
193
- return false;
194
- }
195
- if (!this.participants.includes(message.from)) {
196
- console.info(`Participant ${message.from} not in cohort ${this.id}.`);
197
- return false;
198
- }
199
- return true;
200
- }
201
- /**
202
- * Starts a signing session for the cohort.
203
- * @returns {BeaconCohortSigningSession} The request signature message for the signing session.
204
- */
205
- startSigningSession() {
206
- console.debug(`Starting signing session for cohort ${this.id} with status ${this.status}`);
207
- if (this.status !== COHORT_STATUS.COHORT_SET_STATUS) {
208
- throw new BeaconCoordinatorError(`Cohort ${this.id} is not set.`);
209
- }
210
- // const smtRootBytes = new Uint8Array(32).map(() => Math.floor(Math.random() * 256));
211
- const cohort = new AggregateBeaconCohort(this);
212
- return new BeaconCohortSigningSession({
213
- cohort,
214
- pendingTx: new Transaction(),
215
- processedRequests: this.pendingSignatureRequests,
216
- });
217
- }
218
- /**
219
- * Converts the cohort instance to a JSON object representation.
220
- * @returns {BeaconCohort} The JSON object representation of the cohort.
221
- */
222
- toJSON() {
223
- return {
224
- id: this.id,
225
- coordinatorDid: this.coordinatorDid,
226
- minParticipants: this.minParticipants,
227
- status: this.status,
228
- network: this.network,
229
- pendingSignatureRequests: this.pendingSignatureRequests,
230
- participants: this.participants,
231
- cohortKeys: this.cohortKeys,
232
- trMerkleRoot: this.trMerkleRoot,
233
- beaconAddress: this.beaconAddress,
234
- };
235
- }
236
- }
237
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../src/core/beacon/aggregation/cohort/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAChF,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,EAAE,0BAA0B,EAAE,MAAM,qBAAqB,CAAC;AACjE,OAAO,EAAE,wBAAwB,EAAE,MAAM,mCAAmC,CAAC;AAG7E,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAwB5C,MAAM,OAAO,qBAAqB;IAChC;;;OAGG;IACI,EAAE,CAAS;IAElB;;;OAGG;IACI,cAAc,CAAS;IAE9B;;;OAGG;IACI,eAAe,CAAS;IAE/B;;;OAGG;IACI,MAAM,CAAqB;IAElC;;;OAGG;IACI,OAAO,CAAS;IAEvB;;;OAGG;IACI,wBAAwB,GAA2B,EAAE,CAAC;IAE7D;;;OAGG;IACI,YAAY,GAAkB,IAAI,KAAK,EAAU,CAAC;IAEzD;;;OAGG;IACI,WAAW,GAAsB,IAAI,KAAK,EAAc,CAAC;IAEhE;;;OAGG;IACI,YAAY,GAAe,IAAI,UAAU,EAAE,CAAC;IAEnD;;;OAGG;IACI,aAAa,GAAW,EAAE,CAAC;IAElC;;;OAGG;IACI,UAAU,CAAS;IAE1B;;;;;;;;OAQG;IACH,YAAY,EAAE,EAAE,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,EAAE,OAA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AC,MAAM;YACtC,OAAO,EAAoB,IAAI,CAAC,OAAO;YACvC,wBAAwB,EAAG,IAAI,CAAC,wBAAwB;YACxD,YAAY,EAAe,IAAI,CAAC,YAAY;YAC5C,UAAU,EAAiB,IAAI,CAAC,UAAU;YAC1C,YAAY,EAAe,IAAI,CAAC,YAAY;YAC5C,aAAa,EAAc,IAAI,CAAC,aAAa;SAC9C,CAAC;IACJ,CAAC;CACF"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"base.js","sourceRoot":"","sources":["../../../../../../../src/core/beacon/aggregation/cohort/messages/base.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,cAAc,GAAG,sBAAsB,CAAC;AAyBrD,MAAM,OAAO,WAAW;IACf,IAAI,CAAS;IACb,EAAE,CAAU;IACZ,IAAI,CAAS;IACb,IAAI,CAAY;IAEvB,YAAY,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAQ;QACxC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;QACb,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IAED;;;OAGG;IACI,MAAM;QACX,OAAO;YACL,IAAI,EAAG,IAAI,CAAC,IAAI;YAChB,EAAE,EAAK,IAAI,CAAC,EAAE;YACd,IAAI,EAAG,IAAI,CAAC,IAAI;YAChB,IAAI,EAAG,IAAI,CAAC,IAAI;SACjB,CAAC;IACJ,CAAC;CACF"}
@@ -1,11 +0,0 @@
1
- export const BEACON_COHORT_MESSAGE_PREFIX = 'https://btcr2.dev';
2
- export const BEACON_COHORT_ADVERT = `${BEACON_COHORT_MESSAGE_PREFIX}/musig2/keygen/beacon/cohort_advert`;
3
- export const BEACON_COHORT_OPT_IN = `${BEACON_COHORT_MESSAGE_PREFIX}/musig2/keygen/beacon/cohort_opt_in`;
4
- export const BEACON_COHORT_OPT_IN_ACCEPT = `${BEACON_COHORT_MESSAGE_PREFIX}/musig2/keygen/beacon/cohort_opt_in_accept`;
5
- export const BEACON_COHORT_READY = `${BEACON_COHORT_MESSAGE_PREFIX}/musig2/keygen/beacon/cohort_ready`;
6
- export const BEACON_COHORT_REQUEST_SIGNATURE = `${BEACON_COHORT_MESSAGE_PREFIX}/musig2/sign/beacon/cohort_request_signature`;
7
- export const BEACON_COHORT_AUTHORIZATION_REQUEST = `${BEACON_COHORT_MESSAGE_PREFIX}/musig2/sign/beacon/cohort_authorization_request`;
8
- export const BEACON_COHORT_NONCE_CONTRIBUTION = `${BEACON_COHORT_MESSAGE_PREFIX}/musig2/sign/beacon/cohort_nonce_contribution`;
9
- export const BEACON_COHORT_AGGREGATED_NONCE = `${BEACON_COHORT_MESSAGE_PREFIX}/musig2/sign/beacon/cohort_aggregated_nonce`;
10
- export const BEACON_COHORT_SIGNATURE_AUTHORIZATION = `${BEACON_COHORT_MESSAGE_PREFIX}/musig2/sign/beacon/cohort_signature_authorization`;
11
- //# sourceMappingURL=constants.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../../src/core/beacon/aggregation/cohort/messages/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,4BAA4B,GAAG,mBAAmB,CAAC;AAEhE,MAAM,CAAC,MAAM,oBAAoB,GAAG,GAAG,4BAA4B,qCAAqC,CAAC;AACzG,MAAM,CAAC,MAAM,oBAAoB,GAAG,GAAG,4BAA4B,qCAAqC,CAAC;AACzG,MAAM,CAAC,MAAM,2BAA2B,GAAG,GAAG,4BAA4B,4CAA4C,CAAC;AACvH,MAAM,CAAC,MAAM,mBAAmB,GAAG,GAAG,4BAA4B,oCAAoC,CAAC;AAEvG,MAAM,CAAC,MAAM,+BAA+B,GAAG,GAAG,4BAA4B,8CAA8C,CAAC;AAC7H,MAAM,CAAC,MAAM,mCAAmC,GAAG,GAAG,4BAA4B,kDAAkD,CAAC;AACrI,MAAM,CAAC,MAAM,gCAAgC,GAAG,GAAG,4BAA4B,+CAA+C,CAAC;AAC/H,MAAM,CAAC,MAAM,8BAA8B,GAAG,GAAG,4BAA4B,6CAA6C,CAAC;AAC3H,MAAM,CAAC,MAAM,qCAAqC,GAAG,GAAG,4BAA4B,oDAAoD,CAAC"}
@@ -1,98 +0,0 @@
1
- import { BEACON_COHORT_ADVERT, BEACON_COHORT_AGGREGATED_NONCE, BEACON_COHORT_AUTHORIZATION_REQUEST, BEACON_COHORT_NONCE_CONTRIBUTION, BEACON_COHORT_OPT_IN, BEACON_COHORT_OPT_IN_ACCEPT, BEACON_COHORT_READY, BEACON_COHORT_REQUEST_SIGNATURE, BEACON_COHORT_SIGNATURE_AUTHORIZATION } from './constants.js';
2
- /**
3
- * AggregateBeaconMessage is a utility class that provides constants and type checks
4
- * for various message types used in the aggregate beacon communication protocol.
5
- * It includes methods to validate message types and retrieve message types from objects.
6
- * @class AggregateBeaconMessage
7
- * @type {AggregateBeaconMessageType}
8
- */
9
- export class AggregateBeaconMessage {
10
- static BEACON_COHORT_ADVERT = BEACON_COHORT_ADVERT;
11
- static BEACON_COHORT_OPT_IN = BEACON_COHORT_OPT_IN;
12
- static BEACON_COHORT_READY = BEACON_COHORT_READY;
13
- static BEACON_COHORT_OPT_IN_ACCEPT = BEACON_COHORT_OPT_IN_ACCEPT;
14
- static BEACON_COHORT_KEY_GEN_MESSAGES = new Map([
15
- ['BEACON_COHORT_ADVERT', 'BEACON_COHORT_ADVERT'],
16
- ['BEACON_COHORT_OPT_IN', 'BEACON_COHORT_OPT_IN'],
17
- ['BEACON_COHORT_READY', 'BEACON_COHORT_READY'],
18
- ['BEACON_COHORT_OPT_IN_ACCEPT', 'BEACON_COHORT_OPT_IN_ACCEPT'],
19
- ]);
20
- static BEACON_COHORT_REQUEST_SIGNATURE = BEACON_COHORT_REQUEST_SIGNATURE;
21
- static BEACON_COHORT_AUTHORIZATION_REQUEST = BEACON_COHORT_AUTHORIZATION_REQUEST;
22
- static BEACON_COHORT_NONCE_CONTRIBUTION = BEACON_COHORT_NONCE_CONTRIBUTION;
23
- static BEACON_COHORT_AGGREGATED_NONCE = BEACON_COHORT_AGGREGATED_NONCE;
24
- static BEACON_COHORT_SIGNATURE_AUTHORIZATION = BEACON_COHORT_SIGNATURE_AUTHORIZATION;
25
- static BEACON_COHORT_SIGN_MESSAGES = new Map([
26
- ['BEACON_COHORT_REQUEST_SIGNATURE', 'BEACON_COHORT_REQUEST_SIGNATURE'],
27
- ['BEACON_COHORT_AUTHORIZATION_REQUEST', 'BEACON_COHORT_AUTHORIZATION_REQUEST'],
28
- ['BEACON_COHORT_NONCE_CONTRIBUTION', 'BEACON_COHORT_NONCE_CONTRIBUTION'],
29
- ['BEACON_COHORT_AGGREGATED_NONCE', 'BEACON_COHORT_AGGREGATED_NONCE'],
30
- ['BEACON_COHORT_SIGNATURE_AUTHORIZATION', 'BEACON_COHORT_SIGNATURE_AUTHORIZATION'],
31
- ]);
32
- static ALL_MESSAGES = [
33
- BEACON_COHORT_ADVERT,
34
- BEACON_COHORT_OPT_IN,
35
- BEACON_COHORT_READY,
36
- BEACON_COHORT_OPT_IN_ACCEPT,
37
- BEACON_COHORT_REQUEST_SIGNATURE,
38
- BEACON_COHORT_AUTHORIZATION_REQUEST,
39
- BEACON_COHORT_NONCE_CONTRIBUTION,
40
- BEACON_COHORT_AGGREGATED_NONCE,
41
- BEACON_COHORT_SIGNATURE_AUTHORIZATION
42
- ];
43
- /**
44
- * Checks if the name provided is a valid message name.
45
- * @param {string} type - The type of the message.
46
- * @returns
47
- */
48
- static isValidType(type) {
49
- return this.BEACON_COHORT_KEY_GEN_MESSAGES.has(type) || this.BEACON_COHORT_SIGN_MESSAGES.has(type);
50
- }
51
- /**
52
- * Get the message value based on the type.
53
- * @param {string} type - The type (or name) of the message.
54
- * @returns {string | undefined} - The corresponding type value.
55
- */
56
- static getMessageValueByType(type) {
57
- if (!this.isValidType(type)) {
58
- return undefined;
59
- }
60
- return this.BEACON_COHORT_KEY_GEN_MESSAGES.get(type) || this.BEACON_COHORT_SIGN_MESSAGES.get(type);
61
- }
62
- /**
63
- * Checks if the provided type is a valid AggregateBeaconMessageType.
64
- * @param {string} type - The message type to check.
65
- * @returns {boolean} - Returns true if the type is valid, otherwise false.
66
- */
67
- static isValidValue(type) {
68
- return this.ALL_MESSAGES.includes(type);
69
- }
70
- /**
71
- * Checks if the provided type is a valid KeyGenMessageType.
72
- * @param {string} value - The message type to check.
73
- * @returns {boolean} - Returns true if the type is a key generation message type, otherwise false.
74
- */
75
- static isKeyGenMessageValue(value) {
76
- return this.isValidValue(value) && [
77
- BEACON_COHORT_ADVERT,
78
- BEACON_COHORT_READY,
79
- BEACON_COHORT_OPT_IN,
80
- BEACON_COHORT_OPT_IN_ACCEPT,
81
- ].includes(value);
82
- }
83
- /**
84
- * Checks if the provided type is a valid SignMessageType.
85
- * @param {string} value - The message type to check.
86
- * @returns {boolean} - Returns true if the type is a sign message type, otherwise false.
87
- */
88
- static isSignMessageValue(value) {
89
- return this.isValidValue(value) && [
90
- BEACON_COHORT_AGGREGATED_NONCE,
91
- BEACON_COHORT_AUTHORIZATION_REQUEST,
92
- BEACON_COHORT_NONCE_CONTRIBUTION,
93
- BEACON_COHORT_REQUEST_SIGNATURE,
94
- BEACON_COHORT_SIGNATURE_AUTHORIZATION
95
- ].includes(value);
96
- }
97
- }
98
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../src/core/beacon/aggregation/cohort/messages/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EACpB,8BAA8B,EAC9B,mCAAmC,EACnC,gCAAgC,EAChC,oBAAoB,EACpB,2BAA2B,EAC3B,mBAAmB,EACnB,+BAA+B,EAC/B,qCAAqC,EACtC,MAAM,gBAAgB,CAAC;AA4BxB;;;;;;GAMG;AACH,MAAM,OAAO,sBAAsB;IACjC,MAAM,CAAC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A2B,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACrG,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,qBAAqB,CAAC,IAAY;QACvC,IAAG,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE,CAAC;YAC3B,OAAO,SAAS,CAAC;QACnB,CAAC;QACD,OAAO,IAAI,CAAC,8BAA8B,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,2BAA2B,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACrG,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,YAAY,CAAC,IAAY;QAC9B,OAAO,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IAC1C,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,oBAAoB,CAAC,KAAa;QACvC,OAAO,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,IAAI;YACjC,oBAAoB;YACpB,mBAAmB;YACnB,oBAAoB;YACpB,2BAA2B;SAC5B,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IACpB,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,kBAAkB,CAAC,KAAa;QACrC,OAAO,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,IAAI;YACjC,8BAA8B;YAC9B,mCAAmC;YACnC,gCAAgC;YAChC,+BAA+B;YAC/B,qCAAqC;SACtC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IACpB,CAAC"}
@@ -1,31 +0,0 @@
1
- import { JSONUtils } from '@did-btcr2/common';
2
- import { BaseMessage } from '../base.js';
3
- import { BEACON_COHORT_ADVERT } from '../constants.js';
4
- /**
5
- * Represents a message advertising a cohort to potential participants.
6
- * @class BeaconCohortAdvertMessage
7
- * @extends BaseMessage
8
- * @type {BeaconCohortAdvertMessage}
9
- */
10
- export class BeaconCohortAdvertMessage extends BaseMessage {
11
- id;
12
- constructor({ from, id, cohortId, cohortSize, beaconType, network }) {
13
- const body = { cohortId, cohortSize, beaconType, network };
14
- const type = BEACON_COHORT_ADVERT;
15
- super({ from, body, type });
16
- this.id = id || `${type}/${cohortId}`;
17
- }
18
- /**
19
- * Initializes a BeaconCohortAdvertMessage from a possible CohortAdvertMessage object.
20
- * @param {CohortAdvertMessage} data The CohortAdvertMessage object to initialize the BeaconCohortAdvertMessage.
21
- * @returns {BeaconCohortAdvertMessage} The new BeaconCohortAdvertMessage.
22
- */
23
- static fromJSON(data) {
24
- const message = JSONUtils.isParsable(data) ? JSON.parse(data) : data;
25
- if (message.type !== BEACON_COHORT_ADVERT) {
26
- throw new Error(`Invalid type: ${message.type}`);
27
- }
28
- return new BeaconCohortAdvertMessage(message);
29
- }
30
- }
31
- //# sourceMappingURL=cohort-advert.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"cohort-advert.js","sourceRoot":"","sources":["../../../../../../../../src/core/beacon/aggregation/cohort/messages/keygen/cohort-advert.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAYvD;;;;;GAKG;AACH,MAAM,OAAO,yBAA0B,SAAQ,WAAW;IACjD,EAAE,CAAS;IAElB,YAAY,EAAE,IAAI,EAAE,EAAE,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAU,EAAE,OAAO,EAAuB;QACtF,MAAM,IAAI,GAAG,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAU,EAAE,OAAO,EAAE,CAAC;QAC3D,MAAM,IAAI,GAAG,oBAAoB,CAAC;QAClC,KAAK,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;QAC5B,IAAI,CAAC,EAAE,GAAG,EAAE,IAAI,GAAG,IAAI,IAAI,QAAQ,EAAE,CAAC;IACxC,CAAC;IAED;;;;OAIG;IACI,MAAM,CAAC,QAAQ,CAAC,IAAgC;QACrD,MAAM,OAAO,GAAG,SAAS,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QACrE,IAAI,OAAO,CAAC,IAAI,KAAK,oBAAoB,EAAC,CAAC;YACzC,MAAM,IAAI,KAAK,CAAC,iBAAiB,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;QACnD,CAAC;QACD,OAAO,IAAI,yBAAyB,CAAC,OAAO,CAAC,CAAC;IAChD,CAAC;CACF"}
@@ -1,29 +0,0 @@
1
- import { JSONUtils } from '@did-btcr2/common';
2
- import { BaseMessage } from '../base.js';
3
- import { BEACON_COHORT_READY } from '../constants.js';
4
- /**
5
- * Represents a message indicating that a cohort has met the required conditions.
6
- * @class BeaconCohortReadyMessage
7
- * @extends BaseMessage
8
- * @type {BeaconCohortReadyMessage}
9
- */
10
- export class BeaconCohortReadyMessage extends BaseMessage {
11
- constructor({ from, to, cohortId, beaconAddress, cohortKeys }) {
12
- const body = { cohortId, beaconAddress, cohortKeys };
13
- const type = BEACON_COHORT_READY;
14
- super({ from, to, body, type });
15
- }
16
- /**
17
- * Initializes an BeaconCohortReadyMessage from a given OptIn object.
18
- * @param {CohortReadyMessage} data The CohortReadyMessage object to initialize the BeaconCohortReadyMessage.
19
- * @returns {BeaconCohortReadyMessage} The new BeaconCohortReadyMessage.
20
- */
21
- static fromJSON(data) {
22
- const message = JSONUtils.isParsable(data) ? JSON.parse(data) : data;
23
- if (message.type !== BEACON_COHORT_READY) {
24
- throw new Error(`Invalid type: ${message.type}`);
25
- }
26
- return new BeaconCohortReadyMessage(message);
27
- }
28
- }
29
- //# sourceMappingURL=cohort-ready.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"cohort-ready.js","sourceRoot":"","sources":["../../../../../../../../src/core/beacon/aggregation/cohort/messages/keygen/cohort-ready.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAWtD;;;;;GAKG;AACH,MAAM,OAAO,wBAAyB,SAAQ,WAAW;IACvD,YAAY,EAAE,IAAI,EAAE,EAAE,EAAE,QAAQ,EAAE,aAAa,EAAE,UAAU,EAAsB;QAC/E,MAAM,IAAI,GAAG,EAAE,QAAQ,EAAE,aAAa,EAAE,UAAU,EAAE,CAAC;QACrD,MAAM,IAAI,GAAG,mBAAmB,CAAC;QACjC,KAAK,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;IAClC,CAAC;IAED;;;;OAIG;IACI,MAAM,CAAC,QAAQ,CAAC,IAA+B;QACpD,MAAM,OAAO,GAAG,SAAS,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QACrE,IAAI,OAAO,CAAC,IAAI,KAAK,mBAAmB,EAAE,CAAC;YACzC,MAAM,IAAI,KAAK,CAAC,iBAAiB,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;QACnD,CAAC;QACD,OAAO,IAAI,wBAAwB,CAAC,OAAO,CAAC,CAAC;IAC/C,CAAC;CACF"}
@@ -1,27 +0,0 @@
1
- import { JSONUtils } from '@did-btcr2/common';
2
- import { BaseMessage } from '../base.js';
3
- import { BEACON_COHORT_OPT_IN_ACCEPT } from '../constants.js';
4
- /**
5
- * Represents a message for a coordinator accepting a participant subscribe to a cohort.
6
- * @class BeaconCohortOptInAcceptMessage
7
- * @extends BaseMessage
8
- * @type {BeaconCohortOptInAcceptMessage}
9
- */
10
- export class BeaconCohortOptInAcceptMessage extends BaseMessage {
11
- constructor({ to, from }) {
12
- super({ to, from, type: BEACON_COHORT_OPT_IN_ACCEPT });
13
- }
14
- /**
15
- * Initializes a BeaconCohortOptInAcceptMessage from a possible CohortOptInAcceptMessage object.
16
- * @param {CohortOptInAcceptMessage} data The CohortOptInAcceptMessage object to initialize the BeaconCohortOptInAcceptMessage.
17
- * @returns {BeaconCohortOptInAcceptMessage} The new BeaconCohortOptInAcceptMessage.
18
- */
19
- static fromJSON(data) {
20
- const message = JSONUtils.isParsable(data) ? JSON.parse(data) : data;
21
- if (message.type != BEACON_COHORT_OPT_IN_ACCEPT) {
22
- throw new Error(`Invalid type: ${message.type}`);
23
- }
24
- return new BeaconCohortOptInAcceptMessage(message);
25
- }
26
- }
27
- //# sourceMappingURL=opt-in-accept.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"opt-in-accept.js","sourceRoot":"","sources":["../../../../../../../../src/core/beacon/aggregation/cohort/messages/keygen/opt-in-accept.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,2BAA2B,EAAE,MAAM,iBAAiB,CAAC;AAQ9D;;;;;GAKG;AACH,MAAM,OAAO,8BAA+B,SAAQ,WAAW;IAC7D,YAAY,EAAE,EAAE,EAAE,IAAI,EAA4B;QAChD,KAAK,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,2BAA2B,EAAE,CAAC,CAAC;IACzD,CAAC;IAED;;;;OAIG;IACI,MAAM,CAAC,QAAQ,CAAC,IAAqC;QAC1D,MAAM,OAAO,GAAG,SAAS,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QACrE,IAAI,OAAO,CAAC,IAAI,IAAI,2BAA2B,EAAE,CAAC;YAChD,MAAM,IAAI,KAAK,CAAC,iBAAiB,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;QACnD,CAAC;QACD,OAAO,IAAI,8BAA8B,CAAC,OAAO,CAAC,CAAC;IACrD,CAAC;CACF"}