@did-btcr2/method 0.18.1 → 0.19.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 (262) hide show
  1. package/dist/browser.js +5217 -6057
  2. package/dist/browser.mjs +5217 -6057
  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/cas-beacon.js +55 -0
  36. package/dist/cjs/core/beacon/cas-beacon.js.map +1 -0
  37. package/dist/cjs/core/beacon/factory.js +11 -10
  38. package/dist/cjs/core/beacon/factory.js.map +1 -1
  39. package/dist/cjs/core/beacon/interfaces.js +32 -0
  40. package/dist/cjs/core/beacon/interfaces.js.map +1 -0
  41. package/dist/cjs/core/beacon/singleton.js +59 -135
  42. package/dist/cjs/core/beacon/singleton.js.map +1 -1
  43. package/dist/cjs/core/beacon/smt-beacon.js +56 -0
  44. package/dist/cjs/core/beacon/smt-beacon.js.map +1 -0
  45. package/dist/cjs/core/beacon/utils.js +67 -105
  46. package/dist/cjs/core/beacon/utils.js.map +1 -1
  47. package/dist/cjs/core/identifier.js +18 -21
  48. package/dist/cjs/core/identifier.js.map +1 -1
  49. package/dist/cjs/core/interfaces.js +2 -0
  50. package/dist/cjs/core/interfaces.js.map +1 -0
  51. package/dist/cjs/core/resolve.js +511 -0
  52. package/dist/cjs/core/resolve.js.map +1 -0
  53. package/dist/cjs/{utils → core}/types.js.map +1 -1
  54. package/dist/cjs/core/{crud/update.js → update.js} +62 -52
  55. package/dist/cjs/core/update.js.map +1 -0
  56. package/dist/cjs/did-btcr2.js +109 -75
  57. package/dist/cjs/did-btcr2.js.map +1 -1
  58. package/dist/cjs/index.js +14 -15
  59. package/dist/cjs/index.js.map +1 -1
  60. package/dist/cjs/utils/appendix.js +10 -18
  61. package/dist/cjs/utils/appendix.js.map +1 -1
  62. package/dist/cjs/utils/did-document.js +51 -58
  63. package/dist/cjs/utils/did-document.js.map +1 -1
  64. package/dist/cjs/utils/general.js +1 -1
  65. package/dist/cjs/utils/general.js.map +1 -1
  66. package/dist/esm/core/beacon/aggregation/cohort/index.js +3 -3
  67. package/dist/esm/core/beacon/aggregation/cohort/index.js.map +1 -1
  68. package/dist/esm/core/beacon/aggregation/cohort/messages/base.js +1 -9
  69. package/dist/esm/core/beacon/aggregation/cohort/messages/base.js.map +1 -1
  70. package/dist/esm/core/beacon/aggregation/cohort/messages/keygen/cohort-advert.js +2 -1
  71. package/dist/esm/core/beacon/aggregation/cohort/messages/keygen/cohort-advert.js.map +1 -1
  72. package/dist/esm/core/beacon/aggregation/cohort/messages/keygen/cohort-ready.js +2 -1
  73. package/dist/esm/core/beacon/aggregation/cohort/messages/keygen/cohort-ready.js.map +1 -1
  74. package/dist/esm/core/beacon/aggregation/cohort/messages/keygen/opt-in-accept.js +2 -1
  75. package/dist/esm/core/beacon/aggregation/cohort/messages/keygen/opt-in-accept.js.map +1 -1
  76. package/dist/esm/core/beacon/aggregation/cohort/messages/keygen/opt-in.js +2 -1
  77. package/dist/esm/core/beacon/aggregation/cohort/messages/keygen/opt-in.js.map +1 -1
  78. package/dist/esm/core/beacon/aggregation/cohort/messages/keygen/subscribe.js +2 -1
  79. package/dist/esm/core/beacon/aggregation/cohort/messages/keygen/subscribe.js.map +1 -1
  80. package/dist/esm/core/beacon/aggregation/cohort/messages/sign/aggregated-nonce.js +2 -1
  81. package/dist/esm/core/beacon/aggregation/cohort/messages/sign/aggregated-nonce.js.map +1 -1
  82. package/dist/esm/core/beacon/aggregation/cohort/messages/sign/authorization-request.js +2 -1
  83. package/dist/esm/core/beacon/aggregation/cohort/messages/sign/authorization-request.js.map +1 -1
  84. package/dist/esm/core/beacon/aggregation/cohort/messages/sign/nonce-contribution.js +2 -1
  85. package/dist/esm/core/beacon/aggregation/cohort/messages/sign/nonce-contribution.js.map +1 -1
  86. package/dist/esm/core/beacon/aggregation/cohort/messages/sign/request-signature.js +2 -1
  87. package/dist/esm/core/beacon/aggregation/cohort/messages/sign/request-signature.js.map +1 -1
  88. package/dist/esm/core/beacon/aggregation/cohort/messages/sign/signature-authorization.js +2 -1
  89. package/dist/esm/core/beacon/aggregation/cohort/messages/sign/signature-authorization.js.map +1 -1
  90. package/dist/esm/core/beacon/aggregation/communication/adapter/nostr.js +36 -18
  91. package/dist/esm/core/beacon/aggregation/communication/adapter/nostr.js.map +1 -1
  92. package/dist/esm/core/beacon/aggregation/coordinator.js +14 -14
  93. package/dist/esm/core/beacon/aggregation/coordinator.js.map +1 -1
  94. package/dist/esm/core/beacon/aggregation/participant.js +4 -3
  95. package/dist/esm/core/beacon/aggregation/participant.js.map +1 -1
  96. package/dist/esm/core/beacon/aggregation/session/index.js +1 -1
  97. package/dist/esm/core/beacon/aggregation/session/index.js.map +1 -1
  98. package/dist/esm/core/beacon/cas-beacon.js +55 -0
  99. package/dist/esm/core/beacon/cas-beacon.js.map +1 -0
  100. package/dist/esm/core/beacon/factory.js +11 -10
  101. package/dist/esm/core/beacon/factory.js.map +1 -1
  102. package/dist/esm/core/beacon/interfaces.js +32 -0
  103. package/dist/esm/core/beacon/interfaces.js.map +1 -0
  104. package/dist/esm/core/beacon/singleton.js +59 -135
  105. package/dist/esm/core/beacon/singleton.js.map +1 -1
  106. package/dist/esm/core/beacon/smt-beacon.js +56 -0
  107. package/dist/esm/core/beacon/smt-beacon.js.map +1 -0
  108. package/dist/esm/core/beacon/utils.js +67 -105
  109. package/dist/esm/core/beacon/utils.js.map +1 -1
  110. package/dist/esm/core/identifier.js +18 -21
  111. package/dist/esm/core/identifier.js.map +1 -1
  112. package/dist/esm/core/interfaces.js +2 -0
  113. package/dist/esm/core/interfaces.js.map +1 -0
  114. package/dist/esm/core/resolve.js +511 -0
  115. package/dist/esm/core/resolve.js.map +1 -0
  116. package/dist/esm/{utils → core}/types.js.map +1 -1
  117. package/dist/esm/core/{crud/update.js → update.js} +62 -52
  118. package/dist/esm/core/update.js.map +1 -0
  119. package/dist/esm/did-btcr2.js +109 -75
  120. package/dist/esm/did-btcr2.js.map +1 -1
  121. package/dist/esm/index.js +14 -15
  122. package/dist/esm/index.js.map +1 -1
  123. package/dist/esm/utils/appendix.js +10 -18
  124. package/dist/esm/utils/appendix.js.map +1 -1
  125. package/dist/esm/utils/did-document.js +51 -58
  126. package/dist/esm/utils/did-document.js.map +1 -1
  127. package/dist/esm/utils/general.js +1 -1
  128. package/dist/esm/utils/general.js.map +1 -1
  129. package/dist/types/core/beacon/aggregation/cohort/index.d.ts +1 -1
  130. package/dist/types/core/beacon/aggregation/cohort/messages/base.d.ts +0 -7
  131. package/dist/types/core/beacon/aggregation/cohort/messages/base.d.ts.map +1 -1
  132. package/dist/types/core/beacon/aggregation/cohort/messages/keygen/cohort-advert.d.ts.map +1 -1
  133. package/dist/types/core/beacon/aggregation/cohort/messages/keygen/cohort-ready.d.ts.map +1 -1
  134. package/dist/types/core/beacon/aggregation/cohort/messages/keygen/opt-in-accept.d.ts.map +1 -1
  135. package/dist/types/core/beacon/aggregation/cohort/messages/keygen/opt-in.d.ts.map +1 -1
  136. package/dist/types/core/beacon/aggregation/cohort/messages/keygen/subscribe.d.ts.map +1 -1
  137. package/dist/types/core/beacon/aggregation/cohort/messages/sign/aggregated-nonce.d.ts.map +1 -1
  138. package/dist/types/core/beacon/aggregation/cohort/messages/sign/authorization-request.d.ts.map +1 -1
  139. package/dist/types/core/beacon/aggregation/cohort/messages/sign/nonce-contribution.d.ts.map +1 -1
  140. package/dist/types/core/beacon/aggregation/cohort/messages/sign/request-signature.d.ts.map +1 -1
  141. package/dist/types/core/beacon/aggregation/cohort/messages/sign/signature-authorization.d.ts.map +1 -1
  142. package/dist/types/core/beacon/aggregation/communication/adapter/nostr.d.ts +13 -5
  143. package/dist/types/core/beacon/aggregation/communication/adapter/nostr.d.ts.map +1 -1
  144. package/dist/types/core/beacon/aggregation/coordinator.d.ts +17 -29
  145. package/dist/types/core/beacon/aggregation/coordinator.d.ts.map +1 -1
  146. package/dist/types/core/beacon/aggregation/participant.d.ts.map +1 -1
  147. package/dist/types/core/beacon/cas-beacon.d.ts +47 -0
  148. package/dist/types/core/beacon/cas-beacon.d.ts.map +1 -0
  149. package/dist/types/core/beacon/factory.d.ts +5 -4
  150. package/dist/types/core/beacon/factory.d.ts.map +1 -1
  151. package/dist/types/core/beacon/interfaces.d.ts +98 -0
  152. package/dist/types/core/beacon/interfaces.d.ts.map +1 -0
  153. package/dist/types/core/beacon/singleton.d.ts +22 -65
  154. package/dist/types/core/beacon/singleton.d.ts.map +1 -1
  155. package/dist/types/core/beacon/smt-beacon.d.ts +48 -0
  156. package/dist/types/core/beacon/smt-beacon.d.ts.map +1 -0
  157. package/dist/types/core/beacon/utils.d.ts +19 -97
  158. package/dist/types/core/beacon/utils.d.ts.map +1 -1
  159. package/dist/types/core/identifier.d.ts.map +1 -1
  160. package/dist/types/core/interfaces.d.ts +94 -0
  161. package/dist/types/core/interfaces.d.ts.map +1 -0
  162. package/dist/types/core/resolve.d.ts +105 -0
  163. package/dist/types/core/resolve.d.ts.map +1 -0
  164. package/dist/types/core/types.d.ts +71 -0
  165. package/dist/types/core/types.d.ts.map +1 -0
  166. package/dist/types/core/{crud/update.d.ts → update.d.ts} +21 -20
  167. package/dist/types/core/update.d.ts.map +1 -0
  168. package/dist/types/did-btcr2.d.ts +45 -57
  169. package/dist/types/did-btcr2.d.ts.map +1 -1
  170. package/dist/types/index.d.ts +14 -15
  171. package/dist/types/index.d.ts.map +1 -1
  172. package/dist/types/utils/appendix.d.ts +5 -10
  173. package/dist/types/utils/appendix.d.ts.map +1 -1
  174. package/dist/types/utils/did-document-builder.d.ts +1 -1
  175. package/dist/types/utils/did-document-builder.d.ts.map +1 -1
  176. package/dist/types/utils/did-document.d.ts +31 -29
  177. package/dist/types/utils/did-document.d.ts.map +1 -1
  178. package/package.json +6 -6
  179. package/src/core/beacon/aggregation/cohort/index.ts +3 -3
  180. package/src/core/beacon/aggregation/cohort/messages/base.ts +1 -12
  181. package/src/core/beacon/aggregation/cohort/messages/keygen/cohort-advert.ts +2 -2
  182. package/src/core/beacon/aggregation/cohort/messages/keygen/cohort-ready.ts +2 -2
  183. package/src/core/beacon/aggregation/cohort/messages/keygen/opt-in-accept.ts +2 -2
  184. package/src/core/beacon/aggregation/cohort/messages/keygen/opt-in.ts +2 -2
  185. package/src/core/beacon/aggregation/cohort/messages/keygen/subscribe.ts +2 -2
  186. package/src/core/beacon/aggregation/cohort/messages/sign/aggregated-nonce.ts +2 -2
  187. package/src/core/beacon/aggregation/cohort/messages/sign/authorization-request.ts +2 -2
  188. package/src/core/beacon/aggregation/cohort/messages/sign/nonce-contribution.ts +2 -2
  189. package/src/core/beacon/aggregation/cohort/messages/sign/request-signature.ts +2 -2
  190. package/src/core/beacon/aggregation/cohort/messages/sign/signature-authorization.ts +2 -2
  191. package/src/core/beacon/aggregation/communication/adapter/nostr.ts +43 -21
  192. package/src/core/beacon/aggregation/coordinator.ts +41 -29
  193. package/src/core/beacon/aggregation/participant.ts +4 -3
  194. package/src/core/beacon/aggregation/session/index.ts +1 -1
  195. package/src/core/beacon/cas-beacon.ts +67 -0
  196. package/src/core/beacon/factory.ts +13 -15
  197. package/src/core/beacon/interfaces.ts +124 -0
  198. package/src/core/beacon/singleton.ts +75 -145
  199. package/src/core/beacon/smt-beacon.ts +70 -0
  200. package/src/core/beacon/utils.ts +80 -170
  201. package/src/core/identifier.ts +21 -24
  202. package/src/core/interfaces.ts +101 -0
  203. package/src/core/resolve.ts +707 -0
  204. package/src/core/types.ts +78 -0
  205. package/src/core/{crud/update.ts → update.ts} +75 -68
  206. package/src/did-btcr2.ts +152 -92
  207. package/src/index.ts +14 -24
  208. package/src/utils/appendix.ts +18 -22
  209. package/src/utils/did-document-builder.ts +1 -1
  210. package/src/utils/did-document.ts +67 -71
  211. package/src/utils/general.ts +1 -1
  212. package/dist/cjs/core/beacon/cid-aggregate.js +0 -116
  213. package/dist/cjs/core/beacon/cid-aggregate.js.map +0 -1
  214. package/dist/cjs/core/beacon/smt-aggregate.js +0 -126
  215. package/dist/cjs/core/beacon/smt-aggregate.js.map +0 -1
  216. package/dist/cjs/core/crud/deactivate.js +0 -14
  217. package/dist/cjs/core/crud/deactivate.js.map +0 -1
  218. package/dist/cjs/core/crud/read.js +0 -679
  219. package/dist/cjs/core/crud/read.js.map +0 -1
  220. package/dist/cjs/core/crud/update.js.map +0 -1
  221. package/dist/cjs/interfaces/beacon.js +0 -41
  222. package/dist/cjs/interfaces/beacon.js.map +0 -1
  223. package/dist/cjs/interfaces/crud.js +0 -2
  224. package/dist/cjs/interfaces/crud.js.map +0 -1
  225. package/dist/esm/core/beacon/cid-aggregate.js +0 -116
  226. package/dist/esm/core/beacon/cid-aggregate.js.map +0 -1
  227. package/dist/esm/core/beacon/smt-aggregate.js +0 -126
  228. package/dist/esm/core/beacon/smt-aggregate.js.map +0 -1
  229. package/dist/esm/core/crud/deactivate.js +0 -14
  230. package/dist/esm/core/crud/deactivate.js.map +0 -1
  231. package/dist/esm/core/crud/read.js +0 -679
  232. package/dist/esm/core/crud/read.js.map +0 -1
  233. package/dist/esm/core/crud/update.js.map +0 -1
  234. package/dist/esm/interfaces/beacon.js +0 -41
  235. package/dist/esm/interfaces/beacon.js.map +0 -1
  236. package/dist/esm/interfaces/crud.js +0 -2
  237. package/dist/esm/interfaces/crud.js.map +0 -1
  238. package/dist/types/core/beacon/cid-aggregate.d.ts +0 -102
  239. package/dist/types/core/beacon/cid-aggregate.d.ts.map +0 -1
  240. package/dist/types/core/beacon/smt-aggregate.d.ts +0 -111
  241. package/dist/types/core/beacon/smt-aggregate.d.ts.map +0 -1
  242. package/dist/types/core/crud/deactivate.d.ts +0 -13
  243. package/dist/types/core/crud/deactivate.d.ts.map +0 -1
  244. package/dist/types/core/crud/read.d.ts +0 -334
  245. package/dist/types/core/crud/read.d.ts.map +0 -1
  246. package/dist/types/core/crud/update.d.ts.map +0 -1
  247. package/dist/types/interfaces/beacon.d.ts +0 -116
  248. package/dist/types/interfaces/beacon.d.ts.map +0 -1
  249. package/dist/types/interfaces/crud.d.ts +0 -32
  250. package/dist/types/interfaces/crud.d.ts.map +0 -1
  251. package/dist/types/utils/types.d.ts +0 -38
  252. package/dist/types/utils/types.d.ts.map +0 -1
  253. package/src/canonicalize.d.ts +0 -6
  254. package/src/core/beacon/cid-aggregate.ts +0 -153
  255. package/src/core/beacon/smt-aggregate.ts +0 -135
  256. package/src/core/crud/deactivate.ts +0 -13
  257. package/src/core/crud/read.ts +0 -948
  258. package/src/interfaces/beacon.ts +0 -137
  259. package/src/interfaces/crud.ts +0 -33
  260. package/src/utils/types.ts +0 -41
  261. /package/dist/cjs/{utils → core}/types.js +0 -0
  262. /package/dist/esm/{utils → core}/types.js +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/core/beacon/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,QAAQ,EAAE,KAAK,EAAe,MAAM,mBAAmB,CAAC;AAEjF,OAAO,EAAE,QAAQ,EAAY,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAEjF,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAE1D,MAAM,WAAW,oBAAoB;IACnC,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,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oB,CAAC,OAAO,EAAE,KAAK,CAAC,aAAa,CAAC,GAAG,GAAG,CAAC,MAAM,EAAE,aAAa,CAAC;IAQtF;;;;OAIG;IACH,MAAM,CAAC,mBAAmB,CAAC,WAAW,EAAE,WAAW,GAAG,MAAM,EAAE;CAG/D"}
