@did-btcr2/method 0.26.0 → 0.28.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (297) hide show
  1. package/README.md +118 -236
  2. package/dist/.tsbuildinfo +1 -1
  3. package/dist/browser.js +27665 -23764
  4. package/dist/browser.mjs +27665 -23764
  5. package/dist/cjs/index.js +2661 -2239
  6. package/dist/esm/core/aggregation/cohort.js +178 -0
  7. package/dist/esm/core/aggregation/cohort.js.map +1 -0
  8. package/dist/esm/core/aggregation/errors.js +22 -0
  9. package/dist/esm/core/aggregation/errors.js.map +1 -0
  10. package/dist/esm/core/{beacon/aggregation/cohort → aggregation}/messages/base.js +0 -1
  11. package/dist/esm/core/aggregation/messages/base.js.map +1 -0
  12. package/dist/esm/core/aggregation/messages/constants.js +26 -0
  13. package/dist/esm/core/aggregation/messages/constants.js.map +1 -0
  14. package/dist/esm/core/aggregation/messages/factories.js +113 -0
  15. package/dist/esm/core/aggregation/messages/factories.js.map +1 -0
  16. package/dist/esm/core/aggregation/messages/guards.js +37 -0
  17. package/dist/esm/core/aggregation/messages/guards.js.map +1 -0
  18. package/dist/esm/core/aggregation/messages/index.js +5 -0
  19. package/dist/esm/core/aggregation/messages/index.js.map +1 -0
  20. package/dist/esm/core/aggregation/participant.js +376 -0
  21. package/dist/esm/core/aggregation/participant.js.map +1 -0
  22. package/dist/esm/core/aggregation/phases.js +39 -0
  23. package/dist/esm/core/aggregation/phases.js.map +1 -0
  24. package/dist/esm/core/aggregation/runner/events.js +2 -0
  25. package/dist/esm/core/aggregation/runner/events.js.map +1 -0
  26. package/dist/esm/core/aggregation/runner/index.js +5 -0
  27. package/dist/esm/core/aggregation/runner/index.js.map +1 -0
  28. package/dist/esm/core/aggregation/runner/participant-runner.js +286 -0
  29. package/dist/esm/core/aggregation/runner/participant-runner.js.map +1 -0
  30. package/dist/esm/core/aggregation/runner/service-runner.js +290 -0
  31. package/dist/esm/core/aggregation/runner/service-runner.js.map +1 -0
  32. package/dist/esm/core/aggregation/runner/typed-emitter.js +80 -0
  33. package/dist/esm/core/aggregation/runner/typed-emitter.js.map +1 -0
  34. package/dist/esm/core/aggregation/service.js +416 -0
  35. package/dist/esm/core/aggregation/service.js.map +1 -0
  36. package/dist/esm/core/aggregation/signing-session.js +133 -0
  37. package/dist/esm/core/aggregation/signing-session.js.map +1 -0
  38. package/dist/esm/core/aggregation/transport/didcomm.js +32 -0
  39. package/dist/esm/core/aggregation/transport/didcomm.js.map +1 -0
  40. package/dist/esm/core/aggregation/transport/error.js +12 -0
  41. package/dist/esm/core/aggregation/transport/error.js.map +1 -0
  42. package/dist/esm/core/aggregation/transport/factory.js +20 -0
  43. package/dist/esm/core/aggregation/transport/factory.js.map +1 -0
  44. package/dist/esm/core/aggregation/transport/index.js +6 -0
  45. package/dist/esm/core/aggregation/transport/index.js.map +1 -0
  46. package/dist/esm/core/aggregation/transport/nostr.js +262 -0
  47. package/dist/esm/core/aggregation/transport/nostr.js.map +1 -0
  48. package/dist/esm/core/aggregation/transport/transport.js +2 -0
  49. package/dist/esm/core/aggregation/transport/transport.js.map +1 -0
  50. package/dist/esm/core/beacon/beacon.js +80 -0
  51. package/dist/esm/core/beacon/beacon.js.map +1 -1
  52. package/dist/esm/core/beacon/cas-beacon.js +15 -56
  53. package/dist/esm/core/beacon/cas-beacon.js.map +1 -1
  54. package/dist/esm/core/beacon/error.js +0 -10
  55. package/dist/esm/core/beacon/error.js.map +1 -1
  56. package/dist/esm/core/beacon/fee-estimator.js +30 -0
  57. package/dist/esm/core/beacon/fee-estimator.js.map +1 -0
  58. package/dist/esm/core/beacon/singleton-beacon.js +10 -53
  59. package/dist/esm/core/beacon/singleton-beacon.js.map +1 -1
  60. package/dist/esm/core/beacon/smt-beacon.js +85 -9
  61. package/dist/esm/core/beacon/smt-beacon.js.map +1 -1
  62. package/dist/esm/core/identifier.js +13 -0
  63. package/dist/esm/core/identifier.js.map +1 -1
  64. package/dist/esm/core/resolver.js +9 -0
  65. package/dist/esm/core/resolver.js.map +1 -1
  66. package/dist/esm/core/updater.js +269 -0
  67. package/dist/esm/core/updater.js.map +1 -0
  68. package/dist/esm/did-btcr2.js +30 -42
  69. package/dist/esm/did-btcr2.js.map +1 -1
  70. package/dist/esm/index.js +16 -25
  71. package/dist/esm/index.js.map +1 -1
  72. package/dist/types/core/aggregation/cohort.d.ts +94 -0
  73. package/dist/types/core/aggregation/cohort.d.ts.map +1 -0
  74. package/dist/types/core/aggregation/errors.d.ts +14 -0
  75. package/dist/types/core/aggregation/errors.d.ts.map +1 -0
  76. package/dist/types/core/{beacon/aggregation/cohort → aggregation}/messages/base.d.ts +7 -1
  77. package/dist/types/core/aggregation/messages/base.d.ts.map +1 -0
  78. package/dist/types/core/aggregation/messages/constants.d.ts +23 -0
  79. package/dist/types/core/aggregation/messages/constants.d.ts.map +1 -0
  80. package/dist/types/core/aggregation/messages/factories.d.ts +177 -0
  81. package/dist/types/core/aggregation/messages/factories.d.ts.map +1 -0
  82. package/dist/types/core/aggregation/messages/guards.d.ts +11 -0
  83. package/dist/types/core/aggregation/messages/guards.d.ts.map +1 -0
  84. package/dist/types/core/aggregation/messages/index.d.ts +5 -0
  85. package/dist/types/core/aggregation/messages/index.d.ts.map +1 -0
  86. package/dist/types/core/aggregation/participant.d.ts +101 -0
  87. package/dist/types/core/aggregation/participant.d.ts.map +1 -0
  88. package/dist/types/core/aggregation/phases.d.ts +49 -0
  89. package/dist/types/core/aggregation/phases.d.ts.map +1 -0
  90. package/dist/types/core/aggregation/runner/events.d.ts +89 -0
  91. package/dist/types/core/aggregation/runner/events.d.ts.map +1 -0
  92. package/dist/types/core/aggregation/runner/index.d.ts +5 -0
  93. package/dist/types/core/aggregation/runner/index.d.ts.map +1 -0
  94. package/dist/types/core/aggregation/runner/participant-runner.d.ts +111 -0
  95. package/dist/types/core/aggregation/runner/participant-runner.d.ts.map +1 -0
  96. package/dist/types/core/aggregation/runner/service-runner.d.ts +102 -0
  97. package/dist/types/core/aggregation/runner/service-runner.d.ts.map +1 -0
  98. package/dist/types/core/aggregation/runner/typed-emitter.d.ts +41 -0
  99. package/dist/types/core/aggregation/runner/typed-emitter.d.ts.map +1 -0
  100. package/dist/types/core/aggregation/service.d.ts +112 -0
  101. package/dist/types/core/aggregation/service.d.ts.map +1 -0
  102. package/dist/types/core/aggregation/signing-session.d.ts +69 -0
  103. package/dist/types/core/aggregation/signing-session.d.ts.map +1 -0
  104. package/dist/types/core/aggregation/transport/didcomm.d.ts +20 -0
  105. package/dist/types/core/aggregation/transport/didcomm.d.ts.map +1 -0
  106. package/dist/types/core/{beacon/aggregation/communication → aggregation/transport}/error.d.ts +2 -2
  107. package/dist/types/core/aggregation/transport/error.d.ts.map +1 -0
  108. package/dist/types/core/aggregation/transport/factory.d.ts +13 -0
  109. package/dist/types/core/aggregation/transport/factory.d.ts.map +1 -0
  110. package/dist/types/core/aggregation/transport/index.d.ts +6 -0
  111. package/dist/types/core/aggregation/transport/index.d.ts.map +1 -0
  112. package/dist/types/core/aggregation/transport/nostr.d.ts +55 -0
  113. package/dist/types/core/aggregation/transport/nostr.d.ts.map +1 -0
  114. package/dist/types/core/aggregation/transport/transport.d.ts +37 -0
  115. package/dist/types/core/aggregation/transport/transport.d.ts.map +1 -0
  116. package/dist/types/core/beacon/beacon.d.ts +37 -2
  117. package/dist/types/core/beacon/beacon.d.ts.map +1 -1
  118. package/dist/types/core/beacon/cas-beacon.d.ts +19 -7
  119. package/dist/types/core/beacon/cas-beacon.d.ts.map +1 -1
  120. package/dist/types/core/beacon/error.d.ts +0 -6
  121. package/dist/types/core/beacon/error.d.ts.map +1 -1
  122. package/dist/types/core/beacon/fee-estimator.d.ts +40 -0
  123. package/dist/types/core/beacon/fee-estimator.d.ts.map +1 -0
  124. package/dist/types/core/beacon/interfaces.d.ts +8 -0
  125. package/dist/types/core/beacon/interfaces.d.ts.map +1 -1
  126. package/dist/types/core/beacon/singleton-beacon.d.ts +9 -2
  127. package/dist/types/core/beacon/singleton-beacon.d.ts.map +1 -1
  128. package/dist/types/core/beacon/smt-beacon.d.ts +27 -7
  129. package/dist/types/core/beacon/smt-beacon.d.ts.map +1 -1
  130. package/dist/types/core/identifier.d.ts +8 -0
  131. package/dist/types/core/identifier.d.ts.map +1 -1
  132. package/dist/types/core/interfaces.d.ts +2 -2
  133. package/dist/types/core/resolver.d.ts +11 -1
  134. package/dist/types/core/resolver.d.ts.map +1 -1
  135. package/dist/types/core/updater.d.ts +178 -0
  136. package/dist/types/core/updater.d.ts.map +1 -0
  137. package/dist/types/did-btcr2.d.ts +23 -23
  138. package/dist/types/did-btcr2.d.ts.map +1 -1
  139. package/dist/types/index.d.ts +11 -25
  140. package/dist/types/index.d.ts.map +1 -1
  141. package/package.json +31 -30
  142. package/src/core/aggregation/cohort.ts +247 -0
  143. package/src/core/aggregation/errors.ts +25 -0
  144. package/src/core/{beacon/aggregation/cohort → aggregation}/messages/base.ts +8 -3
  145. package/src/core/aggregation/messages/constants.ts +28 -0
  146. package/src/core/aggregation/messages/factories.ts +240 -0
  147. package/src/core/aggregation/messages/guards.ts +55 -0
  148. package/src/core/aggregation/messages/index.ts +4 -0
  149. package/src/core/aggregation/participant.ts +510 -0
  150. package/src/core/aggregation/phases.ts +82 -0
  151. package/src/core/aggregation/runner/events.ts +77 -0
  152. package/src/core/aggregation/runner/index.ts +4 -0
  153. package/src/core/aggregation/runner/participant-runner.ts +364 -0
  154. package/src/core/aggregation/runner/service-runner.ts +365 -0
  155. package/src/core/aggregation/runner/typed-emitter.ts +87 -0
  156. package/src/core/aggregation/service.ts +547 -0
  157. package/src/core/aggregation/signing-session.ts +209 -0
  158. package/src/core/aggregation/transport/didcomm.ts +42 -0
  159. package/src/core/aggregation/transport/error.ts +13 -0
  160. package/src/core/aggregation/transport/factory.ts +29 -0
  161. package/src/core/aggregation/transport/index.ts +5 -0
  162. package/src/core/aggregation/transport/nostr.ts +333 -0
  163. package/src/core/aggregation/transport/transport.ts +46 -0
  164. package/src/core/beacon/beacon.ts +122 -2
  165. package/src/core/beacon/cas-beacon.ts +28 -76
  166. package/src/core/beacon/error.ts +0 -12
  167. package/src/core/beacon/fee-estimator.ts +52 -0
  168. package/src/core/beacon/interfaces.ts +10 -1
  169. package/src/core/beacon/singleton-beacon.ts +14 -75
  170. package/src/core/beacon/smt-beacon.ts +109 -11
  171. package/src/core/identifier.ts +17 -0
  172. package/src/core/interfaces.ts +2 -2
  173. package/src/core/resolver.ts +25 -2
  174. package/src/core/updater.ts +415 -0
  175. package/src/did-btcr2.ts +36 -66
  176. package/src/index.ts +17 -30
  177. package/dist/esm/core/beacon/aggregation/cohort/index.js +0 -237
  178. package/dist/esm/core/beacon/aggregation/cohort/index.js.map +0 -1
  179. package/dist/esm/core/beacon/aggregation/cohort/messages/base.js.map +0 -1
  180. package/dist/esm/core/beacon/aggregation/cohort/messages/constants.js +0 -11
  181. package/dist/esm/core/beacon/aggregation/cohort/messages/constants.js.map +0 -1
  182. package/dist/esm/core/beacon/aggregation/cohort/messages/index.js +0 -98
  183. package/dist/esm/core/beacon/aggregation/cohort/messages/index.js.map +0 -1
  184. package/dist/esm/core/beacon/aggregation/cohort/messages/keygen/cohort-advert.js +0 -31
  185. package/dist/esm/core/beacon/aggregation/cohort/messages/keygen/cohort-advert.js.map +0 -1
  186. package/dist/esm/core/beacon/aggregation/cohort/messages/keygen/cohort-ready.js +0 -29
  187. package/dist/esm/core/beacon/aggregation/cohort/messages/keygen/cohort-ready.js.map +0 -1
  188. package/dist/esm/core/beacon/aggregation/cohort/messages/keygen/opt-in-accept.js +0 -27
  189. package/dist/esm/core/beacon/aggregation/cohort/messages/keygen/opt-in-accept.js.map +0 -1
  190. package/dist/esm/core/beacon/aggregation/cohort/messages/keygen/opt-in.js +0 -23
  191. package/dist/esm/core/beacon/aggregation/cohort/messages/keygen/opt-in.js.map +0 -1
  192. package/dist/esm/core/beacon/aggregation/cohort/messages/keygen/subscribe.js +0 -28
  193. package/dist/esm/core/beacon/aggregation/cohort/messages/keygen/subscribe.js.map +0 -1
  194. package/dist/esm/core/beacon/aggregation/cohort/messages/sign/aggregated-nonce.js +0 -29
  195. package/dist/esm/core/beacon/aggregation/cohort/messages/sign/aggregated-nonce.js.map +0 -1
  196. package/dist/esm/core/beacon/aggregation/cohort/messages/sign/authorization-request.js +0 -30
  197. package/dist/esm/core/beacon/aggregation/cohort/messages/sign/authorization-request.js.map +0 -1
  198. package/dist/esm/core/beacon/aggregation/cohort/messages/sign/nonce-contribution.js +0 -30
  199. package/dist/esm/core/beacon/aggregation/cohort/messages/sign/nonce-contribution.js.map +0 -1
  200. package/dist/esm/core/beacon/aggregation/cohort/messages/sign/request-signature.js +0 -30
  201. package/dist/esm/core/beacon/aggregation/cohort/messages/sign/request-signature.js.map +0 -1
  202. package/dist/esm/core/beacon/aggregation/cohort/messages/sign/signature-authorization.js +0 -31
  203. package/dist/esm/core/beacon/aggregation/cohort/messages/sign/signature-authorization.js.map +0 -1
  204. package/dist/esm/core/beacon/aggregation/cohort/status.js +0 -8
  205. package/dist/esm/core/beacon/aggregation/cohort/status.js.map +0 -1
  206. package/dist/esm/core/beacon/aggregation/communication/adapter/did-comm.js +0 -121
  207. package/dist/esm/core/beacon/aggregation/communication/adapter/did-comm.js.map +0 -1
  208. package/dist/esm/core/beacon/aggregation/communication/adapter/nostr.js +0 -245
  209. package/dist/esm/core/beacon/aggregation/communication/adapter/nostr.js.map +0 -1
  210. package/dist/esm/core/beacon/aggregation/communication/error.js +0 -12
  211. package/dist/esm/core/beacon/aggregation/communication/error.js.map +0 -1
  212. package/dist/esm/core/beacon/aggregation/communication/factory.js +0 -21
  213. package/dist/esm/core/beacon/aggregation/communication/factory.js.map +0 -1
  214. package/dist/esm/core/beacon/aggregation/communication/service.js +0 -2
  215. package/dist/esm/core/beacon/aggregation/communication/service.js.map +0 -1
  216. package/dist/esm/core/beacon/aggregation/coordinator.js +0 -343
  217. package/dist/esm/core/beacon/aggregation/coordinator.js.map +0 -1
  218. package/dist/esm/core/beacon/aggregation/participant.js +0 -435
  219. package/dist/esm/core/beacon/aggregation/participant.js.map +0 -1
  220. package/dist/esm/core/beacon/aggregation/session/index.js +0 -244
  221. package/dist/esm/core/beacon/aggregation/session/index.js.map +0 -1
  222. package/dist/esm/core/beacon/aggregation/session/status.js +0 -11
  223. package/dist/esm/core/beacon/aggregation/session/status.js.map +0 -1
  224. package/dist/esm/core/update.js +0 -112
  225. package/dist/esm/core/update.js.map +0 -1
  226. package/dist/types/core/beacon/aggregation/cohort/index.d.ts +0 -136
  227. package/dist/types/core/beacon/aggregation/cohort/index.d.ts.map +0 -1
  228. package/dist/types/core/beacon/aggregation/cohort/messages/base.d.ts.map +0 -1
  229. package/dist/types/core/beacon/aggregation/cohort/messages/constants.d.ts +0 -11
  230. package/dist/types/core/beacon/aggregation/cohort/messages/constants.d.ts.map +0 -1
  231. package/dist/types/core/beacon/aggregation/cohort/messages/index.d.ts +0 -65
  232. package/dist/types/core/beacon/aggregation/cohort/messages/index.d.ts.map +0 -1
  233. package/dist/types/core/beacon/aggregation/cohort/messages/keygen/cohort-advert.d.ts +0 -29
  234. package/dist/types/core/beacon/aggregation/cohort/messages/keygen/cohort-advert.d.ts.map +0 -1
  235. package/dist/types/core/beacon/aggregation/cohort/messages/keygen/cohort-ready.d.ts +0 -26
  236. package/dist/types/core/beacon/aggregation/cohort/messages/keygen/cohort-ready.d.ts.map +0 -1
  237. package/dist/types/core/beacon/aggregation/cohort/messages/keygen/opt-in-accept.d.ts +0 -24
  238. package/dist/types/core/beacon/aggregation/cohort/messages/keygen/opt-in-accept.d.ts.map +0 -1
  239. package/dist/types/core/beacon/aggregation/cohort/messages/keygen/opt-in.d.ts +0 -20
  240. package/dist/types/core/beacon/aggregation/cohort/messages/keygen/opt-in.d.ts.map +0 -1
  241. package/dist/types/core/beacon/aggregation/cohort/messages/keygen/subscribe.d.ts +0 -25
  242. package/dist/types/core/beacon/aggregation/cohort/messages/keygen/subscribe.d.ts.map +0 -1
  243. package/dist/types/core/beacon/aggregation/cohort/messages/sign/aggregated-nonce.d.ts +0 -25
  244. package/dist/types/core/beacon/aggregation/cohort/messages/sign/aggregated-nonce.d.ts.map +0 -1
  245. package/dist/types/core/beacon/aggregation/cohort/messages/sign/authorization-request.d.ts +0 -26
  246. package/dist/types/core/beacon/aggregation/cohort/messages/sign/authorization-request.d.ts.map +0 -1
  247. package/dist/types/core/beacon/aggregation/cohort/messages/sign/nonce-contribution.d.ts +0 -26
  248. package/dist/types/core/beacon/aggregation/cohort/messages/sign/nonce-contribution.d.ts.map +0 -1
  249. package/dist/types/core/beacon/aggregation/cohort/messages/sign/request-signature.d.ts +0 -26
  250. package/dist/types/core/beacon/aggregation/cohort/messages/sign/request-signature.d.ts.map +0 -1
  251. package/dist/types/core/beacon/aggregation/cohort/messages/sign/signature-authorization.d.ts +0 -27
  252. package/dist/types/core/beacon/aggregation/cohort/messages/sign/signature-authorization.d.ts.map +0 -1
  253. package/dist/types/core/beacon/aggregation/cohort/status.d.ts +0 -8
  254. package/dist/types/core/beacon/aggregation/cohort/status.d.ts.map +0 -1
  255. package/dist/types/core/beacon/aggregation/communication/adapter/did-comm.d.ts +0 -89
  256. package/dist/types/core/beacon/aggregation/communication/adapter/did-comm.d.ts.map +0 -1
  257. package/dist/types/core/beacon/aggregation/communication/adapter/nostr.d.ts +0 -103
  258. package/dist/types/core/beacon/aggregation/communication/adapter/nostr.d.ts.map +0 -1
  259. package/dist/types/core/beacon/aggregation/communication/error.d.ts.map +0 -1
  260. package/dist/types/core/beacon/aggregation/communication/factory.d.ts +0 -10
  261. package/dist/types/core/beacon/aggregation/communication/factory.d.ts.map +0 -1
  262. package/dist/types/core/beacon/aggregation/communication/service.d.ts +0 -36
  263. package/dist/types/core/beacon/aggregation/communication/service.d.ts.map +0 -1
  264. package/dist/types/core/beacon/aggregation/coordinator.d.ts +0 -116
  265. package/dist/types/core/beacon/aggregation/coordinator.d.ts.map +0 -1
  266. package/dist/types/core/beacon/aggregation/participant.d.ts +0 -192
  267. package/dist/types/core/beacon/aggregation/participant.d.ts.map +0 -1
  268. package/dist/types/core/beacon/aggregation/session/index.d.ts +0 -156
  269. package/dist/types/core/beacon/aggregation/session/index.d.ts.map +0 -1
  270. package/dist/types/core/beacon/aggregation/session/status.d.ts +0 -11
  271. package/dist/types/core/beacon/aggregation/session/status.d.ts.map +0 -1
  272. package/dist/types/core/update.d.ts +0 -52
  273. package/dist/types/core/update.d.ts.map +0 -1
  274. package/src/core/beacon/aggregation/cohort/index.ts +0 -305
  275. package/src/core/beacon/aggregation/cohort/messages/constants.ts +0 -12
  276. package/src/core/beacon/aggregation/cohort/messages/index.ts +0 -143
  277. package/src/core/beacon/aggregation/cohort/messages/keygen/cohort-advert.ts +0 -44
  278. package/src/core/beacon/aggregation/cohort/messages/keygen/cohort-ready.ts +0 -40
  279. package/src/core/beacon/aggregation/cohort/messages/keygen/opt-in-accept.ts +0 -35
  280. package/src/core/beacon/aggregation/cohort/messages/keygen/opt-in.ts +0 -34
  281. package/src/core/beacon/aggregation/cohort/messages/keygen/subscribe.ts +0 -36
  282. package/src/core/beacon/aggregation/cohort/messages/sign/aggregated-nonce.ts +0 -39
  283. package/src/core/beacon/aggregation/cohort/messages/sign/authorization-request.ts +0 -40
  284. package/src/core/beacon/aggregation/cohort/messages/sign/nonce-contribution.ts +0 -40
  285. package/src/core/beacon/aggregation/cohort/messages/sign/request-signature.ts +0 -40
  286. package/src/core/beacon/aggregation/cohort/messages/sign/signature-authorization.ts +0 -41
  287. package/src/core/beacon/aggregation/cohort/status.ts +0 -7
  288. package/src/core/beacon/aggregation/communication/adapter/did-comm.ts +0 -148
  289. package/src/core/beacon/aggregation/communication/adapter/nostr.ts +0 -323
  290. package/src/core/beacon/aggregation/communication/error.ts +0 -13
  291. package/src/core/beacon/aggregation/communication/factory.ts +0 -25
  292. package/src/core/beacon/aggregation/communication/service.ts +0 -42
  293. package/src/core/beacon/aggregation/coordinator.ts +0 -419
  294. package/src/core/beacon/aggregation/participant.ts +0 -517
  295. package/src/core/beacon/aggregation/session/index.ts +0 -301
  296. package/src/core/beacon/aggregation/session/status.ts +0 -18
  297. package/src/core/update.ts +0 -158
