@did-btcr2/method 0.18.1 → 0.20.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 (291) hide show
  1. package/dist/browser.js +4917 -6487
  2. package/dist/browser.mjs +4917 -6487
  3. package/dist/cjs/core/beacon/aggregation/cohort/index.js +3 -3
  4. package/dist/cjs/core/beacon/aggregation/cohort/index.js.map +1 -1
  5. package/dist/cjs/core/beacon/aggregation/cohort/messages/base.js +1 -9
  6. package/dist/cjs/core/beacon/aggregation/cohort/messages/base.js.map +1 -1
  7. package/dist/cjs/core/beacon/aggregation/cohort/messages/keygen/cohort-advert.js +2 -1
  8. package/dist/cjs/core/beacon/aggregation/cohort/messages/keygen/cohort-advert.js.map +1 -1
  9. package/dist/cjs/core/beacon/aggregation/cohort/messages/keygen/cohort-ready.js +2 -1
  10. package/dist/cjs/core/beacon/aggregation/cohort/messages/keygen/cohort-ready.js.map +1 -1
  11. package/dist/cjs/core/beacon/aggregation/cohort/messages/keygen/opt-in-accept.js +2 -1
  12. package/dist/cjs/core/beacon/aggregation/cohort/messages/keygen/opt-in-accept.js.map +1 -1
  13. package/dist/cjs/core/beacon/aggregation/cohort/messages/keygen/opt-in.js +2 -1
  14. package/dist/cjs/core/beacon/aggregation/cohort/messages/keygen/opt-in.js.map +1 -1
  15. package/dist/cjs/core/beacon/aggregation/cohort/messages/keygen/subscribe.js +2 -1
  16. package/dist/cjs/core/beacon/aggregation/cohort/messages/keygen/subscribe.js.map +1 -1
  17. package/dist/cjs/core/beacon/aggregation/cohort/messages/sign/aggregated-nonce.js +2 -1
  18. package/dist/cjs/core/beacon/aggregation/cohort/messages/sign/aggregated-nonce.js.map +1 -1
  19. package/dist/cjs/core/beacon/aggregation/cohort/messages/sign/authorization-request.js +2 -1
  20. package/dist/cjs/core/beacon/aggregation/cohort/messages/sign/authorization-request.js.map +1 -1
  21. package/dist/cjs/core/beacon/aggregation/cohort/messages/sign/nonce-contribution.js +2 -1
  22. package/dist/cjs/core/beacon/aggregation/cohort/messages/sign/nonce-contribution.js.map +1 -1
  23. package/dist/cjs/core/beacon/aggregation/cohort/messages/sign/request-signature.js +2 -1
  24. package/dist/cjs/core/beacon/aggregation/cohort/messages/sign/request-signature.js.map +1 -1
  25. package/dist/cjs/core/beacon/aggregation/cohort/messages/sign/signature-authorization.js +2 -1
  26. package/dist/cjs/core/beacon/aggregation/cohort/messages/sign/signature-authorization.js.map +1 -1
  27. package/dist/cjs/core/beacon/aggregation/communication/adapter/nostr.js +36 -18
  28. package/dist/cjs/core/beacon/aggregation/communication/adapter/nostr.js.map +1 -1
  29. package/dist/cjs/core/beacon/aggregation/coordinator.js +14 -14
  30. package/dist/cjs/core/beacon/aggregation/coordinator.js.map +1 -1
  31. package/dist/cjs/core/beacon/aggregation/participant.js +4 -3
  32. package/dist/cjs/core/beacon/aggregation/participant.js.map +1 -1
  33. package/dist/cjs/core/beacon/aggregation/session/index.js +1 -1
  34. package/dist/cjs/core/beacon/aggregation/session/index.js.map +1 -1
  35. package/dist/cjs/core/beacon/beacon.js +25 -0
  36. package/dist/cjs/core/beacon/beacon.js.map +1 -0
  37. package/dist/cjs/core/beacon/cas-beacon.js +39 -0
  38. package/dist/cjs/core/beacon/cas-beacon.js.map +1 -0
  39. package/dist/cjs/core/beacon/error.js +4 -4
  40. package/dist/cjs/core/beacon/error.js.map +1 -1
  41. package/dist/cjs/core/beacon/factory.js +10 -11
  42. package/dist/cjs/core/beacon/factory.js.map +1 -1
  43. package/dist/cjs/core/beacon/interfaces.js +2 -0
  44. package/dist/cjs/core/beacon/interfaces.js.map +1 -0
  45. package/dist/cjs/core/beacon/signal-discovery.js +183 -0
  46. package/dist/cjs/core/beacon/signal-discovery.js.map +1 -0
  47. package/dist/cjs/core/beacon/singleton.js +75 -178
  48. package/dist/cjs/core/beacon/singleton.js.map +1 -1
  49. package/dist/cjs/core/beacon/smt-beacon.js +39 -0
  50. package/dist/cjs/core/beacon/smt-beacon.js.map +1 -0
  51. package/dist/cjs/core/beacon/utils.js +71 -114
  52. package/dist/cjs/core/beacon/utils.js.map +1 -1
  53. package/dist/cjs/core/identifier.js +18 -21
  54. package/dist/cjs/core/identifier.js.map +1 -1
  55. package/dist/cjs/core/interfaces.js +2 -0
  56. package/dist/cjs/core/interfaces.js.map +1 -0
  57. package/dist/cjs/core/resolve.js +321 -0
  58. package/dist/cjs/core/resolve.js.map +1 -0
  59. package/dist/cjs/{utils → core}/types.js.map +1 -1
  60. package/dist/cjs/core/update.js +113 -0
  61. package/dist/cjs/core/update.js.map +1 -0
  62. package/dist/cjs/did-btcr2.js +168 -129
  63. package/dist/cjs/did-btcr2.js.map +1 -1
  64. package/dist/cjs/index.js +17 -16
  65. package/dist/cjs/index.js.map +1 -1
  66. package/dist/cjs/utils/appendix.js +16 -33
  67. package/dist/cjs/utils/appendix.js.map +1 -1
  68. package/dist/cjs/utils/did-document-builder.js +5 -0
  69. package/dist/cjs/utils/did-document-builder.js.map +1 -1
  70. package/dist/cjs/utils/did-document.js +62 -72
  71. package/dist/cjs/utils/did-document.js.map +1 -1
  72. package/dist/cjs/utils/general.js +1 -1
  73. package/dist/cjs/utils/general.js.map +1 -1
  74. package/dist/esm/core/beacon/aggregation/cohort/index.js +3 -3
  75. package/dist/esm/core/beacon/aggregation/cohort/index.js.map +1 -1
  76. package/dist/esm/core/beacon/aggregation/cohort/messages/base.js +1 -9
  77. package/dist/esm/core/beacon/aggregation/cohort/messages/base.js.map +1 -1
  78. package/dist/esm/core/beacon/aggregation/cohort/messages/keygen/cohort-advert.js +2 -1
  79. package/dist/esm/core/beacon/aggregation/cohort/messages/keygen/cohort-advert.js.map +1 -1
  80. package/dist/esm/core/beacon/aggregation/cohort/messages/keygen/cohort-ready.js +2 -1
  81. package/dist/esm/core/beacon/aggregation/cohort/messages/keygen/cohort-ready.js.map +1 -1
  82. package/dist/esm/core/beacon/aggregation/cohort/messages/keygen/opt-in-accept.js +2 -1
  83. package/dist/esm/core/beacon/aggregation/cohort/messages/keygen/opt-in-accept.js.map +1 -1
  84. package/dist/esm/core/beacon/aggregation/cohort/messages/keygen/opt-in.js +2 -1
  85. package/dist/esm/core/beacon/aggregation/cohort/messages/keygen/opt-in.js.map +1 -1
  86. package/dist/esm/core/beacon/aggregation/cohort/messages/keygen/subscribe.js +2 -1
  87. package/dist/esm/core/beacon/aggregation/cohort/messages/keygen/subscribe.js.map +1 -1
  88. package/dist/esm/core/beacon/aggregation/cohort/messages/sign/aggregated-nonce.js +2 -1
  89. package/dist/esm/core/beacon/aggregation/cohort/messages/sign/aggregated-nonce.js.map +1 -1
  90. package/dist/esm/core/beacon/aggregation/cohort/messages/sign/authorization-request.js +2 -1
  91. package/dist/esm/core/beacon/aggregation/cohort/messages/sign/authorization-request.js.map +1 -1
  92. package/dist/esm/core/beacon/aggregation/cohort/messages/sign/nonce-contribution.js +2 -1
  93. package/dist/esm/core/beacon/aggregation/cohort/messages/sign/nonce-contribution.js.map +1 -1
  94. package/dist/esm/core/beacon/aggregation/cohort/messages/sign/request-signature.js +2 -1
  95. package/dist/esm/core/beacon/aggregation/cohort/messages/sign/request-signature.js.map +1 -1
  96. package/dist/esm/core/beacon/aggregation/cohort/messages/sign/signature-authorization.js +2 -1
  97. package/dist/esm/core/beacon/aggregation/cohort/messages/sign/signature-authorization.js.map +1 -1
  98. package/dist/esm/core/beacon/aggregation/communication/adapter/nostr.js +36 -18
  99. package/dist/esm/core/beacon/aggregation/communication/adapter/nostr.js.map +1 -1
  100. package/dist/esm/core/beacon/aggregation/coordinator.js +14 -14
  101. package/dist/esm/core/beacon/aggregation/coordinator.js.map +1 -1
  102. package/dist/esm/core/beacon/aggregation/participant.js +4 -3
  103. package/dist/esm/core/beacon/aggregation/participant.js.map +1 -1
  104. package/dist/esm/core/beacon/aggregation/session/index.js +1 -1
  105. package/dist/esm/core/beacon/aggregation/session/index.js.map +1 -1
  106. package/dist/esm/core/beacon/beacon.js +25 -0
  107. package/dist/esm/core/beacon/beacon.js.map +1 -0
  108. package/dist/esm/core/beacon/cas-beacon.js +39 -0
  109. package/dist/esm/core/beacon/cas-beacon.js.map +1 -0
  110. package/dist/esm/core/beacon/error.js +4 -4
  111. package/dist/esm/core/beacon/error.js.map +1 -1
  112. package/dist/esm/core/beacon/factory.js +10 -11
  113. package/dist/esm/core/beacon/factory.js.map +1 -1
  114. package/dist/esm/core/beacon/interfaces.js +2 -0
  115. package/dist/esm/core/beacon/interfaces.js.map +1 -0
  116. package/dist/esm/core/beacon/signal-discovery.js +183 -0
  117. package/dist/esm/core/beacon/signal-discovery.js.map +1 -0
  118. package/dist/esm/core/beacon/singleton.js +75 -178
  119. package/dist/esm/core/beacon/singleton.js.map +1 -1
  120. package/dist/esm/core/beacon/smt-beacon.js +39 -0
  121. package/dist/esm/core/beacon/smt-beacon.js.map +1 -0
  122. package/dist/esm/core/beacon/utils.js +71 -114
  123. package/dist/esm/core/beacon/utils.js.map +1 -1
  124. package/dist/esm/core/identifier.js +18 -21
  125. package/dist/esm/core/identifier.js.map +1 -1
  126. package/dist/esm/core/interfaces.js +2 -0
  127. package/dist/esm/core/interfaces.js.map +1 -0
  128. package/dist/esm/core/resolve.js +321 -0
  129. package/dist/esm/core/resolve.js.map +1 -0
  130. package/dist/esm/{utils → core}/types.js.map +1 -1
  131. package/dist/esm/core/update.js +113 -0
  132. package/dist/esm/core/update.js.map +1 -0
  133. package/dist/esm/did-btcr2.js +168 -129
  134. package/dist/esm/did-btcr2.js.map +1 -1
  135. package/dist/esm/index.js +17 -16
  136. package/dist/esm/index.js.map +1 -1
  137. package/dist/esm/utils/appendix.js +16 -33
  138. package/dist/esm/utils/appendix.js.map +1 -1
  139. package/dist/esm/utils/did-document-builder.js +5 -0
  140. package/dist/esm/utils/did-document-builder.js.map +1 -1
  141. package/dist/esm/utils/did-document.js +62 -72
  142. package/dist/esm/utils/did-document.js.map +1 -1
  143. package/dist/esm/utils/general.js +1 -1
  144. package/dist/esm/utils/general.js.map +1 -1
  145. package/dist/types/core/beacon/aggregation/cohort/index.d.ts +1 -1
  146. package/dist/types/core/beacon/aggregation/cohort/messages/base.d.ts +0 -7
  147. package/dist/types/core/beacon/aggregation/cohort/messages/base.d.ts.map +1 -1
  148. package/dist/types/core/beacon/aggregation/cohort/messages/keygen/cohort-advert.d.ts.map +1 -1
  149. package/dist/types/core/beacon/aggregation/cohort/messages/keygen/cohort-ready.d.ts.map +1 -1
  150. package/dist/types/core/beacon/aggregation/cohort/messages/keygen/opt-in-accept.d.ts.map +1 -1
  151. package/dist/types/core/beacon/aggregation/cohort/messages/keygen/opt-in.d.ts.map +1 -1
  152. package/dist/types/core/beacon/aggregation/cohort/messages/keygen/subscribe.d.ts.map +1 -1
  153. package/dist/types/core/beacon/aggregation/cohort/messages/sign/aggregated-nonce.d.ts.map +1 -1
  154. package/dist/types/core/beacon/aggregation/cohort/messages/sign/authorization-request.d.ts.map +1 -1
  155. package/dist/types/core/beacon/aggregation/cohort/messages/sign/nonce-contribution.d.ts.map +1 -1
  156. package/dist/types/core/beacon/aggregation/cohort/messages/sign/request-signature.d.ts.map +1 -1
  157. package/dist/types/core/beacon/aggregation/cohort/messages/sign/signature-authorization.d.ts.map +1 -1
  158. package/dist/types/core/beacon/aggregation/communication/adapter/nostr.d.ts +13 -5
  159. package/dist/types/core/beacon/aggregation/communication/adapter/nostr.d.ts.map +1 -1
  160. package/dist/types/core/beacon/aggregation/coordinator.d.ts +17 -29
  161. package/dist/types/core/beacon/aggregation/coordinator.d.ts.map +1 -1
  162. package/dist/types/core/beacon/aggregation/participant.d.ts.map +1 -1
  163. package/dist/types/core/beacon/beacon.d.ts +44 -0
  164. package/dist/types/core/beacon/beacon.d.ts.map +1 -0
  165. package/dist/types/core/beacon/cas-beacon.d.ts +36 -0
  166. package/dist/types/core/beacon/cas-beacon.d.ts.map +1 -0
  167. package/dist/types/core/beacon/error.d.ts +2 -2
  168. package/dist/types/core/beacon/error.d.ts.map +1 -1
  169. package/dist/types/core/beacon/factory.d.ts +4 -5
  170. package/dist/types/core/beacon/factory.d.ts.map +1 -1
  171. package/dist/types/core/beacon/interfaces.d.ts +59 -0
  172. package/dist/types/core/beacon/interfaces.d.ts.map +1 -0
  173. package/dist/types/core/beacon/signal-discovery.d.ts +25 -0
  174. package/dist/types/core/beacon/signal-discovery.d.ts.map +1 -0
  175. package/dist/types/core/beacon/singleton.d.ts +20 -76
  176. package/dist/types/core/beacon/singleton.d.ts.map +1 -1
  177. package/dist/types/core/beacon/smt-beacon.d.ts +36 -0
  178. package/dist/types/core/beacon/smt-beacon.d.ts.map +1 -0
  179. package/dist/types/core/beacon/utils.d.ts +19 -97
  180. package/dist/types/core/beacon/utils.d.ts.map +1 -1
  181. package/dist/types/core/identifier.d.ts.map +1 -1
  182. package/dist/types/core/interfaces.d.ts +87 -0
  183. package/dist/types/core/interfaces.d.ts.map +1 -0
  184. package/dist/types/core/resolve.d.ts +89 -0
  185. package/dist/types/core/resolve.d.ts.map +1 -0
  186. package/dist/types/core/types.d.ts +84 -0
  187. package/dist/types/core/types.d.ts.map +1 -0
  188. package/dist/types/core/update.d.ts +51 -0
  189. package/dist/types/core/update.d.ts.map +1 -0
  190. package/dist/types/did-btcr2.d.ts +70 -89
  191. package/dist/types/did-btcr2.d.ts.map +1 -1
  192. package/dist/types/index.d.ts +17 -16
  193. package/dist/types/index.d.ts.map +1 -1
  194. package/dist/types/utils/appendix.d.ts +5 -10
  195. package/dist/types/utils/appendix.d.ts.map +1 -1
  196. package/dist/types/utils/did-document-builder.d.ts +6 -1
  197. package/dist/types/utils/did-document-builder.d.ts.map +1 -1
  198. package/dist/types/utils/did-document.d.ts +46 -42
  199. package/dist/types/utils/did-document.d.ts.map +1 -1
  200. package/package.json +6 -6
  201. package/src/core/beacon/aggregation/cohort/index.ts +3 -3
  202. package/src/core/beacon/aggregation/cohort/messages/base.ts +1 -12
  203. package/src/core/beacon/aggregation/cohort/messages/keygen/cohort-advert.ts +2 -2
  204. package/src/core/beacon/aggregation/cohort/messages/keygen/cohort-ready.ts +2 -2
  205. package/src/core/beacon/aggregation/cohort/messages/keygen/opt-in-accept.ts +2 -2
  206. package/src/core/beacon/aggregation/cohort/messages/keygen/opt-in.ts +2 -2
  207. package/src/core/beacon/aggregation/cohort/messages/keygen/subscribe.ts +2 -2
  208. package/src/core/beacon/aggregation/cohort/messages/sign/aggregated-nonce.ts +2 -2
  209. package/src/core/beacon/aggregation/cohort/messages/sign/authorization-request.ts +2 -2
  210. package/src/core/beacon/aggregation/cohort/messages/sign/nonce-contribution.ts +2 -2
  211. package/src/core/beacon/aggregation/cohort/messages/sign/request-signature.ts +2 -2
  212. package/src/core/beacon/aggregation/cohort/messages/sign/signature-authorization.ts +2 -2
  213. package/src/core/beacon/aggregation/communication/adapter/nostr.ts +43 -21
  214. package/src/core/beacon/aggregation/coordinator.ts +41 -29
  215. package/src/core/beacon/aggregation/participant.ts +4 -3
  216. package/src/core/beacon/aggregation/session/index.ts +1 -1
  217. package/src/core/beacon/beacon.ts +58 -0
  218. package/src/core/beacon/cas-beacon.ts +53 -0
  219. package/src/core/beacon/error.ts +5 -6
  220. package/src/core/beacon/factory.ts +12 -16
  221. package/src/core/beacon/interfaces.ts +67 -0
  222. package/src/core/beacon/signal-discovery.ts +237 -0
  223. package/src/core/beacon/singleton.ts +107 -197
  224. package/src/core/beacon/smt-beacon.ts +53 -0
  225. package/src/core/beacon/utils.ts +95 -182
  226. package/src/core/identifier.ts +21 -24
  227. package/src/core/interfaces.ts +93 -0
  228. package/src/core/resolve.ts +463 -0
  229. package/src/core/types.ts +95 -0
  230. package/src/core/update.ts +154 -0
  231. package/src/did-btcr2.ts +255 -159
  232. package/src/index.ts +19 -22
  233. package/src/utils/appendix.ts +26 -44
  234. package/src/utils/did-document-builder.ts +6 -1
  235. package/src/utils/did-document.ts +105 -113
  236. package/src/utils/general.ts +1 -1
  237. package/dist/cjs/core/beacon/cid-aggregate.js +0 -116
  238. package/dist/cjs/core/beacon/cid-aggregate.js.map +0 -1
  239. package/dist/cjs/core/beacon/smt-aggregate.js +0 -126
  240. package/dist/cjs/core/beacon/smt-aggregate.js.map +0 -1
  241. package/dist/cjs/core/crud/deactivate.js +0 -14
  242. package/dist/cjs/core/crud/deactivate.js.map +0 -1
  243. package/dist/cjs/core/crud/read.js +0 -679
  244. package/dist/cjs/core/crud/read.js.map +0 -1
  245. package/dist/cjs/core/crud/update.js +0 -194
  246. package/dist/cjs/core/crud/update.js.map +0 -1
  247. package/dist/cjs/interfaces/beacon.js +0 -41
  248. package/dist/cjs/interfaces/beacon.js.map +0 -1
  249. package/dist/cjs/interfaces/crud.js +0 -2
  250. package/dist/cjs/interfaces/crud.js.map +0 -1
  251. package/dist/esm/core/beacon/cid-aggregate.js +0 -116
  252. package/dist/esm/core/beacon/cid-aggregate.js.map +0 -1
  253. package/dist/esm/core/beacon/smt-aggregate.js +0 -126
  254. package/dist/esm/core/beacon/smt-aggregate.js.map +0 -1
  255. package/dist/esm/core/crud/deactivate.js +0 -14
  256. package/dist/esm/core/crud/deactivate.js.map +0 -1
  257. package/dist/esm/core/crud/read.js +0 -679
  258. package/dist/esm/core/crud/read.js.map +0 -1
  259. package/dist/esm/core/crud/update.js +0 -194
  260. package/dist/esm/core/crud/update.js.map +0 -1
  261. package/dist/esm/interfaces/beacon.js +0 -41
  262. package/dist/esm/interfaces/beacon.js.map +0 -1
  263. package/dist/esm/interfaces/crud.js +0 -2
  264. package/dist/esm/interfaces/crud.js.map +0 -1
  265. package/dist/types/core/beacon/cid-aggregate.d.ts +0 -102
  266. package/dist/types/core/beacon/cid-aggregate.d.ts.map +0 -1
  267. package/dist/types/core/beacon/smt-aggregate.d.ts +0 -111
  268. package/dist/types/core/beacon/smt-aggregate.d.ts.map +0 -1
  269. package/dist/types/core/crud/deactivate.d.ts +0 -13
  270. package/dist/types/core/crud/deactivate.d.ts.map +0 -1
  271. package/dist/types/core/crud/read.d.ts +0 -334
  272. package/dist/types/core/crud/read.d.ts.map +0 -1
  273. package/dist/types/core/crud/update.d.ts +0 -93
  274. package/dist/types/core/crud/update.d.ts.map +0 -1
  275. package/dist/types/interfaces/beacon.d.ts +0 -116
  276. package/dist/types/interfaces/beacon.d.ts.map +0 -1
  277. package/dist/types/interfaces/crud.d.ts +0 -32
  278. package/dist/types/interfaces/crud.d.ts.map +0 -1
  279. package/dist/types/utils/types.d.ts +0 -38
  280. package/dist/types/utils/types.d.ts.map +0 -1
  281. package/src/canonicalize.d.ts +0 -6
  282. package/src/core/beacon/cid-aggregate.ts +0 -153
  283. package/src/core/beacon/smt-aggregate.ts +0 -135
  284. package/src/core/crud/deactivate.ts +0 -13
  285. package/src/core/crud/read.ts +0 -948
  286. package/src/core/crud/update.ts +0 -292
  287. package/src/interfaces/beacon.ts +0 -137
  288. package/src/interfaces/crud.ts +0 -33
  289. package/src/utils/types.ts +0 -41
  290. /package/dist/cjs/{utils → core}/types.js +0 -0
  291. /package/dist/esm/{utils → core}/types.js +0 -0
