@did-btcr2/method 0.17.2 → 0.18.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 (366) hide show
  1. package/dist/browser.js +30124 -19552
  2. package/dist/browser.mjs +30123 -19551
  3. package/dist/cjs/core/beacon/aggregation/cohort/index.js +225 -0
  4. package/dist/cjs/core/beacon/aggregation/cohort/index.js.map +1 -0
  5. package/dist/{esm/core/beacon/aggregation → cjs/core/beacon/aggregation/cohort}/messages/base.js +3 -11
  6. package/dist/cjs/core/beacon/aggregation/cohort/messages/base.js.map +1 -0
  7. package/dist/cjs/core/beacon/aggregation/cohort/messages/constants.js +11 -0
  8. package/dist/cjs/core/beacon/aggregation/cohort/messages/constants.js.map +1 -0
  9. package/dist/cjs/core/beacon/aggregation/cohort/messages/index.js +98 -0
  10. package/dist/cjs/core/beacon/aggregation/cohort/messages/index.js.map +1 -0
  11. package/dist/cjs/core/beacon/aggregation/cohort/messages/keygen/cohort-advert.js +30 -0
  12. package/dist/cjs/core/beacon/aggregation/cohort/messages/keygen/cohort-advert.js.map +1 -0
  13. package/dist/cjs/core/beacon/aggregation/cohort/messages/keygen/cohort-ready.js +28 -0
  14. package/dist/cjs/core/beacon/aggregation/cohort/messages/keygen/cohort-ready.js.map +1 -0
  15. package/dist/cjs/core/beacon/aggregation/cohort/messages/keygen/opt-in-accept.js +26 -0
  16. package/dist/cjs/core/beacon/aggregation/cohort/messages/keygen/opt-in-accept.js.map +1 -0
  17. package/dist/cjs/core/beacon/aggregation/cohort/messages/keygen/opt-in.js +22 -0
  18. package/dist/cjs/core/beacon/aggregation/cohort/messages/keygen/opt-in.js.map +1 -0
  19. package/dist/cjs/core/beacon/aggregation/cohort/messages/keygen/subscribe.js +27 -0
  20. package/dist/cjs/core/beacon/aggregation/cohort/messages/keygen/subscribe.js.map +1 -0
  21. package/dist/cjs/core/beacon/aggregation/cohort/messages/sign/aggregated-nonce.js +28 -0
  22. package/dist/cjs/core/beacon/aggregation/cohort/messages/sign/aggregated-nonce.js.map +1 -0
  23. package/dist/cjs/core/beacon/aggregation/cohort/messages/sign/authorization-request.js +29 -0
  24. package/dist/cjs/core/beacon/aggregation/cohort/messages/sign/authorization-request.js.map +1 -0
  25. package/dist/cjs/core/beacon/aggregation/cohort/messages/sign/nonce-contribution.js +29 -0
  26. package/dist/cjs/core/beacon/aggregation/cohort/messages/sign/nonce-contribution.js.map +1 -0
  27. package/dist/cjs/core/beacon/aggregation/cohort/messages/sign/request-signature.js +29 -0
  28. package/dist/cjs/core/beacon/aggregation/cohort/messages/sign/request-signature.js.map +1 -0
  29. package/dist/cjs/core/beacon/aggregation/cohort/messages/sign/signature-authorization.js +30 -0
  30. package/dist/cjs/core/beacon/aggregation/cohort/messages/sign/signature-authorization.js.map +1 -0
  31. package/dist/cjs/core/beacon/aggregation/cohort/status.js.map +1 -0
  32. package/dist/cjs/core/beacon/aggregation/communication/adapter/did-comm.js +126 -0
  33. package/dist/cjs/core/beacon/aggregation/communication/adapter/did-comm.js.map +1 -0
  34. package/dist/cjs/core/beacon/aggregation/communication/adapter/nostr.js +230 -0
  35. package/dist/cjs/core/beacon/aggregation/communication/adapter/nostr.js.map +1 -0
  36. package/dist/cjs/core/beacon/aggregation/communication/error.js +12 -0
  37. package/dist/cjs/core/beacon/aggregation/communication/error.js.map +1 -0
  38. package/dist/cjs/core/beacon/aggregation/communication/factory.js +21 -0
  39. package/dist/cjs/core/beacon/aggregation/communication/factory.js.map +1 -0
  40. package/dist/cjs/core/beacon/aggregation/communication/service.js.map +1 -0
  41. package/dist/cjs/core/beacon/aggregation/coordinator.js +282 -56
  42. package/dist/cjs/core/beacon/aggregation/coordinator.js.map +1 -1
  43. package/dist/cjs/core/beacon/aggregation/participant.js +435 -1
  44. package/dist/cjs/core/beacon/aggregation/participant.js.map +1 -1
  45. package/dist/cjs/core/beacon/aggregation/session/index.js +233 -0
  46. package/dist/cjs/core/beacon/aggregation/session/index.js.map +1 -0
  47. package/dist/cjs/core/beacon/aggregation/session/status.js +11 -0
  48. package/dist/cjs/core/beacon/aggregation/session/status.js.map +1 -0
  49. package/dist/cjs/core/beacon/cid-aggregate.js.map +1 -1
  50. package/dist/cjs/core/beacon/error.js +37 -0
  51. package/dist/cjs/core/beacon/error.js.map +1 -0
  52. package/dist/cjs/core/beacon/factory.js.map +1 -1
  53. package/dist/cjs/core/beacon/singleton.js +8 -5
  54. package/dist/cjs/core/beacon/singleton.js.map +1 -1
  55. package/dist/cjs/core/beacon/smt-aggregate.js.map +1 -1
  56. package/dist/cjs/{utils/beacons.js → core/beacon/utils.js} +4 -4
  57. package/dist/cjs/core/beacon/utils.js.map +1 -0
  58. package/dist/cjs/core/crud/read.js +2 -9
  59. package/dist/cjs/core/crud/read.js.map +1 -1
  60. package/dist/cjs/core/crud/update.js +18 -19
  61. package/dist/cjs/core/crud/update.js.map +1 -1
  62. package/dist/{esm/utils → cjs/core}/identifier.js +18 -3
  63. package/dist/cjs/core/identifier.js.map +1 -0
  64. package/dist/cjs/did-btcr2.js +2 -2
  65. package/dist/cjs/did-btcr2.js.map +1 -1
  66. package/dist/cjs/index.js +28 -6
  67. package/dist/cjs/index.js.map +1 -1
  68. package/dist/cjs/interfaces/beacon.js.map +1 -1
  69. package/dist/cjs/utils/appendix.js +2 -3
  70. package/dist/cjs/utils/appendix.js.map +1 -1
  71. package/dist/cjs/utils/did-document.js +4 -6
  72. package/dist/cjs/utils/did-document.js.map +1 -1
  73. package/dist/cjs/utils/types.js +2 -0
  74. package/dist/cjs/utils/types.js.map +1 -0
  75. package/dist/esm/core/beacon/aggregation/cohort/index.js +225 -0
  76. package/dist/esm/core/beacon/aggregation/cohort/index.js.map +1 -0
  77. package/dist/{cjs/core/beacon/aggregation → esm/core/beacon/aggregation/cohort}/messages/base.js +3 -11
  78. package/dist/esm/core/beacon/aggregation/cohort/messages/base.js.map +1 -0
  79. package/dist/esm/core/beacon/aggregation/cohort/messages/constants.js +11 -0
  80. package/dist/esm/core/beacon/aggregation/cohort/messages/constants.js.map +1 -0
  81. package/dist/esm/core/beacon/aggregation/cohort/messages/index.js +98 -0
  82. package/dist/esm/core/beacon/aggregation/cohort/messages/index.js.map +1 -0
  83. package/dist/esm/core/beacon/aggregation/cohort/messages/keygen/cohort-advert.js +30 -0
  84. package/dist/esm/core/beacon/aggregation/cohort/messages/keygen/cohort-advert.js.map +1 -0
  85. package/dist/esm/core/beacon/aggregation/cohort/messages/keygen/cohort-ready.js +28 -0
  86. package/dist/esm/core/beacon/aggregation/cohort/messages/keygen/cohort-ready.js.map +1 -0
  87. package/dist/esm/core/beacon/aggregation/cohort/messages/keygen/opt-in-accept.js +26 -0
  88. package/dist/esm/core/beacon/aggregation/cohort/messages/keygen/opt-in-accept.js.map +1 -0
  89. package/dist/esm/core/beacon/aggregation/cohort/messages/keygen/opt-in.js +22 -0
  90. package/dist/esm/core/beacon/aggregation/cohort/messages/keygen/opt-in.js.map +1 -0
  91. package/dist/esm/core/beacon/aggregation/cohort/messages/keygen/subscribe.js +27 -0
  92. package/dist/esm/core/beacon/aggregation/cohort/messages/keygen/subscribe.js.map +1 -0
  93. package/dist/esm/core/beacon/aggregation/cohort/messages/sign/aggregated-nonce.js +28 -0
  94. package/dist/esm/core/beacon/aggregation/cohort/messages/sign/aggregated-nonce.js.map +1 -0
  95. package/dist/esm/core/beacon/aggregation/cohort/messages/sign/authorization-request.js +29 -0
  96. package/dist/esm/core/beacon/aggregation/cohort/messages/sign/authorization-request.js.map +1 -0
  97. package/dist/esm/core/beacon/aggregation/cohort/messages/sign/nonce-contribution.js +29 -0
  98. package/dist/esm/core/beacon/aggregation/cohort/messages/sign/nonce-contribution.js.map +1 -0
  99. package/dist/esm/core/beacon/aggregation/cohort/messages/sign/request-signature.js +29 -0
  100. package/dist/esm/core/beacon/aggregation/cohort/messages/sign/request-signature.js.map +1 -0
  101. package/dist/esm/core/beacon/aggregation/cohort/messages/sign/signature-authorization.js +30 -0
  102. package/dist/esm/core/beacon/aggregation/cohort/messages/sign/signature-authorization.js.map +1 -0
  103. package/dist/esm/core/beacon/aggregation/cohort/status.js.map +1 -0
  104. package/dist/esm/core/beacon/aggregation/communication/adapter/did-comm.js +126 -0
  105. package/dist/esm/core/beacon/aggregation/communication/adapter/did-comm.js.map +1 -0
  106. package/dist/esm/core/beacon/aggregation/communication/adapter/nostr.js +230 -0
  107. package/dist/esm/core/beacon/aggregation/communication/adapter/nostr.js.map +1 -0
  108. package/dist/esm/core/beacon/aggregation/communication/error.js +12 -0
  109. package/dist/esm/core/beacon/aggregation/communication/error.js.map +1 -0
  110. package/dist/esm/core/beacon/aggregation/communication/factory.js +21 -0
  111. package/dist/esm/core/beacon/aggregation/communication/factory.js.map +1 -0
  112. package/dist/esm/core/beacon/aggregation/communication/service.js.map +1 -0
  113. package/dist/esm/core/beacon/aggregation/coordinator.js +282 -56
  114. package/dist/esm/core/beacon/aggregation/coordinator.js.map +1 -1
  115. package/dist/esm/core/beacon/aggregation/participant.js +435 -1
  116. package/dist/esm/core/beacon/aggregation/participant.js.map +1 -1
  117. package/dist/esm/core/beacon/aggregation/session/index.js +233 -0
  118. package/dist/esm/core/beacon/aggregation/session/index.js.map +1 -0
  119. package/dist/esm/core/beacon/aggregation/session/status.js +11 -0
  120. package/dist/esm/core/beacon/aggregation/session/status.js.map +1 -0
  121. package/dist/esm/core/beacon/cid-aggregate.js.map +1 -1
  122. package/dist/esm/core/beacon/error.js +37 -0
  123. package/dist/esm/core/beacon/error.js.map +1 -0
  124. package/dist/esm/core/beacon/factory.js.map +1 -1
  125. package/dist/esm/core/beacon/singleton.js +8 -5
  126. package/dist/esm/core/beacon/singleton.js.map +1 -1
  127. package/dist/esm/core/beacon/smt-aggregate.js.map +1 -1
  128. package/dist/esm/{utils/beacons.js → core/beacon/utils.js} +4 -4
  129. package/dist/esm/core/beacon/utils.js.map +1 -0
  130. package/dist/esm/core/crud/read.js +2 -9
  131. package/dist/esm/core/crud/read.js.map +1 -1
  132. package/dist/esm/core/crud/update.js +18 -19
  133. package/dist/esm/core/crud/update.js.map +1 -1
  134. package/dist/{cjs/utils → esm/core}/identifier.js +18 -3
  135. package/dist/esm/core/identifier.js.map +1 -0
  136. package/dist/esm/did-btcr2.js +2 -2
  137. package/dist/esm/did-btcr2.js.map +1 -1
  138. package/dist/esm/index.js +28 -6
  139. package/dist/esm/index.js.map +1 -1
  140. package/dist/esm/interfaces/beacon.js.map +1 -1
  141. package/dist/esm/utils/appendix.js +2 -3
  142. package/dist/esm/utils/appendix.js.map +1 -1
  143. package/dist/esm/utils/did-document.js +4 -6
  144. package/dist/esm/utils/did-document.js.map +1 -1
  145. package/dist/esm/utils/types.js +2 -0
  146. package/dist/esm/utils/types.js.map +1 -0
  147. package/dist/types/core/beacon/aggregation/cohort/index.d.ts +135 -0
  148. package/dist/types/core/beacon/aggregation/cohort/index.d.ts.map +1 -0
  149. package/dist/types/core/beacon/aggregation/{messages → cohort/messages}/base.d.ts +13 -8
  150. package/dist/types/core/beacon/aggregation/cohort/messages/base.d.ts.map +1 -0
  151. package/dist/types/core/beacon/aggregation/cohort/messages/constants.d.ts +10 -0
  152. package/dist/types/core/beacon/aggregation/cohort/messages/constants.d.ts.map +1 -0
  153. package/dist/types/core/beacon/aggregation/cohort/messages/index.d.ts +64 -0
  154. package/dist/types/core/beacon/aggregation/cohort/messages/index.d.ts.map +1 -0
  155. package/dist/types/core/beacon/aggregation/cohort/messages/keygen/cohort-advert.d.ts +28 -0
  156. package/dist/types/core/beacon/aggregation/cohort/messages/keygen/cohort-advert.d.ts.map +1 -0
  157. package/dist/types/core/beacon/aggregation/cohort/messages/keygen/cohort-ready.d.ts +26 -0
  158. package/dist/types/core/beacon/aggregation/cohort/messages/keygen/cohort-ready.d.ts.map +1 -0
  159. package/dist/types/core/beacon/aggregation/cohort/messages/keygen/opt-in-accept.d.ts +23 -0
  160. package/dist/types/core/beacon/aggregation/cohort/messages/keygen/opt-in-accept.d.ts.map +1 -0
  161. package/dist/types/core/beacon/aggregation/cohort/messages/keygen/opt-in.d.ts +19 -0
  162. package/dist/types/core/beacon/aggregation/cohort/messages/keygen/opt-in.d.ts.map +1 -0
  163. package/dist/types/core/beacon/aggregation/cohort/messages/keygen/subscribe.d.ts +24 -0
  164. package/dist/types/core/beacon/aggregation/cohort/messages/keygen/subscribe.d.ts.map +1 -0
  165. package/dist/types/core/beacon/aggregation/cohort/messages/sign/aggregated-nonce.d.ts +24 -0
  166. package/dist/types/core/beacon/aggregation/cohort/messages/sign/aggregated-nonce.d.ts.map +1 -0
  167. package/dist/types/core/beacon/aggregation/cohort/messages/sign/authorization-request.d.ts +25 -0
  168. package/dist/types/core/beacon/aggregation/cohort/messages/sign/authorization-request.d.ts.map +1 -0
  169. package/dist/types/core/beacon/aggregation/cohort/messages/sign/nonce-contribution.d.ts +25 -0
  170. package/dist/types/core/beacon/aggregation/cohort/messages/sign/nonce-contribution.d.ts.map +1 -0
  171. package/dist/types/core/beacon/aggregation/cohort/messages/sign/request-signature.d.ts +25 -0
  172. package/dist/types/core/beacon/aggregation/cohort/messages/sign/request-signature.d.ts.map +1 -0
  173. package/dist/types/core/beacon/aggregation/cohort/messages/sign/signature-authorization.d.ts +26 -0
  174. package/dist/types/core/beacon/aggregation/cohort/messages/sign/signature-authorization.d.ts.map +1 -0
  175. package/dist/types/core/beacon/aggregation/cohort/status.d.ts.map +1 -0
  176. package/dist/types/core/beacon/aggregation/communication/adapter/did-comm.d.ts +88 -0
  177. package/dist/types/core/beacon/aggregation/communication/adapter/did-comm.d.ts.map +1 -0
  178. package/dist/types/core/beacon/aggregation/communication/adapter/nostr.d.ts +93 -0
  179. package/dist/types/core/beacon/aggregation/communication/adapter/nostr.d.ts.map +1 -0
  180. package/dist/types/core/beacon/aggregation/communication/error.d.ts +7 -0
  181. package/dist/types/core/beacon/aggregation/communication/error.d.ts.map +1 -0
  182. package/dist/types/core/beacon/aggregation/communication/factory.d.ts +9 -0
  183. package/dist/types/core/beacon/aggregation/communication/factory.d.ts.map +1 -0
  184. package/dist/types/core/beacon/aggregation/communication/service.d.ts +35 -0
  185. package/dist/types/core/beacon/aggregation/communication/service.d.ts.map +1 -0
  186. package/dist/types/core/beacon/aggregation/coordinator.d.ts +79 -26
  187. package/dist/types/core/beacon/aggregation/coordinator.d.ts.map +1 -1
  188. package/dist/types/core/beacon/aggregation/participant.d.ts +190 -0
  189. package/dist/types/core/beacon/aggregation/participant.d.ts.map +1 -1
  190. package/dist/types/core/beacon/aggregation/session/index.d.ts +155 -0
  191. package/dist/types/core/beacon/aggregation/session/index.d.ts.map +1 -0
  192. package/dist/types/core/beacon/aggregation/session/status.d.ts +10 -0
  193. package/dist/types/core/beacon/aggregation/session/status.d.ts.map +1 -0
  194. package/dist/types/core/beacon/cid-aggregate.d.ts +3 -4
  195. package/dist/types/core/beacon/cid-aggregate.d.ts.map +1 -1
  196. package/dist/types/core/beacon/error.d.ts +22 -0
  197. package/dist/types/core/beacon/error.d.ts.map +1 -0
  198. package/dist/types/core/beacon/factory.d.ts +2 -3
  199. package/dist/types/core/beacon/factory.d.ts.map +1 -1
  200. package/dist/types/core/beacon/singleton.d.ts +2 -3
  201. package/dist/types/core/beacon/singleton.d.ts.map +1 -1
  202. package/dist/types/core/beacon/smt-aggregate.d.ts +3 -4
  203. package/dist/types/core/beacon/smt-aggregate.d.ts.map +1 -1
  204. package/dist/types/{utils/beacons.d.ts → core/beacon/utils.d.ts} +3 -3
  205. package/dist/types/core/beacon/utils.d.ts.map +1 -0
  206. package/dist/types/core/crud/read.d.ts +3 -3
  207. package/dist/types/core/crud/read.d.ts.map +1 -1
  208. package/dist/types/core/crud/update.d.ts +1 -1
  209. package/dist/types/core/crud/update.d.ts.map +1 -1
  210. package/dist/types/{utils → core}/identifier.d.ts +24 -3
  211. package/dist/types/core/identifier.d.ts.map +1 -0
  212. package/dist/types/did-btcr2.d.ts +1 -1
  213. package/dist/types/did-btcr2.d.ts.map +1 -1
  214. package/dist/types/index.d.ts +28 -6
  215. package/dist/types/index.d.ts.map +1 -1
  216. package/dist/types/interfaces/beacon.d.ts +65 -5
  217. package/dist/types/interfaces/beacon.d.ts.map +1 -1
  218. package/dist/types/interfaces/crud.d.ts +1 -1
  219. package/dist/types/interfaces/crud.d.ts.map +1 -1
  220. package/dist/types/utils/appendix.d.ts +2 -10
  221. package/dist/types/utils/appendix.d.ts.map +1 -1
  222. package/dist/types/utils/did-document-builder.d.ts +1 -1
  223. package/dist/types/utils/did-document-builder.d.ts.map +1 -1
  224. package/dist/types/utils/did-document.d.ts +1 -1
  225. package/dist/types/utils/did-document.d.ts.map +1 -1
  226. package/dist/types/{types/crud.d.ts → utils/types.d.ts} +2 -2
  227. package/dist/types/utils/types.d.ts.map +1 -0
  228. package/package.json +4 -3
  229. package/src/core/beacon/aggregation/cohort/index.ts +292 -0
  230. package/src/core/beacon/aggregation/{messages → cohort/messages}/base.ts +14 -16
  231. package/src/core/beacon/aggregation/cohort/messages/constants.ts +12 -0
  232. package/src/core/beacon/aggregation/cohort/messages/index.ts +143 -0
  233. package/src/core/beacon/aggregation/cohort/messages/keygen/cohort-advert.ts +43 -0
  234. package/src/core/beacon/aggregation/cohort/messages/keygen/cohort-ready.ts +39 -0
  235. package/src/core/beacon/aggregation/cohort/messages/keygen/opt-in-accept.ts +34 -0
  236. package/src/core/beacon/aggregation/cohort/messages/keygen/opt-in.ts +33 -0
  237. package/src/core/beacon/aggregation/cohort/messages/keygen/subscribe.ts +35 -0
  238. package/src/core/beacon/aggregation/cohort/messages/sign/aggregated-nonce.ts +38 -0
  239. package/src/core/beacon/aggregation/cohort/messages/sign/authorization-request.ts +39 -0
  240. package/src/core/beacon/aggregation/cohort/messages/sign/nonce-contribution.ts +39 -0
  241. package/src/core/beacon/aggregation/cohort/messages/sign/request-signature.ts +39 -0
  242. package/src/core/beacon/aggregation/cohort/messages/sign/signature-authorization.ts +40 -0
  243. package/src/core/beacon/aggregation/communication/adapter/did-comm.ts +153 -0
  244. package/src/core/beacon/aggregation/communication/adapter/nostr.ts +300 -0
  245. package/src/core/beacon/aggregation/communication/error.ts +13 -0
  246. package/src/core/beacon/aggregation/communication/factory.ts +25 -0
  247. package/src/core/beacon/aggregation/communication/service.ts +42 -0
  248. package/src/core/beacon/aggregation/coordinator.ts +338 -67
  249. package/src/core/beacon/aggregation/participant.ts +512 -0
  250. package/src/core/beacon/aggregation/session/index.ts +289 -0
  251. package/src/core/beacon/aggregation/session/status.ts +18 -0
  252. package/src/core/beacon/cid-aggregate.ts +4 -5
  253. package/src/core/beacon/error.ts +44 -0
  254. package/src/core/beacon/factory.ts +2 -3
  255. package/src/core/beacon/singleton.ts +10 -8
  256. package/src/core/beacon/smt-aggregate.ts +4 -5
  257. package/src/{utils/beacons.ts → core/beacon/utils.ts} +5 -5
  258. package/src/core/crud/read.ts +7 -16
  259. package/src/core/crud/update.ts +25 -22
  260. package/src/{utils → core}/identifier.ts +35 -5
  261. package/src/did-btcr2.ts +4 -4
  262. package/src/index.ts +36 -8
  263. package/src/interfaces/beacon.ts +75 -5
  264. package/src/interfaces/crud.ts +1 -1
  265. package/src/utils/appendix.ts +3 -11
  266. package/src/utils/did-document-builder.ts +1 -1
  267. package/src/utils/did-document.ts +4 -7
  268. package/src/{types/crud.ts → utils/types.ts} +2 -2
  269. package/dist/cjs/core/beacon/aggregation/messages/advert.js +0 -24
  270. package/dist/cjs/core/beacon/aggregation/messages/advert.js.map +0 -1
  271. package/dist/cjs/core/beacon/aggregation/messages/base.js.map +0 -1
  272. package/dist/cjs/core/beacon/aggregation/messages/cohort-set.js +0 -25
  273. package/dist/cjs/core/beacon/aggregation/messages/cohort-set.js.map +0 -1
  274. package/dist/cjs/core/beacon/aggregation/messages/keygen.js +0 -8
  275. package/dist/cjs/core/beacon/aggregation/messages/keygen.js.map +0 -1
  276. package/dist/cjs/core/beacon/aggregation/messages/opt-in.js +0 -23
  277. package/dist/cjs/core/beacon/aggregation/messages/opt-in.js.map +0 -1
  278. package/dist/cjs/core/beacon/aggregation/messages/sign.js +0 -7
  279. package/dist/cjs/core/beacon/aggregation/messages/sign.js.map +0 -1
  280. package/dist/cjs/core/beacon/aggregation/models/cohort/index.js +0 -92
  281. package/dist/cjs/core/beacon/aggregation/models/cohort/index.js.map +0 -1
  282. package/dist/cjs/core/beacon/aggregation/models/cohort/status.js.map +0 -1
  283. package/dist/cjs/core/beacon/aggregation/protocol/nostr.js +0 -57
  284. package/dist/cjs/core/beacon/aggregation/protocol/nostr.js.map +0 -1
  285. package/dist/cjs/core/beacon/aggregation/protocol/service.js.map +0 -1
  286. package/dist/cjs/core/key-manager/index.js +0 -290
  287. package/dist/cjs/core/key-manager/index.js.map +0 -1
  288. package/dist/cjs/core/key-manager/interface.js +0 -2
  289. package/dist/cjs/core/key-manager/interface.js.map +0 -1
  290. package/dist/cjs/interfaces/ibeacon.js +0 -2
  291. package/dist/cjs/interfaces/ibeacon.js.map +0 -1
  292. package/dist/cjs/types/crud.js +0 -2
  293. package/dist/cjs/types/crud.js.map +0 -1
  294. package/dist/cjs/utils/beacons.js.map +0 -1
  295. package/dist/cjs/utils/identifier.js.map +0 -1
  296. package/dist/esm/core/beacon/aggregation/messages/advert.js +0 -24
  297. package/dist/esm/core/beacon/aggregation/messages/advert.js.map +0 -1
  298. package/dist/esm/core/beacon/aggregation/messages/base.js.map +0 -1
  299. package/dist/esm/core/beacon/aggregation/messages/cohort-set.js +0 -25
  300. package/dist/esm/core/beacon/aggregation/messages/cohort-set.js.map +0 -1
  301. package/dist/esm/core/beacon/aggregation/messages/keygen.js +0 -8
  302. package/dist/esm/core/beacon/aggregation/messages/keygen.js.map +0 -1
  303. package/dist/esm/core/beacon/aggregation/messages/opt-in.js +0 -23
  304. package/dist/esm/core/beacon/aggregation/messages/opt-in.js.map +0 -1
  305. package/dist/esm/core/beacon/aggregation/messages/sign.js +0 -7
  306. package/dist/esm/core/beacon/aggregation/messages/sign.js.map +0 -1
  307. package/dist/esm/core/beacon/aggregation/models/cohort/index.js +0 -92
  308. package/dist/esm/core/beacon/aggregation/models/cohort/index.js.map +0 -1
  309. package/dist/esm/core/beacon/aggregation/models/cohort/status.js.map +0 -1
  310. package/dist/esm/core/beacon/aggregation/protocol/nostr.js +0 -57
  311. package/dist/esm/core/beacon/aggregation/protocol/nostr.js.map +0 -1
  312. package/dist/esm/core/beacon/aggregation/protocol/service.js.map +0 -1
  313. package/dist/esm/core/key-manager/index.js +0 -290
  314. package/dist/esm/core/key-manager/index.js.map +0 -1
  315. package/dist/esm/core/key-manager/interface.js +0 -2
  316. package/dist/esm/core/key-manager/interface.js.map +0 -1
  317. package/dist/esm/interfaces/ibeacon.js +0 -2
  318. package/dist/esm/interfaces/ibeacon.js.map +0 -1
  319. package/dist/esm/types/crud.js +0 -2
  320. package/dist/esm/types/crud.js.map +0 -1
  321. package/dist/esm/utils/beacons.js.map +0 -1
  322. package/dist/esm/utils/identifier.js.map +0 -1
  323. package/dist/types/core/beacon/aggregation/messages/advert.d.ts +0 -22
  324. package/dist/types/core/beacon/aggregation/messages/advert.d.ts.map +0 -1
  325. package/dist/types/core/beacon/aggregation/messages/base.d.ts.map +0 -1
  326. package/dist/types/core/beacon/aggregation/messages/cohort-set.d.ts +0 -23
  327. package/dist/types/core/beacon/aggregation/messages/cohort-set.d.ts.map +0 -1
  328. package/dist/types/core/beacon/aggregation/messages/keygen.d.ts +0 -6
  329. package/dist/types/core/beacon/aggregation/messages/keygen.d.ts.map +0 -1
  330. package/dist/types/core/beacon/aggregation/messages/opt-in.d.ts +0 -22
  331. package/dist/types/core/beacon/aggregation/messages/opt-in.d.ts.map +0 -1
  332. package/dist/types/core/beacon/aggregation/messages/sign.d.ts +0 -5
  333. package/dist/types/core/beacon/aggregation/messages/sign.d.ts.map +0 -1
  334. package/dist/types/core/beacon/aggregation/models/cohort/index.d.ts +0 -77
  335. package/dist/types/core/beacon/aggregation/models/cohort/index.d.ts.map +0 -1
  336. package/dist/types/core/beacon/aggregation/models/cohort/status.d.ts.map +0 -1
  337. package/dist/types/core/beacon/aggregation/protocol/nostr.d.ts +0 -36
  338. package/dist/types/core/beacon/aggregation/protocol/nostr.d.ts.map +0 -1
  339. package/dist/types/core/beacon/aggregation/protocol/service.d.ts +0 -6
  340. package/dist/types/core/beacon/aggregation/protocol/service.d.ts.map +0 -1
  341. package/dist/types/core/key-manager/index.d.ts +0 -145
  342. package/dist/types/core/key-manager/index.d.ts.map +0 -1
  343. package/dist/types/core/key-manager/interface.d.ts +0 -113
  344. package/dist/types/core/key-manager/interface.d.ts.map +0 -1
  345. package/dist/types/interfaces/ibeacon.d.ts +0 -65
  346. package/dist/types/interfaces/ibeacon.d.ts.map +0 -1
  347. package/dist/types/types/crud.d.ts.map +0 -1
  348. package/dist/types/utils/beacons.d.ts.map +0 -1
  349. package/dist/types/utils/identifier.d.ts.map +0 -1
  350. package/src/core/beacon/aggregation/messages/advert.ts +0 -36
  351. package/src/core/beacon/aggregation/messages/cohort-set.ts +0 -37
  352. package/src/core/beacon/aggregation/messages/keygen.ts +0 -8
  353. package/src/core/beacon/aggregation/messages/opt-in.ts +0 -35
  354. package/src/core/beacon/aggregation/messages/sign.ts +0 -7
  355. package/src/core/beacon/aggregation/models/cohort/index.ts +0 -112
  356. package/src/core/beacon/aggregation/protocol/nostr.ts +0 -81
  357. package/src/core/beacon/aggregation/protocol/service.ts +0 -6
  358. package/src/core/key-manager/index.ts +0 -364
  359. package/src/core/key-manager/interface.ts +0 -129
  360. package/src/interfaces/ibeacon.ts +0 -75
  361. /package/dist/cjs/core/beacon/aggregation/{models/cohort → cohort}/status.js +0 -0
  362. /package/dist/cjs/core/beacon/aggregation/{protocol → communication}/service.js +0 -0
  363. /package/dist/esm/core/beacon/aggregation/{models/cohort → cohort}/status.js +0 -0
  364. /package/dist/esm/core/beacon/aggregation/{protocol → communication}/service.js +0 -0
  365. /package/dist/types/core/beacon/aggregation/{models/cohort → cohort}/status.d.ts +0 -0
  366. /package/src/core/beacon/aggregation/{models/cohort → cohort}/status.ts +0 -0
