@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,42 +1,41 @@
1
+ export * from './core/beacon/aggregation/cohort/index.js';
2
+ export * from './core/beacon/aggregation/cohort/messages/base.js';
3
+ export * from './core/beacon/aggregation/cohort/messages/constants.js';
4
+ export * from './core/beacon/aggregation/cohort/messages/index.js';
5
+ export * from './core/beacon/aggregation/cohort/messages/keygen//subscribe.js';
1
6
  export * from './core/beacon/aggregation/cohort/messages/keygen/cohort-advert.js';
2
7
  export * from './core/beacon/aggregation/cohort/messages/keygen/cohort-ready.js';
3
8
  export * from './core/beacon/aggregation/cohort/messages/keygen/opt-in-accept.js';
4
9
  export * from './core/beacon/aggregation/cohort/messages/keygen/opt-in.js';
5
- export * from './core/beacon/aggregation/cohort/messages/keygen//subscribe.js';
6
10
  export * from './core/beacon/aggregation/cohort/messages/sign/aggregated-nonce.js';
7
11
  export * from './core/beacon/aggregation/cohort/messages/sign/authorization-request.js';
8
12
  export * from './core/beacon/aggregation/cohort/messages/sign/nonce-contribution.js';
9
13
  export * from './core/beacon/aggregation/cohort/messages/sign/request-signature.js';
10
14
  export * from './core/beacon/aggregation/cohort/messages/sign/signature-authorization.js';
11
- export * from './core/beacon/aggregation/cohort/messages/base.js';
12
- export * from './core/beacon/aggregation/cohort/messages/constants.js';
13
- export * from './core/beacon/aggregation/cohort/messages/index.js';
14
- export * from './core/beacon/aggregation/cohort/index.js';
15
15
  export * from './core/beacon/aggregation/cohort/status.js';
16
16
  export * from './core/beacon/aggregation/communication/adapter/did-comm.js';
17
17
  export * from './core/beacon/aggregation/communication/adapter/nostr.js';
18
18
  export * from './core/beacon/aggregation/communication/error.js';
19
19
  export * from './core/beacon/aggregation/communication/factory.js';
20
20
  export * from './core/beacon/aggregation/communication/service.js';
21
- export * from './core/beacon/aggregation/session/index.js';
22
- export * from './core/beacon/aggregation/session/status.js';
23
21
  export * from './core/beacon/aggregation/coordinator.js';
24
22
  export * from './core/beacon/aggregation/participant.js';
25
- export * from './core/beacon/cid-aggregate.js';
23
+ export * from './core/beacon/aggregation/session/index.js';
24
+ export * from './core/beacon/aggregation/session/status.js';
25
+ export * from './core/beacon/cas-beacon.js';
26
26
  export * from './core/beacon/error.js';
27
27
  export * from './core/beacon/factory.js';
28
+ export * from './core/beacon/interfaces.js';
28
29
  export * from './core/beacon/singleton.js';
29
- export * from './core/beacon/smt-aggregate.js';
30
+ export * from './core/beacon/smt-beacon.js';
30
31
  export * from './core/beacon/utils.js';
31
- export * from './core/crud/deactivate.js';
32
- export * from './core/crud/read.js';
33
- export * from './core/crud/update.js';
34
32
  export * from './core/identifier.js';
35
- export * from './interfaces/beacon.js';
36
- export * from './interfaces/crud.js';
33
+ export * from './core/interfaces.js';
34
+ export * from './core/resolve.js';
35
+ export * from './core/types.js';
36
+ export * from './core/update.js';
37
37
  export * from './utils/appendix.js';
38
38
  export * from './utils/did-document-builder.js';
39
39
  export * from './utils/did-document.js';
40
40
  export * from './utils/general.js';