@@ -1,196 +1,235 @@
1
- import { INVALID_DID_DOCUMENT, METHOD_NOT_SUPPORTED, MethodError, W3C_DID_RESOLUTION_V1, } from '@did-btcr2/common';
1
+ import { BitcoinNetworkConnection } from '@did-btcr2/bitcoin';
2
+ import { Canonicalization, IdentifierHrp, INVALID_DID_DOCUMENT, INVALID_DID_UPDATE, METHOD_NOT_SUPPORTED, MethodError, MISSING_UPDATE_DATA, ResolveError, UpdateError } from '@did-btcr2/common';
2
3
  import { Did, DidError, DidErrorCode, EMPTY_DID_RESOLUTION_RESULT } from '@web5/dids';
3
4
  import { initEccLib } from 'bitcoinjs-lib';
4
5
  import * as tinysecp from 'tiny-secp256k1';
5
- import { Resolve } from './core/crud/read.js';
6
- import { Update } from './core/crud/update.js';
6
+ import { BeaconUtils } from './core/beacon/utils.js';
7
7
  import { Identifier } from './core/identifier.js';
8
+ import { Resolve } from './core/resolve.js';
9
+ import { Update } from './core/update.js';
8
10
  import { Appendix } from './utils/appendix.js';
11
+ // TODO: convert to API driver?
12
+ export const canonicalization = new Canonicalization();
13
+ // TODO: convert to API driver?
9
14
  /** Initialize tiny secp256k1 */