@@ -1,116 +0,0 @@
1
- import type { RawSchnorrKeyPair } from '@did-btcr2/keypair';
2
- import { AggregateBeaconCohort } from './cohort/index.js';
3
- import type { CommunicationService, Service, ServiceAdapterIdentity } from './communication/service.js';
4
- import type { BeaconCohortSigningSession } from './session/index.js';
5
- /**
6
- * Parameters for initializing a BeaconCoordinator.
7
- * @type {BeaconCoordinatorParams}
8
- * @property {CommunicationService} [protocol] - The communication protocol to be used.
9
- * @property {string} did - The Decentralized Identifier (DID) for the coordinator.
10
- * @property {ServiceAdapterIdentity<RawSchnorrKeyPair>} keys - The keys used for cryptographic operations.
11
- * @property {string} [name] - Optional name for the coordinator.
12
- */
13
- export type BeaconCoordinatorParams = {
14
- protocol?: CommunicationService;
15
- did: string;
16
- keys: ServiceAdapterIdentity<RawSchnorrKeyPair>;
17
- name?: string;
18
- };
19
- /**
20
- * The BeaconCoordinator class is responsible for managing the coordination of beacon aggregation.
21
- * @class BeaconCoordinator
22
- * @type {BeaconCoordinator}
23
- */
24
- export declare class BeaconCoordinator {
25
- #private;
26
- /**
27
- * The name of the BeaconCoordinator service.
28
- * @type {string}
29
- */
30
- name: string;
31
- /**
32
- * The DID of the BeaconCoordinator.
33
- * @type {Array<string>}
34
- */
35
- did: string;
36
- /**
37
- * The communication protocol used by the BeaconCoordinator.
38
- * @type {CommunicationService}
39
- */
40
- protocol: CommunicationService;
41
- /**
42
- * List of subscribers engaged in a Musig2 Cohort signing session with the BeaconCoordinator.
43
- * @type {Array<string>}
44
- */
45
- cohorts: Array<AggregateBeaconCohort>;
46
- /**
47
- * Active signing sessions for the BeaconCoordinator.
48
- * @type {Record<string, BeaconCohortSigningSession>}
49
- */
50
- activeSigningSessions: Map<string, BeaconCohortSigningSession>;
51
- /**
52
- * Constructs a new BeaconCoordinator instance.
53
- * @param {BeaconCoordinatorParams} params The parameters for the coordinator.
54
- * @param {CommunicationService} params.protocol The protocol service used for communication.
55
- * @param {string} [params.name] Optional name for the coordinator. If not provided, a default name will be generated.
56
- * @param {string} [params.did] Optional DID to use for the coordinator. If not provided, a new DID will be generated.
57
- * @param {ServiceAdapterIdentity<RawKeyPair>} params.keys The keys used for cryptographic operations.
58
- */
59
- constructor(params: {
60
- did: string;
61
- keys: ServiceAdapterIdentity<RawSchnorrKeyPair>;
62
- protocol?: CommunicationService;
63
- name?: string;
64
- });
65
- /**
66
- * Setup and start the BeaconCoordinator communication protocol.
67
- * @returns {void}
68
- */
69
- start(): void;
70
- /**
71
- * Starts the key generation process for a cohort once it has enough participants.
72
- * @param {Musig2Cohort} cohort The cohort for which to start key generation.
73
- * @returns {Promise<void>}
74
- */
75
- private _startKeyGeneration;
76
- /**
77
- * Accepts a subscription request from a participant.
78
- * @param {string} participant The DID of the participant requesting the subscription.
79
- * @returns {Promise<void>}
80
- */
81
- acceptSubscription(participant: string): Promise<void>;
82
- /**
83
- * Sends the aggregated nonce to all participants in the session.
84
- * @param {BeaconCohortSigningSession} session The session containing the aggregated nonce.
85
- * @returns {Promise<void>}
86
- */
87
- sendAggregatedNonce(session: BeaconCohortSigningSession): Promise<void>;
88
- /**
89
- * Announces a new cohort to all subscribers.
90
- * @param {number} minParticipants The minimum number of participants required for the cohort.
91
- * @param {string} [network='mutinynet'] The network on which the cohort operates (default is 'signet').
92
- * @param {string} [beaconType='SMTBeacon'] The type of beacon to be used (default is 'SMTBeacon').
93
- * @returns {Promise<AggregateBeaconCohort>} The newly created cohort.
94
- */
95
- advertiseCohort(minParticipants: number, network?: string, beaconType?: string): Promise<AggregateBeaconCohort>;
96
- /**
97
- * Announces to all subscribers a cohort is ready for signing.
98
- * @param {string} cohortId The minimum number of participants required for the cohort.
99
- * @returns {Promise<AggregateBeaconCohort>} The newly created cohort.
100
- */
101
- announceCohortReady(cohortId: string): Promise<AggregateBeaconCohort>;
102
- /**
103
- * Starts a signing session for a given cohort.
104
- * @param {string} cohortId The ID of the cohort for which to start a signing session.
105
- * @returns {Promise<BeaconCohortSigningSession>} The started signing session.
106
- * @throws {BeaconCoordinatorError} If the cohort with the given ID is not found.
107
- */
108
- startSigningSession(cohortId: string): Promise<BeaconCohortSigningSession>;
109
- /**
110
- * Static initialization method for the BeaconCoordinator.
111
- * @param {Service} service The communication service configuration.
112
- * @returns {BeaconCoordinator} Initialized BeaconCoordinator instance.
113
- */
114
- static initialize(service: Service): BeaconCoordinator;
115
- }
116
- //# sourceMappingURL=coordinator.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"coordinator.d.ts","sourceRoot":"","sources":["../../../../../src/core/beacon/aggregation/coordinator.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAG5D,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAsB1D,OAAO,KAAK,EAAE,oBAAoB,EAAE,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AACxG,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,oBAAoB,CAAC;AAGrE;;;;;;;GAOG;AACH,MAAM,MAAM,uBAAuB,GAAG;IACpC,QAAQ,CAAC,EAAE,oBAAoB,CAAC;IAChC,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,sBAAsB,CAAC,iBAAiB,CAAC,CAAA;IAC/C,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAA;AACD;;;;GAIG;AACH,qBAAa,iBAAiB;;IAC5B;;;OAGG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;;OAGG;IACH,GAAG,EAAE,MAAM,CAAC;IAEZ;;;OAGG;IACH,QAAQ,EAAE,oBAAoB,CAAC;IAE/B;;;OAGG;IACH,OAAO,EAAE,KAAK,CAAC,qBAAqB,CAAC,CAAM;IAE3C;;;OAGG;IACH,qBAAqB,EAAE,GAAG,CAAC,MAAM,EAAE,0BAA0B,CAAC,CAAa;IAE3E;;;;;;;OAOG;gBACS,MAAM,EAAE;QAClB,GAAG,EAAE,MAAM,CAAC;QACZ,IAAI,EAAE,sBAAsB,CAAC,iBAAiB,CAAC,CAAA;QAC/C,QAAQ,CAAC,EAAE,oBAAoB,CAAC;QAChC,IAAI,CAAC,EAAE,MAAM,CAAC;KACf;IAOD;;;OAGG;IACH,KAAK,IAAI,IAAI;IAgKb;;;;OAIG;YACW,mBAAmB;IAWjC;;;;OAIG;IACG,kBAAkB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAM5D;;;;OAIG;IACG,mBAAmB,CAAC,OAAO,EAAE,0BAA0B,GAAG,OAAO,CAAC,IAAI,CAAC;IAmB7E;;;;;;OAMG;IACG,eAAe,CACnB,eAAe,EAAE,MAAM,EACvB,OAAO,GAAE,MAAoB,EAC7B,UAAU,GAAE,MAAoB,GAC/B,OAAO,CAAC,qBAAqB,CAAC;IAkBjC;;;;OAIG;IACG,mBAAmB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,qBAAqB,CAAC;IA0B3E;;;;;OAKG;IACG,mBAAmB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,0BAA0B,CAAC;IAsBhF;;;;OAIG;IACH,MAAM,CAAC,UAAU,CAAC,OAAO,EAAE,OAAO,GAAG,iBAAiB;CAUvD"}
@@ -1,192 +0,0 @@
1
- import type { KeyBytes, Maybe } from '@did-btcr2/common';
2
- import { HDKey } from '@scure/bip32';
3
- import { AggregateBeaconCohort } from './cohort/index.js';
4
- import type { CohortAdvertMessage } from './cohort/messages/keygen/cohort-advert.js';
5
- import type { CohortReadyMessage } from './cohort/messages/keygen/cohort-ready.js';
6
- import type { CohortAggregatedNonceMessage } from './cohort/messages/sign/aggregated-nonce.js';
7
- import type { CohortAuthorizationRequestMessage } from './cohort/messages/sign/authorization-request.js';
8
- import type { CommunicationService } from './communication/service.js';
9
- import { BeaconCohortSigningSession } from './session/index.js';
10
- type Seed = KeyBytes;
11
- type Mnemonic = string;
12
- type SessionId = string;
13
- type ActiveSigningSessions = Map<SessionId, BeaconCohortSigningSession>;
14
- type CohortId = string;
15
- type KeyIndex = number;
16
- type CohortKeyState = Map<CohortId, KeyIndex>;
17
- type BeaconParticipantParams = {
18
- ent: Seed | Mnemonic;
19
- protocol?: CommunicationService;
20
- did: string;
21
- name?: string;
22
- };
23
- /**
24
- * Represents a participant in the did:btc1 Beacon Aggregation protocol.
25
- * @class BeaconParticipant
26
- * @type {BeaconParticipant}
27
- */
28
- export declare class BeaconParticipant {
29
- /**
30
- * The name of the BeaconParticipant service.
31
- * @type {string}
32
- */
33
- name: string;
34
- /**
35
- * The DID of the BeaconParticipant.
36
- * @type {Array<string>}
37
- */
38
- did: string;
39
- /**
40
- * The communication protocol used by the BeaconParticipant.
41
- * @type {CommunicationService}
42
- */
43
- protocol: CommunicationService;
44
- /**
45
- * The HD key used by the BeaconParticipant.
46
- * @type {HDKey}
47
- */
48
- hdKey: HDKey;
49
- /**
50
- * The current index for the beacon key.
51
- * @type {number}
52
- */
53
- beaconKeyIndex: number;
54
- /**
55
- * The coordinator DIDs that the participant is subscribed to.
56
- * @type {Array<string>}
57
- */
58
- coordinatorDids: Array<string>;
59
- /**
60
- * The cohorts that the participant is part of.
61
- * @type {Array<AggregateBeaconCohort>}
62
- */
63
- cohorts: Array<AggregateBeaconCohort>;
64
- /**
65
- * A mapping of Cohort IDs to HDKey indexes (CohortId => KeyIndex).
66
- * @type {CohortKeyState}
67
- */
68
- cohortKeyState: CohortKeyState;
69
- /**
70
- * A mapping of active Session IDs to their sessions (sessionId => BeaconCohortSigningSession).
71
- * @type {ActiveSigningSessions}
72
- */
73
- activeSigningSessions: ActiveSigningSessions;
74
- /**
75
- * Creates an instance of BeaconParticipant.
76
- * @param {BeaconParticipantParams} params The parameters for the participant.
77
- * @param {Seed | Mnemonic} params.ent The seed or mnemonic to derive the HD key.
78
- * @param {CommunicationService} params.protocol The communication protocol to use.
79
- * @param {string} params.did The DID of the participant.
80
- * @param {string} [params.name] Optional name for the participant. If not provided, a random name will be generated.
81
- */
82
- constructor({ ent, protocol, did, name }: BeaconParticipantParams);
83
- /**
84
- * Setup and start the BeaconParticipant communication protocol..
85
- * @returns {void}
86
- */
87
- start(): void;
88
- /**
89
- * Retrieves the HD key for a specific cohort based on its ID.
90
- * @param {string} cohortId The ID of the cohort for which to retrieve the key.
91
- * @returns {HDKey} The HD key for the cohort, or throws an error if not found.
92
- * @throws {BeaconParticipantError} If the cohort key state is not found for the given cohort ID.
93
- */
94
- getCohortKey(cohortId: string): HDKey;
95
- /**
96
- * Sets the state of the cohort key for a given cohort ID and key index.
97
- * @param {string} cohortId The ID of the cohort for which to set the key state.
98
- * @returns {void}
99
- */
100
- setCohortKey(cohortId: string): void;
101
- /**
102
- * Finalizes the placeholder "__UNSET__" key and assigns it to the provided cohortId.
103
- * If no "__UNSET__" entry exists, throws an error.
104
- * If cohortId already exists, logs a warning and does nothing.
105
- * @param {string} cohortId The ID of the cohort to finalize the unset key for.
106
- * @throws {BeaconParticipantError} If no "__UNSET__" cohort key state is found.
107
- * @returns {void}
108
- */
109
- finalizeUnsetCohortKey(cohortId: string): void;
110
- /**
111
- * Handle subscription acceptance from a coordinator.
112
- * @param {CohortOptInAcceptMessage} message The message containing the subscription acceptance.
113
- * @returns {Promise<void>}
114
- */
115
- private _handleSubscribeAccept;
116
- /**
117
- * Handles a cohort advertisement message.
118
- * @param {Maybe<BeaconCohortAdvertMessage>} message The cohort advertisement message.
119
- * @returns {Promise<void>}
120
- */
121
- _handleCohortAdvert(message: Maybe<CohortAdvertMessage>): Promise<void>;
122
- /**
123
- * Handles a cohort set message.
124
- * @param {Maybe<CohortReadyMessage>} message The cohort set message.
125
- * @returns {Promise<void>}
126
- */
127
- _handleCohortReady(message: Maybe<CohortReadyMessage>): Promise<void>;
128
- /**
129
- * Handles an authorization request message.
130
- * @param {Maybe<CohortAuthorizationRequestMessage>} message The authorization request message.
131
- * @returns {Promise<void>}
132
- */
133
- _handleAuthorizationRequest(message: Maybe<CohortAuthorizationRequestMessage>): Promise<void>;
134
- /**
135
- * Handles an aggregated nonce message.
136
- * @param {Maybe<CohortAggregatedNonceMessage>} message The aggregated nonce message.
137
- * @returns {Promise<void>}
138
- */
139
- _handleAggregatedNonce(message: Maybe<CohortAggregatedNonceMessage>): Promise<void>;
140
- /**
141
- * Subscribes to a coordinator's messages.
142
- * @param {string} coordinatorDid The DID of the coordinator to subscribe to.
143
- * @returns {Promise<void>}
144
- */
145
- subscribeToCoordinator(coordinatorDid: string): Promise<any>;
146
- /**
147
- * Joins a cohort with the given ID and coordinator DID.
148
- * @param {string} cohortId The ID of the cohort to join.
149
- * @param {string} coordinatorDid The DID of the cohort coordinator.
150
- * @returns {Promise<void>}
151
- */
152
- joinCohort(cohortId: string, coordinatorDid: string): Promise<void>;
153
- /**
154
- * Requests a signature for the given cohort and data.
155
- * @param {string} cohortId The ID of the cohort for which to request a signature.
156
- * @param {string} data The data for which to request a signature.
157
- * @returns {Promise<boolean>} Whether the signature request was successful.
158
- */
159
- requestCohortSignature(cohortId: string, data: string): Promise<boolean>;
160
- /**
161
- * Generates a nonce contribution for the given cohort and session.
162
- * @param {AggregateBeaconCohort} cohort The cohort for which to generate the nonce contribution.
163
- * @param {BeaconCohortSigningSession} session The session for which to generate the nonce contribution.
164
- * @returns {Promise<string[]>} An array of nonce points in hexadecimal format.
165
- */
166
- generateNonceContribution(cohort: AggregateBeaconCohort, session: BeaconCohortSigningSession): Uint8Array;
167
- /**
168
- * Sends a nonce contribution message to the cohort coordinator.
169
- * @param {AggregateBeaconCohort} cohort The cohort to which the nonce contribution is sent.
170
- * @param {Uint8Array} nonceContribution The nonce contribution points in hexadecimal format.
171
- * @param {BeaconCohortSigningSession} session The session associated with the nonce contribution.
172
- */
173
- sendNonceContribution(cohort: AggregateBeaconCohort, nonceContribution: Uint8Array, session: BeaconCohortSigningSession): Promise<void>;
174
- /**
175
- * Sends a partial signature for the given session.
176
- * @param {BeaconCohortSigningSession} session The session for which the partial signature is sent.
177
- * @param {Uint8Array} partialSig The partial signature to send.
178
- * @returns {Promise<void>}
179
- */
180
- sendPartialSignature(session: BeaconCohortSigningSession, partialSig: Uint8Array): Promise<void>;
181
- /**
182
- * Initializes a new BeaconParticipant instance.
183
- * @param {Seed | Mnemonic} ent The secret key used for signing.
184
- * @param {CommunicationService} protocol The communication protocol used by the participant.
185
- * @param {string} [name] The name of the participant.
186
- * @param {string} [did] The decentralized identifier (DID) of the participant.
187
- * @returns {BeaconParticipant} A new instance of BeaconParticipant.
188
- */
189
- static initialize(ent: Seed | Mnemonic, protocol: CommunicationService, did: string, name?: string): BeaconParticipant;
190
- }
191
- export {};
192
- //# sourceMappingURL=participant.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"participant.d.ts","sourceRoot":"","sources":["../../../../../src/core/beacon/aggregation/participant.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAEzD,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAKrC,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAQ1D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2CAA2C,CAAC;AAErF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0CAA0C,CAAC;AAMnF,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,4CAA4C,CAAC;AAE/F,OAAO,KAAK,EAAE,iCAAiC,EAAE,MAAM,iDAAiD,CAAC;AAOzG,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AACvE,OAAO,EAAE,0BAA0B,EAAE,MAAM,oBAAoB,CAAC;AAEhE,KAAK,IAAI,GAAG,QAAQ,CAAC;AACrB,KAAK,QAAQ,GAAG,MAAM,CAAC;AAEvB,KAAK,SAAS,GAAG,MAAM,CAAC;AACxB,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,CAAC,EAAE,MAAM,GAAG,iBAAiB;CAG9H"}
@@ -1,156 +0,0 @@
1
- import * as musig2 from '@scure/btc-signer/musig2';
2
- import { Transaction } from 'bitcoinjs-lib';
3
- import type { AggregateBeaconCohort } from '../cohort/index.js';
4
- import { BeaconCohortAuthorizationRequestMessage } from '../cohort/messages/sign/authorization-request.js';
5
- import type { SIGNING_SESSION_STATUS_TYPE } 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 declare function bigEndianToInt(bytes: Uint8Array): bigint;
12
- /**
13
- * Convert a bigint to a big-endian Uint8Array of specified length.
14
- * @param xInit - The bigint to convert.
15
- * @param length - The desired length of the output array in bytes.
16
- * @returns A Uint8Array representing the bigint in big-endian form.
17
- */
18
- export declare function intToBigEndian(xInit: bigint, length: number): Uint8Array;
19
- type PublicKeyHex = string;
20
- type Nonce = Uint8Array;
21
- type NonceContributions = Map<PublicKeyHex, Nonce>;
22
- type PartialSignatures = Map<string, Uint8Array>;
23
- type ProcessedRequests = Record<string, string>;
24
- export interface SigningSession {
25
- id?: string;
26
- cohort: AggregateBeaconCohort;
27
- pendingTx: Transaction;
28
- nonceContributions?: NonceContributions;
29
- aggregatedNonce?: Uint8Array;
30
- partialSignatures?: PartialSignatures;
31
- signature?: Uint8Array;
32
- status?: SIGNING_SESSION_STATUS_TYPE;
33
- processedRequests?: ProcessedRequests;
34
- nonceSecrets?: bigint;
35
- }
36
- export declare class BeaconCohortSigningSession implements SigningSession {
37
- /**
38
- * Unique identifier for the signing session.
39
- * @type {string}
40
- */
41
- id: string;
42
- /**
43
- * DID of the coordinator.
44
- * @type {AggregateBeaconCohort}
45
- */
46
- cohort: AggregateBeaconCohort;
47
- /**
48
- * Pending transaction to be signed.
49
- * @type {Transaction}
50
- */
51
- pendingTx: Transaction;
52
- /**
53
- * Map of nonce contributions from participants.
54
- * @type {Map<PublicKeyHex, Nonce>}
55
- */
56
- nonceContributions: Map<PublicKeyHex, Nonce>;
57
- /**
58
- * Aggregated nonce from all participants.
59
- * @type {Uint8Array}
60
- */
61
- aggregatedNonce?: Uint8Array;
62
- /**
63
- * Map of partial signatures from participants.
64
- * @type {Map<string, Uint8Array>}
65
- */
66
- partialSignatures: Map<string, Uint8Array>;
67
- /**
68
- * Final signature for the transaction.
69
- * @type {Uint8Array}
70
- */
71
- signature?: Uint8Array;
72
- /**
73
- * Current status of the signing session.
74
- * @type {SIGNING_SESSION_STATUS_TYPE}
75
- */
76
- status: SIGNING_SESSION_STATUS_TYPE;
77
- /**
78
- * Map of processed requests from participants.
79
- * @type {Record<string, string>}
80
- */
81
- processedRequests: Record<string, string>;
82
- /**
83
- * Secrets for nonces contributed by participants.
84
- * @type {Array<bigint>}
85
- */
86
- nonceSecrets?: bigint;
87
- /**
88
- * Musig2 session for signing operations.
89
- * @type {musig2.Session}
90
- */
91
- musig2Session?: musig2.Session;
92
- /**
93
- * Creates a new instance of BeaconCohortSigningSession.
94
- * @param {SigningSession} params Parameters to initialize the signing session.
95
- * @param {Transaction} params.pendingTx The pending transaction to be signed.
96
- * @param {string} [params.id] Optional unique identifier for the signing session. If not provided, a new UUID will be generated.
97
- * @param {AggregateBeaconCohort} [params.cohort] The cohort associated with the signing session.
98
- * @param {Record<string, string>} [params.processedRequests] Map of processed requests from participants.
99
- * @param {SIGNING_SESSION_STATUS_TYPE} [params.status] The current status of the signing session. Defaults to AWAITING_NONCE_CONTRIBUTIONS.
100
- */
101
- constructor({ id, cohort, pendingTx, processedRequests, status }: SigningSession);
102
- /**
103
- * Gets the authorization request message for a participant.
104
- * @param {string} to The public key of the participant to whom the request is sent.
105
- * @param {string} from The public key of the participant sending the request.
106
- * @returns {AuthorizationRequest} The authorization request message.
107
- */
108
- getAuthorizationRequest(to: string, from: string): BeaconCohortAuthorizationRequestMessage;
109
- /**
110
- * Adds a nonce contribution from a participant to the session.
111
- * @param {string} from The public key of the participant contributing the nonce.
112
- * @param {Array<string>} nonceContribution The nonce contribution from the participant.
113
- * @throws {Error} If the session is not awaiting nonce contributions or if the contribution is invalid.
114
- */
115
- addNonceContribution(from: string, nonceContribution: Uint8Array): void;
116
- /**
117
- * Generates the aggregated nonce from all nonce contributions for the session.
118
- * @returns {Uint8Array} The aggregated nonce.
119
- * @throws {AggregateBeaconError} If not all nonce contributions have been received.
120
- */
121
- generateAggregatedNonce(): Uint8Array;
122
- /**
123
- * Adds a partial signature from a participant to the session.
124
- * @param {string} from The public key of the participant contributing the partial signature.
125
- * @param {Uint8Array} partialSignature The partial signature from the participant.
126
- */
127
- addPartialSignature(from: string, partialSignature: Uint8Array): void;
128
- /**
129
- * Generates the final signature from all partial signatures.
130
- * @returns {Uint8Array} The final aggregated signature.
131
- */
132
- generateFinalSignature(): Promise<Uint8Array>;
133
- /**
134
- * Generates a partial signature for the session using the participant's secret key.
135
- * @param {Uint8Array} participantSk The secret key of the participant.
136
- * @returns {Uint8Array} The partial signature generated by the participant.
137
- */
138
- generatePartialSignature(participantSk: Uint8Array): Uint8Array;
139
- /**
140
- * Converts the signing session instance to a JSON object representation.
141
- * @returns {BeaconCohortSigningSession} The JSON object representation of the signing session.
142
- */
143
- toJSON(): Partial<BeaconCohortSigningSession>;
144
- /**
145
- * Checks if the signing session is a completed state.
146
- * @returns {boolean} True if the session is complete, false otherwise.
147
- */
148
- isComplete(): boolean;
149
- /**
150
- * Checks if the signing session is in a failed state.
151
- * @returns {boolean} True if the session has failed, false otherwise.
152
- */
153
- isFailed(): boolean;
154
- }
155
- export {};
156
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","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;AAE5C,OAAO,KAAK,EAAE,qBAAqB,EAAE,M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| 'NONCE_CONTRIBUTIONS_RECEIVED' | 'AWAITING_PARTIAL_SIGNATURES' | 'PARTIAL_SIGNATURES_RECEIVED' | 'SIGNATURE_COMPLETE' | 'FAILED';
2
- export declare enum SIGNING_SESSION_STATUS {
3
- AWAITING_NONCE_CONTRIBUTIONS = "AWAITING_NONCE_CONTRIBUTIONS",
4
- NONCE_CONTRIBUTION_SENT = "NONCE_CONTRIBUTION_SENT",
5
- NONCE_CONTRIBUTIONS_RECEIVED = "NONCE_CONTRIBUTIONS_RECEIVED",
6
- AWAITING_PARTIAL_SIGNATURES = "AWAITING_PARTIAL_SIGNATURES",
7
- PARTIAL_SIGNATURES_RECEIVED = "PARTIAL_SIGNATURES_RECEIVED",
8
- SIGNATURE_COMPLETE = "SIGNATURE_COMPLETE",
9
- FAILED = "FAILED"
10
- }
11
- //# sourceMappingURL=status.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../../../../../src/core/beacon/aggregation/session/status.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,2BAA2B,GACjC,8BAA8B,GAC9B,yBAAyB,GACzB,8BAA8B,GAC9B,6BAA6B,GAC7B,6BAA6B,GAC7B,oBAAoB,GACpB,QAAQ,CAAA;AAEd,oBAAY,sBAAsB;IAC9B,4BAA4B,iCAAiC;IAC7D,uBAAuB,4BAA4B;IACnD,4BAA4B,iCAAiC;IAC7D,2BAA2B,gCAAgC;IAC3D,2BAA2B,gCAAgC;IAC3D,kBAAkB,uBAAuB;IACzC,MAAM,WAAW;CACpB"}
@@ -1,52 +0,0 @@
1
- import type { KeyBytes, PatchOperation } from '@did-btcr2/common';
2
- import type { SignedBTCR2Update, UnsignedBTCR2Update } from '@did-btcr2/cryptosuite';
3
- import type { Btcr2DidDocument, DidVerificationMethod } from '../utils/did-document.js';
4
- import type { BeaconService } from './beacon/interfaces.js';
5
- import type { BitcoinConnection } from '@did-btcr2/bitcoin';
6
- /**
7
- * Implements {@link https://dcdpr.github.io/did-btcr2/operations/update.html | 7.3 Update}.
8
- *
9
- * An update to a did:btcr2 document is an invoked capability using the ZCAP-LD
10
- * data format, signed by a verificationMethod that has the authority to make
11
- * the update as specified in the previous DID document. Capability invocations
12
- * for updates MUST be authorized using Data Integrity following the
13
- * bip340-jcs-2025 cryptosuite with a proofPurpose of capabilityInvocation.
14
- *
15
- * @class Update
16
- * @type {Update}
17
- */
18
- export declare class Update {
19
- /**
20
- * Implements subsection {@link https://dcdpr.github.io/did-btcr2/operations/update.html#construct-btcr2-unsigned-update | 7.3.b Construct BTCR2 Unsigned Update}.
21
- * This process constructs a BTCR2 Unsigned Update conformant to the spec template.
22
- *
23
- * @param {Btcr2DidDocument} sourceDocument The source DID document to be updated.
24
- * @param {PatchOperation[]} patches The array of JSON Patch operations to apply to the sourceDocument.
25
- * @param {number} sourceVersionId The version ID of the source document.
26
- * @returns {UnsignedBTCR2Update} The constructed UnsignedBTCR2Update object.
27
- * @throws {UpdateError} InvalidDid if sourceDocument.id does not match identifier.
28
- */
29
- static construct(sourceDocument: Btcr2DidDocument, patches: PatchOperation[], sourceVersionId: number): UnsignedBTCR2Update;
30
- /**
31
- * Implements subsection {@link http://dcdpr.github.io/did-btcr2/operations/update.html#construct-btcr2-signed-update | 7.3.c Construct BTCR2 Signed Update }.
32
- * This process constructs a BTCR2 Signed Update from a BTCR2 Unsigned Update.
33
- *
34
- * @param {string} did The did-btcr2 identifier to derive the root capability from
35
- * @param {UnsignedBTCR2Update} unsignedUpdate The updatePayload object to be signed
36
- * @param {DidVerificationMethod} verificationMethod The verificationMethod object to be used for signing
37
- * @returns {SignedBTCR2Update} Did update payload secured with a proof => SignedBTCR2Update
38
- * @throws {UpdateError} if the privateKeyBytes are invalid
39
- */
40
- static sign(did: string, unsignedUpdate: UnsignedBTCR2Update, verificationMethod: DidVerificationMethod, secretKey: KeyBytes): SignedBTCR2Update;
41
- /**
42
- * Implements subsection {@link https://dcdpr.github.io/did-btcr2/operations/update.html#announce-did-update | 7.3.d Announce DID Update}.
43
- * BTCR2 Signed Updates are announced to the Bitcoin blockchain depending on the Beacon Type.
44
- * @param {BeaconService} beaconService The BeaconService object representing the funded beacon to announce the update to.
45
- * @param {SignedBTCR2Update} update The signed update object to be announced.
46
- * @param {KeyBytes} secretKey The private key used to sign the update for announcement.
47
- * @returns {SignedBTCR2Update} The SignedBTCR2Update object containing data to validate the Beacon Signal
48
- * @throws {UpdateError} if the beaconService type is invalid
49
- */
50
- static announce(beaconService: BeaconService, update: SignedBTCR2Update, secretKey: KeyBytes, bitcoin: BitcoinConnection): Promise<SignedBTCR2Update>;
51
- }
52
- //# sourceMappingURL=update.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../../../src/core/update.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,QAAQ,EACR,cAAc,EAAC,MAAM,mBAAmB,CAAC;AAO3C,OAAO,KAAK,EAEV,iBAAiB,EACjB,mBAAmB,EACpB,MAAM,wBAAwB,CAAC;AAIhC,OAAO,KAAK,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAGxF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAE5D;;;;;;;;;;;GAWG;AACH,qBAAa,MAAM;IACjB;;;;;;;;;OASG;IACH,MAAM,CAAC,SAAS,CACd,cAAc,EAAE,gBAAgB,EAChC,OAAO,EAAE,cAAc,EAAE,EACzB,eAAe,EAAE,MAAM,GACtB,mBAAmB;IAoCtB;;;;;;;;;OASG;IACH,MAAM,CAAC,IAAI,CACT,GAAG,EAAE,MAAM,EACX,cAAc,EAAE,mBAAmB,EACnC,kBAAkB,EAAE,qBAAqB,EACzC,SAAS,EAAE,QAAQ,GAClB,iBAAiB;IAgCpB;;;;;;;;OAQG;WACU,QAAQ,CACnB,aAAa,EAAE,aAAa,EAC5B,MAAM,EAAE,iBAAiB,EACzB,SAAS,EAAE,QAAQ,EACnB,OAAO,EAAE,iBAAiB,GACzB,OAAO,CAAC,iBAAiB,CAAC;CAU9B"}