41
- export * from './utils/types.js';
42
41
  export * from './did-btcr2.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,mEAAmE,CAAC;AAClF,cAAc,kEAAkE,CAAC;AACjF,cAAc,mEAAmE,CAAC;AAClF,cAAc,4DAA4D,CAAC;AAC3E,cAAc,gEAAgE,CAAC;AAE/E,cAAc,oEAAoE,CAAC;AACnF,cAAc,yEAAyE,CAAC;AACxF,cAAc,sEAAsE,CAAC;AACrF,cAAc,qEAAqE,CAAC;AACpF,cAAc,2EAA2E,CAAC;AAE1F,cAAc,mDAAmD,CAAC;AAClE,cAAc,wDAAwD,CAAC;AACvE,cAAc,oDAAoD,CAAC;AAEnE,cAAc,2CAA2C,CAAC;AAC1D,cAAc,4CAA4C,CAAC;AAE3D,cAAc,6DAA6D,CAAC;AAC5E,cAAc,0DAA0D,CAAC;AACzE,cAAc,kDAAkD,CAAC;AACjE,cAAc,oDAAoD,CAAC;AACnE,cAAc,oDAAoD,CAAC;AAEnE,cAAc,4CAA4C,CAAC;AAC3D,cAAc,6CAA6C,CAAC;AAE5D,cAAc,0CAA0C,CAAC;AACzD,cAAc,0CAA0C,CAAC;AAEzD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,wBAAwB,CAAC;AACvC,cAAc,0BAA0B,CAAC;AACzC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,wBAAwB,CAAC;AAEvC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AAEtC,cAAc,sBAAsB,CAAC;AAErC,cAAc,wBAAwB,CAAC;AAC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c,qBAAqB,CAAC;AACpC,cAAc,iCAAiC,CAAC;AAChD,cAAc,yBAAyB,CAAC;AACxC,cAAc,oBAAoB,CAAC;AAEnC,cAAc,gBAAgB,CAAC"}
@@ -1,6 +1,6 @@
1
1
  import { HashBytes } from '@did-btcr2/common';
2
2
  import { DidDocument, DidService, DidVerificationMethod } from '@web5/dids';
3
- import { RootCapability } from '../interfaces/crud.js';
3
+ import { RootCapability } from '../core/interfaces.js';
4
4
  /**
5
5
  * Implements {@link https://dcdpr.github.io/did-btcr2/#appendix | 9. Appendix} methods.
6
6
  *
@@ -95,16 +95,11 @@ export declare class Appendix {
95
95
  * }
96
96
  * }
97
97
  */
98
- static derefernceRootCapabilityIdentifier(capabilityId: string): RootCapability;
98
+ static dereferenceZcapId(capabilityId: string): RootCapability;
99
99
  /**
100
- * Implements {@link https://dcdpr.github.io/did-btcr2/#fetch-content-from-addressable-storage | 9.3. Fetch Content from Addressable Storage}.
101
- *
102
- * The Fetch Content from Addressable Storage function takes in SHA256 hash of some content, hashBytes, converts these
103
- * bytes to a IPFS v1 Content Identifier and attempts to retrieve the identified content from Content Addressable
104
- * Storage (CAS). It returns the retrieved content or null.
105
- *
106
- * @param {HashBytes} hashBytes The SHA256 hash of the content to be fetched.
107
- * @returns {string} The fetched content or null if not found.
100
+ * Implements CAS Lookup Step from {@link https://dcdpr.github.io/did-btcr2/operations/resolve.html#process-beacon-signals | 7.2.e Process Beacon Signals }.
101
+ * @param {HashBytes} hashBytes The hash bytes to look up in the CAS system.
102
+ * @returns {Promise<string | undefined>} The content fetched from the CAS system, or undefined if not found.
108
103
  */
109
104
  static fetchFromCas(hashBytes: HashBytes): Promise<string | undefined>;
110
105
  }
