@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
@@ -2,7 +2,15 @@ import { RawSchnorrKeyPair } from '@did-btcr2/keypair';
2
2
  import { AggregateBeaconCohort } from './cohort/index.js';
3
3
  import { CommunicationService, Service, ServiceAdapterIdentity } from './communication/service.js';
4
4
  import { BeaconCohortSigningSession } from './session/index.js';
5
- type BeaconCoordinatorParams = {
5
+ /**
6
+ * Parameters for initializing a BeaconCoordinator.
7
+ * @type {BeaconCoordinatorParams}
8
+ * @property {CommunicationService} [protocol] - The communication protocol to be used.
9
+ * @property {string} did - The Decentralized Identifier (DID) for the coordinator.
10
+ * @property {ServiceAdapterIdentity<RawSchnorrKeyPair>} keys - The keys used for cryptographic operations.
11
+ * @property {string} [name] - Optional name for the coordinator.
12
+ */
13
+ export type BeaconCoordinatorParams = {
6
14
  protocol?: CommunicationService;
7
15
  did: string;
8
16
  keys: ServiceAdapterIdentity<RawSchnorrKeyPair>;
@@ -14,6 +22,7 @@ type BeaconCoordinatorParams = {
14
22
  * @type {BeaconCoordinator}
15
23
  */
16
24
  export declare class BeaconCoordinator {
25
+ #private;
17
26
  /**
18
27
  * The name of the BeaconCoordinator service.
19
28
  * @type {string}
@@ -47,37 +56,17 @@ export declare class BeaconCoordinator {
47
56
  * @param {string} [params.did] Optional DID to use for the coordinator. If not provided, a new DID will be generated.
48
57
  * @param {ServiceAdapterIdentity<RawKeyPair>} params.keys The keys used for cryptographic operations.
49
58
  */
50
- constructor(params: BeaconCoordinatorParams);
59
+ constructor(params: {
60
+ did: string;
61
+ keys: ServiceAdapterIdentity<RawSchnorrKeyPair>;
62
+ protocol?: CommunicationService;
63
+ name?: string;
64
+ });
51
65
  /**
52
66
  * Setup and start the BeaconCoordinator communication protocol.
53
67
  * @returns {void}
54
68
  */
55
69
  start(): void;
56
- /**
57
- * Handles opt-in requests from participants to join a cohort.
58
- * @param {OptInMessage} message The message containing the opt-in request.
59
- * @returns {Promise<void>}
60
- */
61
- private _handleOptIn;
62
- /**
63
- * Handles request signature messages from participants.
64
- * @private
65
- * @param {CohortRequestSignatureMessage} message The message containing the request signature.
66
- * @returns {Promise<void>}
67
- */
68
- private _handleRequestSignature;
69
- /**
70
- * Handles nonce contribution messages from participants.
71
- * @param {CohortNonceContributionMessage} message The message containing the nonce contribution.
72
- * @returns {Promise<void>}
73
- */
74
- private _handleNonceContribution;
75
- /**
76
- * Handles signature authorization messages from participants.
77
- * @param {Maybe<CohortSignatureAuthorizationMessage>} message The message containing the signature authorization request.
78
- * @returns {Promise<void>}
79
- */
80
- private _handleSignatureAuthorization;
81
70
  /**
82
71
  * Starts the key generation process for a cohort once it has enough participants.
83
72
  * @param {Musig2Cohort} cohort The cohort for which to start key generation.
@@ -100,7 +89,7 @@ export declare class BeaconCoordinator {
100
89
  * Announces a new cohort to all subscribers.
101
90
  * @param {number} minParticipants The minimum number of participants required for the cohort.
102
91
  * @param {string} [network='mutinynet'] The network on which the cohort operates (default is 'signet').
103
- * @param {string} [beaconType='SMTAggregateBeacon'] The type of beacon to be used (default is 'SMTAggregateBeacon').
92
+ * @param {string} [beaconType='SMTBeacon'] The type of beacon to be used (default is 'SMTBeacon').
104
93
  * @returns {Promise<AggregateBeaconCohort>} The newly created cohort.
105
94
  */
106
95
  advertiseCohort(minParticipants: number, network?: string, beaconType?: string): Promise<AggregateBeaconCohort>;
@@ -124,4 +113,3 @@ export declare class BeaconCoordinator {
124
113
  */
125
114
  static initialize(service: Service): BeaconCoordinator;
126
115
  }
127
- export {};
@@ -1 +1 @@
1
- {"version":3,"file":"coordinator.d.ts","sourceRoot":"","sources":["../../../../../src/core/beacon/aggregation/coordinator.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAEvD,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAkB1D,OAAO,EAAE,oBAAoB,EAAE,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AACnG,OAAO,EAAE,0BAA0B,EAAE,MAAM,oBAAoB,CAAC;AAGhE,KAAK,uBAAuB,GAAG;IAC7B,QAAQ,CAAC,EAAE,oBAAoB,CAAC;IAChC,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,sBAAsB,CAAC,iBAAiB,CAAC,CAAA;IAC/C,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAA;AACD;;;;GAIG;AAEH,qBAAa,iBAAiB;IAC5B;;;OAGG;IACI,IAAI,EAAE,MAAM,CAAC;IAEpB;;;OAGG;IACI,GAAG,EAAE,MAAM,CAAC;IAEnB;;;OAGG;IACI,QAAQ,EAAE,oBAAoB,CAAC;IAEtC;;;OAGG;IACI,OAAO,EAAE,KAAK,CAAC,qBAAqB,CAAC,CAAM;IAElD;;;OAGG;IACI,qBAAqB,EAAE,GAAG,CAAC,MAAM,EAAE,0BAA0B,CAAC,CAAa;IAElF;;;;;;;OAOG;gBACS,MAAM,EAAE,uBAAuB;IAO3C;;;OAGG;IACI,KAAK,IAAI,IAAI;IASpB;;;;OAIG;YACW,YAAY;IAqB1B;;;;;OAKG;YACW,uBAAuB;IAgBrC;;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C;IAY7G;;;;;;;OAOG;WACW,UAAU,CAAC,GAAG,EAAE,IAAI,GAAG,QAAQ,EAAE,QAAQ,EAAE,oBAAoB,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,iBAAiB;CAG9H"}
@@ -0,0 +1,44 @@
1
+ import { KeyBytes } from '@did-btcr2/common';
2
+ import { BitcoinNetworkConnection } from '../../../../bitcoin/dist/types/bitcoin.js';
3
+ import { SignedBTCR2Update } from '../../../../cryptosuite/dist/types/data-integrity-proof/interface.js';
4
+ import { SidecarData } from '../types.js';
5
+ import { BeaconService, BeaconSignal, BlockMetadata } from './interfaces.js';
6
+ /**
7
+ * Abstract base class for all BTCR2 Beacon types.
8
+ * A Beacon is a service listed in a BTCR2 DID document that informs resolvers
9
+ * how to find authentic updates to the DID.
10
+ *
11
+ * Beacons are lightweight typed wrappers around a {@link BeaconService} configuration.
12
+ * Dependencies (signals, sidecar data, bitcoin connection) are passed as method
13
+ * parameters rather than held as instance state.
14
+ *
15
+ * Use {@link BeaconFactory.establish} to create typed instances from service config.
16
+ *
17
+ * @abstract
18
+ * @class Beacon
19
+ * @type {Beacon}
20
+ */
21
+ export declare abstract class Beacon {
22
+ /**
23
+ * The Beacon service configuration parsed from the DID Document.
24
+ */
25
+ readonly service: BeaconService;
26
+ constructor(service: BeaconService);
27
+ /**
28
+ * Processes an array of Beacon Signals to extract BTCR2 Signed Updates.
29
+ * Used during the resolve path.
30
+ * @param {Array<BeaconSignal>} signals The beacon signals discovered on-chain.
31
+ * @param {SidecarData} sidecar The processed sidecar data containing update/CAS/SMT maps.
32
+ * @returns {Promise<Array<[SignedBTCR2Update, BlockMetadata]>>} The updates announced by the signals.
33
+ */
34
+ abstract processSignals(signals: Array<BeaconSignal>, sidecar: SidecarData): Promise<Array<[SignedBTCR2Update, BlockMetadata]>>;
35
+ /**
36
+ * Broadcasts a signed update as a Beacon Signal to the Bitcoin network.
37
+ * Used during the update path.
38
+ * @param {SignedBTCR2Update} signedUpdate The signed BTCR2 update to broadcast.
39
+ * @param {KeyBytes} secretKey The secret key for signing the Bitcoin transaction.
40
+ * @param {BitcoinNetworkConnection} bitcoin The Bitcoin network connection.
41
+ * @returns {Promise<SignedBTCR2Update>} The signed update that was broadcast.
42
+ */
43
+ abstract broadcastSignal(signedUpdate: SignedBTCR2Update, secretKey: KeyBytes, bitcoin: BitcoinNetworkConnection): Promise<SignedBTCR2Update>;
44
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"beacon.d.ts","sourceRoot":"","sources":["../../../../src/core/beacon/beacon.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,wBAAwB,EAAE,MAAM,2CAA2C,CAAC;AACrF,OAAO,EAAE,iBAAiB,EAAE,MAAM,sEAAsE,CAAC;AACzG,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAE7E;;;;;;;;;;;;;;GAcG;AACH,8BAAsB,MAAM;IAC1B;;OAEG;IACH,QAAQ,CAAC,OAAO,EAAE,aAAa,CAAC;gBAEpB,OAAO,EAAE,aAAa;IAIlC;;;;;;OAMG;IACH,QAAQ,CAAC,cAAc,CACrB,OAAO,EAAE,KAAK,CAAC,YAAY,CAAC,EAC5B,OAAO,EAAE,WAAW,GACnB,OAAO,CAAC,KAAK,CAAC,CAAC,iBAAiB,EAAE,aAAa,CAAC,CAAC,CAAC;IAGrD;;;;;;;OAOG;IACH,QAAQ,CAAC,eAAe,CACtB,YAAY,EAAE,iBAAiB,EAC/B,SAAS,EAAE,QAAQ,EACnB,OAAO,EAAE,wBAAwB,GAChC,OAAO,CAAC,iBAAiB,CAAC;CAC9B"}
@@ -0,0 +1,36 @@
1
+ import { BitcoinNetworkConnection } from '@did-btcr2/bitcoin';
2
+ import { KeyBytes } from '@did-btcr2/common';
3
+ import { SignedBTCR2Update } from '@did-btcr2/cryptosuite';
4
+ import { SidecarData } from '../types.js';
5
+ import { Beacon } from './beacon.js';
6
+ import { BeaconService, BeaconSignal, BlockMetadata } from './interfaces.js';
7
+ /**
8
+ * Implements {@link https://dcdpr.github.io/did-btcr2/terminology.html#cas-beacon | CAS Beacon}.
9
+ * @class CASBeacon
10
+ * @type {CASBeacon}
11
+ * @extends {Beacon}
12
+ */
13
+ export declare class CASBeacon extends Beacon {
14
+ /**
15
+ * Creates an instance of CASBeacon.
16
+ * @param {BeaconService} service The service of the Beacon.
17
+ */
18
+ constructor(service: BeaconService);
19
+ /**
20
+ * Implements {@link https://dcdpr.github.io/did-btcr2/operations/resolve.html#process-cas-beacon | 7.2.e.1 Process CAS Beacon}.
21
+ * @param {Array<BeaconSignal>} signals The array of Beacon Signals to process.
22
+ * @param {SidecarData} sidecar The sidecar data associated with the CAS Beacon.
23
+ * @returns {Promise<Array<[SignedBTCR2Update, BlockMetadata]>>} The processed signals.
24
+ * @throws {CASBeaconError} if processing fails.
25
+ */
26
+ processSignals(signals: Array<BeaconSignal>, sidecar: SidecarData): Promise<Array<[SignedBTCR2Update, BlockMetadata]>>;
27
+ /**
28
+ * Broadcast CAS Beacon signal to the Bitcoin network.
29
+ * @param {SignedBTCR2Update} signedUpdate The signed BTCR2 update to broadcast.
30
+ * @param {KeyBytes} secretKey The secret key for signing the Bitcoin transaction.
31
+ * @param {BitcoinNetworkConnection} bitcoin The Bitcoin network connection.
32
+ * @return {Promise<SignedBTCR2Update>} The signed update that was broadcasted.
33
+ * @throws {CASBeaconError} if broadcasting fails.
34
+ */
35
+ broadcastSignal(signedUpdate: SignedBTCR2Update, secretKey: KeyBytes, bitcoin: BitcoinNetworkConnection): Promise<SignedBTCR2Update>;
36
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cas-beacon.d.ts","sourceRoot":"","sources":["../../../../src/core/beacon/cas-beacon.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAE7E;;;;;GAKG;AACH,qBAAa,SAAU,SAAQ,MAAM;IACnC;;;OAGG;gBACS,OAAO,EAAE,aAAa;IAIlC;;;;;;OAMG;IACH,cAAc,CACZ,OAAO,EAAE,KAAK,CAAC,YAAY,CAAC,EAC5B,OAAO,EAAE,WAAW,GACnB,OAAO,CAAC,KAAK,CAAC,CAAC,iBAAiB,EAAE,aAAa,CAAC,CAAC,CAAC;IAIrD;;;;;;;OAOG;IACG,eAAe,CACnB,YAAY,EAAE,iBAAiB,EAC/B,SAAS,EAAE,QAAQ,EACnB,OAAO,EAAE,wBAAwB,GAChC,OAAO,CAAC,iBAAiB,CAAC;CAG9B"}
@@ -14,9 +14,9 @@ export declare class SingletonBeaconError extends MethodError {
14
14
  export declare class AggregateBeaconError extends MethodError {
15
15
  constructor(message: string, type?: string, data?: Record<string, any>);
16
16
  }
17
- export declare class CIDAggregateBeaconError extends MethodError {
17
+ export declare class CASBeaconError extends MethodError {
18
18
  constructor(message: string, type?: string, data?: Record<string, any>);
19
19
  }
20
- export declare class SMTAggregateBeaconError extends MethodError {
20
+ export declare class SMTBeaconError extends MethodError {
21
21
  constructor(message: string, type?: string, data?: Record<string, any>);
22
22
  }
@@ -1 +1 @@
1
- {"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../../../src/core/beacon/error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,qBAAa,WAAY,SAAQ,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,IAAI,GAAE,MAAsB,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;CAGtF;AAED,qBAAa,sBAAuB,SAAQ,WAAW;gBACzC,OAAO,EAAE,MAAM,EAAE,IAAI,GAAE,MAAiC,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;CAGjG;AAED,qBAAa,sBAAuB,SAAQ,WAAW;gBACzC,OAAO,EAAE,MAAM,EAAE,IAAI,GAAE,MAAiC,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;CAGjG;AAED,qBAAa,oBAAqB,SAAQ,WAAW;gBACvC,OAAO,EAAE,MAAM,EAAE,IAAI,GAAE,MAA+B,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;CAG/F;AAED,qBAAa,oBAAqB,SAAQ,WAAW;gBACvC,OAAO,EAAE,MAAM,EAAE,IAAI,GAAE,MAA+B,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;CAG/F;AAED,qBAAa,cAAe,SAAQ,WAAW;gBACjC,OAAO,EAAE,MAAM,EAAE,IAAI,GAAE,MAAyB,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;CAGzF;AAED,qBAAa,cAAe,SAAQ,WAAW;gBACjC,OAAO,EAAE,MAAM,EAAE,IAAI,GAAE,MAAyB,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;CAGzF"}
@@ -1,5 +1,5 @@
1
- import { Beacon, BeaconService } from '../../interfaces/beacon.js';
2
- import { SidecarData } from '../../utils/types.js';
1
+ import { Beacon } from './beacon.js';
2
+ import { BeaconService } from './interfaces.js';
3
3
  /**
4
4
  * Beacon Factory pattern to create Beacon instances.
5
5
  * @class BeaconFactory
@@ -8,9 +8,8 @@ import { SidecarData } from '../../utils/types.js';
8
8
  export declare class BeaconFactory {
9
9
  /**
10
10
  * Establish a Beacon instance based on the provided service and optional sidecar data.
11
- * @param {BeaconService} service - The beacon service configuration.
12
- * @param {SidecarData} [sidecar] - The optional sidecar data.
11
+ * @param {BeaconService} service The beacon service configuration.
13
12
  * @returns {Beacon} The established Beacon instance.
14
13
  */
15
- static establish(service: BeaconService, sidecar?: SidecarData): Beacon;
14
+ static establish(service: BeaconService): Beacon;
16
15
  }
@@ -1 +1 @@
1
- {"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../../src/core/beacon/factory.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAuB,WAAW,EAAuB,MAAM,sBAAsB,CAAC;AAK7F;;;;GAIG;AACH,qBAAa,aAAa;IACxB;;;;;OAKG;IACH,MAAM,CAAC,SAAS,CAAC,OAAO,EAAE,aAAa,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,MAAM;CAexE"}
1
+ {"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../../src/core/beacon/factory.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAIhD;;;;GAIG;AACH,qBAAa,aAAa;IACxB;;;;OAIG;IACH,MAAM,CAAC,SAAS,CAAC,OAAO,EAAE,aAAa,GAAG,MAAM;CAYjD"}
@@ -0,0 +1,59 @@
1
+ import { RawTransactionRest, RawTransactionV2 } from '@did-btcr2/bitcoin';
2
+ import { UnixTimestamp } from '@did-btcr2/common';
3
+ import { DidServiceEndpoint, DidService } from '@web5/dids';
4
+ /**
5
+ * Represents a Beacon Service, which extends a W3C DID Service by setting serviceEndpoint
6
+ * as a single DidServiceEndpoint.
7
+ * @interface BeaconService
8
+ * @extends DidService
9
+ */
10
+ export interface BeaconService extends DidService {
11
+ serviceEndpoint: DidServiceEndpoint;
12
+ }
13
+ /**
14
+ * Represents a parsed Beacon Service, which extends the Beacon Service with a Bitcoin address.
15
+ * @interface ParsedBeaconService
16
+ * @extends BeaconService
17
+ */
18
+ export interface ParsedBeaconService extends BeaconService {
19
+ /**
20
+ * The Bitcoin address associated with this Beacon Service.
21
+ */
22
+ address: string;
23
+ }
24
+ /**
25
+ * Metadata about a Bitcoin block containing a Beacon Signal.
26
+ * @interface BlockMetadata
27
+ */
28
+ export interface BlockMetadata {
29
+ /**
30
+ * The block height at which the Beacon Signal was included.
31
+ */
32
+ height: number;
33
+ /**
34
+ * The timestamp of the block containing the Beacon Signal.
35
+ */
36
+ time: UnixTimestamp;
37
+ /**
38
+ * The number of confirmations for the block containing the Beacon Signal.
39
+ */
40
+ confirmations: number;
41
+ }
42
+ /**
43
+ * Represents a Beacon Signal, which is a transaction broadcasted by a Beacon to announce a DID update.
44
+ * @interface BeaconSignal
45
+ */
46
+ export interface BeaconSignal {
47
+ /**
48
+ * The raw Bitcoin transaction representing the Beacon Signal.
49
+ */
50
+ tx: RawTransactionRest | RawTransactionV2;
51
+ /**
52
+ * The beacon signal bytes hash (i.e. the hash of the BTCR2 update included in the Beacon Signal tx).
53
+ */
54
+ signalBytes: string;
55
+ /**
56
+ * Metadata about the block containing the Beacon Signal.
57
+ */
58
+ blockMetadata: BlockMetadata;
59
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../../src/core/beacon/interfaces.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC1E,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE5D;;;;;GAKG;AACH,MAAM,WAAW,aAAc,SAAQ,UAAU;IAC7C,eAAe,EAAE,kBAAkB,CAAC;CACvC;AAED;;;;GAIG;AACH,MAAM,WAAW,mBAAoB,SAAQ,aAAa;IACtD;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;CACnB;AAED;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC3B;;MAEE;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,IAAI,EAAE,aAAa,CAAC;IAEpB;;OAEG;IACH,aAAa,EAAE,MAAM,CAAC;CACvB;AAED;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC3B;;OAEG;IACH,EAAE,EAAE,kBAAkB,GAAG,gBAAgB,CAAC;IAE1C;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IAEpB;;OAEG;IACH,aAAa,EAAE,aAAa,CAAC;CAC9B"}
@@ -0,0 +1,25 @@
1
+ import { BitcoinNetworkConnection } from '@did-btcr2/bitcoin';
2
+ import { BeaconService, BeaconSignal } from './interfaces.js';
3
+ /**
4
+ * Static utility class for discovering Beacon Signals on the Bitcoin blockchain.
5
+ * Extracted from {@link Resolve} for single-responsibility and independent testability.
6
+ *
7
+ * @class BeaconSignalDiscovery
8
+ */
9
+ export declare class BeaconSignalDiscovery {
10
+ /**
11
+ * Retrieves the beacon signals for the given array of BeaconService objects
12
+ * using an esplora/electrs REST API connection via a bitcoin I/O driver.
13
+ * @param {Array<BeaconService>} beaconServices Array of BeaconService objects to retrieve signals for
14
+ * @param {BitcoinNetworkConnection} bitcoin Bitcoin network connection to use for REST calls
15
+ * @returns {Promise<Map<BeaconService, Array<BeaconSignal>>>} Map of beacon service to its discovered signals
16
+ */
17
+ static indexer(beaconServices: Array<BeaconService>, bitcoin: BitcoinNetworkConnection): Promise<Map<BeaconService, Array<BeaconSignal>>>;
18
+ /**
19
+ * Traverse the full blockchain from genesis to chain top looking for beacon signals.
20
+ * @param {Array<BeaconService>} beaconServices Array of BeaconService objects to search for signals.
21
+ * @param {BitcoinNetworkConnection} bitcoin Bitcoin network connection to use for RPC calls.
22
+ * @returns {Promise<Map<BeaconService, Array<BeaconSignal>>>} Map of beacon service to its discovered signals.
23
+ */
24
+ static fullnode(beaconServices: Array<BeaconService>, bitcoin: BitcoinNetworkConnection): Promise<Map<BeaconService, Array<BeaconSignal>>>;
25
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"signal-discovery.d.ts","sourceRoot":"","sources":["../../../../src/core/beacon/signal-discovery.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,wBAAwB,EAKzB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAG9D;;;;;GAKG;AACH,qBAAa,qBAAqB;IAEhC;;;;;;OAMG;WACU,OAAO,CAClB,cAAc,EAAE,KAAK,CAAC,aAAa,CAAC,EACpC,OAAO,EAAE,wBAAwB,GAChC,OAAO,CAAC,GAAG,CAAC,aAAa,EAAE,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC;IA0EnD;;;;;OAKG;WACU,QAAQ,CACnB,cAAc,EAAE,KAAK,CAAC,aAAa,CAAC,EACpC,OAAO,EAAE,wBAAwB,GAChC,OAAO,CAAC,GAAG,CAAC,aAAa,EAAE,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC;CA4HpD"}
@@ -1,91 +1,35 @@
1
- import { RawTransactionRest, RawTransactionV2 } from '@did-btcr2/bitcoin';
2
- import { DidUpdatePayload } from '@did-btcr2/common';
3
- import { Beacon, BeaconService, BeaconSignal } from '../../interfaces/beacon.js';
4
- import { BeaconSidecarData, SignalsMetadata, SingletonSidecar } from '../../utils/types.js';
1
+ import { BitcoinNetworkConnection } from '@did-btcr2/bitcoin';
2
+ import { KeyBytes } from '@did-btcr2/common';
3
+ import { SignedBTCR2Update } from '@did-btcr2/cryptosuite';
4
+ import { SidecarData } from '../types.js';
5
+ import { Beacon } from './beacon.js';
6
+ import { BeaconService, BeaconSignal, BlockMetadata } from './interfaces.js';
5
7
  /**
6
- * Implements {@link https://dcdpr.github.io/did-btcr2/#singleton-beacon | 5.1 Singleton Beacon}.
7
- *
8
- * A Singleton Beacon enables a single entity to independently post a DID Update Payload in a Beacon Signal. Its is a
9
- * Beacon that can be used to publish a single DID Update Payload targeting a single DID document. The serviceEndpoint
10
- * for this Beacon Type is a Bitcoin address represented as a URI following the BIP21 scheme. It is recommended that
11
- * this Bitcoin address be under the sole control of the DID controller. How the Bitcoin address and the cryptographic
12
- * material that controls it are generated is left to the implementation.
13
- *
8
+ * Implements {@link https://dcdpr.github.io/did-btcr2/terminology.html#singleton-beacon | Singleton Beacon}.
14
9
  * @class SingletonBeacon
15
10
  * @type {SingletonBeacon}
16
- * @extends {Beacon}
11
+ * @extends {AggregateBeacon}
17
12
  */
18
13
  export declare class SingletonBeacon extends Beacon {
19
14
  /**
20
15
  * Creates an instance of SingletonBeacon.
21
- * @param {BeaconService} service The Beacon service.
22
- * @param {?BeaconSidecarData} [sidecar] Optional sidecar data.
23
- */
24
- constructor(service: BeaconService, sidecar?: BeaconSidecarData<SingletonSidecar>);
25
- /**
26
- * Get the Beacon service.
27
- * @readonly
28
- * @type {BeaconService} The Beacon service.
29
- */
30
- get service(): BeaconService;
31
- /**
32
- * Implements {@link https://dcdpr.github.io/did-btcr2/#establish-singleton-beacon | 5.1.1 Establish Singleton Beacon}.
16
+ * @param {BeaconService} service The BeaconService object representing the funded beacon to announce the update to.
33
17
  *
34
- * Static, convenience method for establishing a Beacon object.
35
- *
36
- * A Singleton Beacon is a Beacon that can be used to publish a single DID Update Payload targeting a single DID
37
- * document. The serviceEndpoint for this Beacon Type is a Bitcoin address represented as a URI following the BIP21
38
- * scheme. It is RECOMMENDED that this Bitcoin address be under the sole control of the DID controller. How the
39
- * Bitcoin address and the cryptographic material that controls it are generated is left to the implementation.
40
- * The Establish Singleton Beacon algorithm takes in a Bitcoin address and a serviceId and returns a Singleton Beacon service.
41
- * It returns a SignletonBeacon object with the given id, type, and serviceEndpoint.
42
- *
43
- * @param {string} service The Beacon service.
44
- * @param {BeaconSidecarData<SingletonSidecar>} sidecar The sidecar data.
45
- * @returns {SingletonBeacon} The Singleton Beacon.
46
- */
47
- static establish(service: BeaconService, sidecar: BeaconSidecarData<SingletonSidecar>): SingletonBeacon;
48
- /**
49
- * TODO: Figure out if this is necessary or not.
50
- * @param {string} didUpdatePayload The DID Update Payload to generate the signal for.
51
- * @returns {BeaconSignal} The generated signal.
52
- * @throws {MethodError} if the signal is invalid.
53
18
  */
54
- generateSignal(didUpdatePayload: string): BeaconSignal;
19
+ constructor(service: BeaconService);
55
20
  /**
56
- * TODO: Finish implementation per spec
57
- *
58
- * Implements {@link https://dcdpr.github.io/did-btcr2/#process-singleton-beacon-signal | 5.1.3 Process Singleton Beacon Signal}.
59
- * See {@link Beacon.processSignal | Abstract Beacon Interface Method processSignal} for more details.
60
- *
61
- * The Process Singleton Beacon Signal algorithm is called by the Process Beacon Signals algorithm as part of the Read
62
- * operation. It takes a Bitcoin transaction representing a Beacon Signal and optional signalSidecarData containing
63
- * any sidecar data provided to the resolver for the Beacon Signal identified by the Bitcoin transaction identifier.
64
- * It returns the DID Update payload announced by the Beacon Signal or throws an error.
65
- *
66
- * @param {RawTransactionV2} signal Bitcoin transaction representing a Beacon Signal.
67
- * @param {SignalsMetadata} signalsMetadata: SignalsMetadata Optional sidecar data for the Beacon Signal.
68
- * @returns {Promise<DidUpdatePayload | undefined>} The DID Update payload announced by the Beacon Signal.
69
- * @throws {DidError} if the signalTx is invalid or the signalSidecarData is invalid.
21
+ * Processes an array of Beacon Signals associated with a Singleton Beacon Service.
22
+ * @returns {Promise<SignedBTCR2Update | undefined>} The DID Update payload announced by the Beacon Signal.
23
+ * @throws {SingletonBeaconError} if the signalTx is invalid or the signalSidecarData is invalid.
70
24
  */
71
- processSignal(signal: RawTransactionV2 | RawTransactionRest, signalsMetadata: SignalsMetadata): Promise<DidUpdatePayload | undefined>;
25
+ processSignals(signals: Array<BeaconSignal>, sidecar: SidecarData): Promise<Array<[SignedBTCR2Update, BlockMetadata]>>;
72
26
  /**
73
- * Implements {@link https://dcdpr.github.io/did-btcr2/#broadcast-singleton-beacon-signal | 5.1.2 Broadcast Singleton Beacon Signal}.
74
- *
75
- * The Broadcast Singleton Beacon Signal algorithm is called by the Announce DID Update algorithm as part of the
76
- * Update operation, if the Beacon being used is of the type SingletonBeacon. It takes as input a Beacon service and a
77
- * secured didUpdatePayload. The algorithm constructs a Bitcoin transaction that spends from the Beacon address
78
- * identified in the service and contains a transaction output of the format [OP_RETURN, OP_PUSH32, <hashBytes>],
79
- * where hashBytes is the SHA256 hash of the canonical didUpdatePayload. The Bitcoin transaction is then signed and
80
- * broadcast to the Bitcoin network, thereby publicly announcing a DID update in a Beacon Signal. It returns a
81
- * signalMetadata object mapping the Bitcoin transaction identifier of the Beacon Signal to the necessary data needed
82
- * to verify the signal announces a specific DID Update Payload.
83
- *
84
- * TODO: Design and implement a way to construct, sign and send via RPC
85
- *
86
- * @param {DidUpdatePayload} didUpdatePayload The verificationMethod object to be used for signing.
87
- * @returns {SignedRawTx} Successful output of a bitcoin transaction.
27
+ * Broadcasts a SingletonBeacon signal to the Bitcoin network.
28
+ * @param {SignedBTCR2Update} signedUpdate The signed BTCR2 update to broadcast.
29
+ * @param {KeyBytes} secretKey The secret key for signing the Bitcoin transaction.
30
+ * @param {BitcoinNetworkConnection} bitcoin The Bitcoin network connection.
31
+ * @returns {Promise<SignedBTCR2Update>} The signed update that was broadcast.
88
32
  * @throws {SingletonBeaconError} if the bitcoin address is invalid or unfunded.
89
33
  */
90
- broadcastSignal(didUpdatePayload: DidUpdatePayload): Promise<SignalsMetadata>;
34
+ broadcastSignal(signedUpdate: SignedBTCR2Update, secretKey: KeyBytes, bitcoin: BitcoinNetworkConnection): Promise<SignedBTCR2Update>;
91
35
  }
@@ -1 +1 @@
1
- {"version":3,"file":"singleton.d.ts","sourceRoot":"","sources":["../../../../src/core/beacon/singleton.ts"],"names":[],"mappings":"AAAA,OAAO,EAAyC,kBAAkB,EAAE,gBAAgB,EAAe,MAAM,oBAAoB,CAAC;AAC9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AAE,YAAY,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAE7E;;;;;GAKG;AACH,qBAAa,eAAgB,SAAQ,MAAM;IAEzC;;;;OAIG;gBACS,OAAO,EAAE,aAAa;IAIlC;;;;OAIG;IACG,cAAc,CAClB,OAAO,EAAE,KAAK,CAAC,YAAY,CAAC,EAC5B,OAAO,EAAE,WAAW,GACnB,OAAO,CAAC,KAAK,CAAC,CAAC,iBAAiB,EAAE,aAAa,CAAC,CAAC,CAAC;IA0CrD;;;;;;;OAOG;IACG,eAAe,CACnB,YAAY,EAAE,iBAAiB,EAC/B,SAAS,EAAE,QAAQ,EACnB,OAAO,EAAE,wBAAwB,GAChC,OAAO,CAAC,iBAAiB,CAAC;CAsE9B"}
@@ -0,0 +1,36 @@
1
+ import { BitcoinNetworkConnection } from '@did-btcr2/bitcoin';
2
+ import { KeyBytes } from '@did-btcr2/common';
3
+ import { SignedBTCR2Update } from '@did-btcr2/cryptosuite';
4
+ import { SidecarData } from '../types.js';
5
+ import { Beacon } from './beacon.js';
6
+ import { BeaconService, BeaconSignal, BlockMetadata } from './interfaces.js';
7
+ /**
8
+ * Implements {@link https://dcdpr.github.io/did-btcr2/terminology.html#smt-beacon | SMTBeacon}.
9
+ * @class SMTBeacon
10
+ * @type {SMTBeacon}
11
+ * @extends {Beacon}
12
+ */
13
+ export declare class SMTBeacon extends Beacon {
14
+ /**
15
+ * Creates an instance of SMTBeacon.
16
+ * @param {BeaconService} service The Beacon service.
17
+ */
18
+ constructor(service: BeaconService);
19
+ /**
20
+ * Implements {@link https://dcdpr.github.io/did-btcr2/operations/resolve.html#process-smt-beacon | 7.2.e.1 Process SMT Beacon}.
21
+ * @param {Array<BeaconSignal>} signals The array of Beacon Signals to process.
22
+ * @param {SidecarData} sidecar The sidecar data associated with the SMT Beacon.
23
+ * @returns {Promise<Array<[SignedBTCR2Update, BlockMetadata]>>} The processed signals.
24
+ * @throws {SMTBeaconError} if processing fails.
25
+ */
26
+ processSignals(signals: Array<BeaconSignal>, sidecar: SidecarData): Promise<Array<[SignedBTCR2Update, BlockMetadata]>>;
27
+ /**
28
+ * Broadcast CAS Beacon signal to the Bitcoin network.
29
+ * @param {SignedBTCR2Update} signedUpdate The signed BTCR2 update to broadcast.
30
+ * @param {KeyBytes} secretKey The secret key for signing the Bitcoin transaction.
31
+ * @param {BitcoinNetworkConnection} bitcoin The Bitcoin network connection.
32
+ * @return {Promise<SignedBTCR2Update>} The signed update that was broadcasted.
33
+ * @throws {SMTBeaconError} if broadcasting fails.
34
+ */
35
+ broadcastSignal(signedUpdate: SignedBTCR2Update, secretKey: KeyBytes, bitcoin: BitcoinNetworkConnection): Promise<SignedBTCR2Update>;
36
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"smt-beacon.d.ts","sourceRoot":"","sources":["../../../../src/core/beacon/smt-beacon.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAE7E;;;;;GAKG;AACH,qBAAa,SAAU,SAAQ,MAAM;IACnC;;;OAGG;gBACS,OAAO,EAAE,aAAa;IAIlC;;;;;;OAMG;IACH,cAAc,CACZ,OAAO,EAAE,KAAK,CAAC,YAAY,CAAC,EAC5B,OAAO,EAAE,WAAW,GACnB,OAAO,CAAC,KAAK,CAAC,CAAC,iBAAiB,EAAE,aAAa,CAAC,CAAC,CAAC;IAIrD;;;;;;;OAOG;IACG,eAAe,CACnB,YAAY,EAAE,iBAAiB,EAC/B,SAAS,EAAE,QAAQ,EACnB,OAAO,EAAE,wBAAwB,GAChC,OAAO,CAAC,iBAAiB,CAAC;CAG9B"}