package/src/did-btcr2.ts CHANGED
@@ -5,7 +5,7 @@ import {
5
5
  METHOD_NOT_SUPPORTED,
6
6
  MethodError,
7
7
  PatchOperation,
8
- W3C_DID_RESOLUTION_V1
8
+ W3C_DID_RESOLUTION_V1,
9
9
  } from '@did-btcr2/common';
10
10
  import type { DidResolutionResult } from '@web5/dids';
11
11
  import {
@@ -20,10 +20,10 @@ import * as tinysecp from 'tiny-secp256k1';
20
20
  import { Resolve } from './core/crud/read.js';
21
21
  import { Update } from './core/crud/update.js';
22
22
  import { DidResolutionOptions } from './interfaces/crud.js';
23
- import { Appendix } from './utils/appendix.js';
24
23
  import { DidDocument, DidVerificationMethod } from './utils/did-document.js';
25
- import { Identifier } from './utils/identifier.js';
26
- import { SignalsMetadata } from './types/crud.js';
24
+ import { SignalsMetadata } from './utils/types.js';
25
+ import { Identifier } from './core/identifier.js';
26
+ import { Appendix } from './utils/appendix.js';
27
27
 
28
28
  export type Btcr2Identifier = string;
29
29
 
package/src/index.ts CHANGED
@@ -1,26 +1,54 @@
1
+ export * from './core/beacon/aggregation/cohort/messages/keygen/cohort-advert.js';
2
+ export * from './core/beacon/aggregation/cohort/messages/keygen/cohort-ready.js';
3
+ export * from './core/beacon/aggregation/cohort/messages/keygen/opt-in-accept.js';
4
+ export * from './core/beacon/aggregation/cohort/messages/keygen/opt-in.js';
5
+ export * from './core/beacon/aggregation/cohort/messages/keygen//subscribe.js';
6
+
7
+ export * from './core/beacon/aggregation/cohort/messages/sign/aggregated-nonce.js';
8
+ export * from './core/beacon/aggregation/cohort/messages/sign/authorization-request.js';
9
+ export * from './core/beacon/aggregation/cohort/messages/sign/nonce-contribution.js';
10
+ export * from './core/beacon/aggregation/cohort/messages/sign/request-signature.js';
11
+ export * from './core/beacon/aggregation/cohort/messages/sign/signature-authorization.js';
12
+
13
+ export * from './core/beacon/aggregation/cohort/messages/base.js';
14
+ export * from './core/beacon/aggregation/cohort/messages/constants.js';
15
+ export * from './core/beacon/aggregation/cohort/messages/index.js';
16
+
17
+ export * from './core/beacon/aggregation/cohort/index.js';
18
+ export * from './core/beacon/aggregation/cohort/status.js';
19
+
20
+ export * from './core/beacon/aggregation/communication/adapter/did-comm.js';
21
+ export * from './core/beacon/aggregation/communication/adapter/nostr.js';
22
+ export * from './core/beacon/aggregation/communication/error.js';
23
+ export * from './core/beacon/aggregation/communication/factory.js';
24
+ export * from './core/beacon/aggregation/communication/service.js';
25
+
26
+ export * from './core/beacon/aggregation/session/index.js';
27
+ export * from './core/beacon/aggregation/session/status.js';
28
+
29
+ export * from './core/beacon/aggregation/coordinator.js';
30
+ export * from './core/beacon/aggregation/participant.js';
31
+
1
32
  export * from './core/beacon/cid-aggregate.js';
33
+ export * from './core/beacon/error.js';
2
34
  export * from './core/beacon/factory.js';
3
35
  export * from './core/beacon/singleton.js';
4
36
  export * from './core/beacon/smt-aggregate.js';
37
+ export * from './core/beacon/utils.js';
5
38
 
6
39
  export * from './core/crud/deactivate.js';
7
40
  export * from './core/crud/read.js';
8
41
  export * from './core/crud/update.js';
9
42
 
10
- export * from './core/key-manager/index.js';
11
- export * from './core/key-manager/interface.js';
43
+ export * from './core/identifier.js';
12
44
 
13
45
  export * from './interfaces/beacon.js';
14
46
  export * from './interfaces/crud.js';
15
- export * from './interfaces/ibeacon.js';
16
-
17
- export * from './types/crud.js';
18
47
 
19
48
  export * from './utils/appendix.js';
20
- export * from './utils/beacons.js';
21
49
  export * from './utils/did-document-builder.js';
22
50
  export * from './utils/did-document.js';
23
51
  export * from './utils/general.js';
24
- export * from './utils/identifier.js';
52
+ export * from './utils/types.js';
25
53
 
26
- export * from './did-btcr2.js';
54
+ export * from './did-btcr2.js';
@@ -1,8 +1,78 @@
1
- import { DidUpdatePayload } from '@did-btcr2/common';
2
- import { DidServiceEndpoint } from '@web5/dids';
3
- import { RawTransactionV2, RawTransactionRest } from '@did-btcr2/bitcoin';
4
- import { SidecarData, SignalsMetadata } from '../types/crud.js';
5
- import { BeaconService, BeaconSignal, IBeacon } from './ibeacon.js';
1
+ import { RawTransactionRest, RawTransactionV2 } from '@did-btcr2/bitcoin';
2
+ import { DidUpdatePayload, UnixTimestamp } from '@did-btcr2/common';
3
+ import { DidServiceEndpoint, DidService as IDidService } from '@web5/dids';
4
+ import { SidecarData, SignalsMetadata } from '../utils/types.js';
5
+
6
+ /**
7
+ * Beacon interface
8
+ * @interface IBeacon
9
+ * @type {IBeacon}
10
+ */
11
+ export interface IBeacon {
12
+ /**
13
+ * A unique identifier for the Beacon
14
+ * @type {string}
15
+ */
16
+ id: string;
17
+
18
+ /**
19
+ * The type of the Beacon
20
+ * @type {string}
21
+ */
22
+ type: string;
23
+
24
+ /**
25
+ * The service endpoint of the Beacon
26
+ * @type {string}
27
+ */
28
+ serviceEndpoint: DidServiceEndpoint;
29
+
30
+ /**
31
+ * Returns the Beacon Service object
32
+ * @type {BeaconService}
33
+ */
34
+ service: BeaconService;
35
+
36
+ /**
37
+ * Generates a Beacon Signal Transaction
38
+ * @param {string} didUpdatePayload The DID update payload
39
+ * @returns {BeaconSignal} The Beacon Signal
40
+ */
41
+ generateSignal(didUpdatePayload: string): BeaconSignal;
42
+
43
+ /**
44
+ * Processes a Beacon Signal.
45
+ * @param {RawTransactionV2} signal The raw transaction
46
+ * @param {SidecarData} signalsMetadata The signals metadata from the sidecar data
47
+ * @returns {Promise<DidUpdatePayload | undefined>} The DID update payload
48
+ */
49
+ processSignal(signal: RawTransactionV2, signalsMetadata: SignalsMetadata): Promise<DidUpdatePayload | undefined>;
50
+
51
+
52
+ /**
53
+ * Broadcasts a signal.
54
+ * @param {DidUpdatePayload} didUpdatePayload The DID update payload.
55
+ * @returns {Promise<SignalMetadata>} The signal metadata.
56
+ */
57
+ broadcastSignal(didUpdatePayload: DidUpdatePayload): Promise<SignalsMetadata>;
58
+ }
59
+
60
+ export interface BeaconService extends IDidService {
61
+ serviceEndpoint: DidServiceEndpoint;
62
+ casType?: string;
63
+ }
64
+
65
+ export interface BeaconServiceAddress extends BeaconService {
66
+ address: string;
67
+ }
68
+ export interface BeaconSignal {
69
+ beaconId: string;
70
+ beaconType: string;
71
+ beaconAddress: string;
72
+ tx: RawTransactionRest | RawTransactionV2;
73
+ blockheight: number;
74
+ blocktime: UnixTimestamp;
75
+ }
6
76
 
7
77
  /**
8
78
  * Implements {@link https://dcdpr.github.io/did-btcr2/#update-beacons | 5. Beacons}.
@@ -1,7 +1,7 @@
1
1
  import { UnixTimestamp } from '@did-btcr2/common';
2
2
  import { DidResolutionOptions as IDidResolutionOptions } from '@web5/dids';
3
- import { SidecarData } from '../types/crud.js';
4
3
  import { DidDocument } from '../utils/did-document.js';
4
+ import { SidecarData } from '../utils/types.js';
5
5
 
6
6
  /**
7
7
  * Options for resolving a DID Document
@@ -1,25 +1,17 @@
1
- import { Bytes, HashBytes, Logger, W3C_ZCAP_V1 } from '@did-btcr2/common';
1
+ import { HashBytes, W3C_ZCAP_V1 } from '@did-btcr2/common';
2
2
  import { strings } from '@helia/strings';
3
3
  import {
4
4
  DidDocument,
5
5
  DidError,
6
6
  DidErrorCode,
7
7
  DidService,
8
+ DidVerificationMethod,
8
9
  DidVerificationRelationship
9
10
  } from '@web5/dids';
10
11
  import { createHelia } from 'helia';
11
12
  import { CID } from 'multiformats';
12
13
  import { create as createDigest } from 'multiformats/hashes/digest';
13
14
  import { RootCapability } from '../interfaces/crud.js';
14
- import { DidVerificationMethod } from './did-document.js';
15
-
16
- export interface DidComponents {
17
- hrp: string;
18
- idType: string;
19
- version: number;
20
- network: string;
21
- genesisBytes: Bytes;
22
- };
23
15
 
24
16
  /**
25
17
  * Implements {@link https://dcdpr.github.io/did-btcr2/#appendix | 9. Appendix} methods.
@@ -246,7 +238,7 @@ export class Appendix {
246
238
  const helia = strings(await createHelia());
247
239
 
248
240
  // 2. Set content to the result of fetching the cid from a CAS system. Which CAS systems checked is up to implementation.
249
- Logger.warn('// TODO: Is this right? Are implementations just supposed to check all CAS they trust?');
241
+ // TODO: Is this right? Are implementations just supposed to check all CAS they trust?'
250
242
  const content = await helia.get(cid, {});
251
243
 
252
244
  // 3. If content for cid cannot be found, set content to null.
@@ -1,5 +1,5 @@
1
1
  import { DidDocumentError, INVALID_DID_DOCUMENT } from '@did-btcr2/common';
2
- import { BeaconService } from '../interfaces/ibeacon.js';
2
+ import { BeaconService } from '../interfaces/beacon.js';
3
3
  import { DidDocument, DidVerificationMethod } from './did-document.js';
4
4
 
5
5
  export class DidDocumentBuilder {
@@ -7,14 +7,13 @@ import {
7
7
  INVALID_DID_DOCUMENT,
8
8
  JSONObject,
9
9
  KeyBytes,
10
- Logger
11
10
  } from '@did-btcr2/common';
12
11
  import { CompressedSecp256k1PublicKey } from '@did-btcr2/keypair';
13
12
  import { DidService, DidDocument as IIDidDocument, DidVerificationMethod as IIDidVerificationMethod } from '@web5/dids';
14
- import { BeaconService } from '../interfaces/ibeacon.js';
13
+ import { BeaconService } from '../interfaces/beacon.js';
14
+ import { BeaconUtils } from '../core/beacon/utils.js';
15
+ import { Identifier } from '../core/identifier.js';
15
16
  import { Appendix } from './appendix.js';
16
- import { BeaconUtils } from './beacons.js';
17
- import { Identifier } from './identifier.js';
18
17
 
19
18
  export const BECH32M_CHARS = '';
20
19
  export const DID_REGEX = /did:btcr2:(x1[qpzry9x8gf2tvdw0s3jn54khce6mua7l]*)/g;
@@ -123,7 +122,6 @@ export class DidDocument implements IDidDocument {
123
122
  service: Array<BeaconService>;
124
123
 
125
124
  constructor(document: IDidDocument) {
126
- console.log('Constructing DidDocument with document:', document);
127
125
  // Set the ID and ID type
128
126
  const idType = document.id.includes('k1')
129
127
  ? IdentifierTypes.KEY
@@ -299,8 +297,7 @@ export class DidDocument implements IDidDocument {
299
297
  try {
300
298
  Identifier.decode(id);
301
299
  return true;
302
- } catch (error: any) {
303
- Logger.error('Invalid DID Document ID', error);
300
+ } catch {
304
301
  return false;
305
302
  }
306
303
  }
@@ -1,6 +1,6 @@
1
1
  import { DidUpdatePayload, ProofBytes } from '@did-btcr2/common';
2
- import { BeaconService } from '../interfaces/ibeacon.js';
3
- import { DidDocument } from '../utils/did-document.js';
2
+ import { BeaconService } from '../interfaces/beacon.js';
3
+ import { DidDocument } from './did-document.js';
4
4
  import { BlockV3 } from '@did-btcr2/bitcoin';
5
5
 
6
6
  export type FindNextSignals = {
@@ -1,24 +0,0 @@
1
- import { BaseMessage } from './base.js';
2
- export class AdvertMessage extends BaseMessage {
3
- cohortId;
4
- cohortSize;
5
- network = 'signet';
6
- constructor({ type = 'BEACON_ADVERT', to, from, threadId, cohortId, cohortSize, network }) {
7
- super({ type, to, from, threadId, body: { cohortId, cohortSize, network } });
8
- this.cohortId = cohortId;
9
- this.cohortSize = cohortSize;
10
- this.network = network;
11
- }
12
- /**
13
- * Initializes an AdvertMessage from a given Advert object.
14
- * @param {Advert} data - The Advert object to initialize the AdvertMessage.
15
- * @returns {object} The serialized AdvertMessage.
16
- */
17
- static initialize(data) {
18
- if (data.type != 'BEACON_ADVERT') {
19
- throw new Error(`Invalid type: ${data.type}`);
20
- }
21
- return new AdvertMessage(data);
22
- }
23
- }
24
- //# sourceMappingURL=advert.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"advert.js","sourceRoot":"","sources":["../../../../../../src/core/beacon/aggregation/messages/advert.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAYxC,MAAM,OAAO,aAAc,SAAQ,WAAW;IACrC,QAAQ,CAAS;IACjB,UAAU,CAAS;IACnB,OAAO,GAAW,QAAQ,CAAC;IAElC,YAAY,EAAE,IAAI,GAAG,eAAe,EAAE,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,UAAU,EAAE,OAAO,EAAU;QAC/F,KAAK,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE,QAAQ,EAAE,UAAU,EAAE,OAAO,EAAE,EAAC,CAAC,CAAC;QAC5E,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAED;;;;OAIG;IACI,MAAM,CAAC,UAAU,CAAC,IAAY;QACnC,IAAI,IAAI,CAAC,IAAI,IAAI,eAAe,EAAC,CAAC;YAChC,MAAM,IAAI,KAAK,CAAC,iBAAiB,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;QAChD,CAAC;QACD,OAAO,IAAI,aAAa,CAAC,IAAI,CAAC,CAAC;IACjC,CAAC;CACF"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"base.js","sourceRoot":"","sources":["../../../../../../src/core/beacon/aggregation/messages/base.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,cAAc,GAAG,sBAAsB,CAAC;AAmBrD,MAAM,OAAO,WAAW;IACf,IAAI,CAAS;IACb,EAAE,CAAS;IACX,IAAI,CAAS;IACb,QAAQ,CAAU;IAClB,IAAI,CAAW;IAEtB,YAAY,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAQ;QAClD,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;QACb,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IAED;;;;OAIG;IACI,MAAM,CAAC,QAAQ,CAAC,IAAiB;QACtC,OAAO,IAAI,WAAW,CAAC,IAAI,CAAC,CAAC;IAC/B,CAAC;IAED;;;OAGG;IACI,IAAI;QACT,OAAO;YACL,IAAI,EAAO,IAAI,CAAC,IAAI;YACpB,EAAE,EAAS,IAAI,CAAC,EAAE;YAClB,IAAI,EAAO,IAAI,CAAC,IAAI;YACpB,QAAQ,EAAG,IAAI,CAAC,QAAQ;YACxB,IAAI,EAAO,IAAI,CAAC,IAAI,IAAI,EAAE;SAC3B,CAAC;IACJ,CAAC;CACF"}
@@ -1,25 +0,0 @@
1
- import { BaseMessage } from './base.js';
2
- import { COHORT_SET } from './keygen.js';
3
- export class CohortSetMessage extends BaseMessage {
4
- cohortId;
5
- beaconAddress;
6
- cohortKeys;
7
- constructor({ type = COHORT_SET, to, from, threadId, cohortId, beaconAddress, cohortKeys }) {
8
- super({ type, to, from, threadId, body: { cohortId, beaconAddress, cohortKeys } });
9
- this.cohortId = cohortId;
10
- this.beaconAddress = beaconAddress;
11
- this.cohortKeys = cohortKeys;
12
- }
13
- /**
14
- * Initializes an CohortSetMessage from a given OptIn object.
15
- * @param {OptIn} data - The OptIn object to initialize the CohortSetMessage.
16
- * @returns {object} The serialized CohortSetMessage.
17
- */
18
- static fromJSON(data) {
19
- if (data.type !== COHORT_SET) {
20
- throw new Error(`Invalid type: ${data.type}`);
21
- }
22
- return new CohortSetMessage(data);
23
- }
24
- }
25
- //# sourceMappingURL=cohort-set.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"cohort-set.js","sourceRoot":"","sources":["../../../../../../src/core/beacon/aggregation/messages/cohort-set.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAYzC,MAAM,OAAO,gBAAiB,SAAQ,WAAW;IACxC,QAAQ,CAAS;IACjB,aAAa,CAAS;IACtB,UAAU,CAAoB;IAErC,YAAY,EAAE,IAAI,GAAG,UAAU,EAAE,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,aAAa,EAAE,UAAU,EAAa;QACnG,KAAK,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE,QAAQ,EAAE,aAAa,EAAE,UAAU,EAAE,EAAC,CAAC,CAAC;QAClF,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;QACnC,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;IAC/B,CAAC;IAED;;;;OAIG;IACI,MAAM,CAAC,QAAQ,CAAC,IAAe;QACpC,IAAI,IAAI,CAAC,IAAI,KAAK,UAAU,EAAE,CAAC;YAC7B,MAAM,IAAI,KAAK,CAAC,iBAAiB,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;QAChD,CAAC;QACD,OAAO,IAAI,gBAAgB,CAAC,IAAI,CAAC,CAAC;IACpC,CAAC;CACF"}
@@ -1,8 +0,0 @@
1
- import { MESSAGE_PREFIX } from './base.js';
2
- export const COHORT_ADVERT = `${MESSAGE_PREFIX}musig2/keygen/cohort_advert`;
3
- export const COHORT_INVITE = `${MESSAGE_PREFIX}musig2/keygen/cohort_invite`;
4
- export const OPT_IN = `${MESSAGE_PREFIX}musig2/keygen/opt_in`;
5
- export const COHORT_SET = `${MESSAGE_PREFIX}musig2/keygen/cohort_set`;
6
- export const SUBSCRIBE = `${MESSAGE_PREFIX}musig2/keygen/subscribe`;
7
- export const SUBSCRIBE_ACCEPT = `${MESSAGE_PREFIX}musig2/keygen/subscribe_accept`;
8
- //# sourceMappingURL=keygen.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"keygen.js","sourceRoot":"","sources":["../../../../../../src/core/beacon/aggregation/messages/keygen.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAE3C,MAAM,CAAC,MAAM,aAAa,GAAG,GAAG,cAAc,6BAA6B,CAAC;AAC5E,MAAM,CAAC,MAAM,aAAa,GAAG,GAAG,cAAc,6BAA6B,CAAC;AAC5E,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,cAAc,sBAAsB,CAAC;AAC9D,MAAM,CAAC,MAAM,UAAU,GAAG,GAAG,cAAc,0BAA0B,CAAC;AACtE,MAAM,CAAC,MAAM,SAAS,GAAG,GAAG,cAAc,yBAAyB,CAAC;AACpE,MAAM,CAAC,MAAM,gBAAgB,GAAG,GAAG,cAAc,gCAAgC,CAAC"}
@@ -1,23 +0,0 @@
1
- import { BaseMessage } from './base.js';
2
- import { OPT_IN } from './keygen.js';
3
- export class OptInMessage extends BaseMessage {
4
- cohortId;
5
- participantPk;
6
- constructor({ type = OPT_IN, to, from, threadId, cohortId, participantPk }) {
7
- super({ type, to, from, threadId, body: { cohortId, participantPk } });
8
- this.cohortId = cohortId;
9
- this.participantPk = participantPk;
10
- }
11
- /**
12
- * Initializes an OptInMessage from a given OptIn object.
13
- * @param {OptIn} data - The OptIn object to initialize the OptInMessage.
14
- * @returns {object} The serialized OptInMessage.
15
- */
16
- static fromJSON(data) {
17
- if (data.type != 'OPT_IN') {
18
- throw new Error(`Invalid type: ${data.type}`);
19
- }
20
- return new OptInMessage(data);
21
- }
22
- }
23
- //# sourceMappingURL=opt-in.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"opt-in.js","sourceRoot":"","sources":["../../../../../../src/core/beacon/aggregation/messages/opt-in.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAWrC,MAAM,OAAO,YAAa,SAAQ,WAAW;IACpC,QAAQ,CAAS;IACjB,aAAa,CAAa;IAEjC,YAAY,EAAE,IAAI,GAAG,MAAM,EAAE,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,aAAa,EAAS;QAC/E,KAAK,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE,QAAQ,EAAE,aAAa,EAAE,EAAC,CAAC,CAAC;QACtE,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;IACrC,CAAC;IAED;;;;OAIG;IACI,MAAM,CAAC,QAAQ,CAAC,IAAkB;QACvC,IAAI,IAAI,CAAC,IAAI,IAAI,QAAQ,EAAE,CAAC;YAC1B,MAAM,IAAI,KAAK,CAAC,iBAAiB,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;QAChD,CAAC;QACD,OAAO,IAAI,YAAY,CAAC,IAAI,CAAC,CAAC;IAChC,CAAC;CACF"}
@@ -1,7 +0,0 @@
1
- import { MESSAGE_PREFIX } from './base.js';
2
- export const REQUEST_SIGNATURE = `${MESSAGE_PREFIX}musig2/sign/request_signature`;
3
- export const AUTHORIZATION_REQUEST = `${MESSAGE_PREFIX}musig2/sign/authorization_request`;
4
- export const NONCE_CONTRIBUTION = `${MESSAGE_PREFIX}musig2/sign/nonce_contribution`;
5
- export const AGGREGATED_NONCE = `${MESSAGE_PREFIX}musig2/sign/aggregated_nonce`;
6
- export const SIGNATURE_AUTHORIZATION = `${MESSAGE_PREFIX}musig2/sign/signature_authorization`;
7
- //# sourceMappingURL=sign.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"sign.js","sourceRoot":"","sources":["../../../../../../src/core/beacon/aggregation/messages/sign.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAE3C,MAAM,CAAC,MAAM,iBAAiB,GAAG,GAAG,cAAc,+BAA+B,CAAC;AAClF,MAAM,CAAC,MAAM,qBAAqB,GAAG,GAAG,cAAc,mCAAmC,CAAC;AAC1F,MAAM,CAAC,MAAM,kBAAkB,GAAG,GAAG,cAAc,gCAAgC,CAAC;AACpF,MAAM,CAAC,MAAM,gBAAgB,GAAG,GAAG,cAAc,8BAA8B,CAAC;AAChF,MAAM,CAAC,MAAM,uBAAuB,GAAG,GAAG,cAAc,qCAAqC,CAAC"}
@@ -1,92 +0,0 @@
1
- import { TapRootMultiSig } from '@did-btcr2/bitcoin';
2
- import { COHORT_STATUS } from './status.js';
3
- export class Musig2Cohort {
4
- /**
5
- * Unique identifier for the cohort.
6
- * @type {string}
7
- */
8
- id;
9
- /**
10
- * DID of the coordinator.
11
- * @type {string}
12
- */
13
- coordinatorDid;
14
- /**
15
- * Minimum number of participants required to finalize the cohort.
16
- * @type {number}
17
- */
18
- minParticipants;
19
- /**
20
- * Status of the cohort.
21
- * @type {string}
22
- */
23
- status;
24
- /**
25
- * Network on which the cohort operates (e.g., 'mainnet', 'testnet').
26
- * @type {string}
27
- */
28
- network;
29
- /**
30
- * Pending signature requests, mapping participant DIDs to their pending signatures.
31
- * @type {Record<string, string>}
32
- */
33
- pendingSignatureRequests = {};
34
- /**
35
- * List of participant DIDs.
36
- * @type {Array<string>}
37
- */
38
- participants = new Array();
39
- /**
40
- * List of cohort keys (public keys).
41
- * @type {Array<Uint8Array>}
42
- */
43
- cohortKeys = new Array();
44
- /**
45
- * Taproot Merkle root for the cohort.
46
- * @type {Uint8Array}
47
- */
48
- trMerkleRoot;
49
- /**
50
- * Beacon address for the cohort, calculated from the Taproot multisig.
51
- * @type {string}
52
- */
53
- beaconAddress;
54
- /**
55
- * Creates a new Musig2Cohort instance.
56
- * @param {Musig2CohortParams} params Parameters for initializing the cohort.
57
- * @param {string} [params.id] Optional unique identifier for the cohort. If not provided, a random UUID will be generated.
58
- * @param {number} params.minParticipants Minimum number of participants required to finalize the cohort.
59
- * @param {string} params.coordinatorDid DID of the coordinator managing the cohort.
60
- * @param {string} params.status Initial status of the cohort (e.g., 'PENDING', 'COHORT_SET').
61
- * @param {string} params.network Network on which the cohort operates (e.g., 'mainnet', 'testnet').
62
- */
63
- constructor(params) {
64
- this.id = params.id || crypto.randomUUID();
65
- this.minParticipants = params.minParticipants;
66
- this.coordinatorDid = params.coordinatorDid;
67
- this.status = params.status || COHORT_STATUS.COHORT_ADVERTISED;
68
- this.network = params.network;
69
- }
70
- finalize() {
71
- if (this.participants.length < this.minParticipants) {
72
- throw new Error('Not enough participants to finalize the cohort');
73
- }
74
- this.status = COHORT_STATUS.COHORT_SET_STATUS;
75
- this.beaconAddress = this.calulateBeaconAddress();
76
- }
77
- /**
78
- * Calculates the beacon Taproot multisig address for the cohort using participant keys.
79
- * @returns {string} The Taproot address for the cohort.
80
- * @throws {Error} If the Taproot address cannot be calculated.
81
- */
82
- calulateBeaconAddress() {
83
- const trMultisig = new TapRootMultiSig(this.cohortKeys, this.cohortKeys.length);
84
- const branch = trMultisig.musigTree();
85
- this.trMerkleRoot = branch.hash;
86
- if (!branch.address) {
87
- throw new Error('Failed to calculate Taproot address');
88
- }
89
- return branch.address;
90
- }
91
- }
92
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../src/core/beacon/aggregation/models/cohort/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAsB,MAAM,aAAa,CAAC;AAUhE,MAAM,OAAO,YAAY;IACvB;;;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,UAAU,GAAsB,IAAI,KAAK,EAAc,CAAC;IAE/D;;;OAGG;IACI,YAAY,CAAc;IAEjC;;;OAGG;IACI,aAAa,CAAU;IAE9B;;;;;;;;OAQG;IACH,YAAY,MAA0B;QACpC,IAAI,CAAC,EAAE,GAAG,MAAM,CAAC,EAAE,IAAI,MAAM,CAAC,UAAU,EAAE,CAAC;QAC3C,IAAI,CAAC,eAAe,GAAG,MAAM,CAAC,eAAe,CAAC;QAC9C,IAAI,CAAC,cAAc,GAAG,MAAM,CAAC,cAAc,CAAC;QAC5C,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,MAA4B,IAAI,aAAa,CAAC,iBAAiB,CAAC;QACrF,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC;IAChC,CAAC;IAEM,QAAQ;QACb,IAAG,IAAI,CAAC,YAAY,CAAC,MAAM,GAAG,IAAI,CAAC,eAAe,EAAE,CAAC;YACnD,MAAM,IAAI,KAAK,CAAC,gDAAgD,CAAC,CAAC;QACpE,CAAC;QACD,IAAI,CAAC,MAAM,GAAG,aAAa,CAAC,iBAAiB,CAAC;QAC9C,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,qBAAqB,EAAE,CAAC;IACpD,CAAC;IAED;;;;OAIG;IACI,qBAAqB;QAC1B,MAAM,UAAU,GAAG,IAAI,eAAe,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;QAChF,MAAM,MAAM,GAAG,UAAU,CAAC,SAAS,EAAE,CAAC;QACtC,IAAI,CAAC,YAAY,GAAG,MAAM,CAAC,IAAI,CAAC;QAChC,IAAG,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;YACnB,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;QACzD,CAAC;QACD,OAAO,MAAM,CAAC,OAAO,CAAC;IACxB,CAAC;CACF"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"status.js","sourceRoot":"","sources":["../../../../../../../src/core/beacon/aggregation/models/cohort/status.ts"],"names":[],"mappings":"AACA,MAAM,CAAN,IAAY,aAKX;AALD,WAAY,aAAa;IACvB,iDAAgC,CAAA;IAChC,6CAA4B,CAAA;IAC5B,iDAAgC,CAAA;IAChC,yCAAwB,CAAA;AAC1B,CAAC,EALW,aAAa,KAAb,aAAa,QAKxB"}
@@ -1,57 +0,0 @@
1
- import { SchnorrKeyPair, Secp256k1SecretKey } from '@did-btcr2/keypair';
2
- import { SimplePool, } from 'nostr-tools/pool';
3
- import { Identifier } from '../../../../utils/identifier.js';
4
- export class NostrAdapter {
5
- name = 'nostr';
6
- config;
7
- handlers = new Map();
8
- constructor(config = { keys: {}, components: {}, relays: ['wss://relay.damus.io'] }) {
9
- this.config = config;
10
- this.config.keys = this.config.keys || SchnorrKeyPair.generate().raw;
11
- this.config.did = config.did || Identifier.encode({
12
- idType: config.components.idType || 'KEY',
13
- version: config.components.version || 1,
14
- network: config.components.network || 'signet',
15
- genesisBytes: this.config.keys.public
16
- });
17
- }
18
- async start() {
19
- const pool = new SimplePool();
20
- pool.subscribe(this.config.relays, { pubkey: this.config.did, kinds: [1059] }, {
21
- onclose: (reasons) => console.log('Subscription closed for reasons:', reasons),
22
- onevent: async (event) => {
23
- console.log('Received event:', event);
24
- }
25
- });
26
- }
27
- registerMessageHandler(messageType, handler) {
28
- this.handlers.set(messageType, handler);
29
- }
30
- /**
31
- * Sends a message to a recipient using the Nostr protocol.
32
- * This method is a placeholder and should be implemented with actual Nostr message sending logic.
33
- * @param message
34
- * @param recipient
35
- * @param sender
36
- */
37
- async sendMessage(message, recipient, sender) {
38
- // TODO: Implement message sending logic via Nostr
39
- console.log(`Sending message to ${recipient} from ${sender}:`, message);
40
- }
41
- /**
42
- * Generates a Nostr identity using the Secp256k1SecretKey and Identifier classes.
43
- * @returns {string} A BTCR2 DID used for communication over the nostr protocol
44
- */
45
- generateIdentity() {
46
- this.config.keys.secret = Secp256k1SecretKey.random();
47
- this.config.keys.public = Secp256k1SecretKey.getPublicKey(this.config.keys.secret).compressed;
48
- this.config.did = Identifier.encode({
49
- idType: this.config.components.idType || 'KEY',
50
- version: this.config.components.version || 1,
51
- network: this.config.components.network || 'signet',
52
- genesisBytes: this.config.keys.public
53
- });
54
- return this.config.did;
55
- }
56
- }
57
- //# sourceMappingURL=nostr.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"nostr.js","sourceRoot":"","sources":["../../../../../../src/core/beacon/aggregation/protocol/nostr.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAExE,OAAO,EAAE,UAAU,GAAG,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAkB7D,MAAM,OAAO,YAAY;IAChB,IAAI,GAAW,OAAO,CAAC;IACtB,MAAM,CAAqB;IAC3B,QAAQ,GAA6C,IAAI,GAAG,EAAE,CAAC;IAEvE,YAAY,SAA6B,EAAE,IAAI,EAAE,EAAE,EAAE,UAAU,EAAE,EAAE,EAAE,MAAM,EAAE,CAAC,sBAAsB,CAAC,EAAE;QACrG,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,MAAM,CAAC,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,IAAI,cAAc,CAAC,QAAQ,EAAE,CAAC,GAAG,CAAC;QACrE,IAAI,CAAC,MAAM,CAAC,GAAG,GAAG,MAAM,CAAC,GAAG,IAAI,UAAU,CAAC,MAAM,CAAC;YAChD,MAAM,EAAS,MAAM,CAAC,UAAU,CAAC,MAAM,IAAI,KAAK;YAChD,OAAO,EAAQ,MAAM,CAAC,UAAU,CAAC,OAAO,IAAI,CAAC;YAC7C,OAAO,EAAQ,MAAM,CAAC,UAAU,CAAC,OAAO,IAAI,QAAQ;YACpD,YAAY,EAAG,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAO;SACxC,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,KAAK;QACT,MAAM,IAAI,GAAG,IAAI,UAAU,EAAE,CAAC;QAC9B,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,GAAG,EAAE,KAAK,EAAE,CAAC,IAAI,CAAC,EAAY,EAAE;YACvF,OAAO,EAAG,CAAC,OAAiB,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,kCAAkC,EAAE,OAAO,CAAC;YACzF,OAAO,EAAG,KAAK,EAAE,KAAU,EAAE,EAAE;gBAC7B,OAAO,CAAC,GAAG,CAAC,iBAAiB,EAAE,KAAK,CAAC,CAAC;YACxC,CAAC;SACF,CAAC,CAAC;IACL,CAAC;IAED,sBAAsB,CAAC,WAAmB,EAAE,OAAoC;QAC9E,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;IAC1C,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,WAAW,CAAC,OAAe,EAAE,SAAiB,EAAE,MAAc;QAClE,kDAAkD;QAClD,OAAO,CAAC,GAAG,CAAC,sBAAsB,SAAS,SAAS,MAAM,GAAG,EAAE,OAAO,CAAC,CAAC;IAC1E,CAAC;IAED;;;OAGG;IACI,gBAAgB;QACrB,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,GAAG,kBAAkB,CAAC,MAAM,EAAE,CAAC;QACtD,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,GAAG,kBAAkB,CAAC,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,UAAU,CAAC;QAC9F,IAAI,CAAC,MAAM,CAAC,GAAG,GAAG,UAAU,CAAC,MAAM,CACjC;YACE,MAAM,EAAS,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,MAAM,IAAK,KAAK;YACtD,OAAO,EAAQ,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,OAAO,IAAI,CAAC;YAClD,OAAO,EAAQ,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,OAAO,IAAI,QAAQ;YACzD,YAAY,EAAG,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM;SACvC,CACF,CAAC;QACF,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC;IACzB,CAAC;CACF"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"service.js","sourceRoot":"","sources":["../../../../../../src/core/beacon/aggregation/protocol/service.ts"],"names":[],"mappings":""}