@did-btcr2/method 0.18.1 → 0.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (291) hide show
  1. package/dist/browser.js +4917 -6487
  2. package/dist/browser.mjs +4917 -6487
  3. package/dist/cjs/core/beacon/aggregation/cohort/index.js +3 -3
  4. package/dist/cjs/core/beacon/aggregation/cohort/index.js.map +1 -1
  5. package/dist/cjs/core/beacon/aggregation/cohort/messages/base.js +1 -9
  6. package/dist/cjs/core/beacon/aggregation/cohort/messages/base.js.map +1 -1
  7. package/dist/cjs/core/beacon/aggregation/cohort/messages/keygen/cohort-advert.js +2 -1
  8. package/dist/cjs/core/beacon/aggregation/cohort/messages/keygen/cohort-advert.js.map +1 -1
  9. package/dist/cjs/core/beacon/aggregation/cohort/messages/keygen/cohort-ready.js +2 -1
  10. package/dist/cjs/core/beacon/aggregation/cohort/messages/keygen/cohort-ready.js.map +1 -1
  11. package/dist/cjs/core/beacon/aggregation/cohort/messages/keygen/opt-in-accept.js +2 -1
  12. package/dist/cjs/core/beacon/aggregation/cohort/messages/keygen/opt-in-accept.js.map +1 -1
  13. package/dist/cjs/core/beacon/aggregation/cohort/messages/keygen/opt-in.js +2 -1
  14. package/dist/cjs/core/beacon/aggregation/cohort/messages/keygen/opt-in.js.map +1 -1
  15. package/dist/cjs/core/beacon/aggregation/cohort/messages/keygen/subscribe.js +2 -1
  16. package/dist/cjs/core/beacon/aggregation/cohort/messages/keygen/subscribe.js.map +1 -1
  17. package/dist/cjs/core/beacon/aggregation/cohort/messages/sign/aggregated-nonce.js +2 -1
  18. package/dist/cjs/core/beacon/aggregation/cohort/messages/sign/aggregated-nonce.js.map +1 -1
  19. package/dist/cjs/core/beacon/aggregation/cohort/messages/sign/authorization-request.js +2 -1
  20. package/dist/cjs/core/beacon/aggregation/cohort/messages/sign/authorization-request.js.map +1 -1
  21. package/dist/cjs/core/beacon/aggregation/cohort/messages/sign/nonce-contribution.js +2 -1
  22. package/dist/cjs/core/beacon/aggregation/cohort/messages/sign/nonce-contribution.js.map +1 -1
  23. package/dist/cjs/core/beacon/aggregation/cohort/messages/sign/request-signature.js +2 -1
  24. package/dist/cjs/core/beacon/aggregation/cohort/messages/sign/request-signature.js.map +1 -1
  25. package/dist/cjs/core/beacon/aggregation/cohort/messages/sign/signature-authorization.js +2 -1
  26. package/dist/cjs/core/beacon/aggregation/cohort/messages/sign/signature-authorization.js.map +1 -1
  27. package/dist/cjs/core/beacon/aggregation/communication/adapter/nostr.js +36 -18
  28. package/dist/cjs/core/beacon/aggregation/communication/adapter/nostr.js.map +1 -1
  29. package/dist/cjs/core/beacon/aggregation/coordinator.js +14 -14
  30. package/dist/cjs/core/beacon/aggregation/coordinator.js.map +1 -1
  31. package/dist/cjs/core/beacon/aggregation/participant.js +4 -3
  32. package/dist/cjs/core/beacon/aggregation/participant.js.map +1 -1
  33. package/dist/cjs/core/beacon/aggregation/session/index.js +1 -1
  34. package/dist/cjs/core/beacon/aggregation/session/index.js.map +1 -1
  35. package/dist/cjs/core/beacon/beacon.js +25 -0
  36. package/dist/cjs/core/beacon/beacon.js.map +1 -0
  37. package/dist/cjs/core/beacon/cas-beacon.js +39 -0
  38. package/dist/cjs/core/beacon/cas-beacon.js.map +1 -0
  39. package/dist/cjs/core/beacon/error.js +4 -4
  40. package/dist/cjs/core/beacon/error.js.map +1 -1
  41. package/dist/cjs/core/beacon/factory.js +10 -11
  42. package/dist/cjs/core/beacon/factory.js.map +1 -1
  43. package/dist/cjs/core/beacon/interfaces.js +2 -0
  44. package/dist/cjs/core/beacon/interfaces.js.map +1 -0
  45. package/dist/cjs/core/beacon/signal-discovery.js +183 -0
  46. package/dist/cjs/core/beacon/signal-discovery.js.map +1 -0
  47. package/dist/cjs/core/beacon/singleton.js +75 -178
  48. package/dist/cjs/core/beacon/singleton.js.map +1 -1
  49. package/dist/cjs/core/beacon/smt-beacon.js +39 -0
  50. package/dist/cjs/core/beacon/smt-beacon.js.map +1 -0
  51. package/dist/cjs/core/beacon/utils.js +71 -114
  52. package/dist/cjs/core/beacon/utils.js.map +1 -1
  53. package/dist/cjs/core/identifier.js +18 -21
  54. package/dist/cjs/core/identifier.js.map +1 -1
  55. package/dist/cjs/core/interfaces.js +2 -0
  56. package/dist/cjs/core/interfaces.js.map +1 -0
  57. package/dist/cjs/core/resolve.js +321 -0
  58. package/dist/cjs/core/resolve.js.map +1 -0
  59. package/dist/cjs/{utils → core}/types.js.map +1 -1
  60. package/dist/cjs/core/update.js +113 -0
  61. package/dist/cjs/core/update.js.map +1 -0
  62. package/dist/cjs/did-btcr2.js +168 -129
  63. package/dist/cjs/did-btcr2.js.map +1 -1
  64. package/dist/cjs/index.js +17 -16
  65. package/dist/cjs/index.js.map +1 -1
  66. package/dist/cjs/utils/appendix.js +16 -33
  67. package/dist/cjs/utils/appendix.js.map +1 -1
  68. package/dist/cjs/utils/did-document-builder.js +5 -0
  69. package/dist/cjs/utils/did-document-builder.js.map +1 -1
  70. package/dist/cjs/utils/did-document.js +62 -72
  71. package/dist/cjs/utils/did-document.js.map +1 -1
  72. package/dist/cjs/utils/general.js +1 -1
  73. package/dist/cjs/utils/general.js.map +1 -1
  74. package/dist/esm/core/beacon/aggregation/cohort/index.js +3 -3
  75. package/dist/esm/core/beacon/aggregation/cohort/index.js.map +1 -1
  76. package/dist/esm/core/beacon/aggregation/cohort/messages/base.js +1 -9
  77. package/dist/esm/core/beacon/aggregation/cohort/messages/base.js.map +1 -1
  78. package/dist/esm/core/beacon/aggregation/cohort/messages/keygen/cohort-advert.js +2 -1
  79. package/dist/esm/core/beacon/aggregation/cohort/messages/keygen/cohort-advert.js.map +1 -1
  80. package/dist/esm/core/beacon/aggregation/cohort/messages/keygen/cohort-ready.js +2 -1
  81. package/dist/esm/core/beacon/aggregation/cohort/messages/keygen/cohort-ready.js.map +1 -1
  82. package/dist/esm/core/beacon/aggregation/cohort/messages/keygen/opt-in-accept.js +2 -1
  83. package/dist/esm/core/beacon/aggregation/cohort/messages/keygen/opt-in-accept.js.map +1 -1
  84. package/dist/esm/core/beacon/aggregation/cohort/messages/keygen/opt-in.js +2 -1
  85. package/dist/esm/core/beacon/aggregation/cohort/messages/keygen/opt-in.js.map +1 -1
  86. package/dist/esm/core/beacon/aggregation/cohort/messages/keygen/subscribe.js +2 -1
  87. package/dist/esm/core/beacon/aggregation/cohort/messages/keygen/subscribe.js.map +1 -1
  88. package/dist/esm/core/beacon/aggregation/cohort/messages/sign/aggregated-nonce.js +2 -1
  89. package/dist/esm/core/beacon/aggregation/cohort/messages/sign/aggregated-nonce.js.map +1 -1
  90. package/dist/esm/core/beacon/aggregation/cohort/messages/sign/authorization-request.js +2 -1
  91. package/dist/esm/core/beacon/aggregation/cohort/messages/sign/authorization-request.js.map +1 -1
  92. package/dist/esm/core/beacon/aggregation/cohort/messages/sign/nonce-contribution.js +2 -1
  93. package/dist/esm/core/beacon/aggregation/cohort/messages/sign/nonce-contribution.js.map +1 -1
  94. package/dist/esm/core/beacon/aggregation/cohort/messages/sign/request-signature.js +2 -1
  95. package/dist/esm/core/beacon/aggregation/cohort/messages/sign/request-signature.js.map +1 -1
  96. package/dist/esm/core/beacon/aggregation/cohort/messages/sign/signature-authorization.js +2 -1
  97. package/dist/esm/core/beacon/aggregation/cohort/messages/sign/signature-authorization.js.map +1 -1
  98. package/dist/esm/core/beacon/aggregation/communication/adapter/nostr.js +36 -18
  99. package/dist/esm/core/beacon/aggregation/communication/adapter/nostr.js.map +1 -1
  100. package/dist/esm/core/beacon/aggregation/coordinator.js +14 -14
  101. package/dist/esm/core/beacon/aggregation/coordinator.js.map +1 -1
  102. package/dist/esm/core/beacon/aggregation/participant.js +4 -3
  103. package/dist/esm/core/beacon/aggregation/participant.js.map +1 -1
  104. package/dist/esm/core/beacon/aggregation/session/index.js +1 -1
  105. package/dist/esm/core/beacon/aggregation/session/index.js.map +1 -1
  106. package/dist/esm/core/beacon/beacon.js +25 -0
  107. package/dist/esm/core/beacon/beacon.js.map +1 -0
  108. package/dist/esm/core/beacon/cas-beacon.js +39 -0
  109. package/dist/esm/core/beacon/cas-beacon.js.map +1 -0
  110. package/dist/esm/core/beacon/error.js +4 -4
  111. package/dist/esm/core/beacon/error.js.map +1 -1
  112. package/dist/esm/core/beacon/factory.js +10 -11
  113. package/dist/esm/core/beacon/factory.js.map +1 -1
  114. package/dist/esm/core/beacon/interfaces.js +2 -0
  115. package/dist/esm/core/beacon/interfaces.js.map +1 -0
  116. package/dist/esm/core/beacon/signal-discovery.js +183 -0
  117. package/dist/esm/core/beacon/signal-discovery.js.map +1 -0
  118. package/dist/esm/core/beacon/singleton.js +75 -178
  119. package/dist/esm/core/beacon/singleton.js.map +1 -1
  120. package/dist/esm/core/beacon/smt-beacon.js +39 -0
  121. package/dist/esm/core/beacon/smt-beacon.js.map +1 -0
  122. package/dist/esm/core/beacon/utils.js +71 -114
  123. package/dist/esm/core/beacon/utils.js.map +1 -1
  124. package/dist/esm/core/identifier.js +18 -21
  125. package/dist/esm/core/identifier.js.map +1 -1
  126. package/dist/esm/core/interfaces.js +2 -0
  127. package/dist/esm/core/interfaces.js.map +1 -0
  128. package/dist/esm/core/resolve.js +321 -0
  129. package/dist/esm/core/resolve.js.map +1 -0
  130. package/dist/esm/{utils → core}/types.js.map +1 -1
  131. package/dist/esm/core/update.js +113 -0
  132. package/dist/esm/core/update.js.map +1 -0
  133. package/dist/esm/did-btcr2.js +168 -129
  134. package/dist/esm/did-btcr2.js.map +1 -1
  135. package/dist/esm/index.js +17 -16
  136. package/dist/esm/index.js.map +1 -1
  137. package/dist/esm/utils/appendix.js +16 -33
  138. package/dist/esm/utils/appendix.js.map +1 -1
  139. package/dist/esm/utils/did-document-builder.js +5 -0
  140. package/dist/esm/utils/did-document-builder.js.map +1 -1
  141. package/dist/esm/utils/did-document.js +62 -72
  142. package/dist/esm/utils/did-document.js.map +1 -1
  143. package/dist/esm/utils/general.js +1 -1
  144. package/dist/esm/utils/general.js.map +1 -1
  145. package/dist/types/core/beacon/aggregation/cohort/index.d.ts +1 -1
  146. package/dist/types/core/beacon/aggregation/cohort/messages/base.d.ts +0 -7
  147. package/dist/types/core/beacon/aggregation/cohort/messages/base.d.ts.map +1 -1
  148. package/dist/types/core/beacon/aggregation/cohort/messages/keygen/cohort-advert.d.ts.map +1 -1
  149. package/dist/types/core/beacon/aggregation/cohort/messages/keygen/cohort-ready.d.ts.map +1 -1
  150. package/dist/types/core/beacon/aggregation/cohort/messages/keygen/opt-in-accept.d.ts.map +1 -1
  151. package/dist/types/core/beacon/aggregation/cohort/messages/keygen/opt-in.d.ts.map +1 -1
  152. package/dist/types/core/beacon/aggregation/cohort/messages/keygen/subscribe.d.ts.map +1 -1
  153. package/dist/types/core/beacon/aggregation/cohort/messages/sign/aggregated-nonce.d.ts.map +1 -1
  154. package/dist/types/core/beacon/aggregation/cohort/messages/sign/authorization-request.d.ts.map +1 -1
  155. package/dist/types/core/beacon/aggregation/cohort/messages/sign/nonce-contribution.d.ts.map +1 -1
  156. package/dist/types/core/beacon/aggregation/cohort/messages/sign/request-signature.d.ts.map +1 -1
  157. package/dist/types/core/beacon/aggregation/cohort/messages/sign/signature-authorization.d.ts.map +1 -1
  158. package/dist/types/core/beacon/aggregation/communication/adapter/nostr.d.ts +13 -5
  159. package/dist/types/core/beacon/aggregation/communication/adapter/nostr.d.ts.map +1 -1
  160. package/dist/types/core/beacon/aggregation/coordinator.d.ts +17 -29
  161. package/dist/types/core/beacon/aggregation/coordinator.d.ts.map +1 -1
  162. package/dist/types/core/beacon/aggregation/participant.d.ts.map +1 -1
  163. package/dist/types/core/beacon/beacon.d.ts +44 -0
  164. package/dist/types/core/beacon/beacon.d.ts.map +1 -0
  165. package/dist/types/core/beacon/cas-beacon.d.ts +36 -0
  166. package/dist/types/core/beacon/cas-beacon.d.ts.map +1 -0
  167. package/dist/types/core/beacon/error.d.ts +2 -2
  168. package/dist/types/core/beacon/error.d.ts.map +1 -1
  169. package/dist/types/core/beacon/factory.d.ts +4 -5
  170. package/dist/types/core/beacon/factory.d.ts.map +1 -1
  171. package/dist/types/core/beacon/interfaces.d.ts +59 -0
  172. package/dist/types/core/beacon/interfaces.d.ts.map +1 -0
  173. package/dist/types/core/beacon/signal-discovery.d.ts +25 -0
  174. package/dist/types/core/beacon/signal-discovery.d.ts.map +1 -0
  175. package/dist/types/core/beacon/singleton.d.ts +20 -76
  176. package/dist/types/core/beacon/singleton.d.ts.map +1 -1
  177. package/dist/types/core/beacon/smt-beacon.d.ts +36 -0
  178. package/dist/types/core/beacon/smt-beacon.d.ts.map +1 -0
  179. package/dist/types/core/beacon/utils.d.ts +19 -97
  180. package/dist/types/core/beacon/utils.d.ts.map +1 -1
  181. package/dist/types/core/identifier.d.ts.map +1 -1
  182. package/dist/types/core/interfaces.d.ts +87 -0
  183. package/dist/types/core/interfaces.d.ts.map +1 -0
  184. package/dist/types/core/resolve.d.ts +89 -0
  185. package/dist/types/core/resolve.d.ts.map +1 -0
  186. package/dist/types/core/types.d.ts +84 -0
  187. package/dist/types/core/types.d.ts.map +1 -0
  188. package/dist/types/core/update.d.ts +51 -0
  189. package/dist/types/core/update.d.ts.map +1 -0
  190. package/dist/types/did-btcr2.d.ts +70 -89
  191. package/dist/types/did-btcr2.d.ts.map +1 -1
  192. package/dist/types/index.d.ts +17 -16
  193. package/dist/types/index.d.ts.map +1 -1
  194. package/dist/types/utils/appendix.d.ts +5 -10
  195. package/dist/types/utils/appendix.d.ts.map +1 -1
  196. package/dist/types/utils/did-document-builder.d.ts +6 -1
  197. package/dist/types/utils/did-document-builder.d.ts.map +1 -1
  198. package/dist/types/utils/did-document.d.ts +46 -42
  199. package/dist/types/utils/did-document.d.ts.map +1 -1
  200. package/package.json +6 -6
  201. package/src/core/beacon/aggregation/cohort/index.ts +3 -3
  202. package/src/core/beacon/aggregation/cohort/messages/base.ts +1 -12
  203. package/src/core/beacon/aggregation/cohort/messages/keygen/cohort-advert.ts +2 -2
  204. package/src/core/beacon/aggregation/cohort/messages/keygen/cohort-ready.ts +2 -2
  205. package/src/core/beacon/aggregation/cohort/messages/keygen/opt-in-accept.ts +2 -2
  206. package/src/core/beacon/aggregation/cohort/messages/keygen/opt-in.ts +2 -2
  207. package/src/core/beacon/aggregation/cohort/messages/keygen/subscribe.ts +2 -2
  208. package/src/core/beacon/aggregation/cohort/messages/sign/aggregated-nonce.ts +2 -2
  209. package/src/core/beacon/aggregation/cohort/messages/sign/authorization-request.ts +2 -2
  210. package/src/core/beacon/aggregation/cohort/messages/sign/nonce-contribution.ts +2 -2
  211. package/src/core/beacon/aggregation/cohort/messages/sign/request-signature.ts +2 -2
  212. package/src/core/beacon/aggregation/cohort/messages/sign/signature-authorization.ts +2 -2
  213. package/src/core/beacon/aggregation/communication/adapter/nostr.ts +43 -21
  214. package/src/core/beacon/aggregation/coordinator.ts +41 -29
  215. package/src/core/beacon/aggregation/participant.ts +4 -3
  216. package/src/core/beacon/aggregation/session/index.ts +1 -1
  217. package/src/core/beacon/beacon.ts +58 -0
  218. package/src/core/beacon/cas-beacon.ts +53 -0
  219. package/src/core/beacon/error.ts +5 -6
  220. package/src/core/beacon/factory.ts +12 -16
  221. package/src/core/beacon/interfaces.ts +67 -0
  222. package/src/core/beacon/signal-discovery.ts +237 -0
  223. package/src/core/beacon/singleton.ts +107 -197
  224. package/src/core/beacon/smt-beacon.ts +53 -0
  225. package/src/core/beacon/utils.ts +95 -182
  226. package/src/core/identifier.ts +21 -24
  227. package/src/core/interfaces.ts +93 -0
  228. package/src/core/resolve.ts +463 -0
  229. package/src/core/types.ts +95 -0
  230. package/src/core/update.ts +154 -0
  231. package/src/did-btcr2.ts +255 -159
  232. package/src/index.ts +19 -22
  233. package/src/utils/appendix.ts +26 -44
  234. package/src/utils/did-document-builder.ts +6 -1
  235. package/src/utils/did-document.ts +105 -113
  236. package/src/utils/general.ts +1 -1
  237. package/dist/cjs/core/beacon/cid-aggregate.js +0 -116
  238. package/dist/cjs/core/beacon/cid-aggregate.js.map +0 -1
  239. package/dist/cjs/core/beacon/smt-aggregate.js +0 -126
  240. package/dist/cjs/core/beacon/smt-aggregate.js.map +0 -1
  241. package/dist/cjs/core/crud/deactivate.js +0 -14
  242. package/dist/cjs/core/crud/deactivate.js.map +0 -1
  243. package/dist/cjs/core/crud/read.js +0 -679
  244. package/dist/cjs/core/crud/read.js.map +0 -1
  245. package/dist/cjs/core/crud/update.js +0 -194
  246. package/dist/cjs/core/crud/update.js.map +0 -1
  247. package/dist/cjs/interfaces/beacon.js +0 -41
  248. package/dist/cjs/interfaces/beacon.js.map +0 -1
  249. package/dist/cjs/interfaces/crud.js +0 -2
  250. package/dist/cjs/interfaces/crud.js.map +0 -1
  251. package/dist/esm/core/beacon/cid-aggregate.js +0 -116
  252. package/dist/esm/core/beacon/cid-aggregate.js.map +0 -1
  253. package/dist/esm/core/beacon/smt-aggregate.js +0 -126
  254. package/dist/esm/core/beacon/smt-aggregate.js.map +0 -1
  255. package/dist/esm/core/crud/deactivate.js +0 -14
  256. package/dist/esm/core/crud/deactivate.js.map +0 -1
  257. package/dist/esm/core/crud/read.js +0 -679
  258. package/dist/esm/core/crud/read.js.map +0 -1
  259. package/dist/esm/core/crud/update.js +0 -194
  260. package/dist/esm/core/crud/update.js.map +0 -1
  261. package/dist/esm/interfaces/beacon.js +0 -41
  262. package/dist/esm/interfaces/beacon.js.map +0 -1
  263. package/dist/esm/interfaces/crud.js +0 -2
  264. package/dist/esm/interfaces/crud.js.map +0 -1
  265. package/dist/types/core/beacon/cid-aggregate.d.ts +0 -102
  266. package/dist/types/core/beacon/cid-aggregate.d.ts.map +0 -1
  267. package/dist/types/core/beacon/smt-aggregate.d.ts +0 -111
  268. package/dist/types/core/beacon/smt-aggregate.d.ts.map +0 -1
  269. package/dist/types/core/crud/deactivate.d.ts +0 -13
  270. package/dist/types/core/crud/deactivate.d.ts.map +0 -1
  271. package/dist/types/core/crud/read.d.ts +0 -334
  272. package/dist/types/core/crud/read.d.ts.map +0 -1
  273. package/dist/types/core/crud/update.d.ts +0 -93
  274. package/dist/types/core/crud/update.d.ts.map +0 -1
  275. package/dist/types/interfaces/beacon.d.ts +0 -116
  276. package/dist/types/interfaces/beacon.d.ts.map +0 -1
  277. package/dist/types/interfaces/crud.d.ts +0 -32
  278. package/dist/types/interfaces/crud.d.ts.map +0 -1
  279. package/dist/types/utils/types.d.ts +0 -38
  280. package/dist/types/utils/types.d.ts.map +0 -1
  281. package/src/canonicalize.d.ts +0 -6
  282. package/src/core/beacon/cid-aggregate.ts +0 -153
  283. package/src/core/beacon/smt-aggregate.ts +0 -135
  284. package/src/core/crud/deactivate.ts +0 -13
  285. package/src/core/crud/read.ts +0 -948
  286. package/src/core/crud/update.ts +0 -292
  287. package/src/interfaces/beacon.ts +0 -137
  288. package/src/interfaces/crud.ts +0 -33
  289. package/src/utils/types.ts +0 -41
  290. /package/dist/cjs/{utils → core}/types.js +0 -0
  291. /package/dist/esm/{utils → core}/types.js +0 -0