@@ -1 +1 @@
1
- {"version":3,"file":"appendix.d.ts","sourceRoot":"","sources":["../../../src/utils/appendix.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAe,MAAM,mBAAmB,CAAC;AAE3D,OAAO,EACL,WAAW,EAGX,UAAU,EACV,qB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AAO,GAAG,GAAG,IAAI,UAAU;IAW3D;;;;;OAKG;WACW,sBAAsB,CAAC,WAAW,EAAE,WAAW,GAAG,qBAAqB,EAAE;IAgBvF;;;;;;;;;;;;;;;;;;;;OAoBG;WACW,oBAAoB,CAAC,UAAU,EAAE,MAAM,GAAG,cAAc;IAwBtE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAuCG;WACW,iBAAiB,CAAC,YAAY,EAAE,MAAM,GAAG,cAAc;IA+CrE;;;;OAIG;WACU,YAAY,CAAC,SAAS,EAAE,SAAS,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;CAW7E"}
@@ -1,4 +1,4 @@
1
- import { BeaconService } from '../interfaces/beacon.js';
1
+ import { BeaconService } from '../core/beacon/interfaces.js';
2
2
  import { DidDocument, DidVerificationMethod } from './did-document.js';
3
3
  export declare class DidDocumentBuilder {
4
4
  private document;
@@ -1 +1 @@
1
- {"version":3,"file":"did-document-builder.d.ts","sourceRoot":"","sources":["../../../src/utils/did-document-builder.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAEvE,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,QAAQ,CAA4B;gBAEhC,eAAe,EAAE,OAAO,CAAC,WAAW,CAAC;IAYjD,cAAc,CAAC,UAAU,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,GAAG,IAAI;IAOhD,kBAAkB,CAAC,cAAc,EAAE,KAAK,CAAC,MAAM,GAAG,qBAAqB,CAAC,GAAG,IAAI;IAO/E,mBAAmB,CAAC,eAAe,EAAE,KAAK,CAAC,MAAM,GAAG,qBAAqB,CAAC,GAAG,IAAI;IAOjF,wBAAwB,CAAC,oBAAoB,EAAE,KAAK,CAAC,MAAM,GAAG,qBAAqB,CAAC,GAAG,IAAI;IAO3F,wBAAwB,CAAC,oBAAoB,EAAE,KAAK,CAAC,MAAM,GAAG,qBAAqB,CAAC,GAAG,IAAI;IAO3F,WAAW,CAAC,OAAO,EAAE,KAAK,CAAC,aAAa,CAAC,GAAG,IAAI;IAOhD,KAAK,IAAI,WAAW;CAWrB"}
1
+ {"version":3,"file":"did-document-builder.d.ts","sourceRoot":"","sources":["../../../src/utils/did-document-builder.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAEvE,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,QAAQ,CAA4B;gBAEhC,eAAe,EAAE,OAAO,CAAC,WAAW,CAAC;IAYjD,cAAc,CAAC,UAAU,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,GAAG,IAAI;IAOhD,kBAAkB,CAAC,cAAc,EAAE,KAAK,CAAC,MAAM,GAAG,qBAAqB,CAAC,GAAG,IAAI;IAO/E,mBAAmB,CAAC,eAAe,EAAE,KAAK,CAAC,MAAM,GAAG,qBAAqB,CAAC,GAAG,IAAI;IAOjF,wBAAwB,CAAC,oBAAoB,EAAE,KAAK,CAAC,MAAM,GAAG,qBAAqB,CAAC,GAAG,IAAI;IAO3F,wBAAwB,CAAC,oBAAoB,EAAE,KAAK,CAAC,MAAM,GAAG,qBAAqB,CAAC,GAAG,IAAI;IAO3F,WAAW,CAAC,OAAO,EAAE,KAAK,CAAC,aAAa,CAAC,GAAG,IAAI;IAOhD,KAAK,IAAI,WAAW;CAWrB"}
@@ -1,6 +1,7 @@
1
1
  import { JSONObject, KeyBytes } from '@did-btcr2/common';
2
2
  import { DidDocument as IIDidDocument, DidVerificationMethod as IIDidVerificationMethod } from '@web5/dids';
3
- import { BeaconService } from '../interfaces/beacon.js';
3
+ import { BeaconService } from '../core/beacon/interfaces.js';
4
+ export declare const ID_PLACEHOLDER_VALUE = "did:btcr2:_";
4
5
  export declare const BECH32M_CHARS = "";
5
6
  export declare const DID_REGEX: RegExp;
6
7
  export type ExternalData = {
@@ -90,12 +91,13 @@ export declare class DidDocument implements IDidDocument {
90
91
  capabilityInvocation?: Array<string | DidVerificationMethod>;
91
92
  capabilityDelegation?: Array<string | DidVerificationMethod>;
92
93
  service: Array<BeaconService>;
94
+ deactivated?: boolean;
93
95
  constructor(document: IDidDocument);
94
96
  /**
95
97
  * Convert the DidDocument to a JSON object.
96
- * @returns {JSONObject} The JSON representation of the DidDocument.
98
+ * @returns {DidDocument} The JSON representation of the DidDocument.
97
99
  */
98
- json(): JSONObject;
100
+ json(): DidDocument;
99
101
  /**
100
102
  * Create a minimal DidDocument from "k1" btcr2 identifier.
101
103
  * @param {string} publicKeyMultibase The public key in multibase format.
@@ -167,60 +169,60 @@ export declare class DidDocument implements IDidDocument {
167
169
  * @returns {DidDocument} Validated DID Document.
168
170
  * @throws {DidDocumentError} If the DID Document is invalid.
169
171
  */
170
- static validate(didDocument: DidDocument | IntermediateDidDocument): DidDocument;
172
+ static validate(didDocument: DidDocument | GenesisDocument): DidDocument;
171
173
  /**
172
- * Validate the IntermediateDidDocument.
173
- * @returns {boolean} True if the IntermediateDidDocument is valid.
174
+ * Validate the GenesisDocument.
175
+ * @returns {boolean} True if the GenesisDocument is valid.
174
176
  */
175
- validateIntermediate(): boolean;
177
+ validateGenesis(): boolean;
176
178
  /**
177
- * Convert the DidDocument to an IntermediateDidDocument.
178
- * @returns {IntermediateDidDocument} The IntermediateDidDocument representation of the DidDocument.
179
+ * Convert the DidDocument to an GenesisDocument.
180
+ * @returns {GenesisDocument} The GenesisDocument representation of the DidDocument.
179
181
  */
180
- toIntermediate(): IntermediateDidDocument;
182
+ toIntermediate(): GenesisDocument;
183
+ }
184
+ export declare class Document {
185
+ static isValid(didDocument: DidDocument | GenesisDocument): boolean;
181
186
  }
182
187
  /**
183
- * IntermediateDidDocument extends the DidDocument class for creating and managing intermediate DID documents.
188
+ * GenesisDocument extends the DidDocument class for creating and managing intermediate DID documents.
184
189
  * This class is used to create a minimal DID document with a placeholder ID.
185
190
  * It is used in the process of creating a new DID document.
186
- * @class IntermediateDidDocument
191
+ * @class GenesisDocument
187
192
  * @extends {DidDocument}
188
193
  */
189
- export declare class IntermediateDidDocument extends DidDocument {
190
- constructor(document: JSONObject);
194
+ export declare class GenesisDocument extends DidDocument {
195
+ constructor(document: object | DidDocument);
191
196
  /**
192
- * Convert the IntermediateDidDocument to a DidDocument by replacing the placeholder value with the provided DID.
197
+ * Convert the GenesisDocument to a DidDocument by replacing the placeholder value with the provided DID.
193
198
  * @param did The DID to replace the placeholder value in the document.
194
199
  * @returns {DidDocument} A new DidDocument with the placeholder value replaced by the provided DID.
195
200
  */
196
201
  toDidDocument(did: string): DidDocument;
197
202
  /**
198
- * Create an IntermediateDidDocument from a DidDocument by replacing the DID with a placeholder value.
203
+ * Create an GenesisDocument from a DidDocument by replacing the DID with a placeholder value.
199
204
  * @param {DidDocument} didDocument The DidDocument to convert.
200
- * @returns {IntermediateDidDocument} The IntermediateDidDocument representation of the DidDocument.
205
+ * @returns {GenesisDocument} The GenesisDocument representation of the DidDocument.
201
206
  */
202
- static fromDidDocument(didDocument: DidDocument): IntermediateDidDocument;
207
+ static fromDidDocument(didDocument: DidDocument): GenesisDocument;
203
208
  /**
204
- * Create a minimal IntermediateDidDocument with a placeholder ID.
209
+ * Create a minimal GenesisDocument with a placeholder ID.
205
210
  * @param {Array<DidVerificationMethod>} verificationMethod The public key in multibase format.
206
211
  * @param {VerificationRelationships} relationships The public key in multibase format.
207
212
  * @param {Array<BeaconService>} service The service to be included in the document.
208
- * @returns {IntermediateDidDocument} A new IntermediateDidDocument with the placeholder ID.
213
+ * @returns {GenesisDocument} A new GenesisDocument with the placeholder ID.
209
214
  */
210
- static create(verificationMethod: Array<DidVerificationMethod>, relationships: VerificationRelationships, service: Array<BeaconService>): IntermediateDidDocument;
215
+ static create(verificationMethod: Array<DidVerificationMethod>, relationships: VerificationRelationships, service: Array<BeaconService>): GenesisDocument;
211
216
  /**
212
- * Create a minimal IntermediateDidDocument from a public key.
217
+ * Create a minimal GenesisDocument from a public key.
213
218
  * @param {KeyBytes} publicKey The public key in bytes format.
214
- * @returns {IntermediateDidDocument} A new IntermediateDidDocument with the placeholder ID.
219
+ * @returns {GenesisDocument} A new GenesisDocument with the placeholder ID.
215
220
  */
216
- static fromPublicKey(publicKey: KeyBytes, network: string): IntermediateDidDocument;
221
+ static fromPublicKey(publicKey: KeyBytes, network: string): GenesisDocument;
217
222
  /**
218
223
  * Taken an object, convert it to an IntermediateDocuemnt and then to a DidDocument.
219
- * @param {JSONObject} object The JSON object to convert.
224
+ * @param {object | DidDocument} object The JSON object to convert.
220
225
  * @returns {DidDocument} The created DidDocument.
221
226
  */
222
- static fromJSON(object: JSONObject): IntermediateDidDocument;
223
- }
224
- export declare class Document {
225
- static isValid(didDocument: DidDocument | IntermediateDidDocument): boolean;
227
+ static fromJSON(object: object | DidDocument): GenesisDocument;
226
228
  }
@@ -1 +1 @@
1
- {"version":3,"file":"did-document.d.ts","sourceRoot":"","sources":["../../../src/utils/did-document.ts"],"names":[],"mappings":"AACA,OAAO,EAML,UAAU,EACV,QAAQ,EACT,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAc,WAAW,IAAI,aAAa,EAAE,qBAAqB,IAAI,uBAAuB,EAAE,MAAM,YAAY,CAAC;AACxH,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAKxD,eAAO,MAAM,aAAa,KAAK,CAAC;AAChC,eAAO,MAAM,SAAS,QAAuD,CAAC;AAE9E,MAAM,MAAM,YAAY,GAAG;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,kBAAkB,EAAE,KAAK,CAAC,qBAAqB,CAAC,CAAC;IACjD,cAAc,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,qBAAqB,CAAC,CAAC;IACvD,eAAe,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,qBAAqB,CAAC,CAAC;IACxD,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AM,CAAC,eAAe;IAI9B;;;;;OAKG;WACW,gCAAgC,CAAC,WAAW,EAAE,WAAW,GAAG,OAAO;IA6BjF;;;;OAIG;WACW,QAAQ,CAAC,WAAW,EAAE,WAAW,GAAG,eAAe,GAAG,WAAW;IAW/E;;;OAGG;IACI,eAAe,IAAI,OAAO;IAyBjC;;;OAGG;IACI,cAAc,IAAI,eAAe;CAMzC;AAED,qBAAa,QAAQ;WACL,OAAO,CAAC,WAAW,EAAE,WAAW,GAAG,eAAe,GAAG,OAAO;CAG3E;AAGD;;;;;;GAMG;AACH,qBAAa,eAAgB,SAAQ,WAAW;gBAClC,QAAQ,EAAE,MAAM,GAAG,WAAW;IAI1C;;;;OAIG;IACI,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,WAAW;IAO9C;;;;OAIG;WACW,eAAe,CAAC,WAAW,EAAE,WAAW,GAAG,eAAe;IAKxE;;;;;;OAMG;WACW,MAAM,CAClB,kBAAkB,EAAE,KAAK,CAAC,qBAAqB,CAAC,EAChD,aAAa,EAAE,yBAAyB,EACxC,OAAO,EAAE,KAAK,CAAC,aAAa,CAAC,GAC5B,eAAe;IAKlB;;;;OAIG;WACW,aAAa,CAAC,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,GAAG,eAAe;IA4BlF;;;;OAIG;WACW,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,WAAW,GAAG,eAAe;CAGtE"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@did-btcr2/method",
3
- "version": "0.18.1",
3
+ "version": "0.19.0",
4
4
  "type": "module",
5
5
  "description": "Javascript/TypeScript reference implementation of did:btcr2 method, a censorship resistant DID Method using the Bitcoin blockchain as a Verifiable Data Registry to announce changes to the DID document. Core package of the did-btcr2-js monorepo.",
6
6
  "main": "./dist/cjs/index.js",
@@ -83,11 +83,11 @@
83
83
  "multiformats": "^13.3.1",
84
84
  "nostr-tools": "^2.15.0",
85
85
  "tiny-secp256k1": "^2.2.3",
86
- "@did-btcr2/bitcoin": "0.3.2",
87
- "@did-btcr2/common": "2.2.2",
88
- "@did-btcr2/keypair": "0.7.2",
89
- "@did-btcr2/cryptosuite": "3.2.1",
90
- "@did-btcr2/kms": "0.1.1"
86
+ "@did-btcr2/bitcoin": "0.3.4",
87
+ "@did-btcr2/cryptosuite": "4.0.0",
88
+ "@did-btcr2/common": "3.1.0",
89
+ "@did-btcr2/kms": "0.1.1",
90
+ "@did-btcr2/keypair": "0.8.0"
91
91
  },
92
92
  "devDependencies": {
93
93
  "@eslint/js": "^9.22.0",
@@ -90,7 +90,7 @@ export class AggregateBeaconCohort implements BeaconCohort {
90
90
  public beaconAddress: string = '';
91
91
 
92
92
  /**
93
- * Type of beacon used in the cohort (default is 'SMTAggregateBeacon').
93
+ * Type of beacon used in the cohort (default is 'SMTBeacon').
94
94
  * @type {string}
95
95
  */
96
96
  public beaconType: string;
@@ -110,7 +110,7 @@ export class AggregateBeaconCohort implements BeaconCohort {
110
110
  this.coordinatorDid = coordinatorDid || '';
111
111
  this.status = status as COHORT_STATUS_TYPE || COHORT_STATUS.COHORT_ADVERTISED;
112
112
  this.network = network;
113
- this.beaconType = beaconType || 'SMTAggregateBeacon';
113
+ this.beaconType = beaconType || 'SMTBeacon';
114
114
  }
115
115
 
116
116
  set cohortKeys(keys: Array<Uint8Array>) {
@@ -287,6 +287,6 @@ export class AggregateBeaconCohort implements BeaconCohort {
287
287
  * @returns {BeaconCohort} The JSON object representation of the cohort.
288
288
  */
289
289
  public json(): BeaconCohort {
290
- return Object.json(this) as BeaconCohort;
290
+ return Object.fromEntries(Object.entries(this)) as BeaconCohort;
291
291
  }
292
292
  }
@@ -1,5 +1,3 @@
1
- import { Maybe } from '@did-btcr2/common';
2
-
3
1
  export const MESSAGE_PREFIX = 'https://btcr2.tools/';
4
2
 
5
3
  export type BaseBody = {
@@ -38,20 +36,11 @@ export class BaseMessage {
38
36
  this.body = body;
39
37
  }
40
38
 
41
- /**
42
- * Creates a BaseMessage from a JSON object.
43
- * @param {Maybe<Base>} data The JSON object to initialize the BaseMessage.
44
- * @returns {BaseMessage} The initialized BaseMessage.
45
- */
46
- public static fromJSON(data: Maybe<Base>): BaseMessage {
47
- return new BaseMessage(data);
48
- }
49
-
50
39
  /**
51
40
  * Converts a BaseMessage to a JSON object.
52
41
  * @returns {Base} The JSON representation of the BaseMessage.
53
42
  */
54
43
  public json(): Base {
55
- return Object.json(this) as Base;
44
+ return Object.fromEntries(Object.entries(this)) as Base;
56
45
  }
57
46
  }
@@ -1,4 +1,4 @@
1
- import { Maybe } from '@did-btcr2/common';
1
+ import { JSONUtils, Maybe } from '@did-btcr2/common';
2
2
  import { BaseMessage } from '../base.js';
3
3
  import { BEACON_COHORT_ADVERT } from '../constants.js';
4
4
 
@@ -34,7 +34,7 @@ export class BeaconCohortAdvertMessage extends BaseMessage {
34
34
  * @returns {BeaconCohortAdvertMessage} The new BeaconCohortAdvertMessage.
35
35
  */
36
36
  public static fromJSON(data: Maybe<CohortAdvertMessage>): BeaconCohortAdvertMessage {
37
- const message = JSON.parse(data);
37
+ const message = JSONUtils.isParsable(data) ? JSON.parse(data) : data;
38
38
  if (message.type !== BEACON_COHORT_ADVERT){
39
39
  throw new Error(`Invalid type: ${message.type}`);
40
40
  }
@@ -1,4 +1,4 @@
1
- import { Maybe } from '@did-btcr2/common';
1
+ import { JSONUtils, Maybe } from '@did-btcr2/common';
2
2
  import { BaseMessage } from '../base.js';
3
3
  import { BEACON_COHORT_READY } from '../constants.js';
4
4
 
@@ -30,7 +30,7 @@ export class BeaconCohortReadyMessage extends BaseMessage {
30
30
  * @returns {BeaconCohortReadyMessage} The new BeaconCohortReadyMessage.
31
31
  */
32
32
  public static fromJSON(data: Maybe<CohortReadyMessage>): BeaconCohortReadyMessage {
33
- const message = JSON.parse(data);
33
+ const message = JSONUtils.isParsable(data) ? JSON.parse(data) : data;
34
34
  if (message.type !== BEACON_COHORT_READY) {
35
35
  throw new Error(`Invalid type: ${message.type}`);
36
36
  }
@@ -1,4 +1,4 @@
1
- import { Maybe } from '@did-btcr2/common';
1
+ import { JSONUtils, Maybe } from '@did-btcr2/common';
2
2
  import { BaseMessage } from '../base.js';
3
3
  import { BEACON_COHORT_OPT_IN_ACCEPT } from '../constants.js';
4
4
 
@@ -25,7 +25,7 @@ export class BeaconCohortOptInAcceptMessage extends BaseMessage {
25
25
  * @returns {BeaconCohortOptInAcceptMessage} The new BeaconCohortOptInAcceptMessage.
26
26
  */
27
27
  public static fromJSON(data: Maybe<CohortOptInAcceptMessage>): BeaconCohortOptInAcceptMessage {
28
- const message = JSON.parse(data);
28
+ const message = JSONUtils.isParsable(data) ? JSON.parse(data) : data;
29
29
  if (message.type != BEACON_COHORT_OPT_IN_ACCEPT) {
30
30
  throw new Error(`Invalid type: ${message.type}`);
31
31
  }
@@ -1,4 +1,4 @@
1
- import { Maybe } from '@did-btcr2/common';
1
+ import { JSONUtils, Maybe } from '@did-btcr2/common';
2
2
  import { BaseMessage } from '../base.js';
3
3
  import { BEACON_COHORT_OPT_IN } from '../constants.js';
4
4
 
@@ -24,7 +24,7 @@ export class BeaconCohortOptInMessage extends BaseMessage {
24
24
  * @returns {BeaconCohortOptInMessage} The new BeaconCohortOptInMessage.
25
25
  */
26
26
  public static fromJSON(data: Maybe<CohortOptInMessage>): BeaconCohortOptInMessage {
27
- const message = JSON.parse(data);
27
+ const message = JSONUtils.isParsable(data) ? JSON.parse(data) : data;
28
28
  if (message.type != BEACON_COHORT_OPT_IN) {
29
29
  throw new Error(`Invalid type: ${message.type}`);
30
30
  }
@@ -1,4 +1,4 @@
1
- import { Maybe } from '@did-btcr2/common';
1
+ import { JSONUtils, Maybe } from '@did-btcr2/common';
2
2
  import { BaseMessage } from '../base.js';
3
3
  import { BEACON_COHORT_OPT_IN_ACCEPT } from '../constants.js';
4
4
 
@@ -26,7 +26,7 @@ export class BeaconCohortSubscribeMessage extends BaseMessage {
26
26
  * @returns {BeaconCohortSubscribeMessage} The serialized SubscribeMessage.
27
27
  */
28
28
  public static fromJSON(data: Maybe<CohortSubscribeMessage>): BeaconCohortSubscribeMessage {
29
- const message = JSON.parse(data);
29
+ const message = JSONUtils.isParsable(data) ? JSON.parse(data) : data;
30
30
  if (message.type != BEACON_COHORT_OPT_IN_ACCEPT) {
31
31
  throw new Error(`Invalid type: ${message.type}`);
32
32
  }
@@ -1,4 +1,4 @@
1
- import { Maybe } from '@did-btcr2/common';
1
+ import { JSONUtils, Maybe } from '@did-btcr2/common';
2
2
  import { BaseMessage } from '../base.js';
3
3
  import { BEACON_COHORT_AGGREGATED_NONCE } from '../constants.js';
4
4
 
@@ -29,7 +29,7 @@ export class BeaconCohortAggregatedNonceMessage extends BaseMessage {
29
29
  * @returns {BeaconCohortAggregatedNonceMessage} The new BeaconCohortAggregatedNonceMessage.
30
30
  */
31
31
  public static fromJSON(data: Maybe<CohortAggregatedNonceMessage>): BeaconCohortAggregatedNonceMessage {
32
- const message = JSON.parse(data);
32
+ const message = JSONUtils.isParsable(data) ? JSON.parse(data) : data;
33
33
  if (message.type != BEACON_COHORT_AGGREGATED_NONCE) {
34
34
  throw new Error(`Invalid type: ${message.type}`);
35
35
  }
@@ -1,4 +1,4 @@
1
- import { Maybe } from '@did-btcr2/common';
1
+ import { JSONUtils, Maybe } from '@did-btcr2/common';
2
2
  import { BaseMessage } from '../base.js';
3
3
  import { BEACON_COHORT_AUTHORIZATION_REQUEST } from '../constants.js';
4
4
 
@@ -30,7 +30,7 @@ export class BeaconCohortAuthorizationRequestMessage extends BaseMessage {
30
30
  * @returns {BeaconCohortAuthorizationRequestMessage} The serialized BeaconCohortAuthorizationRequestMessage.
31
31
  */
32
32
  public static fromJSON(data: Maybe<CohortAuthorizationRequestMessage>): BeaconCohortAuthorizationRequestMessage {
33
- const message = JSON.parse(data);
33
+ const message = JSONUtils.isParsable(data) ? JSON.parse(data) : data;
34
34
  if (message.type != BEACON_COHORT_AUTHORIZATION_REQUEST) {
35
35
  throw new Error(`Invalid type: ${message.type}`);
36
36
  }
@@ -1,4 +1,4 @@
1
- import { Maybe } from '@did-btcr2/common';
1
+ import { JSONUtils, Maybe } from '@did-btcr2/common';
2
2
  import { BaseMessage } from '../base.js';
3
3
  import { BEACON_COHORT_NONCE_CONTRIBUTION } from '../constants.js';
4
4
 
@@ -30,7 +30,7 @@ export class BeaconCohortNonceContributionMessage extends BaseMessage {
30
30
  * @returns {BeaconCohortNonceContributionMessage} The new BeaconCohortNonceContributionMessage.
31
31
  */
32
32
  public static fromJSON(data: Maybe<CohortNonceContributionMessage>): BeaconCohortNonceContributionMessage {
33
- const message = JSON.parse(data);
33
+ const message = JSONUtils.isParsable(data) ? JSON.parse(data) : data;
34
34
  if (message.type != BEACON_COHORT_NONCE_CONTRIBUTION) {
35
35
  throw new Error(`Invalid type: ${message.type}`);
36
36
  }
@@ -1,4 +1,4 @@
1
- import { Maybe } from '@did-btcr2/common';
1
+ import { JSONUtils, Maybe } from '@did-btcr2/common';
2
2
  import { BaseMessage } from '../base.js';
3
3
  import { BEACON_COHORT_REQUEST_SIGNATURE } from '../constants.js';
4
4
 
@@ -30,7 +30,7 @@ export class BeaconCohortRequestSignatureMessage extends BaseMessage {
30
30
  * @returns {BeaconCohortRequestSignatureMessage} The new BeaconCohortRequestSignatureMessage.
31
31
  */
32
32
  public static fromJSON(data: Maybe<CohortRequestSignatureMessage>): BeaconCohortRequestSignatureMessage {
33
- const message = JSON.parse(data);
33
+ const message = JSONUtils.isParsable(data) ? JSON.parse(data) : data;
34
34
  if (message.type != BEACON_COHORT_REQUEST_SIGNATURE) {
35
35
  throw new Error(`Invalid type: ${message.type}`);
36
36
  }
@@ -1,4 +1,4 @@
1
- import { Maybe } from '@did-btcr2/common';
1
+ import { JSONUtils, Maybe } from '@did-btcr2/common';
2
2
  import { BaseMessage } from '../base.js';
3
3
  import { BEACON_COHORT_SIGNATURE_AUTHORIZATION } from '../constants.js';
4
4
 
@@ -31,7 +31,7 @@ export class BeaconCohortSignatureAuthorizationMessage extends BaseMessage {
31
31
  * @returns {BeaconCohortSignatureAuthorizationMessage} The serialized BeaconCohortSignatureAuthorizationMessage.
32
32
  */
33
33
  public static fromJSON(data: Maybe<CohortSignatureAuthorizationMessage>): BeaconCohortSignatureAuthorizationMessage {
34
- const message = JSON.parse(data);
34
+ const message = JSONUtils.isParsable(data) ? JSON.parse(data) : data;
35
35
  if (message.type != BEACON_COHORT_SIGNATURE_AUTHORIZATION) {
36
36
  throw new Error(`Invalid type: ${message.type}`);
37
37
  }