@@ -1 +1 @@
1
- {"version":3,"file":"identifier.d.ts","sourceRoot":"","sources":["../../../src/core/identifier.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,KAAK,EAAmE,MAAM,mBAAmB,CAAC;AAChI,OAAO,EAAgC,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAGlF;;;;;;;;GAQG;AACH,MAAM,WAAW,aAAa;IAC1B,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,KAAK,CAAC;CACvB;AAED;;;;;;;;;;GAUG;AACH,qBAAa,UAAU;IACrB;;;;;;;;;;;;;;;;OAgBG;WACW,MAAM,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,EAAE;QAC/D,MAAM,EAAE,MAAM,CAAC;QACf,OAAO,EAAE,MAAM,CAAC;QAChB,OAAO,EAAE,MAAM,CAAC;QAChB,YAAY,EAAE,KAAK,CAAC;KACrB,GAAG,MAAM;IAuFV;;;;;;;OAOG;WACW,MAAM,CAAC,UAAU,EAAE,MAAM,GAAG,aAAa;IA8HvD;;;OAGG;WACW,QAAQ,IAAI;QAAE,IAAI,EAAE,cAAc,CAAC;QAAC,UAAU,EAAE;YAAE,UAAU,EAAE,MAAM,CAAC;YAAC,EAAE,EAAE,MAAM,CAAA;SAAE,CAAA;KAAE;IAYlG;;;;OAIG;IACH,MAAM,CAAC,OAAO,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO;CAQ5C"}
1
+ {"version":3,"file":"identifier.d.ts","sourceRoot":"","sources":["../../../src/core/identifier.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,KAAK,EAAuE,MAAM,mBAAmB,CAAC;AACpI,OAAO,EAAgC,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAGlF;;;;;;;;GAQG;AACH,MAAM,WAAW,aAAa;IAC1B,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,KAAK,CAAC;CACvB;AAED;;;;;;;;;;GAUG;AACH,qBAAa,UAAU;IACrB;;;;;;;;;;;;;;;;OAgBG;IACH,MAAM,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,EAAE;QACxD,MAAM,EAAE,MAAM,CAAC;QACf,OAAO,EAAE,MAAM,CAAC;QAChB,OAAO,EAAE,MAAM,CAAC;QAChB,YAAY,EAAE,KAAK,CAAC;KACrB,GAAG,MAAM;IAoFV;;;;;;;OAOG;IACH,MAAM,CAAC,MAAM,CAAC,UAAU,EAAE,MAAM,GAAG,aAAa;IA8HhD;;;OAGG;IACH,MAAM,CAAC,QAAQ,IAAI;QAAE,IAAI,EAAE,cAAc,CAAC;QAAC,UAAU,EAAE;YAAE,UAAU,EAAE,MAAM,CAAC;YAAC,EAAE,EAAE,MAAM,CAAA;SAAE,CAAA;KAAE;IAY3F;;;;OAIG;IACH,MAAM,CAAC,OAAO,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO;CAQ5C"}
@@ -0,0 +1,94 @@
1
+ import { BitcoinNetworkConnection } from '@did-btcr2/bitcoin';
2
+ import { DidResolutionOptions } from '@web5/dids';
3
+ import { Sidecar } from './types.js';
4
+ export interface RootCapability {
5
+ '@context': string;
6
+ id: string;
7
+ controller: string;
8
+ invocationTarget: string;
9
+ }
10
+ /**
11
+ * See {@link https://dcdpr.github.io/did-btcr2/data-structures.html#resolution-options-example-panel-show | Resolution Options}
12
+ * for data structure details.
13
+ */
14
+ export interface ResolutionOptionsCore extends DidResolutionOptions {
15
+ /**
16
+ * Optional ASCII string representation of the specific version of a DID document
17
+ * to be resolved.
18
+ */
19
+ versionId?: string;
20
+ /**
21
+ * Optional XML Datetime normalized to UTC without sub-second decimal precision.
22
+ * The DID document to be resolved is the most recent version of the DID document
23
+ * that was valid for the DID before the specified versionTime.
24
+ */
25
+ versionTime?: string;
26
+ /**
27
+ * Data transmitted via {@link https://dcdpr.github.io/did-btcr2/data-structures.html#sidecar-data-example-panel-show | Sidecar (data structure)}.
28
+ * Includes Singleton beacon updates, CAS announcements, and SMT proofs.
29
+ */
30
+ sidecar?: Sidecar;
31
+ }
32
+ /**
33
+ * Full set of resolution options for the did:btcr2 method. See {@link ResolutionOptionsCore}
34
+ * for the resolution options defined by the specification.
35
+ * @extends ResolutionOptionsCore
36
+ */
37
+ export interface ResolutionOptions extends ResolutionOptionsCore {
38
+ /**
39
+ * Drivers for interacting with external systems, such as the Bitcoin network.
40
+ */
41
+ drivers: {
42
+ bitcoin?: BitcoinNetworkConnection;
43
+ };
44
+ /**
45
+ * Flag to signal a full blockchain search for beacon signals from genesis
46
+ * block to chain tip during resolution, instead of using an indexer.
47
+ * @type {boolean}
48
+ * @default false
49
+ */
50
+ fullBlockchainTraversal?: boolean;
51
+ }
52
+ /**
53
+ * {@link https://dcdpr.github.io/did-btcr2/terminology.html#smt-proof | SMT Proof}
54
+ * a set of SHA-256 hashes for nodes in a Sparse Merkle Tree that together form
55
+ * a path from a leaf in the tree to the Merkle root, proving that the leaf is in the tree.
56
+ * See {@link https://dcdpr.github.io/did-btcr2/data-structures.html#smt-proof | SMT Proof (data structure)}.
57
+ *
58
+ * @example
59
+ * ```json
60
+ * {
61
+ * "id": "<< Hexadecimal of Root Hash >>",
62
+ * "nonce": "<< Hexadecimal of Nonce 1101 >>",
63
+ * "updateId": "<< Hexadecimal of hash(Data Block 1101) >>",
64
+ * "collapsed": "<< Hexadecimal of 0001 >>",
65
+ * "hashes": [
66
+ * "<< Hexadecimal of Hash 1110 >>",
67
+ * "<< Hexadecimal of Hash 1001 >>",
68
+ * "<< Hexadecimal of Hash 0 >>"
69
+ * ]
70
+ * }
71
+ * ```
72
+ */
73
+ export interface SMTProof {
74
+ /**
75
+ * The SHA-256 hash of the root node of the Sparse Merkle Tree.
76
+ */
77
+ id: string;
78
+ /**
79
+ * Optional 256-bit nonce generated for each update. MUST be encoded as a string using the "base64url" [RFC4648] encoding.
80
+ */
81
+ nonce?: string;
82
+ /**
83
+ * Optional BTCR2 Signed Update (data structure) hashed with the JSON Document Hashing algorithm.
84
+ */
85
+ updateId?: string;
86
+ /**
87
+ * Bitmap of zero nodes within the path (see: collapsed leaves).
88
+ */
89
+ collapsed: string;
90
+ /**
91
+ * Array of SHA-256 hashes representing the sibling SMT nodes from the leaf, containing the SHA-256 hash of the BTCR2 Signed Update or the “zero identity”, to the root.
92
+ */
93
+ hashes: string[];
94
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../src/core/interfaces.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAErC,MAAM,WAAW,cAAc;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,MAAM,CAAC;IACnB,gBAAgB,EAAE,MAAM,CAAC;CAC5B;AAED;;;GAGG;AACH,MAAM,WAAW,qBAAsB,SAAQ,oBAAoB;IACjE;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAElB;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;;;GAIG;AACH,MAAM,WAAW,iBAAkB,SAAQ,qBAAqB;IAC9D;;OAEG;IACH,OAAO,EAAE;QACP,OAAO,CAAC,EAAE,wBAAwB,CAAC;KACpC,CAAC;IAEF;;;;;OAKG;IACH,uBAAuB,CAAC,EAAE,OAAO,CAAC;CACnC;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,WAAW,QAAQ;IACvB;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IACX;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB"}
@@ -0,0 +1,105 @@
1
+ import { BitcoinNetworkConnection } from '@did-btcr2/bitcoin';
2
+ import { BTCR2SignedUpdate } from '@did-btcr2/cryptosuite';
3
+ import { DidDocument } from '../utils/did-document.js';
4
+ import { BeaconService, BeaconSignal, BlockMetadata } from './beacon/interfaces.js';
5
+ import { DidComponents } from './identifier.js';
6
+ import { Sidecar, SidecarData } from './types.js';
7
+ /**
8
+ * The response object for DID Resolution.
9
+ */
10
+ export interface DidResolutionResponse {
11
+ currentDocument: DidDocument;
12
+ confirmations: number;
13
+ versionId: string;
14
+ updated: string;
15
+ }
16
+ /**
17
+ * Implements {@link https://dcdpr.github.io/did-btcr2/operations/resolve.html | 7.2 Resolve}.
18
+ * Resolving a did:btcr2 identifier iteratively builds a DID document by applying BTCR2 Updates
19
+ * to an Initial DID Document that have been committed to the Bitcoin blockchain by Authorized
20
+ * Beacon Signals. The Initial DID Document is either deterministically created from the DID or
21
+ * provided by Sidecar Data.
22
+ * @class Resolve
23
+ * @type {Resolve}
24
+ */
25
+ export declare class Resolve {
26
+ /**
27
+ * Implements subsection {@link https://dcdpr.github.io/did-btcr2/operations/resolve.html#process-sidecar-data | Process Sidecar Data}
28
+ * @param {Sidecar} sidecar The sidecar data to process.
29
+ * @returns {SidecarData} The processed sidecar data containing maps of updates, CAS announcements, and SMT proofs.
30
+ */
31
+ static processSidecarData(sidecar?: Sidecar): SidecarData;
32
+ /**
33
+ * Implements subsection {@link https://dcdpr.github.io/did-btcr2/operations/resolve.html#establish-current-document | 7.2.d Establish current_document}.
34
+ * Resolution begins by creating an Initial Did Document called current_document (Current DID Document).
35
+ * The current_document is iteratively patched with BTCR2 Signed Updates announced by Authorized Beacon Signals.
36
+ * @param {DidComponents} didComponents The decoded components of the did.
37
+ * @param {GenesisDocument} genesisDocument The genesis document for resolving the DID Document.
38
+ * @returns {Promise<DidDocument>} The resolved DID Document object.
39
+ * @throws {DidError} if the DID hrp is invalid, no sidecarData passed and hrp = "x".
40
+ */
41
+ static establishCurrentDocument(didComponents: DidComponents, genesisDocument?: object): Promise<DidDocument>;
42
+ /**
43
+ * Implements subsection {@link https://dcdpr.github.io/did-btcr2/operations/resolve.html#if-genesis_bytes-is-a-secp256k1-public-key | 7.2.d.1 if genesis bytes is a secp256k1 Public Key}.
44
+ * @param {DidComponents} didComponents The decoded components of the did.
45
+ * @returns {DidDocument} The resolved DID Document object.
46
+ */
47
+ static deterministic(didComponents: DidComponents): DidDocument;
48
+ /**
49
+ * Implements subsection {@link https://dcdpr.github.io/did-btcr2/operations/resolve.html#if-genesis_bytes-is-a-sha-256-hash | 7.2.d.2 if genesis_bytes is a SHA-256 Hash}.
50
+ * @param {DidComponents} didComponents BTCR2 DID components used to resolve the DID Document
51
+ * @param {GenesisDocument} genesisDocument The genesis document for resolving the DID Document.
52
+ * @returns {Promise<DidDocument>} The resolved DID Document object
53
+ * @throws {MethodError} InvalidDidDocument if not conformant to DID Core v1.1
54
+ */
55
+ static external(didComponents: DidComponents, genesisDocument: object): Promise<DidDocument>;
56
+ /**
57
+ * Finds uses the beacon services in the currentDocument to scan for onchain Beacon Signals (transactions) containing
58
+ * Signal Bytes (last output in OP_RETURN transaction).
59
+ * @param {Array<BeaconService>} beaconServices The array of BeaconService objects to search for signals.
60
+ * @param {SidecarData} sidecarData The sidecar data containing maps of updates, CAS announcements, and SMT proofs.
61
+ * @param {BitcoinNetworkConnection} bitcoin The bitcoin network connection used to fetch beacon signals
62
+ * @param {boolean} [fullBlockchainTraversal=false] Whether to perform a full blockchain traversal or use an indexer
63
+ * @returns {Promise<Array<[BTCR2SignedUpdate, BlockMetadata]>>} The array of BTCR2 Signed Updates announced by the Beacon Signals.
64
+ */
65
+ static processBeaconSignals(beaconServices: Array<BeaconService>, sidecarData: SidecarData, bitcoin: BitcoinNetworkConnection, fullBlockchainTraversal?: boolean): Promise<Array<[BTCR2SignedUpdate, BlockMetadata]>>;
66
+ /**
67
+ * Implements subsection {@link https://dcdpr.github.io/did-btcr2/operations/resolve.html#process-updates | 7.2.f Process updates Array}.
68
+ * @param {DidDocument} currentDocument The current DID Document to apply the updates to.
69
+ * @param {Array<[BTCR2SignedUpdate, BlockMetadata]>} unsortedUpdates The unsorted array of BTCR2 Signed Updates and their associated Block Metadata.
70
+ * @param {string} [versionTime] The optional version time to limit updates to.
71
+ * @param {string} [versionId] The optional version id to limit updates to.
72
+ * @returns {Promise<DidResolutionResponse>} The updated DID Document, number of confirmations, and version id.
73
+ */
74
+ static processUpdatesArray(currentDocument: DidDocument, unsortedUpdates: Array<[BTCR2SignedUpdate, BlockMetadata]>, versionTime?: string, versionId?: string): Promise<DidResolutionResponse>;
75
+ /**
76
+ * Retrieves the beacon signals for the given array of BeaconService objects
77
+ * using a esplora/electrs REST API connection via a bitcoin I/O driver.
78
+ * @param {Array<BeaconService>} beaconServices Array of BeaconService objects to retrieve signals for
79
+ * @param {BitcoinNetworkConnection} bitcoin Bitcoin network connection to use for REST calls
80
+ * @returns {Promise<Array<BeaconSignal>>} Promise resolving to an array of BeaconSignal objects
81
+ */
82
+ static queryBlockchainIndexer(beaconServices: Array<BeaconService>, bitcoin: BitcoinNetworkConnection): Promise<Map<BeaconService, Array<BeaconSignal>>>;
83
+ /**
84
+ * Traverse the full blockchain from genesis to chain top looking for beacon signals.
85
+ * @param {Array<BeaconService>} beaconServices Array of BeaconService objects to search for signals.
86
+ * @param {BitcoinNetworkConnection} bitcoin Bitcoin network connection to use for RPC calls.
87
+ * @returns {Promise<Array<BeaconSignal>>} Promise resolving to an array of BeaconSignal objects.
88
+ */
89
+ static traverseFullBlockchain(beaconServices: Array<BeaconService>, bitcoin: BitcoinNetworkConnection): Promise<Map<BeaconService, Array<BeaconSignal>>>;
90
+ /**
91
+ * Implements subsection {@link https://dcdpr.github.io/did-btcr2/#confirm-duplicate-update | 7.2.f.1 Confirm Duplicate Update}.
92
+ * This step confirms that an update with a lower-than-expected targetVersionId is a true duplicate.
93
+ * @param {BTCR2SignedUpdate} update The BTCR2 Signed Update to confirm as a duplicate.
94
+ * @returns {void} Does not return a value, but throws an error if the update is not a valid duplicate.
95
+ */
96
+ static confirmDuplicateUpdate(update: BTCR2SignedUpdate, updateHashHistory: string[]): void;
97
+ /**
98
+ * Implements subsection {@link https://dcdpr.github.io/did-btcr2/operations/resolve.html#apply-update | 7.2.f.3 Apply Update}.
99
+ * @param {DidDocument} currentDocument The current DID Document to apply the update to.
100
+ * @param {BTCR2SignedUpdate} update The BTCR2 Signed Update to apply.
101
+ * @returns {Promise<DidDocument>} The updated DID Document after applying the update.
102
+ * @throws {ResolveError} If the update is invalid or cannot be applied.
103
+ */
104
+ static applyDidUpdate(currentDocument: DidDocument, update: BTCR2SignedUpdate): Promise<DidDocument>;
105
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolve.d.ts","sourceRoot":"","sources":["../../../src/core/resolve.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,wBAAwB,EAMzB,MAAM,oBAAoB,CAAC;AAc5B,OAAO,EAGL,iBAAiB,EAGlB,MAAM,wBAAwB,CAAC;AAKhC,OAAO,EAAE,WAAW,EAAwB,MAAM,0BAA0B,CAAC;AAE7E,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,wBAAwB,CA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AC,aAAa,CAAC,EACpC,OAAO,EAAE,wBAAwB,GAChC,OAAO,CAAC,GAAG,CAAC,aAAa,EAAE,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC;IAyEnD;;;;;OAKG;WACU,sBAAsB,CACjC,cAAc,EAAE,KAAK,CAAC,aAAa,CAAC,EACpC,OAAO,EAAE,wBAAwB,GAChC,OAAO,CAAC,GAAG,CAAC,aAAa,EAAE,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC;IA0InD;;;;;OAKG;IACH,MAAM,CAAC,sBAAsB,CAAC,MAAM,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,EAAE,GAAG,IAAI;IAmB3F;;;;;;OAMG;WACU,cAAc,CACzB,eAAe,EAAE,WAAW,EAC5B,MAAM,EAAE,iBAAiB,GACxB,OAAO,CAAC,WAAW,CAAC;CAsFxB"}
@@ -0,0 +1,71 @@
1
+ import { HexString } from '@did-btcr2/common';
2
+ import { BTCR2SignedUpdate } from '@did-btcr2/cryptosuite';
3
+ import { SMTProof } from './interfaces.js';
4
+ /**
5
+ * {@link https://dcdpr.github.io/did-btcr2/data-structures.html#cas-announcement | CAS Announcement }
6
+ * a data structure that maps DIDs to BTCR2 Signed Update hashes. All BTCR2 Signed
7
+ * Updates (data structure) MUST be hashed with the JSON Document Hashing algorithm.
8
+ * The concrete representation of this data structure will be published to a CAS.
9
+ * @example
10
+ * ```json
11
+ * {
12
+ * "did:btcr2:k1q5pa5tq86fzrl0ez32nh8e0ks4tzzkxnnmn8tdvxk04ahzt70u09dag02h0cp": "a4ayc_80_OGda4BO_1o_V0etpOqiLx1JwB5S3beHW0s",
13
+ * "did:btcr2:x1qhjw6jnhwcyu5wau4x0cpwvz74c3g82c3uaehqpaf7lzfgmnwsd7spmmf54": "1HNeOiZeFu7gP1lxi5tdAwGcB9i2xR-Q2jpmbuwTqzU",
14
+ * "did:btcr2:k1qgp5h79scv4sfqkzak5g6y89dsy3cq0pd2nussu2cm3zjfhn4ekwrucc4q7t7": "TgdAhWK-24tgzgXB3s_jrRa3IjCWfeAfZAt-Rym0n84"
15
+ * }
16
+ * ```
17
+ */
18
+ export type CASAnnouncement = {
19
+ [key: string]: string;
20
+ };
21
+ /**
22
+ * See {@link https://dcdpr.github.io/did-btcr2/terminology.html#sidecar | Sidecar }
23
+ * for more details about the sidecar mechanism. See {@link https://dcdpr.github.io/did-btcr2/data-structures.html#sidecar-data | Sidecar Data}
24
+ * for more details about the data structure.
25
+ */
26
+ export type Sidecar = {
27
+ /**
28
+ * The context string "https://btcr2.dev/context/v1"
29
+ */
30
+ '@context'?: string;
31
+ /**
32
+ * Optional Genesis Did Document. Required when resolving did:btcr2 identifiers
33
+ * with `x` HRP.D
34
+ */
35
+ genesisDocument?: object;
36
+ /**
37
+ * Optional array of BTCR2 Signed Updates. Required if the DID being resolved
38
+ * has ever had a published BTCR2 Update.
39
+ */
40
+ updates?: Array<BTCR2SignedUpdate>;
41
+ /**
42
+ * Optional array of CAS Announcements. Required if the DID being reslved has
43
+ * used a CAS Beacon to publish a BTCR2 Update.
44
+ */
45
+ casUpdates?: Array<CASAnnouncement>;
46
+ /**
47
+ * Optional array of SMT Proofs. Required if the DID being resolved has used
48
+ * an SMT Beacon to publish a BTCR2 Update.
49
+ */
50
+ smtProofs?: Array<SMTProof>;
51
+ };
52
+ /**
53
+ * The Sidecar data structure post-processing used for resolution.
54
+ */
55
+ export type SidecarData = {
56
+ /**
57
+ * Map of BTCR2 Signed Updates by their hash bytes.
58
+ * @type {Map<HexString, BTCR2SignedUpdate>}
59
+ */
60
+ updateMap: Map<HexString, BTCR2SignedUpdate>;
61
+ /**
62
+ * Map of CAS Announcements by their hash bytes.
63
+ * @type {Map<HexString, CASAnnouncement>}
64
+ */
65
+ casMap: Map<HexString, CASAnnouncement>;
66
+ /**
67
+ * Map of SMT Proofs by their ID.
68
+ * @type {Map<string, SMTProof>}
69
+ */
70
+ smtMap: Map<string, SMTProof>;
71
+ };
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/core/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAE3C;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;CACtB,CAAA;AAED;;;;GAIG;AACH,MAAM,MAAM,OAAO,GAAG;IACpB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IAEzB;;;OAGG;IACH,OAAO,CAAC,EAAE,KAAK,CAAC,iBAAiB,CAAC,CAAA;IAElC;;;OAGG;IACH,UAAU,CAAC,EAAE,KAAK,CAAC,eAAe,CAAC,CAAC;IAEpC;;;OAGG;IACH,SAAS,CAAC,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC;CAC7B,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG;IACxB;;;OAGG;IACH,SAAS,EAAE,GAAG,CAAC,SAAS,EAAE,iBAAiB,CAAC,CAAC;IAC7C;;;OAGG;IACH,MAAM,EAAE,GAAG,CAAC,SAAS,EAAE,eAAe,CAAC,CAAC;IACxC;;;OAGG;IACH,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;CAC/B,CAAA"}
@@ -1,6 +1,7 @@
1
- import { DidUpdateInvocation, DidUpdatePayload, PatchOperation } from '@did-btcr2/common';
2
- import { DidDocument, DidVerificationMethod } from '../../utils/did-document.js';
3
- import { SignalsMetadata } from '../../utils/types.js';
1
+ import { PatchOperation } from '@did-btcr2/common';
2
+ import { BTCR2SignedUpdate, BTCR2UnsignedUpdate } from '@did-btcr2/cryptosuite';
3
+ import { DidDocument, DidVerificationMethod } from '../utils/did-document.js';
4
+ import { SidecarData } from './types.js';
4
5
  export interface ConstructUpdateParams {
5
6
  identifier: string;
6
7
  sourceDocument: DidDocument;
@@ -13,7 +14,7 @@ export interface UpdateParams extends ConstructUpdateParams {
13
14
  }
14
15
  export type InvokePayloadParams = {
15
16
  identifier: string;
16
- didUpdatePayload: DidUpdatePayload;
17
+ BTCR2SignedUpdate: BTCR2SignedUpdate;
17
18
  verificationMethod: DidVerificationMethod;
18
19
  };
19
20
  /**
@@ -41,7 +42,7 @@ export declare class Update {
41
42
  * @param {DidDocument} params.sourceDocument The source document to be updated.
42
43
  * @param {string} params.sourceVersionId The versionId of the source document.
43
44
  * @param {DidDocumentPatch} params.patch The JSON patch to be applied to the source document.
44
- * @returns {Promise<DidUpdatePayload>} The constructed DidUpdatePayload object.
45
+ * @returns {Promise<BTCR2SignedUpdate>} The constructed BTCR2SignedUpdate object.
45
46
  * @throws {MethodError} InvalidDid if sourceDocument.id does not match identifier.
46
47
  */
47
48
  static construct({ identifier, sourceDocument, sourceVersionId, patch, }: {
@@ -49,45 +50,45 @@ export declare class Update {
49
50
  sourceDocument: DidDocument;
50
51
  sourceVersionId: number;
51
52
  patch: PatchOperation[];
52
- }): Promise<DidUpdatePayload>;
53
+ }): Promise<BTCR2UnsignedUpdate>;
53
54
  /**
54
55
  * {@link https://dcdpr.github.io/did-btcr2/#invoke-did-update-payload | 4.3.2 Invoke DID Update Payload}.
55
56
  *
56
- * The Invoke DID Update Payload algorithm takes in a Identifier, an unsigned didUpdatePayload, and a
57
+ * The Invoke DID Update Payload algorithm takes in a Identifier, an unsigned BTCR2SignedUpdate, and a
57
58
  * verificationMethod. It retrieves the privateKeyBytes for the verificationMethod and adds a capability invocation in
58
59
  * the form of a Data Integrity proof following the Authorization Capabilities (ZCAP-LD) and VC Data Integrity
59
60
  * specifications. It returns the invoked DID Update Payload.
60
61
  *
61
62
  * @param {InvokePayloadParams} params Required params for calling the invokePayload method
62
63
  * @param {string} params.identifier The did-btcr2 identifier to derive the root capability from
63
- * @param {DidUpdatePayload} params.didUpdatePayload The updatePayload object to be signed
64
+ * @param {BTCR2SignedUpdate} params.BTCR2SignedUpdate The updatePayload object to be signed
64
65
  * @param {DidVerificationMethod} params.verificationMethod The verificationMethod object to be used for signing
65
- * @returns {DidUpdateInvocation} Did update payload secured with a proof => DidUpdateInvocation
66
+ * @returns {BTCR2SignedUpdate} Did update payload secured with a proof => BTCR2SignedUpdate
66
67
  * @throws {MethodError} if the privateKeyBytes are invalid
67
68
  */
68
- static invoke({ identifier, didUpdatePayload, verificationMethod }: {
69
+ static invoke({ identifier, unsignedUpdate, verificationMethod }: {
69
70
  identifier: string;
70
- didUpdatePayload: DidUpdatePayload;
71
+ unsignedUpdate: BTCR2UnsignedUpdate;
71
72
  verificationMethod: DidVerificationMethod;
72
- }): Promise<DidUpdateInvocation>;
73
+ }): Promise<BTCR2SignedUpdate>;
73
74
  /**
74
75
  * Implements {@link https://dcdpr.github.io/did-btcr2/#announce-did-update | 4.3.3 Announce DID Update}.
75
76
  *
76
77
  * The Announce DID Update algorithm retrieves beaconServices from the sourceDocument and calls the Broadcast DID
77
78
  * Update algorithm corresponding to the type of the Beacon. It takes in a Identifier, sourceDocument, an array of
78
- * beaconIds, and a didUpdateInvocation. It returns an array of signalsMetadata, containing the necessary
79
- * data to validate the Beacon Signal against the didUpdateInvocation.
79
+ * beaconIds, and a BTCR2SignedUpdate. It returns an array of signalsMetadata, containing the necessary
80
+ * data to validate the Beacon Signal against the BTCR2SignedUpdate.
80
81
  *
81
82
  * @param {AnnounceUpdatePayloadParams} params Required params for calling the announcePayload method
82
83
  * @param {DidDocument} params.sourceDocument The did-btcr2 did document to derive the root capability from
83
- * @param {string[]} params.beaconIds The didUpdatePayload object to be signed
84
- * @param {DidUpdateInvocation} params.didUpdatePayload The verificationMethod object to be used for signing
85
- * @returns {SignalsMetadata} The signalsMetadata object containing data to validate the Beacon Signal
84
+ * @param {string[]} params.beaconIds The BTCR2SignedUpdate object to be signed
85
+ * @param {BTCR2SignedUpdate} params.BTCR2SignedUpdate The verificationMethod object to be used for signing
86
+ * @returns {BTCR2SignedUpdate} The BTCR2SignedUpdate object containing data to validate the Beacon Signal
86
87
  * @throws {MethodError} if the beaconService type is invalid
87
88
  */
88
- static announce({ sourceDocument, beaconIds, didUpdateInvocation }: {
89
+ static announce({ sourceDocument, beaconIds, signedUpdate }: {
89
90
  sourceDocument: DidDocument;
90
91
  beaconIds: string[];
91
- didUpdateInvocation: DidUpdateInvocation;
92
- }): Promise<SignalsMetadata>;
92
+ signedUpdate: BTCR2SignedUpdate;
93
+ }): Promise<SidecarData>;
93
94
  }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../../../src/core/update.ts"],"names":[],"mappings":"AAAA,OAAO,EAOL,cAAc,EAEf,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAwC,MAAM,wBAAwB,CAAC;AAMtH,OAAO,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAG9E,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEzC,MAAM,WAAW,qBAAqB;IAClC,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE,WAAW,CAAC;IAC5B,eAAe,EAAE,MAAM,CAAC;IACxB,KAAK,EAAE,cAAc,EAAE,CAAC;CAC3B;AAED,MAAM,WAAW,YAAa,SAAQ,qBAAqB;IACvD,oBAAoB,EAAE,MAAM,CAAC;IAC7B,SAAS,EAAE,MAAM,EAAE,CAAC;CACvB;AAED,MAAM,MAAM,mBAAmB,GAAG;IAChC,UAAU,EAAE,MAAM,CAAC;IACnB,iBAAiB,EAAE,iBAAiB,CAAC;IACrC,kBAAkB,EAAE,qBAAqB,CAAC;CAC3C,CAAA;AAED;;;;;;;;;;;GAWG;AACH,qBAAa,MAAM;IACjB;;;;;;;;;;;;;;OAcG;WACiB,SAAS,CAAC,EAC5B,UAAU,EACV,cAAc,EACd,eAAe,EACf,KAAK,GACN,EAAE;QACD,UAAU,EAAE,MAAM,CAAC;QACnB,cAAc,EAAE,WAAW,CAAC;QAC5B,eAAe,EAAE,MAAM,CAAC;QACxB,KAAK,EAAE,cAAc,EAAE,CAAC;KACzB,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAiDhC;;;;;;;;;;;;;;OAcG;WACiB,MAAM,CAAC,EACzB,UAAU,EACV,cAAc,EACd,kBAAkB,EACnB,EAAE;QACD,UAAU,EAAE,MAAM,CAAC;QACnB,cAAc,EAAE,mBAAmB,CAAC;QACpC,kBAAkB,EAAE,qBAAqB,CAAC;KAC3C,GAAG,OAAO,CAAC,iBAAiB,CAAC;IA6E9B;;;;;;;;;;;;;;OAcG;WACiB,QAAQ,CAAC,EAC3B,cAAc,EACd,SAAS,EACT,YAAY,EACb,EAAE;QACD,cAAc,EAAE,WAAW,CAAC;QAC5B,SAAS,EAAE,MAAM,EAAE,CAAC;QACpB,YAAY,EAAE,iBAAiB,CAAC;KACjC,GAAG,OAAO,CAAC,WAAW,CAAC;CAiDzB"}
@@ -1,11 +1,13 @@
1
- import { DocumentBytes, KeyBytes, PatchOperation } from '@did-btcr2/common';
2
- import type { DidResolutionResult } from '@web5/dids';
3
- import { DidMethod } from '@web5/dids';
4
- import { DidResolutionOptions } from './interfaces/crud.js';
1
+ import { Canonicalization, DocumentBytes, KeyBytes, PatchOperation } from '@did-btcr2/common';
2
+ import { DidMethod, DidResolutionResult } from '@web5/dids';
3
+ import { ResolutionOptions } from './core/interfaces.js';
4
+ import { SidecarData } from './core/types.js';
5
5
  import { DidDocument, DidVerificationMethod } from './utils/did-document.js';
6
- import { SignalsMetadata } from './utils/types.js';
6
+ export declare const canonicalization: Canonicalization;
7
7
  export type Btcr2Identifier = string;
8
8
  export interface DidCreateOptions {
9
+ /** Type of identifier to create (key or external) */
10
+ idType: 'KEY' | 'EXTERNAL';
9
11
  /** DID BTCR2 Version Number */
10
12
  version?: number;
11
13
  /** Bitcoin Network */
@@ -13,10 +15,12 @@ export interface DidCreateOptions {
13
15
  }
14
16
  /**
15
17
  * Implements {@link https://dcdpr.github.io/did-btcr2 | did:btcr2 DID Method Specification}.
16
- * did:btcr2 is a censorship resistant DID Method using the Bitcoin blockchain as a Verifiable Data Registry to announce
17
- * changes to the DID document. It improves on prior work by allowing: zero-cost off-chain DID creation; aggregated
18
- * updates for scalable on-chain update costs; long-term identifiers that can support frequent updates; private
19
- * 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.
20
24
  *
21
25
  * @class DidBtcr2
22
26
  * @type {DidBtcr2}
@@ -26,54 +30,43 @@ export declare class DidBtcr2 implements DidMethod {
26
30
  /** @type {string} Name of the DID method, as defined in the DID BTCR2 specification */
27
31
  static methodName: string;
28
32
  /**
29
- * Entry point for section {@link https://dcdpr.github.io/did-btcr2/#create | 4.1 Create}.
30
- * See {@link Create} for implementation details.
31
- *
32
- * A did:btcr2 identifier and associated DID document can either be created deterministically from a cryptographic
33
- * seed, or it can be created from an arbitrary genesis intermediate DID document representation. In both cases,
34
- * DID creation can be undertaken in an offline manner, i.e., the DID controller does not need to interact with the
35
- * Bitcoin network to create their DID.
36
- * @param {CreateParams} params See {@link CreateParams} for details.
37
- * @param {IdType} params.idType Type of identifier to create (key or external).
38
- * @param {KeyBytes} params.pubKeyBytes Public key byte array used to create a btcr2 "key" identifier.
39
- * @param {IntermediateDocument} params.intermediateDocument DID Document used to create a btcr2 "external" identifier.
40
- * @param {DidCreateOptions} params.options See {@link DidCreateOptions} for create options.
41
- * @param {number} params.options.version Version number of the btcr2 method.
42
- * @param {string} params.options.network Bitcoin network name (mainnet, testnet, signet, regtest).
43
- * @returns {Promise<CreateResponse>} Promise resolving to a CreateResponse object.
44
- * @throws {DidBtcr2Error} if any of the checks fail
33
+ * Implements section {@link https://dcdpr.github.io/did-btcr2/operations/create.html | 7.1 Create}.
34
+ * @param {KeyBytes | DocumentBytes} genesisBytes The bytes used to create the genesis document for a did:btcr2 identifier.
35
+ * 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.
36
+ * @param {DidCreateOptions} options Options for creating the identifier, including the idType (key or external), version, and network.
37
+ * @param {string} options.idType The type of identifier to create, either 'KEY' or 'EXTERNAL'. Defaults to 'KEY'.
38
+ * @param {number} options.version The version number of the did:btcr2 specification to use for creating the identifier. Defaults to 1.
39
+ * @param {string} options.network The Bitcoin network to use for the identifier, e.g. 'bitcoin', 'testnet', etc. Defaults to 'bitcoin'.
40
+ * @returns {Promise<Btcr2Identifier>} Promise resolving to a Btcr2Identifier string.
41
+ * @throws {MethodError} if any of the checks fail
45
42
  */
46
- static create(params: {
47
- idType: 'KEY' | 'EXTERNAL';
48
- genesisBytes: KeyBytes | DocumentBytes;
49
- options?: DidCreateOptions;
50
- }): Promise<Btcr2Identifier>;
43
+ static create(genesisBytes: KeyBytes | DocumentBytes, options?: DidCreateOptions): Promise<Btcr2Identifier>;
51
44
  /**
52
- * Entry point for section {@link https://dcdpr.github.io/did-btcr2/#read | 7.2 Read}.
53
- * See {@link Resolve} for implementation details.
45
+ * Entry point for section {@link https://dcdpr.github.io/did-btcr2/#read | 7.2 Resolve}.
46
+ * See specification for the {@link https://dcdpr.github.io/did-btcr2/operations/resolve.html#process | Resolve Process}.
47
+ * See {@link Resolve | Resolve (class)} for class implementation.
54
48
  *
55
- * The Read operation is an algorithm consisting of a series of subroutine algorithms executed by a resolver after a
56
- * resolution request identifying a specific did:btcr2 identifier is received from a client at Resolution Time. The
57
- * request MUST always contain the resolutionOptions object containing additional information to be used in resolution.
58
- * This object MAY be empty. See the DID Resolution specification for further details about the DID Resolution Options
59
- * object. The resolver then attempts to resolve the DID document of the identifier at a specific Target Time. The
60
- * Target Time is either provided in resolutionOptions or is set to the Resolution Time of the request.
49
+ * Resolving a did:btcr2 identifier iteratively builds a DID document by applying
50
+ * BTCR2 Updates to an Initial DID Document that have been committed to the Bitcoin
51
+ * blockchain by Authorized Beacon Signals. The Initial DID Document is either
52
+ * deterministically created from the DID or provided by Sidecar Data.
61
53
  *
62
- * @param {string} identifier a valid did:btcr2 identifier to be resolved
63
- * @param {DidResolutionOptions} [resolutionsOptions] see {@link https://www.w3.org/TR/did-1.0/#did-resolution-options | DidResolutionOptions}
64
- * @param {number} options.versionId the version of the identifier and/or DID document
65
- * @param {number} options.versionTime a timestamp used during resolution as a bound for when to stop resolving
66
- * @param {DidDocument} options.sidecarData data necessary for resolving a DID
67
- * @param {string} options.network Bitcoin network name (mainnet, testnet, signet, regtest).
68
- * @returns {DidResolutionResult} Promise resolving to a DID Resolution Result containing the `targetDocument`
54
+ * @param {string} did a valid did:btcr2 identifier to be resolved
55
+ * @param {ResolutionOptions} resolutionOptions see {@link https://www.w3.org/TR/did-1.0/#did-resolution-options | ResolutionOptions}
56
+ * @param {number} resolutionOptions.versionId optional version of the identifier and/or DID document
57
+ * @param {number} resolutionOptions.versionTime optional timestamp used during resolution as a bound for when to stop resolving
58
+ * @param {DidDocument} resolutionOptions.sidecar optional data necessary for resolving a DID
59
+ * @returns {Promise<DidResolutionResult>} Promise resolving to a DID Resolution Result containing the `targetDocument`
69
60
  * @throws {Error} if the resolution fails for any reason
70
61
  * @throws {DidError} InvalidDid if the identifier is invalid
71
62
  * @example
72
63
  * ```ts
73
- * const resolution = await DidBtcr2.resolve('did:btcr2:k1q0dygyp3gz969tp46dychzy4q78c2k3js68kvyr0shanzg67jnuez2cfplh')
64
+ * const resolution = await DidBtcr2.resolve(
65
+ * 'did:btcr2:k1q0dygyp3gz969tp46dychzy4q78c2k3js68kvyr0shanzg67jnuez2cfplh'
66
+ * )
74
67
  * ```
75
68
  */
76
- static resolve(identifier: string, resolutionsOptions?: DidResolutionOptions): Promise<DidResolutionResult>;
69
+ static resolve(did: string, resolutionOptions?: ResolutionOptions): Promise<DidResolutionResult>;
77
70
  /**
78
71
  * Entry point for section {@link https://dcdpr.github.io/did-btcr2/#update | 4.3 Update}.
79
72
  * See {@link Update} for implementation details.
@@ -89,7 +82,7 @@ export declare class DidBtcr2 implements DidMethod {
89
82
  * The result of these transformations MUST produce a DID document conformant to the DID Core specification. The
90
83
  * verificationMethodId is an identifier for a verificationMethod within the sourceDocument. The verificationMethod
91
84
  * identified MUST be a BIP340 Multikey. The beaconIds MUST identify service endpoints with one of the three Beacon
92
- * Types SingletonBeacon, CIDAggregateBeacon, and SMTAggregateBeacon.
85
+ * Types SingletonBeacon, CASBeacon, and SMTBeacon.
93
86
  *
94
87
  * @param {UpdateParams} params Required parameters for the update operation.
95
88
  * @param {string} params.identifier The btcr2 identifier to be updated.
@@ -108,21 +101,16 @@ export declare class DidBtcr2 implements DidMethod {
108
101
  patch: PatchOperation[];
109
102
  verificationMethodId: string;
110
103
  beaconIds: string[];
111
- }): Promise<SignalsMetadata>;
104
+ }): Promise<SidecarData>;
112
105
  /**
113
106
  * Given the W3C DID Document of a `did:btcr2` identifier, return the signing verification method that will be used
114
107
  * for signing messages and credentials. If given, the `methodId` parameter is used to select the
115
108
  * verification method. If not given, the Identity Key's verification method with an ID fragment
116
109
  * of '#initialKey' is used.
117
- *
118
- * @param {{ didDocument: DidDocument; methodId?: string; }} params Parameters for the `getSigningMethod` method.
119
- * @param {DidDocument} params.didDocument DID Document to get the verification method from.
120
- * @param {string} params.methodId Optional ID of the verification method to use for signing.
110
+ * @param {DidDocument} didDocument The DID Document of the `did:btcr2` identifier.
111
+ * @param {string} [methodId] Optional verification method ID to be used for signing.
121
112
  * @returns {DidVerificationMethod} Promise resolving to the {@link DidVerificationMethod} object used for signing.
122
113
  * @throws {DidError} if the parsed did method does not match `btcr2` or signing method could not be determined.
123
114
  */
124
- static getSigningMethod({ didDocument, methodId }: {
125
- didDocument: DidDocument;
126
- methodId?: string;
127
- }): DidVerificationMethod;
115
+ static getSigningMethod(didDocument: DidDocument, methodId?: string): DidVerificationMethod;
128
116
  }
@@ -1 +1 @@
1
- {"version":3,"file":"did-btcr2.d.ts","sourceRoot":"","sources":["../../src/did-btcr2.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EAEb,QAAQ,EAGR,cAAc,EAEf,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AACtD,OAAO,EAIL,SAAS,EAEV,MAAM,YAAY,CAAC;AAKpB,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAC7E,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAInD,MAAM,MAAM,eAAe,GAAG,MAAM,CAAC;AAErC,MAAM,WAAW,gBAAgB;IAC/B,+BAA+B;IAC/B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,sBAAsB;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAKD;;;;;;;;;;GAUG;AACH,qBAAa,QAAS,YAAW,SAAS;IACxC,uFAAuF;IACvF,OAAc,UAAU,EAAE,MAAM,CAAW;IAE3C;;;;;;;;;;;;;;;;;OAiBG;WACiB,MAAM,CAAC,MAAM,EAAE;QACjC,MAAM,EAAE,KAAK,GAAG,UAAU,CAAC;QAC3B,YAAY,EAAE,QAAQ,GAAG,aAAa,CAAC;QACvC,OAAO,CAAC,EAAE,gBAAgB,CAAC;KAC5B,GAAG,OAAO,CAAC,eAAe,CAAC;IAa5B;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;WACiB,OAAO,CAAC,UAAU,EAAE,MAAM,EAAE,kBAAkB,GAAE,oBAAyB,GAAG,OAAO,CAAC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