@did-btcr2/method 0.18.0 → 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 +5240 -6079
  2. package/dist/browser.mjs +5240 -6079
  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 +5 -5
  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
@@ -0,0 +1,511 @@
1
+ import { GENESIS_TX_ID, getNetwork, TXIN_WITNESS_COINBASE } from '@did-btcr2/bitcoin';
2
+ import { DateUtils, IdentifierHrp, INVALID_DID, INVALID_DID_DOCUMENT, INVALID_DID_UPDATE, JSONPatch, JSONUtils, LATE_PUBLISHING_ERROR, MethodError, MISSING_UPDATE_DATA, ResolveError } from '@did-btcr2/common';
3
+ import { BIP340Cryptosuite, BIP340DataIntegrityProof, SchnorrMultikey } from '@did-btcr2/cryptosuite';
4
+ import { CompressedSecp256k1PublicKey } from '@did-btcr2/keypair';
5
+ import { bytesToHex } from '@noble/hashes/utils';
6
+ import { canonicalization, DidBtcr2 } from '../did-btcr2.js';
7
+ import { Appendix } from '../utils/appendix.js';
8
+ import { DidDocument, ID_PLACEHOLDER_VALUE } from '../utils/did-document.js';
9
+ import { BeaconFactory } from './beacon/factory.js';
10
+ import { BeaconUtils } from './beacon/utils.js';
11
+ import { Identifier } from './identifier.js';
12
+ /**
13
+ * Implements {@link https://dcdpr.github.io/did-btcr2/operations/resolve.html | 7.2 Resolve}.
14
+ * Resolving a did:btcr2 identifier iteratively builds a DID document by applying BTCR2 Updates
15
+ * to an Initial DID Document that have been committed to the Bitcoin blockchain by Authorized
16
+ * Beacon Signals. The Initial DID Document is either deterministically created from the DID or
17
+ * provided by Sidecar Data.
18
+ * @class Resolve
19
+ * @type {Resolve}
20
+ */
21
+ export class Resolve {
22
+ /**
23
+ * Implements subsection {@link https://dcdpr.github.io/did-btcr2/operations/resolve.html#process-sidecar-data | Process Sidecar Data}
24
+ * @param {Sidecar} sidecar The sidecar data to process.
25
+ * @returns {SidecarData} The processed sidecar data containing maps of updates, CAS announcements, and SMT proofs.
26
+ */
27
+ static processSidecarData(sidecar = {}) {
28
+ // BTCR2 Signed Updates map
29
+ const updateMap = new Map();
30
+ if (sidecar.updates?.length)
31
+ for (const update of sidecar.updates) {
32
+ updateMap.set(canonicalization.process(update, { encoding: 'hex' }), update);
33
+ }
34
+ // CAS Announcements map
35
+ const casMap = new Map();
36
+ if (sidecar.casUpdates?.length)
37
+ for (const update of sidecar.casUpdates) {
38
+ casMap.set(canonicalization.process(update, { encoding: 'hex' }), update);
39
+ }
40
+ // SMT Proofs map
41
+ const smtMap = new Map();
42
+ if (sidecar.smtProofs?.length)
43
+ for (const proof of sidecar.smtProofs) {
44
+ smtMap.set(proof.id, proof);
45
+ }
46
+ return { updateMap, casMap, smtMap };
47
+ }
48
+ /**
49
+ * Implements subsection {@link https://dcdpr.github.io/did-btcr2/operations/resolve.html#establish-current-document | 7.2.d Establish current_document}.
50
+ * Resolution begins by creating an Initial Did Document called current_document (Current DID Document).
51
+ * The current_document is iteratively patched with BTCR2 Signed Updates announced by Authorized Beacon Signals.
52
+ * @param {DidComponents} didComponents The decoded components of the did.
53
+ * @param {GenesisDocument} genesisDocument The genesis document for resolving the DID Document.
54
+ * @returns {Promise<DidDocument>} The resolved DID Document object.
55
+ * @throws {DidError} if the DID hrp is invalid, no sidecarData passed and hrp = "x".
56
+ */
57
+ static async establishCurrentDocument(didComponents, genesisDocument) {
58
+ // Deconstruct the hrp from the components
59
+ const { hrp, genesisBytes } = didComponents;
60
+ // If hrp `x`, perform external resolution
61
+ if (hrp === IdentifierHrp.x) {
62
+ if (!genesisDocument)
63
+ throw new ResolveError('External resolution requires genesisDocument', MISSING_UPDATE_DATA, { didComponents });
64
+ return await this.external(didComponents, genesisDocument);
65
+ }
66
+ // Check for hrp `k`
67
+ if (hrp === IdentifierHrp.k) {
68
+ // Validate genesis bytes as a compressed secp256k1 public key
69
+ if (!CompressedSecp256k1PublicKey.isValid(genesisBytes)) {
70
+ throw new ResolveError('Deterministic resolution requires valid secp256k1 public key', INVALID_DID, { genesisBytes });
71
+ }
72
+ // Perform deterministic resolution
73
+ return this.deterministic(didComponents);
74
+ }
75
+ // Else, throw an error for unsupported hrp
76
+ throw new ResolveError(`Unsupported DID hrp ${hrp}`, INVALID_DID, { hrp });
77
+ }
78
+ /**
79
+ * 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}.
80
+ * @param {DidComponents} didComponents The decoded components of the did.
81
+ * @returns {DidDocument} The resolved DID Document object.
82
+ */
83
+ static deterministic(didComponents) {
84
+ // Encode the did from the didComponents
85
+ const did = Identifier.encode(didComponents);
86
+ // Deconstruct the bytes from the given components
87
+ const { genesisBytes } = didComponents;
88
+ // Construct a new CompressedSecp256k1PublicKey and deconstruct the publicKey and publicKeyMultibase
89
+ const { multibase: publicKeyMultibase } = new CompressedSecp256k1PublicKey(genesisBytes);
90
+ // Generate the service field for the DID Document
91
+ const service = BeaconUtils.generateBeaconServices({
92
+ id: did,
93
+ publicKey: genesisBytes,
94
+ network: getNetwork(didComponents.network),
95
+ beaconType: 'SingletonBeacon'
96
+ });
97
+ return new DidDocument({
98
+ id: did,
99
+ controller: [did],
100
+ verificationMethod: [{
101
+ id: `${did}#initialKey`,
102
+ type: 'Multikey',
103
+ controller: did,
104
+ publicKeyMultibase: publicKeyMultibase.encoded
105
+ }],
106
+ service
107
+ });
108
+ }
109
+ /**
110
+ * 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}.
111
+ * @param {DidComponents} didComponents BTCR2 DID components used to resolve the DID Document
112
+ * @param {GenesisDocument} genesisDocument The genesis document for resolving the DID Document.
113
+ * @returns {Promise<DidDocument>} The resolved DID Document object
114
+ * @throws {MethodError} InvalidDidDocument if not conformant to DID Core v1.1
115
+ */
116
+ static async external(didComponents, genesisDocument) {
117
+ // Canonicalize and sha256 hash the currentDocument
118
+ const hashBytes = canonicalization.process(genesisDocument, { encoding: 'hex' });
119
+ // Compare the genesisBytes to the hashBytes
120
+ const genesisBytes = bytesToHex(didComponents.genesisBytes);
121
+ // If the genesisBytes do not match the hashBytes, throw an error
122
+ if (genesisBytes !== hashBytes) {
123
+ throw new MethodError(`Initial document mismatch: genesisBytes ${genesisBytes} !== hashBytes ${hashBytes}`, INVALID_DID_DOCUMENT, { genesisBytes, hashBytes });
124
+ }
125
+ // Encode the did from the didComponents
126
+ const did = Identifier.encode(didComponents);
127
+ // Replace the placeholder did with the did throughout the currentDocument.
128
+ const currentDocument = JSON.parse(JSON.stringify(genesisDocument).replaceAll(ID_PLACEHOLDER_VALUE, did));
129
+ // Return a W3C conformant DID Document
130
+ return new DidDocument(currentDocument);
131
+ }
132
+ /**
133
+ * Finds uses the beacon services in the currentDocument to scan for onchain Beacon Signals (transactions) containing
134
+ * Signal Bytes (last output in OP_RETURN transaction).
135
+ * @param {Array<BeaconService>} beaconServices The array of BeaconService objects to search for signals.
136
+ * @param {SidecarData} sidecarData The sidecar data containing maps of updates, CAS announcements, and SMT proofs.
137
+ * @param {BitcoinNetworkConnection} bitcoin The bitcoin network connection used to fetch beacon signals
138
+ * @param {boolean} [fullBlockchainTraversal=false] Whether to perform a full blockchain traversal or use an indexer
139
+ * @returns {Promise<Array<[BTCR2SignedUpdate, BlockMetadata]>>} The array of BTCR2 Signed Updates announced by the Beacon Signals.
140
+ */
141
+ static async processBeaconSignals(beaconServices, sidecarData, bitcoin, fullBlockchainTraversal) {
142
+ // Query indexer or perform a full blockchain traversal for Beacon Signals
143
+ const beaconServicesSignals = !fullBlockchainTraversal
144
+ ? await this.queryBlockchainIndexer(beaconServices, bitcoin)
145
+ : await this.traverseFullBlockchain(beaconServices, bitcoin);
146
+ // Set updates to an empty array
147
+ const unsortedUpdates = new Array();
148
+ // Iterate over each beacon service and its signals
149
+ for (const [service, signals] of beaconServicesSignals) {
150
+ // Establish a beacon object
151
+ const beacon = BeaconFactory.establish(service, signals, sidecarData);
152
+ // Process its signals
153
+ const processed = await beacon.processSignals();
154
+ // Append the processed updates to the updates array
155
+ unsortedUpdates.push(...processed);
156
+ }
157
+ return unsortedUpdates;
158
+ }
159
+ /**
160
+ * Implements subsection {@link https://dcdpr.github.io/did-btcr2/operations/resolve.html#process-updates | 7.2.f Process updates Array}.
161
+ * @param {DidDocument} currentDocument The current DID Document to apply the updates to.
162
+ * @param {Array<[BTCR2SignedUpdate, BlockMetadata]>} unsortedUpdates The unsorted array of BTCR2 Signed Updates and their associated Block Metadata.
163
+ * @param {string} [versionTime] The optional version time to limit updates to.
164
+ * @param {string} [versionId] The optional version id to limit updates to.
165
+ * @returns {Promise<DidResolutionResponse>} The updated DID Document, number of confirmations, and version id.
166
+ */
167
+ static async processUpdatesArray(currentDocument, unsortedUpdates, versionTime, versionId) {
168
+ // Start the version number being processed at 1
169
+ let currentVersionId = 1;
170
+ // Initialize an empty array to hold the update hashes
171
+ const updateHashHistory = [];
172
+ // 1. Sort updates by targetVersionId (ascending), using blockheight as tie-breaker
173
+ const updates = unsortedUpdates.sort(([upd0, blk0], [upd1, blk1]) => upd0.targetVersionId - upd1.targetVersionId || blk0.height - blk1.height);
174
+ // Create a default response object
175
+ const response = {
176
+ currentDocument,
177
+ versionId: `${currentVersionId}`,
178
+ confirmations: 0,
179
+ updated: ''
180
+ };
181
+ // Iterate over each (update block) pair
182
+ for (const [update, block] of updates) {
183
+ // Get the hash of the current document
184
+ const currentDocumentHash = canonicalization.process(response.currentDocument, { encoding: 'base58' });
185
+ // Set confirmations to the block confirmations
186
+ response.confirmations = block.confirmations;
187
+ // Safely convert versionTime to timestamp
188
+ const vTime = DateUtils.dateStringToTimestamp(versionTime || '');
189
+ // Safely convert block.blocktime to timestamp
190
+ const bTime = DateUtils.blocktimeToTimestamp(block.time);
191
+ // Set the updated field to the blocktime of the current update
192
+ response.updated = DateUtils.toISOStringNonFractional(bTime);
193
+ // if resolutionOptions.versionTime is defined and the blocktime is more recent, return currentDocument
194
+ if (vTime < bTime) {
195
+ return response;
196
+ }
197
+ // Check update.targetVersionId against currentVersionId
198
+ // If update.targetVersionId <= currentVersionId, confirm duplicate update
199
+ if (update.targetVersionId <= currentVersionId) {
200
+ updateHashHistory.push(currentDocumentHash);
201
+ this.confirmDuplicateUpdate(update, updateHashHistory);
202
+ }
203
+ // If update.targetVersionId == currentVersionId + 1, apply the update
204
+ else if (update.targetVersionId === currentVersionId + 1) {
205
+ // Prepend `z` to the sourceHash if it does not start with it
206
+ const sourceHash = update.sourceHash.startsWith('z') ? update.sourceHash : `z${update.sourceHash}`;
207
+ // Check if update.sourceHash !== currentDocumentHash
208
+ if (sourceHash !== currentDocumentHash) {
209
+ // Raise an INVALID_DID_UPDATE error if they do not match
210
+ throw new ResolveError(`Hash mismatch: update.sourceHash !== currentDocumentHash`, INVALID_DID_UPDATE, { sourceHash, currentDocumentHash });
211
+ }
212
+ // Apply the update to the currentDocument and set it in the response
213
+ response.currentDocument = await this.applyDidUpdate(response.currentDocument, update);
214
+ // Create unsigned_update by removing the proof property from update.
215
+ const unsignedUpdate = JSONUtils.deleteKeys(update, ['proof']);
216
+ // Push the canonicalized unsigned update hash to the updateHashHistory
217
+ updateHashHistory.push(canonicalization.process(unsignedUpdate, { encoding: 'base58' }));
218
+ }
219
+ // If update.targetVersionId > currentVersionId + 1, throw LATE_PUBLISHING error
220
+ else if (update.targetVersionId > currentVersionId + 1) {
221
+ throw new ResolveError(`Version Id Mismatch: targetVersionId cannot be > currentVersionId + 1`, 'LATE_PUBLISHING_ERROR', {
222
+ targetVersionId: update.targetVersionId,
223
+ currentVersionId: String(currentVersionId + 1)
224
+ });
225
+ }
226
+ // Increment currentVersionId
227
+ currentVersionId++;
228
+ // Set currentVersionId in response
229
+ response.versionId = `${currentVersionId}`;
230
+ // If resolutionOptions.versionId is defined and <= currentVersionId, return currentDocument
231
+ if (currentVersionId >= Number(versionId)) {
232
+ return response;
233
+ }
234
+ // Check if the current document is deactivated before further processing
235
+ if (currentDocument.deactivated) {
236
+ return response;
237
+ }
238
+ }
239
+ // Return response data
240
+ return response;
241
+ }
242
+ /**
243
+ * Retrieves the beacon signals for the given array of BeaconService objects
244
+ * using a esplora/electrs REST API connection via a bitcoin I/O driver.
245
+ * @param {Array<BeaconService>} beaconServices Array of BeaconService objects to retrieve signals for
246
+ * @param {BitcoinNetworkConnection} bitcoin Bitcoin network connection to use for REST calls
247
+ * @returns {Promise<Array<BeaconSignal>>} Promise resolving to an array of BeaconSignal objects
248
+ */
249
+ static async queryBlockchainIndexer(beaconServices, bitcoin) {
250
+ // Empty array of beaconSignals
251
+ const beaconServiceSignals = new Map();
252
+ // Iterate over each beacon
253
+ for (const beaconService of beaconServices) {
254
+ beaconServiceSignals.set(beaconService, []);
255
+ // Get the transactions for the beacon address via REST
256
+ const beaconSignals = await bitcoin.network.rest.address.getTxs(beaconService.serviceEndpoint);
257
+ // If no signals are found, continue
258
+ if (!beaconSignals || !beaconSignals.length) {
259
+ continue;
260
+ }
261
+ // Iterate over each signal
262
+ for (const beaconSignal of beaconSignals) {
263
+ // Get the last vout in the transaction
264
+ const signalVout = beaconSignal.vout.slice(-1)[0];
265
+ /**
266
+ * Look for OP_RETURN in last vout scriptpubkey_asm
267
+ * Vout (rest) format:
268
+ * {
269
+ * scriptpubkey: '6a20570f177c65e64fb5cf61180b664cdddf09ab76153c2b192e22006e5b22a3917a',
270
+ * scriptpubkey_asm: 'OP_RETURN OP_PUSHBYTES_32 570f177c65e64fb5cf61180b664cdddf09ab76153c2b192e22006e5b22a3917a',
271
+ * scriptpubkey_type: 'op_return',
272
+ * value: 0
273
+ * }
274
+ */
275
+ if (!signalVout || !signalVout.scriptpubkey_asm.includes('OP_RETURN')) {
276
+ // If not found, continue to next signal
277
+ continue;
278
+ }
279
+ // Construct output map for easier access
280
+ const outputMap = new Map(Object.entries(signalVout));
281
+ // Grab the signal vout scriptpubkey
282
+ const signalVoutScriptPubkey = outputMap.get('scriptpubkey_asm');
283
+ // If the signal vout scriptpubkey does not exist, continue to next signal
284
+ if (!signalVoutScriptPubkey) {
285
+ continue;
286
+ }
287
+ // Extract hex string hash of the signal bytes from the scriptpubkey
288
+ const updateHash = signalVoutScriptPubkey.split(' ').slice(-1)[0];
289
+ if (!updateHash) {
290
+ continue;
291
+ }
292
+ const confirmations = await bitcoin.network.rest.block.count() - beaconSignal.status.block_height + 1;
293
+ // Push the beacon signal object to the signals array for the beacon service
294
+ beaconServiceSignals.get(beaconService)?.push({
295
+ tx: beaconSignal,
296
+ signalBytes: updateHash,
297
+ blockMetadata: {
298
+ confirmations,
299
+ height: beaconSignal.status.block_height,
300
+ time: beaconSignal.status.block_time,
301
+ }
302
+ });
303
+ }
304
+ }
305
+ // Return the beaconSignals
306
+ return beaconServiceSignals;
307
+ }
308
+ /**
309
+ * Traverse the full blockchain from genesis to chain top looking for beacon signals.
310
+ * @param {Array<BeaconService>} beaconServices Array of BeaconService objects to search for signals.
311
+ * @param {BitcoinNetworkConnection} bitcoin Bitcoin network connection to use for RPC calls.
312
+ * @returns {Promise<Array<BeaconSignal>>} Promise resolving to an array of BeaconSignal objects.
313
+ */
314
+ static async traverseFullBlockchain(beaconServices, bitcoin) {
315
+ const beaconServiceSignals = new Map();
316
+ for (const beaconService of beaconServices) {
317
+ beaconServiceSignals.set(beaconService, []);
318
+ }
319
+ // Get the RPC connection from the bitcoin network
320
+ const rpc = bitcoin.network.rpc;
321
+ // Ensure that the RPC connection is available
322
+ if (!rpc) {
323
+ throw new ResolveError('RPC connection is not available', 'RPC_CONNECTION_ERROR', bitcoin);
324
+ }
325
+ // Get the current block height
326
+ const targetHeight = await rpc.getBlockCount();
327
+ // Set genesis height
328
+ let height = 0;
329
+ // Opt into rpc connection to get the block data at the blockhash
330
+ let block = await bitcoin.network.rpc.getBlock({ height });
331
+ console.info(`Searching for beacon signals, please wait ...`);
332
+ while (block.height <= targetHeight) {
333
+ // Iterate over each transaction in the block
334
+ for (const tx of block.tx) {
335
+ // If the txid is a coinbase, continue ...
336
+ if (tx.txid === GENESIS_TX_ID) {
337
+ continue;
338
+ }
339
+ // Iterate over each input in the transaction
340
+ for (const vin of tx.vin) {
341
+ // If the vin is a coinbase transaction, continue ...
342
+ if (vin.coinbase) {
343
+ continue;
344
+ }
345
+ // If the vin txinwitness contains a coinbase did, continue ...
346
+ if (vin.txinwitness && vin.txinwitness.length === 1 && vin.txinwitness[0] === TXIN_WITNESS_COINBASE) {
347
+ continue;
348
+ }
349
+ // If the txid from the vin is undefined, continue ...
350
+ if (!vin.txid) {
351
+ continue;
352
+ }
353
+ // If the vout from the vin is undefined, continue ...
354
+ if (vin.vout === undefined) {
355
+ continue;
356
+ }
357
+ // Get the previous output transaction data
358
+ const prevout = await rpc.getRawTransaction(vin.txid, 2);
359
+ // If the previous output vout at the vin.vout index is undefined, continue ...
360
+ if (!prevout.vout[vin.vout]) {
361
+ continue;
362
+ }
363
+ // Get the address from the scriptPubKey from the prevvout (previous output's input at the vout index)
364
+ const scriptPubKey = prevout.vout[vin.vout].scriptPubKey;
365
+ // If the scriptPubKey.address is undefined, continue ...
366
+ if (!scriptPubKey.address) {
367
+ continue;
368
+ }
369
+ // If the beaconAddress from prevvout scriptPubKey is not a beacon service endpoint address, continue ...
370
+ const beaconService = BeaconUtils.getBeaconServicesMap(beaconServices).get(scriptPubKey.address);
371
+ if (!beaconService) {
372
+ continue;
373
+ }
374
+ /**
375
+ * Look for 'OP_RETURN' in prevout.vout[vin.vout].scriptPubKey.asm, else continue ...
376
+ *
377
+ * TxOut (rpc) format:
378
+ * {
379
+ * value: 0,
380
+ * n: 1,
381
+ * scriptPubKey: {
382
+ * asm: 'OP_RETURN 570f177c65e64fb5cf61180b664cdddf09ab76153c2b192e22006e5b22a3917a',
383
+ * desc: 'raw(6a20570f177c65e64fb5cf61180b664cdddf09ab76153c2b192e22006e5b22a3917a)#cdgj3pm4',
384
+ * hex: '6a20570f177c65e64fb5cf61180b664cdddf09ab76153c2b192e22006e5b22a3917a',
385
+ * type: 'nulldata'
386
+ * }
387
+ * }
388
+ */
389
+ const txVoutScriptPubkeyAsm = prevout.vout[vin.vout].scriptPubKey.asm;
390
+ if (!txVoutScriptPubkeyAsm.includes('OP_RETURN')) {
391
+ continue;
392
+ }
393
+ // Log the found txid and beacon
394
+ console.info(`Tx ${tx.txid} contains beacon service address ${scriptPubKey.address} and OP_RETURN!`, tx);
395
+ // Extract hex string hash of the signal bytes from the scriptpubkey
396
+ const updateHash = txVoutScriptPubkeyAsm.split(' ').slice(-1)[0];
397
+ if (!updateHash) {
398
+ continue;
399
+ }
400
+ // Push the beacon signal object to the beacon signals array for that beacon service
401
+ beaconServiceSignals.get(beaconService)?.push({
402
+ tx,
403
+ signalBytes: updateHash,
404
+ blockMetadata: {
405
+ height: block.height,
406
+ time: block.time,
407
+ confirmations: block.confirmations
408
+ }
409
+ });
410
+ }
411
+ ;
412
+ }
413
+ // Increment the height
414
+ height += 1;
415
+ // Check if we've reached the chain tip
416
+ const tip = await rpc.getBlockCount();
417
+ if (height > tip) {
418
+ // If so, break the loop
419
+ console.info(`Chain tip reached ${height}, breaking ...`);
420
+ break;
421
+ }
422
+ // Reset the block var to the next block data
423
+ block = await rpc.getBlock({ height });
424
+ }
425
+ return beaconServiceSignals;
426
+ }
427
+ /**
428
+ * Implements subsection {@link https://dcdpr.github.io/did-btcr2/#confirm-duplicate-update | 7.2.f.1 Confirm Duplicate Update}.
429
+ * This step confirms that an update with a lower-than-expected targetVersionId is a true duplicate.
430
+ * @param {BTCR2SignedUpdate} update The BTCR2 Signed Update to confirm as a duplicate.
431
+ * @returns {void} Does not return a value, but throws an error if the update is not a valid duplicate.
432
+ */
433
+ static confirmDuplicateUpdate(update, updateHashHistory) {
434
+ // Create unsigned_update by removing the proof property from update.
435
+ const unsignedUpdate = JSONUtils.deleteKeys(update, ['proof']);
436
+ // Hash unsignedUpdate with JSON Document Hashing algorithm
437
+ const unsignedUpdateHash = canonicalization.process(unsignedUpdate);
438
+ // 5. Let historicalUpdateHash equal updateHashHistory[updateHashIndex].
439
+ const historicalUpdateHash = updateHashHistory[update.targetVersionId - 2];
440
+ // Check if the updateHash matches the historical hash
441
+ if (updateHashHistory[update.targetVersionId - 2] !== unsignedUpdateHash) {
442
+ throw new ResolveError(`Invalid duplicate: ${unsignedUpdateHash} does not match ${historicalUpdateHash}`, LATE_PUBLISHING_ERROR, { unsignedUpdateHash, updateHashHistory });
443
+ }
444
+ }
445
+ /**
446
+ * Implements subsection {@link https://dcdpr.github.io/did-btcr2/operations/resolve.html#apply-update | 7.2.f.3 Apply Update}.
447
+ * @param {DidDocument} currentDocument The current DID Document to apply the update to.
448
+ * @param {BTCR2SignedUpdate} update The BTCR2 Signed Update to apply.
449
+ * @returns {Promise<DidDocument>} The updated DID Document after applying the update.
450
+ * @throws {ResolveError} If the update is invalid or cannot be applied.
451
+ */
452
+ static async applyDidUpdate(currentDocument, update) {
453
+ // Get the capability id from the to update proof.
454
+ const capabilityId = update.proof?.capability;
455
+ // Since this field is optional, check that it exists
456
+ if (!capabilityId) {
457
+ // If it does not exist, throw INVALID_DID_UPDATE error
458
+ throw new ResolveError('No root capability found in update', INVALID_DID_UPDATE, update);
459
+ }
460
+ // Get the root capability object by dereferencing the capabilityId
461
+ const rootCapability = Appendix.dereferenceZcapId(capabilityId);
462
+ // Deconstruct the invocationTarget and controller from the root capability
463
+ const { invocationTarget, controller: rootController } = rootCapability;
464
+ // Check that both invocationTarget and rootController equal currentDocument.id
465
+ if (![invocationTarget, rootController].every((id) => id === currentDocument.id)) {
466
+ // If they do not all match, throw INVALID_DID_UPDATE error
467
+ throw new ResolveError('Invalid root capability', INVALID_DID_UPDATE, { rootCapability, currentDocument });
468
+ }
469
+ // Get the verificationMethod field from the update proof as verificationMethodId.
470
+ const verificationMethodId = update.proof?.verificationMethod;
471
+ // Since this field is optional, check that it exists
472
+ if (!verificationMethodId) {
473
+ // If it does not exist, throw INVALID_DID_UPDATE error
474
+ throw new ResolveError('No verificationMethod found in update', INVALID_DID_UPDATE, update);
475
+ }
476
+ // Get the verificationMethod from the DID Document using the verificationMethodId.
477
+ const vm = DidBtcr2.getSigningMethod(currentDocument, verificationMethodId);
478
+ // Split the vmId by the `#` to get the id and controller.
479
+ const [vmController, vmId] = vm.id.split('#');
480
+ // Construct a new SchnorrMultikey.
481
+ const multikey = SchnorrMultikey.fromPublicKeyMultibase(`#${vmId}`, vmController, vm.publicKeyMultibase);
482
+ // Construct a new BIP340Cryptosuite with the SchnorrMultikey.
483
+ const cryptosuite = new BIP340Cryptosuite(multikey);
484
+ // Canonicalize the update
485
+ const canonicalUpdate = canonicalization.canonicalize(update);
486
+ // Construct a DataIntegrityProof with the cryptosuite
487
+ const diProof = new BIP340DataIntegrityProof(cryptosuite);
488
+ // Call the verifyProof method
489
+ const verificationResult = diProof.verifyProof(canonicalUpdate, 'capabilityInvocation');
490
+ // If the result is not verified, throw INVALID_DID_UPDATE error
491
+ if (!verificationResult.verified) {
492
+ throw new MethodError('Invalid update: proof not verified', INVALID_DID_UPDATE, verificationResult);
493
+ }
494
+ // Apply the update.patch to the currentDocument to get the updatedDocument.
495
+ const updatedDocument = JSONPatch.apply(currentDocument, update.patch);
496
+ // Verify that updatedDocument is conformant to DID Core v1.1.
497
+ DidDocument.validate(updatedDocument);
498
+ // Canonicalize and hash the updatedDocument to get the currentDocumentHash.
499
+ const currentDocumentHash = canonicalization.process(currentDocument, { encoding: 'base58' });
500
+ // Prepare the update targetHash for comparison with currentDocumentHash.
501
+ const updateTargetHash = update.targetHash.startsWith('z') ? update.targetHash : `z${update.targetHash}`;
502
+ // Make sure the update.targetHash equals currentDocumentHash.
503
+ if (updateTargetHash !== currentDocumentHash) {
504
+ // If they do not match, throw INVALID_DID_UPDATE error.
505
+ throw new MethodError(`Invalid update: updateTargetHash !== currentDocumentHash`, INVALID_DID_UPDATE, { updateTargetHash, currentDocumentHash });
506
+ }
507
+ // Return final updatedDocument.
508
+ return updatedDocument;
509
+ }
510
+ }
511
+ //# sourceMappingURL=resolve.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolve.js","sourceRoot":"","sources":["../../../src/core/resolve.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,aAAa,EACb,UAAU,EAEV,qBAAqB,EACtB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,SAAS,EACT,aAAa,EACb,WAAW,EACX,oBAAoB,EACpB,kBAAkB,EAClB,SAAS,EACT,SAAS,EACT,qBAAqB,EACrB,WAAW,EACX,mBAAmB,EACnB,YAAY,EACb,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,iBAAiB,EACjB,wBAAwB,EAGxB,eAAe,EAChB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,4BAA4B,EAAE,MAAM,oBAAoB,CAAC;AAClE,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,gBAAg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AmB,EAAE,CAAC;YAC7C,wDAAwD;YACxD,MAAM,IAAI,WAAW,CACnB,0DAA0D,EAC1D,kBAAkB,EAAE,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,CAC9D,CAAC;QACJ,CAAC;QAED,iCAAiC;QACjC,OAAO,eAAe,CAAC;IACzB,CAAC;CACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/utils/types.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/core/types.ts"],"names":[],"mappings":""}