10
15
  initEccLib(tinysecp);
11
16
  /**
12
17
  * Implements {@link https://dcdpr.github.io/did-btcr2 | did:btcr2 DID Method Specification}.
13
- * did:btcr2 is a censorship resistant DID Method using the Bitcoin blockchain as a Verifiable Data Registry to announce
14
- * changes to the DID document. It improves on prior work by allowing: zero-cost off-chain DID creation; aggregated
15
- * updates for scalable on-chain update costs; long-term identifiers that can support frequent updates; private
16
- * communication of the DID document; private DID resolution; and non-repudiation appropriate for serious contracts.
18
+ * did:btcr2 is a censorship-resistant Decentralized Identifier (DID) method using
19
+ * the Bitcoin blockchain as a Verifiable Data Registry to announce changes to the
20
+ * DID document. It supports zero-cost off-chain DID creation; aggregated updates
21
+ * for scalable on-chain update costs; long-term identifiers that can support
22
+ * frequent updates; private communication of the DID document; private DID resolution;
23
+ * and non-repudiation.
17
24
  *
18
25
  * @class DidBtcr2
19
26
  * @type {DidBtcr2}
20
27
  * @implements {DidMethod}
21
28
  */
22
29
  export class DidBtcr2 {
23
- /** @type {string} Name of the DID method, as defined in the DID BTCR2 specification */
30
+ /**
31
+ * Name of the DID method, as defined in the DID BTCR2 specification
32
+ */
24
33
  static methodName = 'btcr2';
25
34
  /**
26
- * Entry point for section {@link https://dcdpr.github.io/did-btcr2/#create | 4.1 Create}.
27
- * See {@link Create} for implementation details.
28
- *
29
- * A did:btcr2 identifier and associated DID document can either be created deterministically from a cryptographic
30
- * seed, or it can be created from an arbitrary genesis intermediate DID document representation. In both cases,
31
- * DID creation can be undertaken in an offline manner, i.e., the DID controller does not need to interact with the
32
- * Bitcoin network to create their DID.
33
- * @param {CreateParams} params See {@link CreateParams} for details.
34
- * @param {IdType} params.idType Type of identifier to create (key or external).
35
- * @param {KeyBytes} params.pubKeyBytes Public key byte array used to create a btcr2 "key" identifier.
36
- * @param {IntermediateDocument} params.intermediateDocument DID Document used to create a btcr2 "external" identifier.
37
- * @param {DidCreateOptions} params.options See {@link DidCreateOptions} for create options.
38
- * @param {number} params.options.version Version number of the btcr2 method.
39
- * @param {string} params.options.network Bitcoin network name (mainnet, testnet, signet, regtest).
40
- * @returns {Promise<CreateResponse>} Promise resolving to a CreateResponse object.
41
- * @throws {DidBtcr2Error} if any of the checks fail
35
+ * Implements section {@link https://dcdpr.github.io/did-btcr2/operations/create.html | 7.1 Create}.
36
+ * @param {KeyBytes | DocumentBytes} genesisBytes The bytes used to create the genesis document for a did:btcr2 identifier.
37
+ * This can be either the bytes of the genesis document itself or the bytes of a key that will be used to create the genesis document.
38
+ * @param {DidCreateOptions} options Options for creating the identifier, including the idType (key or external), version, and network.
39
+ * @param {string} options.idType The type of identifier to create, either 'KEY' or 'EXTERNAL'. Defaults to 'KEY'.
40
+ * @param {number} options.version The version number of the did:btcr2 specification to use for creating the identifier. Defaults to 1.
41
+ * @param {string} options.network The Bitcoin network to use for the identifier, e.g. 'bitcoin', 'testnet', etc. Defaults to 'bitcoin'.
42
+ * @returns {Promise<Btcr2Identifier>} Promise resolving to a Btcr2Identifier string.
43
+ * @throws {MethodError} if any of the checks fail
42
44
  */
43
- static async create(params) {
44
- // Deconstruct the idType and options from the params
45
- const { idType, options = {} } = params;
46
- // Deconstruct the version and network from the options, setting defaults if not given
47
- const { version = 1, network = 'bitcoin' } = options;
48
- // Set the genesisBytes from the params
49
- const genesisBytes = params.genesisBytes;
45
+ static async create(genesisBytes, options) {
46
+ // Deconstruct the idType, version and network from the options, setting defaults if not given
47
+ const { idType, version = 1, network = 'bitcoin' } = options || {};
48
+ if (!idType) {
49
+ throw new MethodError('idType is required for creating a did:btcr2 identifier', INVALID_DID_DOCUMENT, options);
50
+ }
51
+ // Call identifier encoding algorithm
50
52
  return Identifier.encode({ idType, genesisBytes, version, network });
51
53
  }
52
54
  /**
53
- * Entry point for section {@link https://dcdpr.github.io/did-btcr2/#read | 7.2 Read}.
54
- * See {@link Resolve} for implementation details.
55
+ * Entry point for section {@link https://dcdpr.github.io/did-btcr2/operations/resolve.html | 7.2 Resolve}.
56
+ * See specification for the {@link https://dcdpr.github.io/did-btcr2/operations/resolve.html#process | Resolve Process}.
57
+ * See {@link Resolve | Resolve (class)} for class implementation.
55
58
  *
56
- * The Read operation is an algorithm consisting of a series of subroutine algorithms executed by a resolver after a
57
- * resolution request identifying a specific did:btcr2 identifier is received from a client at Resolution Time. The
58
- * request MUST always contain the resolutionOptions object containing additional information to be used in resolution.
59
- * This object MAY be empty. See the DID Resolution specification for further details about the DID Resolution Options
60
- * object. The resolver then attempts to resolve the DID document of the identifier at a specific Target Time. The
61
- * Target Time is either provided in resolutionOptions or is set to the Resolution Time of the request.
59
+ * Resolving a did:btcr2 identifier iteratively builds a DID document by applying
60
+ * BTCR2 Updates to an Initial DID Document that have been committed to the Bitcoin
61
+ * blockchain by Authorized Beacon Signals. The Initial DID Document is either
62
+ * deterministically created from the DID or provided by Sidecar Data.
62
63
  *
63
- * @param {string} identifier a valid did:btcr2 identifier to be resolved
64
- * @param {DidResolutionOptions} [resolutionsOptions] see {@link https://www.w3.org/TR/did-1.0/#did-resolution-options | DidResolutionOptions}
65
- * @param {number} options.versionId the version of the identifier and/or DID document
66
- * @param {number} options.versionTime a timestamp used during resolution as a bound for when to stop resolving
67
- * @param {DidDocument} options.sidecarData data necessary for resolving a DID
68
- * @param {string} options.network Bitcoin network name (mainnet, testnet, signet, regtest).
69
- * @returns {DidResolutionResult} Promise resolving to a DID Resolution Result containing the `targetDocument`
70
- * @throws {Error} if the resolution fails for any reason
71
- * @throws {DidError} InvalidDid if the identifier is invalid
64
+ * @param {string} did The did:btcr2 identifier to be resolved.
65
+ * @param {ResolutionOptions} resolutionOptions Options used during the resolution process.
66
+ * @returns {Promise<DidResolutionResult>} Promise resolving to a DID Resolution Result containing the `targetDocument`
67
+ * @throws {ResolveError} If the resolution process fails at any step.
72
68
  * @example
73
69
  * ```ts
74
- * const resolution = await DidBtcr2.resolve('did:btcr2:k1q0dygyp3gz969tp46dychzy4q78c2k3js68kvyr0shanzg67jnuez2cfplh')
70
+ * const resolution = await DidBtcr2.resolve(
71
+ * 'did:btcr2:k1q0dygyp3gz969tp46dychzy4q78c2k3js68kvyr0shanzg67jnuez2cfplh'
72
+ * )
75
73
  * ```
76
74
  */
77
- static async resolve(identifier, resolutionsOptions = {}) {
75
+ static async resolve(did, resolutionOptions = { drivers: {} }) {
78
76
  try {
79
- // 1. Pass identifier to the did:btcr2 Identifier Decoding algorithm, retrieving idType, version, network, and genesisBytes.
80
- // 2. Set identifierComponents to a map of idType, version, network, and genesisBytes.
81
- const identifierComponents = Identifier.decode(identifier);
82
- // Set the network based on the decoded identifier
83
- resolutionsOptions.network ??= identifierComponents.network;
84
- // 3. Set initialDocument to the result of running the algorithm in Resolve Initial Document passing in the
85
- // identifier, identifierComponents and resolutionOptions.
86
- const initialDocument = await Resolve.initialDocument({ identifier, identifierComponents, resolutionsOptions });
87
- // 4. Set targetDocument to the result of running the algorithm in Resolve Target Document passing in
88
- // initialDocument and resolutionOptions.
89
- const targetDocument = await Resolve.targetDocument({ initialDocument, resolutionsOptions });
90
- // 5. Return targetDocument.
77
+ // Initialize an empty DID Resolution Result
91
78
  const didResolutionResult = {
92
- '@context': W3C_DID_RESOLUTION_V1,
79
+ '@context': 'https://w3id.org/did-resolution/v1',
93
80
  didResolutionMetadata: { contentType: 'application/ld+json' },
94
- didDocumentMetadata: { created: new Date().getUTCDateTime() },
95
- didDocument: targetDocument,
81
+ didDocumentMetadata: {
82
+ deactivated: false,
83
+ updated: undefined,
84
+ versionId: resolutionOptions.versionId,
85
+ confirmations: undefined,
86
+ },
87
+ didDocument: null,
96
88
  };
89
+ // Decode the did to be resolved
90
+ const didComponents = Identifier.decode(did);
91
+ // Process sidecar if provided
92
+ const sidecarData = Resolve.sidecarData(resolutionOptions.sidecar);
93
+ // Check if bitcoin driver provided
94
+ if (!resolutionOptions?.drivers?.bitcoin) {
95
+ // If not, initialize default drivers
96
+ resolutionOptions.drivers = resolutionOptions.drivers || {};
97
+ // Set bitcoin driver to default BitcoinNetworkConnection
98
+ resolutionOptions.drivers.bitcoin = new BitcoinNetworkConnection();
99
+ // Set the network based on the decoded identifier
100
+ resolutionOptions.drivers.bitcoin.setActiveNetwork(didComponents.network);
101
+ }
102
+ // Parse the genesis document from the resolution options if provided
103
+ const genesisDocument = resolutionOptions.sidecar?.genesisDocument;
104
+ // Since genesisDocument is optional, check if it exists
105
+ if (!genesisDocument) {
106
+ // If no genesisDocument and x HRP, throw MISSING_UPDATE_DATA error
107
+ if (didComponents.hrp === IdentifierHrp.x)
108
+ throw new ResolveError('External resolution requires genesisDocument', MISSING_UPDATE_DATA, { resolutionOptions });
109
+ }
110
+ // Establish the current document
111
+ const currentDocument = await Resolve.currentDocument(didComponents, genesisDocument);
112
+ // Extract all Beacon services from the current DID Document
113
+ const beaconServices = currentDocument.service
114
+ .filter(BeaconUtils.isBeaconService)
115
+ .map(BeaconUtils.parseBeaconServiceEndpoint);
116
+ console.log('beaconServices', beaconServices);
117
+ // Process the Beacon Signals to get the required updates
118
+ const unsortedUpdates = await Resolve.beaconSignals(beaconServices, sidecarData, resolutionOptions.drivers.bitcoin);
119
+ console.log('unsortedUpdates', unsortedUpdates);
120
+ // If no updates found, return the current document
121
+ if (!unsortedUpdates.length) {
122
+ // Set the current document in the didResolutionResult
123
+ didResolutionResult.didDocument = currentDocument;
124
+ // Set the deactivated status in the didDocumentMetadata
125
+ didResolutionResult.didDocumentMetadata.deactivated = !!currentDocument.deactivated;
126
+ // Return the didResolutionResult early
127
+ return didResolutionResult;
128
+ }
129
+ // Process the updates to apply updates to bring the current DID Document to its more current state
130
+ const result = await Resolve.updates(currentDocument, unsortedUpdates, resolutionOptions.versionTime, resolutionOptions.versionId);
131
+ // Set all of the required fields in the didResolutionResult
132
+ didResolutionResult.didDocument = result.currentDocument;
133
+ didResolutionResult.didDocumentMetadata.confirmations = result.confirmations;
134
+ didResolutionResult.didDocumentMetadata.versionId = result.versionId;
135
+ didResolutionResult.didDocumentMetadata.deactivated = !!result.currentDocument.deactivated;
97
136
  // Return didResolutionResult;
98
137
  return didResolutionResult;
99
138
  }
100
139
  catch (error) {
101
140
  console.error(error);
102
- // Rethrow any unexpected errors that are not a `DidError`.
103
- if (!(error instanceof DidError))
141
+ // Rethrow any unexpected errors that are not a `ResolveError`.
142
+ if (!(error instanceof ResolveError))
104
143
  throw new Error(error);
105
144
  // Return a DID Resolution Result with the appropriate error code.
106
145
  return {
107
146
  ...EMPTY_DID_RESOLUTION_RESULT,
108
147
  didResolutionMetadata: {
109
- error: error.code,
148
+ error: error.type,
110
149
  ...error.message && { errorMessage: error.message }
111
150
  }
112
151
  };
113
152
  }
114
153
  }
115
154
  /**
116
- * Entry point for section {@link https://dcdpr.github.io/did-btcr2/#update | 4.3 Update}.
117
- * See {@link Update} for implementation details.
118
- *
119
- * An update to a did:btcr2 document is an invoked capability using the ZCAP-LD data format, signed by a
120
- * verificationMethod that has the authority to make the update as specified in the previous DID document. Capability
121
- * invocations for updates MUST be authorized using Data Integrity following the bip340-jcs-2025
122
- * cryptosuite with a proofPurpose of capabilityInvocation.
155
+ * Entry point for section {@link https://dcdpr.github.io/did-btcr2/#read | 7.3 Update}.
156
+ * See specification for the {@link https://dcdpr.github.io/did-btcr2/operations/resolve.html#process | Resolve Process}.
157
+ * See {@link Update | Update (class)} for class implementation.
123
158
  *
124
- * The Update algorithm takes as inputs a Identifier, sourceDocument, sourceVersionId, documentPatch, a
125
- * verificationMethodId and an array of beaconIds. The sourceDocument is the DID document being updated. The
126
- * documentPatch is a JSON Patch object containing a set of transformations to be applied to the sourceDocument.
127
- * The result of these transformations MUST produce a DID document conformant to the DID Core specification. The
128
- * verificationMethodId is an identifier for a verificationMethod within the sourceDocument. The verificationMethod
129
- * identified MUST be a BIP340 Multikey. The beaconIds MUST identify service endpoints with one of the three Beacon
130
- * Types SingletonBeacon, CIDAggregateBeacon, and SMTAggregateBeacon.
131
- *
132
- * @param {UpdateParams} params Required parameters for the update operation.
133
- * @param {string} params.identifier The btcr2 identifier to be updated.
134
- * @param {DidDocument} params.sourceDocument The DID document being updated.
135
- * @param {string} params.sourceVersionId The versionId of the source document.
136
- * @param {PatchOperation} params.documentPatch The JSON patch to be applied to the source document.
137
- * @param {string} params.verificationMethodId The verificationMethod ID to sign the update
138
- * @param {string[]} params.beaconIds The beacon IDs to announce the update
139
- * @returns {Promise<void>} Promise resolving to void
140
- * @throws {MethodError} if the verificationMethod type is not `Multikey` or the publicKeyMultibase header is not `zQ3s`
159
+ * BTCR2 DID documents can be updated by anchoring BTCR2 Updates to Bitcoin transactions. These transactions MAY be
160
+ * published to the Bitcoin network. Any property in the DID document may be updated except the id. Doing so would
161
+ * invalidate the DID document.
162
+ * @param params An object containing the parameters for the update operation.
163
+ * @param {Btcr2DidDocument} params.sourceDocument The DID document being updated.
164
+ * @param {PatchOperation[]} params.patches The array of JSON Patch operations to apply to the sourceDocument.
165
+ * @param {string} params.sourceVersionId The version ID before applying the update.
166
+ * @param {string} params.verificationMethodId The verificationMethod ID to sign the update with.
167
+ * @param {string} params.beaconId The beacon ID associated with the update.
168
+ * @param {KeyBytes | HexString} [params.signingMaterial] Optional signing material (key bytes or hex string).
169
+ * @param {BitcoinNetworkConnection} [params.bitcoin] Optional Bitcoin network connection for announcing the update. If not provided, a default connection will be initialized.
170
+ * @return {Promise<SignedBTCR2Update>} Promise resolving to the signed BTCR2 update.
171
+ * @throws {UpdateError} if no verificationMethod, verificationMethod type is not `Multikey` or the publicKeyMultibase
172
+ * header is not `zQ3s`
141
173
  */
142
- static async update(params) {
143
- // Deconstruct the params
144
- const { identifier, sourceDocument, sourceVersionId, patch, verificationMethodId: methodId, beaconIds, } = params;
145
- // 1. Set unsignedUpdate to the result of passing Identifier, sourceDocument,
146
- // sourceVersionId, and documentPatch into the Construct DID Update
147
- // Payload algorithm.
148
- const didUpdatePayload = await Update.construct({
149
- identifier,
150
- sourceDocument,
151
- sourceVersionId,
152
- patch,
153
- });
154
- // 2. Set verificationMethod to the result of retrieving the verificationMethod
155
- // from sourceDocument using the verificationMethodId.
156
- const verificationMethod = this.getSigningMethod({ didDocument: sourceDocument, methodId, });
174
+ static async update({ sourceDocument, patches, sourceVersionId, verificationMethodId, beaconId, signingMaterial, bitcoin, }) {
175
+ // TODO: provide KMS as alternative
176
+ // If no signingMaterial provided, throw an UpdateError with INVALID_DID_UPDATE.
177
+ if (!signingMaterial) {
178
+ throw new UpdateError('Missing signing material for update', INVALID_DID_UPDATE, { signingMaterial });
179
+ }
180
+ // Convert signingMaterial to bytes if it's a hex string
181
+ const secretKey = typeof signingMaterial === 'string'
182
+ ? Buffer.from(signingMaterial, 'hex')
183
+ : signingMaterial;
184
+ // Validate that the verificationMethodId is authorized for capabilityInvocation
185
+ if (!sourceDocument.capabilityInvocation?.some(vr => vr === verificationMethodId)) {
186
+ throw new UpdateError('Invalid verificationMethodId: not authorized for capabilityInvocation', INVALID_DID_DOCUMENT, sourceDocument);
187
+ }
188
+ // Get the verification method to be used for signing the update
189
+ const verificationMethod = this.getSigningMethod(sourceDocument, verificationMethodId);
157
190
  // Validate the verificationMethod exists in the sourceDocument
158
191
  if (!verificationMethod) {
159
- throw new MethodError('Verification method not found in did document', INVALID_DID_DOCUMENT, sourceDocument);
192
+ throw new UpdateError('Invalid verificationMethod: not found in source document', INVALID_DID_DOCUMENT, { sourceDocument, verificationMethodId });
160
193
  }
161
- // 3. Validate the verificationMethod is a BIP340 Multikey:
162
- // 3.1 verificationMethod.type == Multikey
194
+ // Validate the verificationMethod is of type 'Multikey'
163
195
  if (verificationMethod.type !== 'Multikey') {
164
- throw new MethodError('Invalid type: must be type "Multikey"', INVALID_DID_DOCUMENT, verificationMethod);
196
+ throw new UpdateError('Invalid verificationMethod: verificationMethod.type must be "Multikey"', INVALID_DID_DOCUMENT, verificationMethod);
165
197
  }
166
- // 3.2 verificationMethod.publicKeyMultibase[4] == zQ3s
167
- const mbasePrefix = verificationMethod.publicKeyMultibase?.slice(0, 4);
168
- if (mbasePrefix !== 'zQ3s') {
169
- throw new MethodError(`Invalid publicKeyMultibase prefix ${mbasePrefix}`, INVALID_DID_DOCUMENT, verificationMethod);
198
+ // Validate the publicKeyMultibase prefix is 'zQ3s'
199
+ if (verificationMethod.publicKeyMultibase?.slice(0, 4) !== 'zQ3s') {
200
+ throw new UpdateError('Invalid verificationMethodId: publicKeyMultibase prefix must start with "zQ3s"', INVALID_DID_DOCUMENT, verificationMethod);
170
201
  }
171
- // 4. Set didUpdateInvocation to the result of passing Identifier, unsignedUpdate as didUpdatePayload, and
172
- // verificationMethod to the Invoke DID Update Payload algorithm.
173
- const didUpdateInvocation = await Update.invoke({ identifier, verificationMethod, didUpdatePayload, });
174
- // 5. Set signalsMetadata to the result of passing Identifier, sourceDocument, beaconIds and didUpdateInvocation
175
- // to the Announce DID Update algorithm.
176
- const signalsMetadata = await Update.announce({ sourceDocument, beaconIds, didUpdateInvocation, });
177
- // 6. Return signalsMetadata. It is up to implementations to ensure that the signalsMetadata is persisted.
178
- return signalsMetadata;
179
- // TODO: Should we be applying the patch, producing a target did document and returning it?
202
+ // Construct an unsigned update following the BTCR2 Update construction algorithm
203
+ const update = await Update.construct(sourceDocument, patches, sourceVersionId);
204
+ // Sign the unsigned update using the specified verification method
205
+ const signed = await Update.sign(sourceDocument.id, update, verificationMethod, secretKey);
206
+ // Filter sourceDocument services to get beaconServices matching beaconIds
207
+ const beaconService = sourceDocument.service
208
+ .filter((service) => service.id === beaconId)
209
+ .filter((service) => !!service)
210
+ .shift();
211
+ // If no matching beacon service found, throw an UpdateError with INVALID_DID_UPDATE.
212
+ if (!beaconService) {
213
+ throw new UpdateError('No beacon service found for provided beaconId', INVALID_DID_UPDATE, { sourceDocument, beaconId });
214
+ }
215
+ // If no bitcoin network connection provided, initialize default
216
+ bitcoin ??= new BitcoinNetworkConnection();
217
+ // Announce the signed update to the blockchain using the specified beacon(s)
218
+ // await Update.announce(beaconService, signed, secretKey, bitcoin);
219
+ // Return signed update if announced successfully
220
+ return signed;
180
221
  }
181
222
  /**
182
223
  * Given the W3C DID Document of a `did:btcr2` identifier, return the signing verification method that will be used
183
224
  * for signing messages and credentials. If given, the `methodId` parameter is used to select the
184
225
  * verification method. If not given, the Identity Key's verification method with an ID fragment
185
226
  * of '#initialKey' is used.
186
- *
187
- * @param {{ didDocument: DidDocument; methodId?: string; }} params Parameters for the `getSigningMethod` method.
188
- * @param {DidDocument} params.didDocument DID Document to get the verification method from.
189
- * @param {string} params.methodId Optional ID of the verification method to use for signing.
227
+ * @param {Btcr2DidDocument} didDocument The DID Document of the `did:btcr2` identifier.
228
+ * @param {string} [methodId] Optional verification method ID to be used for signing.
190
229
  * @returns {DidVerificationMethod} Promise resolving to the {@link DidVerificationMethod} object used for signing.
191
230
  * @throws {DidError} if the parsed did method does not match `btcr2` or signing method could not be determined.
192
231
  */
193
- static getSigningMethod({ didDocument, methodId }) {
232
+ static getSigningMethod(didDocument, methodId) {
194
233
  // Set the default methodId to the first assertionMethod if not given
195
234
  methodId ??= '#initialKey';
196
235
  // Verify the DID method is supported.
@@ -1 +1 @@
1
- {"version":3,"file":"did-btcr2.js","sourceRoot":"","sources":["../../src/did-btcr2.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,oBAAoB,EAEpB,oBAAoB,EACpB,WAAW,EAEX,qBAAqB,GACtB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EACL,GAAG,EACH,QAAQ,EACR,YAAY,EAEZ,2BAA2B,EAC5B,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,KAAK,QAAQ,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAI/C,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAW/C,gCAAgC;AAChC,UAAU,CAAC,QAAQ,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;QAE3B,sCAAsC;QACtC,MAAM,SAAS,GAAG,GAAG,CAAC,KAAK,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;QAC5C,IAAI,SAAS,IAAI,SAAS,CAAC,MAAM,KAAK,IAAI,CAAC,UAAU,EAAE,CAAC;YACtD,MAAM,IAAI,WAAW,CAAC,yBAAyB,SAAS,CAAC,MAAM,EAAE,EAAE,oBAAoB,EAAE,EAAE,UAAU,EAAE,WAAW,CAAC,EAAE,EAAE,CAAC,CAAC;QAC3H,CAAC;QAED,2FAA2F;QAC3F,kEAAkE;QAClE,MAAM,kBAAkB,GAAG,WAAW,CAAC,kBAAkB,EAAE,IAAI,CAC7D,CAAC,EAAyB,EAAE,EAAE,CAAC,QAAQ,CAAC,kBAAkB,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,kBAAkB,CAAC,QAAQ,CAAC;eACvG,QAAQ,CAAC,kBAAkB,CAAC,WAAW,CAAC,eAAe,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CACpE,CAAC;QAEF,qDAAqD;QACrD,IAAI,CAAC,CAAC,kBAAkB,IAAI,kBAAkB,CAAC,kBAAkB,CAAC,EAAE,CAAC;YACnE,MAAM,IAAI,QAAQ,CAChB,YAAY,CAAC,aAAa,EAC1B,0FAA0F,CAC3F,CAAC;QACJ,CAAC;QACD,OAAO,kBAA2C,CAAC;IACrD,CAAC"}
package/dist/cjs/index.js CHANGED
@@ -1,43 +1,44 @@
1
+ export * from './core/beacon/aggregation/cohort/index.js';
2
+ export * from './core/beacon/aggregation/cohort/status.js';
3
+ export * from './core/beacon/aggregation/cohort/messages/base.js';
4
+ export * from './core/beacon/aggregation/cohort/messages/constants.js';
5
+ export * from './core/beacon/aggregation/cohort/messages/index.js';
6
+ export * from './core/beacon/aggregation/cohort/messages/keygen//subscribe.js';
1
7
  export * from './core/beacon/aggregation/cohort/messages/keygen/cohort-advert.js';
2
8
  export * from './core/beacon/aggregation/cohort/messages/keygen/cohort-ready.js';
3
9
  export * from './core/beacon/aggregation/cohort/messages/keygen/opt-in-accept.js';
4
10
  export * from './core/beacon/aggregation/cohort/messages/keygen/opt-in.js';
5
- export * from './core/beacon/aggregation/cohort/messages/keygen//subscribe.js';
6
11
  export * from './core/beacon/aggregation/cohort/messages/sign/aggregated-nonce.js';
7
12
  export * from './core/beacon/aggregation/cohort/messages/sign/authorization-request.js';
8
13
  export * from './core/beacon/aggregation/cohort/messages/sign/nonce-contribution.js';
9
14
  export * from './core/beacon/aggregation/cohort/messages/sign/request-signature.js';
10
15
  export * from './core/beacon/aggregation/cohort/messages/sign/signature-authorization.js';
11
- export * from './core/beacon/aggregation/cohort/messages/base.js';
12
- export * from './core/beacon/aggregation/cohort/messages/constants.js';
13
- export * from './core/beacon/aggregation/cohort/messages/index.js';
14
- export * from './core/beacon/aggregation/cohort/index.js';
15
- export * from './core/beacon/aggregation/cohort/status.js';
16
16
  export * from './core/beacon/aggregation/communication/adapter/did-comm.js';
17
17
  export * from './core/beacon/aggregation/communication/adapter/nostr.js';
18
18
  export * from './core/beacon/aggregation/communication/error.js';
19
19
  export * from './core/beacon/aggregation/communication/factory.js';
20
20
  export * from './core/beacon/aggregation/communication/service.js';
21
- export * from './core/beacon/aggregation/session/index.js';
22
- export * from './core/beacon/aggregation/session/status.js';
23
21
  export * from './core/beacon/aggregation/coordinator.js';
24
22
  export * from './core/beacon/aggregation/participant.js';
25
- export * from './core/beacon/cid-aggregate.js';
23
+ export * from './core/beacon/aggregation/session/index.js';
24
+ export * from './core/beacon/aggregation/session/status.js';
25
+ export * from './core/beacon/beacon.js';
26
+ export * from './core/beacon/cas-beacon.js';
26
27
  export * from './core/beacon/error.js';
27
28
  export * from './core/beacon/factory.js';
29
+ export * from './core/beacon/interfaces.js';
30
+ export * from './core/beacon/signal-discovery.js';
28
31
  export * from './core/beacon/singleton.js';
29
- export * from './core/beacon/smt-aggregate.js';
32
+ export * from './core/beacon/smt-beacon.js';
30
33
  export * from './core/beacon/utils.js';
31
- export * from './core/crud/deactivate.js';
32
- export * from './core/crud/read.js';
33
- export * from './core/crud/update.js';
34
34
  export * from './core/identifier.js';
35
- export * from './interfaces/beacon.js';
36
- export * from './interfaces/crud.js';
35
+ export * from './core/interfaces.js';
36
+ export * from './core/resolve.js';
37
+ export * from './core/types.js';
38
+ export * from './core/update.js';
37
39
  export * from './utils/appendix.js';
38
40
  export * from './utils/did-document-builder.js';
39
41
  export * from './utils/did-document.js';
40
42
  export * from './utils/general.js';
41
- export * from './utils/types.js';
42
43
  export * from './did-btcr2.js';
43
44
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,mEAAmE,CAAC;AAClF,cAAc,kEAAkE,CAAC;AACjF,cAAc,mEAAmE,CAAC;AAClF,cAAc,4DAA4D,CAAC;AAC3E,cAAc,gEAAgE,CAAC;AAE/E,cAAc,oEAAoE,CAAC;AACnF,cAAc,yEAAyE,CAAC;AACxF,cAAc,sEAAsE,CAAC;AACrF,cAAc,qEAAqE,CAAC;AACpF,cAAc,2EAA2E,CAAC;AAE1F,cAAc,mDAAmD,CAAC;AAClE,cAAc,wDAAwD,CAAC;AACvE,cAAc,oDAAoD,CAAC;AAEnE,cAAc,2CAA2C,CAAC;AAC1D,cAAc,4CAA4C,CAAC;AAE3D,cAAc,6DAA6D,CAAC;AAC5E,cAAc,0DAA0D,CAAC;AACzE,cAAc,kDAAkD,CAAC;AACjE,cAAc,oDAAoD,CAAC;AACnE,cAAc,oDAAoD,CAAC;AAEnE,cAAc,4CAA4C,CAAC;AAC3D,cAAc,6CAA6C,CAAC;AAE5D,cAAc,0CAA0C,CAAC;AACzD,cAAc,0CAA0C,CAAC;AAEzD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,wBAAwB,CAAC;AACvC,cAAc,0BAA0B,CAAC;AACzC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,gCAAgC,C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D,cAAc,4BAA4B,CAAC;AAC3C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,wBAAwB,CAAC;AAEvC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AAEjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,iCAAiC,CAAC;AAChD,cAAc,yBAAyB,CAAC;AACxC,cAAc,oBAAoB,CAAC;AAEnC,cAAc,gBAAgB,CAAC"}
@@ -1,4 +1,3 @@
1
- import { W3C_ZCAP_V1 } from '@did-btcr2/common';
2
1
  import { strings } from '@helia/strings';
3
2
  import { DidError, DidErrorCode, DidVerificationRelationship } from '@web5/dids';
4
3
  import { createHelia } from 'helia';
@@ -104,20 +103,12 @@ export class Appendix {
104
103
  * ```
105
104
  */
106
105
  static deriveRootCapability(identifier) {
107
- // 1. Define rootCapability as an empty object.
108
- const rootCapability = {};
109
- // 2. Set rootCapability.@context to ‘https://w3id.org/zcap/v1’.
110
- rootCapability['@context'] = W3C_ZCAP_V1;
111
- // 3. Set encodedIdentifier to result of calling algorithm encodeURIComponent(identifier).
112
- const encodedIdentifier = encodeURIComponent(identifier);
113
- // 4. Set rootCapability.id to urn:zcap:root:${encodedIdentifier}.
114
- rootCapability.id = `urn:zcap:root:${encodedIdentifier}`;
115
- // 5. Set rootCapability.controller to identifier.
116
- rootCapability.controller = identifier;
117
- // 6. Set rootCapability.invocationTarget to identifier.
118
- rootCapability.invocationTarget = identifier;
119
- // 7. Return rootCapability.
120
- return rootCapability;
106
+ return {
107
+ '@context': 'https://w3id.org/zcap/v1',
108
+ id: `urn:zcap:root:${encodeURIComponent(identifier)}`,
109
+ controller: identifier,
110
+ invocationTarget: identifier,
111
+ };
121
112
  }
122
113
  /**
123
114
  * Implements {@link https://dcdpr.github.io/did-btcr2/#dereference-root-capability-identifier | 9.4.2 Dereference Root Capability Identifier}.
@@ -159,7 +150,7 @@ export class Appendix {
159
150
  * }
160
151
  * }
161
152
  */
162
- static derefernceRootCapabilityIdentifier(capabilityId) {
153
+ static dereferenceZcapId(capabilityId) {
163
154
  // 1. Set rootCapability to an empty object.
164
155
  const rootCapability = {};
165
156
  // 2. Set components to the result of capabilityId.split(":").
@@ -195,26 +186,18 @@ export class Appendix {
195
186
  return rootCapability;
196
187
  }
197
188
  /**
198
- * Implements {@link https://dcdpr.github.io/did-btcr2/#fetch-content-from-addressable-storage | 9.3. Fetch Content from Addressable Storage}.
199
- *
200
- * The Fetch Content from Addressable Storage function takes in SHA256 hash of some content, hashBytes, converts these
201
- * bytes to a IPFS v1 Content Identifier and attempts to retrieve the identified content from Content Addressable
202
- * Storage (CAS). It returns the retrieved content or null.
203
- *
204
- * @param {HashBytes} hashBytes The SHA256 hash of the content to be fetched.
205
- * @returns {string} The fetched content or null if not found.
189
+ * Implements CAS Lookup Step from {@link https://dcdpr.github.io/did-btcr2/operations/resolve.html#process-beacon-signals | 7.2.e Process Beacon Signals }.
190
+ * @param {HashBytes} hashBytes The hash bytes to look up in the CAS system.
191
+ * @returns {Promise<string | undefined>} The content fetched from the CAS system, or undefined if not found.
206
192
  */
207
193
  static async fetchFromCas(hashBytes) {
208
- // 1. Set cid to the result of converting hashBytes to an IPFS v1 CID.
194
+ // Construct CID from hash bytes
209
195
  const cid = CID.create(1, 1, createDigest(1, hashBytes));
210
- // Create a Helia node connection to IPFS
211
- const helia = strings(await createHelia());
212
- // 2. Set content to the result of fetching the cid from a CAS system. Which CAS systems checked is up to implementation.
213
- // TODO: Is this right? Are implementations just supposed to check all CAS they trust?'
214
- const content = await helia.get(cid, {});
215
- // 3. If content for cid cannot be found, set content to null.
216
- // 4. Return content.
217
- return content;
196
+ // Connect to IPFS/Helia node
197
+ const helia = await createHelia();
198
+ const node = strings(helia);
199
+ // Return the IPFS get result
200
+ return await node.get(cid, {});
218
201
  }
219
202
  }
220
203
  //# sourceMappingURL=appendix.js.map
@@ -1 +1 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C5C,cAAc,CAAC,EAAE,GAAG,YAAY,CAAC;QAEjC,kDAAkD;QAClD,cAAc,CAAC,UAAU,GAAG,UAAU,CAAC;QAEvC,wDAAwD;QACxD,cAAc,CAAC,gBAAgB,GAAG,UAAU,CAAC;QAE7C,4BAA4B;QAC5B,OAAO,cAAc,CAAC;IACxB,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,KAAK,CAAC,YAAY,CAAC,SAAoB;QAC5C,gCAAgC;QAChC,MAAM,GAAG,GAAG,GAAG,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,YAAY,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC,CAAC;QAEzD,6BAA6B;QAC7B,MAAM,KAAK,GAAG,MAAM,WAAW,EAAE,CAAC;QAClC,MAAM,IAAI,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;QAE5B,6BAA6B;QAC7B,OAAO,MAAM,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;IACjC,CAAC;CACF"}
@@ -1,5 +1,10 @@
1
1
  import { DidDocumentError, INVALID_DID_DOCUMENT } from '@did-btcr2/common';
2
2
  import { DidDocument } from './did-document.js';
3
+ /**
4
+ * A builder class for constructing DID Documents.
5
+ * @type {DidDocumentBuilder}
6
+ * @class DidDocumentBuilder
7
+ */
3
8
  export class DidDocumentBuilder {
4
9
  document = {};
5
10
  constructor(initialDocument) {