@@ -1,116 +0,0 @@
1
- import { MethodError } from '@did-btcr2/common';
2
- import { Beacon } from '../../interfaces/beacon.js';
3
- /**
4
- * Implements {@link https://dcdpr.github.io/did-btcr2/#cidaggregate-beacon | 5.2 CIDAggregate Beacon}.
5
- *
6
- * A Beacon of the type CIDAggregatoBeacon is a Beacon that publishes Bitcoin transactions containing a Content
7
- * Identifier (CID) announcing an Aggregated DID Update Bundle. An Aggregated DID Update Bundle is a JSON object that
8
- * maps did:btcr2 identifiers to CID values for the individual DID Update Payloads. The Aggregated DID Update Bundle CID
9
- * (bundleCID) SHOULD be resolvable against a Content Addressable Storage (CAS) system such as IPFS, while the CID for
10
- * the DID Update Payload (payloadCID) MAY be resolvable against a CAS or provided through a Sidecar mechanism. It is
11
- * RECOMMENDED that this type of Beacon is only included in a DID document if the DID controller is REQUIRED to
12
- * participate in authorizing Bitcoin transactions from this Beacon. In other words, this Beacon SHOULD identify an
13
- * n-of-n P2TR Bitcoin address where n is the number of unique DID controllers submitting updates through the Beacon.
14
- *
15
- * @class CIDAggregateBeacon
16
- * @type {CIDAggregateBeacon}
17
- * @extends {Beacon}
18
- */
19
- export class CIDAggregateBeacon extends Beacon {
20
- /**
21
- * Creates an instance of CIDAggregateBeacon.
22
- * @param {BeaconService} service The service of the Beacon.
23
- * @param {?BeaconSidecarData} [sidecar] The sidecar data of the Beacon.
24
- */
25
- constructor(service, sidecar) {
26
- super({ ...service, type: 'CIDAggregateBeacon' }, sidecar);
27
- }
28
- get service() {
29
- return {
30
- type: this.type,
31
- id: this.id,
32
- serviceEndpoint: this.serviceEndpoint
33
- };
34
- }
35
- /**
36
- * TODO: Finish implementation
37
- *
38
- * Implements {@link https://dcdpr.github.io/did-btcr2/#establish-cidaggregate-beacon | 5.2.1 Establish CIDAggregate Beacon}.
39
- *
40
- * To establish a CIDAggregatorBeacon, a cohort of cooperating parties SHOULD generate an n-of-n P2TR Bitcoin address
41
- * where each party contributes a public key. Furthermore, each party SHOULD verify that their key is part of the
42
- * address and all other keys that are part of the address are keys with controllers able to produce valid signatures.
43
- * To establish a Beacon there are two roles. One is the cohort participant, they want to join a Beacon cohort and
44
- * submit a request to do so with a key and proof of control over that key. The other is the Beacon coordinator, they
45
- * advertise and curate Beacon cohorts by combining Beacon participants into cohorts, verifying proofs of control, and
46
- * producing Beacon addresses.
47
- *
48
- * @param {string} id The identifier of the Beacon.
49
- * @param {string} type The type of the Beacon.
50
- * @param {DidServiceEndpoint} serviceEndpoint The service endpoint of the Beacon.
51
- * @returns {CIDAggregateBeacon} The established CIDAggregate Beacon.
52
- */
53
- static establish(id, type, serviceEndpoint) {
54
- return new CIDAggregateBeacon({ id, type, serviceEndpoint });
55
- }
56
- /**
57
- * TODO: Figure out if this is necessary or not.
58
- * @param {string} didUpdatePayload The DID Update Payload to generate the signal for.
59
- * @returns {BeaconSignal} The generated signal.
60
- * @throws {MethodError} if the signal is invalid.
61
- */
62
- generateSignal(didUpdatePayload) {
63
- throw new MethodError('Method not implemented.', `METHOD_NOT_IMPLEMENTED`, { didUpdatePayload });
64
- }
65
- /**
66
- * TODO: Finish implementation
67
- *
68
- * Implements {@link https://dcdpr.github.io/did-btcr2/#process-cidaggregate-beacon-signal | 5.2.3 Process CIDAggregate Beacon Signal}.
69
- *
70
- * A Beacon Signal from a CIDAggregate Beacon is a Bitcoin transaction that contains the hashBytes of a DID Update
71
- * Bundle in its first transaction output. The corresponding DID Update Bundle MUST either be provided through Sidecar
72
- * Data or by converting hashBytes into a IPFS v1 Content Identifier and attempting to retrieve it from Content
73
- * Addressable Storage. The DID Update Bundle maps from did:btcr2 identifiers to hashes of DID Update payloads
74
- * applicable for that identifier. Again this algorithm attempts to retrieve and validate the DID Update Payload
75
- * identified for the identifier being resolved. If successful, the DID Update Payload is returned.
76
- *
77
- * The Process CIDAggregate Beacon Signal algorithm is called by the Process Beacon Signals algorithm as part of the
78
- * Read operation.
79
- *
80
- * It takes as inputs a did:btcr2 identifier, Identifier, a Beacon Signal, tx, and a optional
81
- * object, signalSidecarData, containing any sidecar data provided to the resolver for the Beacon Signal identified by
82
- * the Bitcoin transaction identifier.
83
- *
84
- * It returns the DID Update payload announced by the Beacon Signal for the
85
- * did:btcr2 identifier being resolved or throws an error.
86
- *
87
- * @param {RawTransactionV2} signal Bitcoin transaction representing a Beacon Signal.
88
- * @param {SignalsMetadata} signalsMetadata Optional sidecar data for the Beacon Signal.
89
- * @returns {Promise<DidUpdatePayload | undefined>} The DID Update payload announced by the Beacon Signal.
90
- * @throws {DidError} if the signalTx is invalid or the signalsMetadata is invalid.
91
- */
92
- processSignal(signal, signalsMetadata) {
93
- throw new MethodError('Method not implemented.', `METHOD_NOT_IMPLEMENTED`, { signal, signalsMetadata });
94
- }
95
- /**
96
- * TODO: Finish implementation
97
- *
98
- * Implements {@link https://dcdpr.github.io/did-btcr2/#broadcast-cidaggregate-beacon-signal | 5.2.2 Broadcast CIDAggregate Beacon Signal}.
99
- *
100
- * The Broadcast CIDAggregate Beacon Signal algorithm involving two roles: a set of cohort participants and a Beacon
101
- * coordinator. The Beacon coordinator collects individual DID Update Payload Content Identifiers (CIDs) for specific
102
- * did:btcr2 idntifiers and aggregates them into a DID Update Bundle, which is then published to a Content Addressable
103
- * Storage (CAS). The CID for the DID Update Bundle is included in a Partially Signed Bitcoin Transaction (PSBT) transaction
104
- * output spent from the Beacon’s n-of-n address. Each of the n cohort participants in the Beacon MUST sign the
105
- * transaction before it can be broadcast to the network. It is RECOMMENDED that cohort participants keep a copy of
106
- * the DID Update Bundle and separately pin it to the CAS.
107
- *
108
- * @param {DidUpdatePayload} didUpdatePayload The verificationMethod object to be used for signing.
109
- * @returns {SignalsMetadata} Successful output of a bitcoin transaction.
110
- * @throws {SingletonBeaconError} if the bitcoin address is invalid or unfunded.
111
- */
112
- broadcastSignal(didUpdatePayload) {
113
- throw new MethodError('Method not implemented.', `METHOD_NOT_IMPLEMENTED`, didUpdatePayload);
114
- }
115
- }
116
- //# sourceMappingURL=cid-aggregate.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"cid-aggregate.js","sourceRoot":"","sources":["../../../../src/core/beacon/cid-aggregate.ts"],"names":[],"mappings":"AACA,OAAO,EAAyC,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEvF,OAAO,EAAE,MAAM,EAA+B,MAAM,4BAA4B,CAAC;AAGjF;;;;;;;;;;;;;;;GAeG;AACH,MAAM,OAAO,kBAAmB,SAAQ,MAAM;IAC5C;;;;OAIG;IACH,YAAY,OAAsB,EAAE,OAAgD;QAClF,KAAK,CAAC,EAAE,GAAG,OAAO,EAAE,IAAI,EAAE,oBAAoB,EAAE,EAAE,OAAO,CAAC,CAAC;IAC7D,CAAC;IACD,IAAI,OAAO;QACT,OAAO;YACL,IAAI,EAAc,IAAI,CAAC,IAAI;YAC3B,EAAE,EAAgB,IAAI,CAAC,EAAE;YACzB,eAAe,EAAG,IAAI,CAAC,eAAe;SACvC,CAAC;IACJ,CAAC;IAGD;;;;;;;;;;;;;;;;;OAiBG;IACH,MAAM,CAAC,SAAS,CAAC,EAAU,EAAE,IAAY,EAAE,eAAmC;QAC5E,OAAO,IAAI,kBAAkB,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,eAAe,EAAE,CAAC,CAAC;IAC/D,CAAC;IAGD;;;;;OAKG;IACH,cAAc,CAAC,gBAAwB;QACrC,MAAM,IAAI,WAAW,CAAC,yBAAyB,EAAE,wBAAwB,EAAE,EAAC,gBAAgB,EAAC,CAAC,CAAC;IACjG,CAAC;IAGD;;;;;;;;;;;;;;;;;;;;;;;;;;OA0BG;IACH,aAAa,CAAC,MAAwB,EAAE,eAAgC;QACtE,MAAM,IAAI,WAAW,CAAC,yBAAyB,EAAE,wBAAwB,EAAE,EAAC,MAAM,EAAE,eAAe,EAAC,CAAC,CAAC;IACxG,CAAC;IAED;;;;;;;;;;;;;;;;OAgBG;IACH,eAAe,CAAC,gBAAkC;QAChD,MAAM,IAAI,WAAW,CAAC,yBAAyB,EAAE,wBAAwB,EAAE,gBAAgB,CAAC,CAAC;IAC/F,CAAC;CA4BF"}
@@ -1,126 +0,0 @@
1
- import { MethodError } from '@did-btcr2/common';
2
- import { Beacon } from '../../interfaces/beacon.js';
3
- /**
4
- * TODO: Finish implementation
5
- *
6
- * Implements {@link https://dcdpr.github.io/did-btcr2/#smtaggregate-beacon | 5.3 SMTAggregate Beacon}.
7
- *
8
- * A SMTAggregate Beacon is a Beacon whose Beacon Signals are Bitcoin transactions containing the root of a Sparse
9
- * Merkle Tree (SMT). The SMT root attests to a set of DID Update Payloads, however, the updates themselves MUST be
10
- * provided along with a proof of inclusion against the SMT root through a Sidecar mechanism during resolution. Using
11
- * the SMT root a resolver can then verify the inclusion proof for the given DID Update Payload. If a DID document
12
- * includes a SMTAggregator Beacon in their set of Beacon services, then they MUST provide proofs for each signal that
13
- * the Beacon broadcasts. If they did not submit an update to their DID in a signal, then they MUST provide a proof of
14
- * non-inclusion for that signal.
15
- *
16
- * @class SMTAggregateBeacon
17
- * @type {SMTAggregateBeacon}
18
- * @extends {Beacon}
19
- */
20
- export class SMTAggregateBeacon extends Beacon {
21
- /**
22
- * Creates an instance of SMTAggregateBeacon.
23
- * @param {BeaconService} service The Beacon service.
24
- * @param {?BeaconSidecarData} [sidecar] Optional sidecar data.
25
- */
26
- constructor(service, sidecar) {
27
- super({ ...service, type: 'SMTAggregateBeacon' }, sidecar);
28
- }
29
- /**
30
- * Get the Beacon service.
31
- * @readonly
32
- * @type {BeaconService} The Beacon service.
33
- */
34
- get service() {
35
- const service = {
36
- type: this.type,
37
- id: this.id,
38
- serviceEndpoint: this.serviceEndpoint
39
- };
40
- return service;
41
- }
42
- /**
43
- * TODO: Figure out if this is necessary or not.
44
- * @param {string} didUpdatePayload The DID Update Payload to generate the signal for.
45
- * @returns {BeaconSignal} The generated signal.
46
- * @throws {MethodError} if the signal is invalid.
47
- */
48
- generateSignal(didUpdatePayload) {
49
- throw new MethodError('Method not implemented.', `METHOD_NOT_IMPLEMENTED`, { didUpdatePayload });
50
- }
51
- /**
52
- * Implements {@link https://dcdpr.github.io/did-btcr2/#establish-beacon | 5.3.1 Establish Beacon}.
53
- *
54
- * The Establish Beacon algorithm is essentially the same as for the CIDAggregate Beacon in Establish CIDAggregate
55
- * Beacon. A cohort of DID controllers need to coordinate to produce a Bitcoin address that will act as the Beacon.
56
- * It is RECOMMENDED this is an n-of-n P2TR address, with n being the set of DID controllers in the cohort. Once the
57
- * address has been created, and all parties in the cohort acknowledge their intention to participate in that Beacon,
58
- * each DID controller SHOULD add the Beacon as a service to their DID document.
59
- *
60
- * Additionally, the SMTAggregate Beacon cohort participants MUST register the did:btcr2 identifiers they intend use
61
- * this Beacon with. This is so the Beacon coordinator can generate the necessary proofs of both inclusion and
62
- * non-inclusion for each DID.
63
- *
64
- * Static, convenience method for establishing a Beacon object.
65
- *
66
- * @param {string} id The Beacon ID.
67
- * @param {string} type The Beacon type.
68
- * @param {DidServiceEndpoint} serviceEndpoint The service endpoint.
69
- * @returns {Beacon} The Beacon.
70
- */
71
- static establish(id, type, serviceEndpoint) {
72
- return new SMTAggregateBeacon({ id, type, serviceEndpoint });
73
- }
74
- /**
75
- *
76
- * Implements {@link https://dcdpr.github.io/did-btcr2/#broadcast-smtaggregate-beacon-signal | 5.3.2 Broadcast SMTAggregate Beacon Signal}.
77
- *
78
- * See {@link Beacon.broadcastSignal | Beacon Interface Method broadcastSignal} for more information.
79
- *
80
- * To publish a DID Update Payload, the DID controller MUST get a hash of the DID Update Payload included at the leaf
81
- * of the Sparse Merkle Tree (SMT) identified by their did:btcr2 identifier and receive an inclusion proof for this
82
- * data. If a member of the Beacon cohort does not wish to announce an update in a Beacon Signal, they MUST receive
83
- * and verify a proof of non-inclusion for their DID. Upon verifying the non-inclusion proof against the SMT root
84
- * contained in the Beacon Signal, they SHOULD accept and authorize the signal following the MuSig2 protocol. Once all
85
- * members of the cohort have authorized the signal, it can be broadcast as a transaction to the Bitcoin network. DID
86
- * controllers are responsible for persisting their DID updates and proofs, these will need to be provided through a
87
- * Sidecar mechanism during a resolution process.
88
- *
89
- * @param {DidUpdatePayload} didUpdatePayload The DID Update Payload to broadcast.
90
- * @returns {Promise<SignalMetadata>} The signal metadata.
91
- * @throws {MethodError} if the signal is invalid.
92
- */
93
- broadcastSignal(didUpdatePayload) {
94
- throw new MethodError('Method not implemented.', `METHOD_NOT_IMPLEMENTED`, didUpdatePayload);
95
- }
96
- /**
97
- * Implements {@link https://dcdpr.github.io/did-btcr2/#process-smtaggregate-beacon-signal | 5.3.3 Process SMTAggregate Beacon Signal}.
98
- *
99
- * See {@link Beacon.processSignal | Beacon Interface Method processSignal} for more information.
100
- *
101
- * A Beacon Signal from a SMTAggregate Beacon is a Bitcoin transaction with the first transaction output of the format
102
- * [OP_RETURN, OP_PUSH32, <32bytes>]. The 32 bytes of data contained within this transaction output represent the root
103
- * of a Sparse Merkle Tree (SMT). This SMT aggregates a set of hashes of DID Update payloads. In order to process
104
- * these Beacon Signals, the resolver MUST have been passed Sidecar data for this signal containing either the DID
105
- * Update payload object and a SMT proof that the hash of this object is in the SMT at the leaf indexed by the
106
- * did:Identifier being resolved. Or theSidecar data:: MUST contain a proof that the leaf indexed by the
107
- * did:Identifier is empty, thereby proving that theSMT:: does not contain an update for their identifier.
108
- *
109
- * The Process SMTAggregate Beacon Signal is called by the Process Beacon Signals algorithm as part of the Read
110
- * operation. It takes as inputs a did:btcr2 identifier, Identifier, a Beacon Signal, tx, and a optional object,
111
- * signalSidecarData, containing any sidecar data provided to the resolver for the Beacon Signal identified by the
112
- * Bitcoin transaction identifier.
113
- *
114
- * It returns the DID Update payload announced by the Beacon Signal for the did:btcr2 identifier being resolved or
115
- * throws an error.
116
- *
117
- * @param {RawTransactionV2} signal The raw transaction signal.
118
- * @param {SignalsMetadata} signalsMetadata The signals metadata.
119
- * @returns {Promise<DidUpdatePayload | undefined>} The updated DID document.
120
- * @throws {MethodError} if the signal is invalid.
121
- */
122
- processSignal(signal, signalsMetadata) {
123
- throw new MethodError('Method not implemented.', `METHOD_NOT_IMPLEMENTED`, { signal, signalsMetadata });
124
- }
125
- }
126
- //# sourceMappingURL=smt-aggregate.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"smt-aggregate.js","sourceRoot":"","sources":["../../../../src/core/beacon/smt-aggregate.ts"],"names":[],"mappings":"AACA,OAAO,EAAoB,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAElE,OAAO,EAAE,MAAM,EAA+B,MAAM,4BAA4B,CAAC;AAGjF;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,OAAO,kBAAmB,SAAQ,MAAM;IAC5C;;;;OAIG;IACH,YAAY,OAAsB,EAAE,OAAgD;QAClF,KAAK,CAAC,EAAE,GAAG,OAAO,EAAE,IAAI,EAAE,oBAAoB,EAAE,EAAE,OAAO,CAAC,CAAC;IAC7D,CAAC;IAED;;;;OAIG;IACH,IAAI,OAAO;QACT,MAAM,OAAO,GAAG;YACd,IAAI,EAAc,IAAI,CAAC,IAAI;YAC3B,EAAE,EAAgB,IAAI,CAAC,EAAE;YACzB,eAAe,EAAG,IAAI,CAAC,eAAe;SACvC,CAAC;QACF,OAAO,OAAO,CAAC;IACjB,CAAC;IAED;;;;;OAKG;IACI,cAAc,CAAC,gBAAwB;QAC5C,MAAM,IAAI,WAAW,CAAC,yBAAyB,EAAE,wBAAwB,EAAE,EAAC,gBAAgB,EAAC,CAAC,CAAC;IACjG,CAAC;IAED;;;;;;;;;;;;;;;;;;;OAmBG;IACI,MAAM,CAAC,SAAS,CAAC,EAAU,EAAE,IAAY,EAAE,eAAmC;QACnF,OAAO,IAAI,kBAAkB,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,eAAe,EAAE,CAAC,CAAC;IAC/D,CAAC;IAED;;;;;;;;;;;;;;;;;;OAkBG;IACI,eAAe,CAAC,gBAAkC;QACvD,MAAM,IAAI,WAAW,CAAC,yBAAyB,EAAE,wBAAwB,EAAE,gBAAgB,CAAC,CAAC;IAC/F,CAAC;IAGD;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;IACI,aAAa,CAAC,MAAwB,EAAE,eAAgC;QAC7E,MAAM,IAAI,WAAW,CAAC,yBAAyB,EAAE,wBAAwB,EAAE,EAAC,MAAM,EAAE,eAAe,EAAC,CAAC,CAAC;IACxG,CAAC;CACF"}
@@ -1,14 +0,0 @@
1
- import { DidBtcr2 } from '../../did-btcr2.js';
2
- /**
3
- * Implements {@link https://dcdpr.github.io/did-btcr2/#deactivate | 4.4 Deactivate}
4
- * To deactivate a did:btcr2, the DID controller MUST add the property deactivated with the value true on the DID
5
- * document. To do this, the DID controller constructs a valid DID Update Payload with a JSON patch that adds this
6
- * property and announces the payload through a Beacon in their current DID document following the algorithm in Update.
7
- * Once a did:btcr2 has been deactivated this state is considered permanent and resolution MUST terminate.
8
- * @class Deactivate
9
- * @type {Deactivate}
10
- * @extends {DidBtcr2}
11
- */
12
- export class Deactivate extends DidBtcr2 {
13
- }
14
- //# sourceMappingURL=deactivate.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"deactivate.js","sourceRoot":"","sources":["../../../../src/core/crud/deactivate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAE9C;;;;;;;;;GASG;AACH,MAAM,OAAO,UAAW,SAAQ,QAAQ;CAAG"}