@did-btcr2/method 0.18.0 → 0.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (262) hide show
  1. package/dist/browser.js +5240 -6079
  2. package/dist/browser.mjs +5240 -6079
  3. package/dist/cjs/core/beacon/aggregation/cohort/index.js +3 -3
  4. package/dist/cjs/core/beacon/aggregation/cohort/index.js.map +1 -1
  5. package/dist/cjs/core/beacon/aggregation/cohort/messages/base.js +1 -9
  6. package/dist/cjs/core/beacon/aggregation/cohort/messages/base.js.map +1 -1
  7. package/dist/cjs/core/beacon/aggregation/cohort/messages/keygen/cohort-advert.js +2 -1
  8. package/dist/cjs/core/beacon/aggregation/cohort/messages/keygen/cohort-advert.js.map +1 -1
  9. package/dist/cjs/core/beacon/aggregation/cohort/messages/keygen/cohort-ready.js +2 -1
  10. package/dist/cjs/core/beacon/aggregation/cohort/messages/keygen/cohort-ready.js.map +1 -1
  11. package/dist/cjs/core/beacon/aggregation/cohort/messages/keygen/opt-in-accept.js +2 -1
  12. package/dist/cjs/core/beacon/aggregation/cohort/messages/keygen/opt-in-accept.js.map +1 -1
  13. package/dist/cjs/core/beacon/aggregation/cohort/messages/keygen/opt-in.js +2 -1
  14. package/dist/cjs/core/beacon/aggregation/cohort/messages/keygen/opt-in.js.map +1 -1
  15. package/dist/cjs/core/beacon/aggregation/cohort/messages/keygen/subscribe.js +2 -1
  16. package/dist/cjs/core/beacon/aggregation/cohort/messages/keygen/subscribe.js.map +1 -1
  17. package/dist/cjs/core/beacon/aggregation/cohort/messages/sign/aggregated-nonce.js +2 -1
  18. package/dist/cjs/core/beacon/aggregation/cohort/messages/sign/aggregated-nonce.js.map +1 -1
  19. package/dist/cjs/core/beacon/aggregation/cohort/messages/sign/authorization-request.js +2 -1
  20. package/dist/cjs/core/beacon/aggregation/cohort/messages/sign/authorization-request.js.map +1 -1
  21. package/dist/cjs/core/beacon/aggregation/cohort/messages/sign/nonce-contribution.js +2 -1
  22. package/dist/cjs/core/beacon/aggregation/cohort/messages/sign/nonce-contribution.js.map +1 -1
  23. package/dist/cjs/core/beacon/aggregation/cohort/messages/sign/request-signature.js +2 -1
  24. package/dist/cjs/core/beacon/aggregation/cohort/messages/sign/request-signature.js.map +1 -1
  25. package/dist/cjs/core/beacon/aggregation/cohort/messages/sign/signature-authorization.js +2 -1
  26. package/dist/cjs/core/beacon/aggregation/cohort/messages/sign/signature-authorization.js.map +1 -1
  27. package/dist/cjs/core/beacon/aggregation/communication/adapter/nostr.js +36 -18
  28. package/dist/cjs/core/beacon/aggregation/communication/adapter/nostr.js.map +1 -1
  29. package/dist/cjs/core/beacon/aggregation/coordinator.js +14 -14
  30. package/dist/cjs/core/beacon/aggregation/coordinator.js.map +1 -1
  31. package/dist/cjs/core/beacon/aggregation/participant.js +4 -3
  32. package/dist/cjs/core/beacon/aggregation/participant.js.map +1 -1
  33. package/dist/cjs/core/beacon/aggregation/session/index.js +1 -1
  34. package/dist/cjs/core/beacon/aggregation/session/index.js.map +1 -1
  35. package/dist/cjs/core/beacon/cas-beacon.js +55 -0
  36. package/dist/cjs/core/beacon/cas-beacon.js.map +1 -0
  37. package/dist/cjs/core/beacon/factory.js +11 -10
  38. package/dist/cjs/core/beacon/factory.js.map +1 -1
  39. package/dist/cjs/core/beacon/interfaces.js +32 -0
  40. package/dist/cjs/core/beacon/interfaces.js.map +1 -0
  41. package/dist/cjs/core/beacon/singleton.js +59 -135
  42. package/dist/cjs/core/beacon/singleton.js.map +1 -1
  43. package/dist/cjs/core/beacon/smt-beacon.js +56 -0
  44. package/dist/cjs/core/beacon/smt-beacon.js.map +1 -0
  45. package/dist/cjs/core/beacon/utils.js +67 -105
  46. package/dist/cjs/core/beacon/utils.js.map +1 -1
  47. package/dist/cjs/core/identifier.js +18 -21
  48. package/dist/cjs/core/identifier.js.map +1 -1
  49. package/dist/cjs/core/interfaces.js +2 -0
  50. package/dist/cjs/core/interfaces.js.map +1 -0
  51. package/dist/cjs/core/resolve.js +511 -0
  52. package/dist/cjs/core/resolve.js.map +1 -0
  53. package/dist/cjs/{utils → core}/types.js.map +1 -1
  54. package/dist/cjs/core/{crud/update.js → update.js} +62 -52
  55. package/dist/cjs/core/update.js.map +1 -0
  56. package/dist/cjs/did-btcr2.js +109 -75
  57. package/dist/cjs/did-btcr2.js.map +1 -1
  58. package/dist/cjs/index.js +14 -15
  59. package/dist/cjs/index.js.map +1 -1
  60. package/dist/cjs/utils/appendix.js +10 -18
  61. package/dist/cjs/utils/appendix.js.map +1 -1
  62. package/dist/cjs/utils/did-document.js +51 -58
  63. package/dist/cjs/utils/did-document.js.map +1 -1
  64. package/dist/cjs/utils/general.js +1 -1
  65. package/dist/cjs/utils/general.js.map +1 -1
  66. package/dist/esm/core/beacon/aggregation/cohort/index.js +3 -3
  67. package/dist/esm/core/beacon/aggregation/cohort/index.js.map +1 -1
  68. package/dist/esm/core/beacon/aggregation/cohort/messages/base.js +1 -9
  69. package/dist/esm/core/beacon/aggregation/cohort/messages/base.js.map +1 -1
  70. package/dist/esm/core/beacon/aggregation/cohort/messages/keygen/cohort-advert.js +2 -1
  71. package/dist/esm/core/beacon/aggregation/cohort/messages/keygen/cohort-advert.js.map +1 -1
  72. package/dist/esm/core/beacon/aggregation/cohort/messages/keygen/cohort-ready.js +2 -1
  73. package/dist/esm/core/beacon/aggregation/cohort/messages/keygen/cohort-ready.js.map +1 -1
  74. package/dist/esm/core/beacon/aggregation/cohort/messages/keygen/opt-in-accept.js +2 -1
  75. package/dist/esm/core/beacon/aggregation/cohort/messages/keygen/opt-in-accept.js.map +1 -1
  76. package/dist/esm/core/beacon/aggregation/cohort/messages/keygen/opt-in.js +2 -1
  77. package/dist/esm/core/beacon/aggregation/cohort/messages/keygen/opt-in.js.map +1 -1
  78. package/dist/esm/core/beacon/aggregation/cohort/messages/keygen/subscribe.js +2 -1
  79. package/dist/esm/core/beacon/aggregation/cohort/messages/keygen/subscribe.js.map +1 -1
  80. package/dist/esm/core/beacon/aggregation/cohort/messages/sign/aggregated-nonce.js +2 -1
  81. package/dist/esm/core/beacon/aggregation/cohort/messages/sign/aggregated-nonce.js.map +1 -1
  82. package/dist/esm/core/beacon/aggregation/cohort/messages/sign/authorization-request.js +2 -1
  83. package/dist/esm/core/beacon/aggregation/cohort/messages/sign/authorization-request.js.map +1 -1
  84. package/dist/esm/core/beacon/aggregation/cohort/messages/sign/nonce-contribution.js +2 -1
  85. package/dist/esm/core/beacon/aggregation/cohort/messages/sign/nonce-contribution.js.map +1 -1
  86. package/dist/esm/core/beacon/aggregation/cohort/messages/sign/request-signature.js +2 -1
  87. package/dist/esm/core/beacon/aggregation/cohort/messages/sign/request-signature.js.map +1 -1
  88. package/dist/esm/core/beacon/aggregation/cohort/messages/sign/signature-authorization.js +2 -1
  89. package/dist/esm/core/beacon/aggregation/cohort/messages/sign/signature-authorization.js.map +1 -1
  90. package/dist/esm/core/beacon/aggregation/communication/adapter/nostr.js +36 -18
  91. package/dist/esm/core/beacon/aggregation/communication/adapter/nostr.js.map +1 -1
  92. package/dist/esm/core/beacon/aggregation/coordinator.js +14 -14
  93. package/dist/esm/core/beacon/aggregation/coordinator.js.map +1 -1
  94. package/dist/esm/core/beacon/aggregation/participant.js +4 -3
  95. package/dist/esm/core/beacon/aggregation/participant.js.map +1 -1
  96. package/dist/esm/core/beacon/aggregation/session/index.js +1 -1
  97. package/dist/esm/core/beacon/aggregation/session/index.js.map +1 -1
  98. package/dist/esm/core/beacon/cas-beacon.js +55 -0
  99. package/dist/esm/core/beacon/cas-beacon.js.map +1 -0
  100. package/dist/esm/core/beacon/factory.js +11 -10
  101. package/dist/esm/core/beacon/factory.js.map +1 -1
  102. package/dist/esm/core/beacon/interfaces.js +32 -0
  103. package/dist/esm/core/beacon/interfaces.js.map +1 -0
  104. package/dist/esm/core/beacon/singleton.js +59 -135
  105. package/dist/esm/core/beacon/singleton.js.map +1 -1
  106. package/dist/esm/core/beacon/smt-beacon.js +56 -0
  107. package/dist/esm/core/beacon/smt-beacon.js.map +1 -0
  108. package/dist/esm/core/beacon/utils.js +67 -105
  109. package/dist/esm/core/beacon/utils.js.map +1 -1
  110. package/dist/esm/core/identifier.js +18 -21
  111. package/dist/esm/core/identifier.js.map +1 -1
  112. package/dist/esm/core/interfaces.js +2 -0
  113. package/dist/esm/core/interfaces.js.map +1 -0
  114. package/dist/esm/core/resolve.js +511 -0
  115. package/dist/esm/core/resolve.js.map +1 -0
  116. package/dist/esm/{utils → core}/types.js.map +1 -1
  117. package/dist/esm/core/{crud/update.js → update.js} +62 -52
  118. package/dist/esm/core/update.js.map +1 -0
  119. package/dist/esm/did-btcr2.js +109 -75
  120. package/dist/esm/did-btcr2.js.map +1 -1
  121. package/dist/esm/index.js +14 -15
  122. package/dist/esm/index.js.map +1 -1
  123. package/dist/esm/utils/appendix.js +10 -18
  124. package/dist/esm/utils/appendix.js.map +1 -1
  125. package/dist/esm/utils/did-document.js +51 -58
  126. package/dist/esm/utils/did-document.js.map +1 -1
  127. package/dist/esm/utils/general.js +1 -1
  128. package/dist/esm/utils/general.js.map +1 -1
  129. package/dist/types/core/beacon/aggregation/cohort/index.d.ts +1 -1
  130. package/dist/types/core/beacon/aggregation/cohort/messages/base.d.ts +0 -7
  131. package/dist/types/core/beacon/aggregation/cohort/messages/base.d.ts.map +1 -1
  132. package/dist/types/core/beacon/aggregation/cohort/messages/keygen/cohort-advert.d.ts.map +1 -1
  133. package/dist/types/core/beacon/aggregation/cohort/messages/keygen/cohort-ready.d.ts.map +1 -1
  134. package/dist/types/core/beacon/aggregation/cohort/messages/keygen/opt-in-accept.d.ts.map +1 -1
  135. package/dist/types/core/beacon/aggregation/cohort/messages/keygen/opt-in.d.ts.map +1 -1
  136. package/dist/types/core/beacon/aggregation/cohort/messages/keygen/subscribe.d.ts.map +1 -1
  137. package/dist/types/core/beacon/aggregation/cohort/messages/sign/aggregated-nonce.d.ts.map +1 -1
  138. package/dist/types/core/beacon/aggregation/cohort/messages/sign/authorization-request.d.ts.map +1 -1
  139. package/dist/types/core/beacon/aggregation/cohort/messages/sign/nonce-contribution.d.ts.map +1 -1
  140. package/dist/types/core/beacon/aggregation/cohort/messages/sign/request-signature.d.ts.map +1 -1
  141. package/dist/types/core/beacon/aggregation/cohort/messages/sign/signature-authorization.d.ts.map +1 -1
  142. package/dist/types/core/beacon/aggregation/communication/adapter/nostr.d.ts +13 -5
  143. package/dist/types/core/beacon/aggregation/communication/adapter/nostr.d.ts.map +1 -1
  144. package/dist/types/core/beacon/aggregation/coordinator.d.ts +17 -29
  145. package/dist/types/core/beacon/aggregation/coordinator.d.ts.map +1 -1
  146. package/dist/types/core/beacon/aggregation/participant.d.ts.map +1 -1
  147. package/dist/types/core/beacon/cas-beacon.d.ts +47 -0
  148. package/dist/types/core/beacon/cas-beacon.d.ts.map +1 -0
  149. package/dist/types/core/beacon/factory.d.ts +5 -4
  150. package/dist/types/core/beacon/factory.d.ts.map +1 -1
  151. package/dist/types/core/beacon/interfaces.d.ts +98 -0
  152. package/dist/types/core/beacon/interfaces.d.ts.map +1 -0
  153. package/dist/types/core/beacon/singleton.d.ts +22 -65
  154. package/dist/types/core/beacon/singleton.d.ts.map +1 -1
  155. package/dist/types/core/beacon/smt-beacon.d.ts +48 -0
  156. package/dist/types/core/beacon/smt-beacon.d.ts.map +1 -0
  157. package/dist/types/core/beacon/utils.d.ts +19 -97
  158. package/dist/types/core/beacon/utils.d.ts.map +1 -1
  159. package/dist/types/core/identifier.d.ts.map +1 -1
  160. package/dist/types/core/interfaces.d.ts +94 -0
  161. package/dist/types/core/interfaces.d.ts.map +1 -0
  162. package/dist/types/core/resolve.d.ts +105 -0
  163. package/dist/types/core/resolve.d.ts.map +1 -0
  164. package/dist/types/core/types.d.ts +71 -0
  165. package/dist/types/core/types.d.ts.map +1 -0
  166. package/dist/types/core/{crud/update.d.ts → update.d.ts} +21 -20
  167. package/dist/types/core/update.d.ts.map +1 -0
  168. package/dist/types/did-btcr2.d.ts +45 -57
  169. package/dist/types/did-btcr2.d.ts.map +1 -1
  170. package/dist/types/index.d.ts +14 -15
  171. package/dist/types/index.d.ts.map +1 -1
  172. package/dist/types/utils/appendix.d.ts +5 -10
  173. package/dist/types/utils/appendix.d.ts.map +1 -1
  174. package/dist/types/utils/did-document-builder.d.ts +1 -1
  175. package/dist/types/utils/did-document-builder.d.ts.map +1 -1
  176. package/dist/types/utils/did-document.d.ts +31 -29
  177. package/dist/types/utils/did-document.d.ts.map +1 -1
  178. package/package.json +5 -5
  179. package/src/core/beacon/aggregation/cohort/index.ts +3 -3
  180. package/src/core/beacon/aggregation/cohort/messages/base.ts +1 -12
  181. package/src/core/beacon/aggregation/cohort/messages/keygen/cohort-advert.ts +2 -2
  182. package/src/core/beacon/aggregation/cohort/messages/keygen/cohort-ready.ts +2 -2
  183. package/src/core/beacon/aggregation/cohort/messages/keygen/opt-in-accept.ts +2 -2
  184. package/src/core/beacon/aggregation/cohort/messages/keygen/opt-in.ts +2 -2
  185. package/src/core/beacon/aggregation/cohort/messages/keygen/subscribe.ts +2 -2
  186. package/src/core/beacon/aggregation/cohort/messages/sign/aggregated-nonce.ts +2 -2
  187. package/src/core/beacon/aggregation/cohort/messages/sign/authorization-request.ts +2 -2
  188. package/src/core/beacon/aggregation/cohort/messages/sign/nonce-contribution.ts +2 -2
  189. package/src/core/beacon/aggregation/cohort/messages/sign/request-signature.ts +2 -2
  190. package/src/core/beacon/aggregation/cohort/messages/sign/signature-authorization.ts +2 -2
  191. package/src/core/beacon/aggregation/communication/adapter/nostr.ts +43 -21
  192. package/src/core/beacon/aggregation/coordinator.ts +41 -29
  193. package/src/core/beacon/aggregation/participant.ts +4 -3
  194. package/src/core/beacon/aggregation/session/index.ts +1 -1
  195. package/src/core/beacon/cas-beacon.ts +67 -0
  196. package/src/core/beacon/factory.ts +13 -15
  197. package/src/core/beacon/interfaces.ts +124 -0
  198. package/src/core/beacon/singleton.ts +75 -145
  199. package/src/core/beacon/smt-beacon.ts +70 -0
  200. package/src/core/beacon/utils.ts +80 -170
  201. package/src/core/identifier.ts +21 -24
  202. package/src/core/interfaces.ts +101 -0
  203. package/src/core/resolve.ts +707 -0
  204. package/src/core/types.ts +78 -0
  205. package/src/core/{crud/update.ts → update.ts} +75 -68
  206. package/src/did-btcr2.ts +152 -92
  207. package/src/index.ts +14 -24
  208. package/src/utils/appendix.ts +18 -22
  209. package/src/utils/did-document-builder.ts +1 -1
  210. package/src/utils/did-document.ts +67 -71
  211. package/src/utils/general.ts +1 -1
  212. package/dist/cjs/core/beacon/cid-aggregate.js +0 -116
  213. package/dist/cjs/core/beacon/cid-aggregate.js.map +0 -1
  214. package/dist/cjs/core/beacon/smt-aggregate.js +0 -126
  215. package/dist/cjs/core/beacon/smt-aggregate.js.map +0 -1
  216. package/dist/cjs/core/crud/deactivate.js +0 -14
  217. package/dist/cjs/core/crud/deactivate.js.map +0 -1
  218. package/dist/cjs/core/crud/read.js +0 -679
  219. package/dist/cjs/core/crud/read.js.map +0 -1
  220. package/dist/cjs/core/crud/update.js.map +0 -1
  221. package/dist/cjs/interfaces/beacon.js +0 -41
  222. package/dist/cjs/interfaces/beacon.js.map +0 -1
  223. package/dist/cjs/interfaces/crud.js +0 -2
  224. package/dist/cjs/interfaces/crud.js.map +0 -1
  225. package/dist/esm/core/beacon/cid-aggregate.js +0 -116
  226. package/dist/esm/core/beacon/cid-aggregate.js.map +0 -1
  227. package/dist/esm/core/beacon/smt-aggregate.js +0 -126
  228. package/dist/esm/core/beacon/smt-aggregate.js.map +0 -1
  229. package/dist/esm/core/crud/deactivate.js +0 -14
  230. package/dist/esm/core/crud/deactivate.js.map +0 -1
  231. package/dist/esm/core/crud/read.js +0 -679
  232. package/dist/esm/core/crud/read.js.map +0 -1
  233. package/dist/esm/core/crud/update.js.map +0 -1
  234. package/dist/esm/interfaces/beacon.js +0 -41
  235. package/dist/esm/interfaces/beacon.js.map +0 -1
  236. package/dist/esm/interfaces/crud.js +0 -2
  237. package/dist/esm/interfaces/crud.js.map +0 -1
  238. package/dist/types/core/beacon/cid-aggregate.d.ts +0 -102
  239. package/dist/types/core/beacon/cid-aggregate.d.ts.map +0 -1
  240. package/dist/types/core/beacon/smt-aggregate.d.ts +0 -111
  241. package/dist/types/core/beacon/smt-aggregate.d.ts.map +0 -1
  242. package/dist/types/core/crud/deactivate.d.ts +0 -13
  243. package/dist/types/core/crud/deactivate.d.ts.map +0 -1
  244. package/dist/types/core/crud/read.d.ts +0 -334
  245. package/dist/types/core/crud/read.d.ts.map +0 -1
  246. package/dist/types/core/crud/update.d.ts.map +0 -1
  247. package/dist/types/interfaces/beacon.d.ts +0 -116
  248. package/dist/types/interfaces/beacon.d.ts.map +0 -1
  249. package/dist/types/interfaces/crud.d.ts +0 -32
  250. package/dist/types/interfaces/crud.d.ts.map +0 -1
  251. package/dist/types/utils/types.d.ts +0 -38
  252. package/dist/types/utils/types.d.ts.map +0 -1
  253. package/src/canonicalize.d.ts +0 -6
  254. package/src/core/beacon/cid-aggregate.ts +0 -153
  255. package/src/core/beacon/smt-aggregate.ts +0 -135
  256. package/src/core/crud/deactivate.ts +0 -13
  257. package/src/core/crud/read.ts +0 -948
  258. package/src/interfaces/beacon.ts +0 -137
  259. package/src/interfaces/crud.ts +0 -33
  260. package/src/utils/types.ts +0 -41
  261. /package/dist/cjs/{utils → core}/types.js +0 -0
  262. /package/dist/esm/{utils → core}/types.js +0 -0
@@ -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,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A0B,GAAG,UAAU;IAmBhH;;;;;OAKG;IACU,qBAAqB,CAChC,MAAM,EAAE,qBAAqB,EAC7B,iBAAiB,EAAE,UAAU,EAC7B,OAAO,EAAE,0BAA0B,GAClC,OAAO,CAAC,IAAI,CAAC;IAchB;;;;;OAKG;IACU,oBAAoB,CAAC,OAAO,EAAE,0BAA0B,EAAE,UAAU,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;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,47 @@
1
+ import { BitcoinNetworkConnection } from '@did-btcr2/bitcoin';
2
+ import { HexString } from '@did-btcr2/common';
3
+ import { SidecarData } from '../types.js';
4
+ import { AggregateBeacon, BeaconService, BeaconSignal, BlockMetadata } from './interfaces.js';
5
+ import { BTCR2SignedUpdate } from '@did-btcr2/cryptosuite';
6
+ /**
7
+ * Implements {@link https://dcdpr.github.io/did-btcr2/terminology.html#cas-beacon | CAS Beacon}.
8
+ *
9
+ * @class CASBeacon
10
+ * @type {CASBeacon}
11
+ * @extends {AggregateBeacon}
12
+ */
13
+ export declare class CASBeacon extends AggregateBeacon {
14
+ /**
15
+ * Creates an instance of CASBeacon.
16
+ * @param {BeaconService} service The service of the Beacon.
17
+ * @param {?BeaconSidecarData} [sidecar] The sidecar data of the Beacon.
18
+ */
19
+ constructor(service: BeaconService, signals: Array<BeaconSignal>, sidecar: SidecarData, bitcoin?: BitcoinNetworkConnection);
20
+ /**
21
+ * Establish a CASBeacon instance based on the provided service and sidecar data.
22
+ * @param {BeaconService} service - The beacon service configuration.
23
+ * @param {SidecarData} sidecar - The sidecar data.
24
+ * @returns {CASBeacon} The established CASBeacon instance.
25
+ */
26
+ static establish(service: BeaconService, signals: Array<BeaconSignal>, sidecar: SidecarData): CASBeacon;
27
+ /**
28
+ * TODO: Figure out if this is necessary or not.
29
+ * @param {HexString} updateHash The hash of the update to generate the signal for.
30
+ * @returns {BeaconSignal} The generated signal.
31
+ * @throws {MethodError} if the signal is invalid.
32
+ */
33
+ generateSignal(updateHash: HexString): BeaconSignal;
34
+ /**
35
+ * Implements {@link https://dcdpr.github.io/did-btcr2/operations/resolve.html#process-cas-beacon | 7.2.e.1 Process CAS Beacon}.
36
+ * @returns {Promise<BTCR2SignedUpdate | undefined>} The processed signed update or undefined.
37
+ * @throws {MethodError} if the signal processing fails.
38
+ */
39
+ processSignals(): Promise<Array<[BTCR2SignedUpdate, BlockMetadata]>>;
40
+ /**
41
+ * TODO: Finish implementation
42
+ * @param {HexString} updateHash The hash of the update to broadcast.
43
+ * @returns {Promise<{ spentTx: string; signedUpdate: BTCR2SignedUpdate }>} The result of the broadcast.
44
+ * @throws {MethodError} if the broadcast fails.
45
+ */
46
+ broadcastSignal(updateHash: HexString): Promise<HexString>;
47
+ }
@@ -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,SAAS,EAAe,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC9F,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAE3D;;;;;;GAMG;AACH,qBAAa,SAAU,SAAQ,eAAe;IAC5C;;;;OAIG;gBAED,OAAO,EAAE,aAAa,EACtB,OAAO,EAAE,KAAK,CAAC,YAAY,CAAC,EAC5B,OAAO,EAAE,WAAW,EACpB,OAAO,CAAC,EAAE,wBAAwB;IAKpC;;;;;OAKG;IACH,MAAM,CAAC,SAAS,CAAC,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,KAAK,CAAC,YAAY,CAAC,EAAE,OAAO,EAAE,WAAW,GAAG,SAAS;IAIvG;;;;;OAKG;IACH,cAAc,CAAC,UAAU,EAAE,SAAS,GAAG,YAAY;IAInD;;;;OAIG;IACH,cAAc,IAAI,OAAO,CAAC,KAAK,CAAC,CAAC,iBAAiB,EAAE,aAAa,CAAC,CAAC,CAAC;IAIpE;;;;;OAKG;IACG,eAAe,CAAC,UAAU,EAAE,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC;CAGjE"}
@@ -1,5 +1,5 @@
1
- import { Beacon, BeaconService } from '../../interfaces/beacon.js';
2
- import { SidecarData } from '../../utils/types.js';
1
+ import { SidecarData } from '../types.js';
2
+ import { AggregateBeacon, BeaconService, BeaconSignal } from './interfaces.js';
3
3
  /**
4
4
  * Beacon Factory pattern to create Beacon instances.
5
5
  * @class BeaconFactory
@@ -9,8 +9,9 @@ export declare class BeaconFactory {
9
9
  /**
10
10
  * Establish a Beacon instance based on the provided service and optional sidecar data.
11
11
  * @param {BeaconService} service - The beacon service configuration.
12
- * @param {SidecarData} [sidecar] - The optional sidecar data.
12
+ * @param {Array<BeaconSignal>} signals - The array of beacon signals.
13
+ * @param {SidecarData} sidecar - The sidecar data associated with the beacon.
13
14
  * @returns {Beacon} The established Beacon instance.
14
15
  */
15
- static establish(service: BeaconService, sidecar?: SidecarData): Beacon;
16
+ static establish(service: BeaconService, signals: Array<BeaconSignal>, sidecar: SidecarData): AggregateBeacon;
16
17
  }
@@ -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,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAI/E;;;;GAIG;AACH,qBAAa,aAAa;IACxB;;;;;;OAMG;IACH,MAAM,CAAC,SAAS,CAAC,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,KAAK,CAAC,YAAY,CAAC,EAAE,OAAO,EAAE,WAAW,GAAG,eAAe;CAY9G"}
@@ -0,0 +1,98 @@
1
+ import { BitcoinNetworkConnection, RawTransactionRest, RawTransactionV2 } from '@did-btcr2/bitcoin';
2
+ import { HexString, UnixTimestamp } from '@did-btcr2/common';
3
+ import { DidServiceEndpoint, DidService as IDidService } from '@web5/dids';
4
+ import { SidecarData } from '../types.js';
5
+ import { BTCR2SignedUpdate } from '@did-btcr2/cryptosuite';
6
+ /**
7
+ * Represents a Beacon Service, which extends the DID Service with a service endpoint.
8
+ * @interface BeaconService
9
+ * @extends IDidService
10
+ */
11
+ export interface BeaconService extends IDidService {
12
+ serviceEndpoint: DidServiceEndpoint;
13
+ }
14
+ /**
15
+ * Represents a parsed Beacon Service, which extends the Beacon Service with a Bitcoin address.
16
+ * @interface ParsedBeaconService
17
+ * @extends BeaconService
18
+ */
19
+ export interface ParsedBeaconService extends BeaconService {
20
+ /**
21
+ * The Bitcoin address associated with this Beacon Service.
22
+ */
23
+ address: string;
24
+ }
25
+ /**
26
+ * Metadata about a Bitcoin block containing a Beacon Signal.
27
+ * @interface BlockMetadata
28
+ */
29
+ export interface BlockMetadata {
30
+ /**
31
+ * The block height at which the Beacon Signal was included.
32
+ */
33
+ height: number;
34
+ /**
35
+ * The timestamp of the block containing the Beacon Signal.
36
+ */
37
+ time: UnixTimestamp;
38
+ /**
39
+ * The number of confirmations for the block containing the Beacon Signal.
40
+ */
41
+ confirmations: number;
42
+ }
43
+ /**
44
+ * Represents a Beacon Signal, which is a transaction broadcasted by a Beacon to announce a DID update.
45
+ * @interface BeaconSignal
46
+ */
47
+ export interface BeaconSignal {
48
+ /**
49
+ * The raw Bitcoin transaction representing the Beacon Signal.
50
+ */
51
+ tx: RawTransactionRest | RawTransactionV2;
52
+ /**
53
+ * The beacon signal bytes hash (i.e. the hash of the BTCR2 update included in the Beacon Signal tx).
54
+ */
55
+ signalBytes: string;
56
+ /**
57
+ * Metadata about the block containing the Beacon Signal.
58
+ */
59
+ blockMetadata: BlockMetadata;
60
+ }
61
+ /**
62
+ * Abstract class representing an AggregateBeacon.
63
+ * @abstract
64
+ * @class AggregateBeacon
65
+ * @type {AggregateBeacon}
66
+ */
67
+ export declare abstract class AggregateBeacon {
68
+ /**
69
+ * The Beacon service object parsed from the DID Document.
70
+ */
71
+ service: BeaconService;
72
+ /**
73
+ * The array of Beacon Signals associated with this Beacon service.
74
+ */
75
+ signals: Array<BeaconSignal>;
76
+ /**
77
+ * The sidecar data associated with this Beacon service.
78
+ * TODO: Make this more specific to Beacon type.
79
+ */
80
+ sidecar: SidecarData;
81
+ /**
82
+ * The Bitcoin network connection associated with this Beacon service.
83
+ */
84
+ bitcoin: BitcoinNetworkConnection;
85
+ constructor(service: BeaconService, signals: Array<BeaconSignal>, sidecar: SidecarData, bitcoin?: BitcoinNetworkConnection);
86
+ /**
87
+ * Generates an unsigned update in a Beacon Signal (implemented by subclasses).
88
+ */
89
+ abstract generateSignal(updateHash: HexString): BeaconSignal;
90
+ /**
91
+ * Processes a Beacon Signal (implemented by subclasses).
92
+ */
93
+ abstract processSignals(): Promise<Array<[BTCR2SignedUpdate, BlockMetadata]>>;
94
+ /**
95
+ * Broadcasts a signed update in a Beacon Signal (implemented by subclasses).
96
+ */
97
+ abstract broadcastSignal(updateHash: HexString): Promise<HexString>;
98
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../../src/core/beacon/interfaces.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACpG,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,EAAE,kBAAkB,EAAE,UAAU,IAAI,WAAW,EAAE,MAAM,YAAY,CAAC;AAC3E,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAE3D;;;;GAIG;AACH,MAAM,WAAW,aAAc,SAAQ,WAAW;IAC9C,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;AAED;;;;;GAKG;AACH,8BAAsB,eAAe;IACnC;;OAEG;IACH,OAAO,EAAE,aAAa,CAAC;IAEvB;;OAEG;IACH,OAAO,EAAE,KAAK,CAAC,YAAY,CAAC,CAAC;IAE7B;;;OAGG;IACH,OAAO,EAAE,WAAW,CAAC;IAErB;;OAEG;IACH,OAAO,EAAE,wBAAwB,CAAC;gBAGhC,OAAO,EAAE,aAAa,EACtB,OAAO,EAAE,KAAK,CAAC,YAAY,CAAC,EAC5B,OAAO,EAAE,WAAW,EACpB,OAAO,CAAC,EAAE,wBAAwB;IAQpC;;OAEG;IACH,QAAQ,CAAC,cAAc,CAAC,UAAU,EAAE,SAAS,GAAG,YAAY;IAE5D;;OAEG;IACH,QAAQ,CAAC,cAAc,IAAI,OAAO,CAAC,KAAK,CAAC,CAAC,iBAAiB,EAAE,aAAa,CAAC,CAAC,CAAC;IAE7E;;OAEG;IACH,QAAQ,CAAC,eAAe,CAAC,UAAU,EAAE,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC;CACpE"}
@@ -1,91 +1,48 @@
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 { HexString } from '@did-btcr2/common';
3
+ import { BTCR2SignedUpdate } from '@did-btcr2/cryptosuite';
4
+ import { SidecarData } from '../types.js';
5
+ import { AggregateBeacon, BeaconService, BeaconSignal, BlockMetadata } from './interfaces.js';
5
6
  /**
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.
7
+ * Implements {@link https://dcdpr.github.io/did-btcr2/terminology.html#singleton-beacon | Singleton Beacon}.
13
8
  *
14
9
  * @class SingletonBeacon
15
10
  * @type {SingletonBeacon}
16
- * @extends {Beacon}
11
+ * @extends {AggregateBeacon}
17
12
  */
18
- export declare class SingletonBeacon extends Beacon {
13
+ export declare class SingletonBeacon extends AggregateBeacon {
19
14
  /**
20
15
  * Creates an instance of SingletonBeacon.
21
16
  * @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.
17
+ * @param {?BeaconSidecarData} sidecar The SingletonBeacon sidecar data.
29
18
  */
30
- get service(): BeaconService;
19
+ constructor(service: BeaconService, signals: Array<BeaconSignal>, sidecar: SidecarData, bitcoin?: BitcoinNetworkConnection);
31
20
  /**
32
- * Implements {@link https://dcdpr.github.io/did-btcr2/#establish-singleton-beacon | 5.1.1 Establish Singleton Beacon}.
33
- *
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
- *
21
+ * Static, convenience method for establishing a CASBeacon object.
43
22
  * @param {string} service The Beacon service.
44
- * @param {BeaconSidecarData<SingletonSidecar>} sidecar The sidecar data.
23
+ * @param {SidecarData} sidecar The sidecar data.
45
24
  * @returns {SingletonBeacon} The Singleton Beacon.
46
25
  */
47
- static establish(service: BeaconService, sidecar: BeaconSidecarData<SingletonSidecar>): SingletonBeacon;
26
+ static establish(service: BeaconService, signals: Array<BeaconSignal>, sidecar: SidecarData): SingletonBeacon;
48
27
  /**
49
- * TODO: Figure out if this is necessary or not.
50
- * @param {string} didUpdatePayload The DID Update Payload to generate the signal for.
28
+ * Generates a Beacon Signal for a Singleton Beacon Service.
29
+ * @param {HexString} updateHash The update hash to be included in the Beacon Signal.
51
30
  * @returns {BeaconSignal} The generated signal.
52
31
  * @throws {MethodError} if the signal is invalid.
53
32
  */
54
- generateSignal(didUpdatePayload: string): BeaconSignal;
33
+ generateSignal(updateHash: HexString): BeaconSignal;
55
34
  /**
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.
35
+ * Processes an array of Beacon Signals associated with a Singleton Beacon Service.
36
+ * @returns {Promise<BTCR2SignedUpdate | undefined>} The DID Update payload announced by the Beacon Signal.
37
+ * @throws {SingletonBeaconError} if the signalTx is invalid or the signalSidecarData is invalid.
70
38
  */
71
- processSignal(signal: RawTransactionV2 | RawTransactionRest, signalsMetadata: SignalsMetadata): Promise<DidUpdatePayload | undefined>;
39
+ processSignals(): Promise<Array<[BTCR2SignedUpdate, BlockMetadata]>>;
72
40
  /**
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
- *
41
+ * Broadcasts a SingletonBeacon signal.
84
42
  * TODO: Design and implement a way to construct, sign and send via RPC
85
43
  *
86
- * @param {DidUpdatePayload} didUpdatePayload The verificationMethod object to be used for signing.
87
44
  * @returns {SignedRawTx} Successful output of a bitcoin transaction.
88
45
  * @throws {SingletonBeaconError} if the bitcoin address is invalid or unfunded.
89
46
  */
90
- broadcastSignal(didUpdatePayload: DidUpdatePayload): Promise<SignalsMetadata>;
47
+ broadcastSignal(updateHash: HexString): Promise<HexString>;
91
48
  }
@@ -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;AAC9H,OAAO,EAAE,gBAAgB,EAAqE,MAAM,mBAAmB,CAAC;AAKxH,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AACjF,OAAO,EAAE,iBAAiB,EAAY,eAAe,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAMtG;;;;;;;;;;;;GAYG;AACH,qBAAa,eAAgB,SAAQ,MAAM;IAEzC;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E,OAAO,EAAE,KAAK,CAAC,YAAY,CAAC,EAAE,OAAO,EAAE,WAAW,GAAG,eAAe;IAI7G;;;;;OAKG;IACH,cAAc,CAAC,UAAU,EAAE,SAAS,GAAG,YAAY;IAInD;;;;OAIG;IACG,cAAc,IAAI,OAAO,CAAC,KAAK,CAAC,CAAC,iBAAiB,EAAE,aAAa,CAAC,CAAC,CAAC;IA2C1E;;;;;;OAMG;IACG,eAAe,CAAC,UAAU,EAAE,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC;CAwEjE"}
@@ -0,0 +1,48 @@
1
+ import { BitcoinNetworkConnection } from '@did-btcr2/bitcoin';
2
+ import { HexString } from '@did-btcr2/common';
3
+ import { BTCR2SignedUpdate } from '@did-btcr2/cryptosuite';
4
+ import { SidecarData } from '../types.js';
5
+ import { AggregateBeacon, BeaconService, BeaconSignal, BlockMetadata } from './interfaces.js';
6
+ /**
7
+ * TODO: Finish implementation
8
+ * Implements {@link https://dcdpr.github.io/did-btcr2/terminology.html#smt-beacon | SMTBeacon}.
9
+ * @class SMTBeacon
10
+ * @type {SMTBeacon}
11
+ * @extends {AggregateBeacon}
12
+ */
13
+ export declare class SMTBeacon extends AggregateBeacon {
14
+ /**
15
+ * Creates an instance of SingletonBeacon.
16
+ * @param {BeaconService} service The Beacon service.
17
+ * @param {Array<BeaconSignal>} signals The SingletonBeacon sidecar data.
18
+ * @param {SidecarData} sidecar The sidecar data.
19
+ */
20
+ constructor(service: BeaconService, signals: Array<BeaconSignal>, sidecar: SidecarData, bitcoin?: BitcoinNetworkConnection);
21
+ /**
22
+ * Static, convenience method for establishing a SMTBeacon object.
23
+ * @param {string} service The Beacon service.
24
+ * @param {SidecarData} sidecar The sidecar data.
25
+ * @returns {SingletonBeacon} The Singleton Beacon.
26
+ */
27
+ static establish(service: BeaconService, signals: Array<BeaconSignal>, sidecar: SidecarData): SMTBeacon;
28
+ /**
29
+ * TODO: Figure out if this is necessary or not.
30
+ * @param {HexString} updateHash The hash of the BTCR2 update to generate the signal for.
31
+ * @returns {BeaconSignal} The generated signal.
32
+ * @throws {MethodError} if the signal is invalid.
33
+ */
34
+ generateSignal(updateHash: HexString): BeaconSignal;
35
+ /**
36
+ * Process SMTBeacon signals.
37
+ * @returns {Promise<Array<BTCR2SignedUpdate>>} The processed signed update or undefined.
38
+ * @throws {MethodError} if the signal processing fails.
39
+ */
40
+ processSignals(): Promise<Array<[BTCR2SignedUpdate, BlockMetadata]>>;
41
+ /**
42
+ * Broadcast a SMTBeacon signal.
43
+ * @param {HexString} updateHash The hash of the BTCR2 update to broadcast.
44
+ * @returns {Promise<SignalsMetadata>} The result of the broadcast.
45
+ * @throws {MethodError} if the broadcast fails.
46
+ */
47
+ broadcastSignal(updateHash: HexString): Promise<HexString>;
48
+ }
@@ -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,SAAS,EAAe,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAE9F;;;;;;GAMG;AACH,qBAAa,SAAU,SAAQ,eAAe;IAC5C;;;;;OAKG;gBAED,OAAO,EAAE,aAAa,EACtB,OAAO,EAAE,KAAK,CAAC,YAAY,CAAC,EAC5B,OAAO,EAAE,WAAW,EACpB,OAAO,CAAC,EAAE,wBAAwB;IAKpC;;;;;OAKG;IACH,MAAM,CAAC,SAAS,CAAC,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,KAAK,CAAC,YAAY,CAAC,EAAE,OAAO,EAAE,WAAW,GAAG,SAAS;IAIvG;;;;;OAKG;IACH,cAAc,CAAC,UAAU,EAAE,SAAS,GAAG,YAAY;IAInD;;;;OAIG;IACG,cAAc,IAAI,OAAO,CAAC,KAAK,CAAC,CAAC,iBAAiB,EAAE,aAAa,CAAC,CAAC,CAAC;IAK1E;;;;;OAKG;IACG,eAAe,CAAC,UAAU,EAAE,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC;CAIjE"}
@@ -1,32 +1,7 @@
1
1
  import { KeyBytes, Maybe } from '@did-btcr2/common';
2
2
  import { networks } from 'bitcoinjs-lib';
3
- import { BeaconService, BeaconServiceAddress } from '../../interfaces/beacon.js';
4
3
  import { DidDocument } from '../../utils/did-document.js';
5
- export interface GenerateBeaconParams {
6
- identifier: string;
7
- publicKey: KeyBytes;
8
- network: networks.Network;
9
- type: string;
10
- }
11
- /**
12
- * Required parameters for generating Beacon Services.
13
- * @interface GenerateBitcoinAddrsParams
14
- * @type {GenerateBitcoinAddrsParams}
15
- */
16
- export interface GenerateBitcoinAddrsParams {
17
- publicKey: KeyBytes;
18
- network: networks.Network;
19
- }
20
- /**
21
- * Required parameters for generating Beacon Services.
22
- * @interface GenerateBeaconServicesParams
23
- * @type {GenerateBeaconServicesParams}
24
- */
25
- export interface GenerateBeaconServicesParams {
26
- publicKey: KeyBytes;
27
- network: networks.Network;
28
- beaconType: string;
29
- }
4
+ import { BeaconService } from './interfaces.js';
30
5
  /**
31
6
  * Static class of utility functions for the Beacon Service
32
7
  * @class BeaconUtils
@@ -54,98 +29,45 @@ export declare class BeaconUtils {
54
29
  */
55
30
  static getBeaconServices(didDocument: DidDocument): BeaconService[];
56
31
  /**
57
- * Generate all 3 Beacon Service Endpoints for a given public key.
58
- * @param {GenerateBitcoinAddrsParams} params Required parameters for generating Beacon Services.
59
- * @param {KeyBytes} params.publicKey Public key bytes used to generate the beacon object serviceEndpoint.
60
- * @param {Network} params.network Bitcoin network interface from bitcoinlib-js.
32
+ * Create the 3 default Beacon Service Endpoints for a given `k` (public-key-based) identifier.
33
+ * @param {string} did The DID for which to create the beacon services.
61
34
  * @returns {Array<Array<string>>} 2D Array of bitcoin addresses (p2pkh, p2wpkh, p2tr).
62
35
  * @throws {DidMethodError} if the bitcoin address is invalid.
63
36
  */
64
- static generateBeaconAddresses({ identifier, publicKey, network }: {
65
- identifier: string;
66
- publicKey: KeyBytes;
67
- network: networks.Network;
68
- }): Array<Array<string>>;
37
+ static createBeaconServices(did: string, beaconType: string): Array<BeaconService>;
69
38
  /**
70
39
  * Generate a set of Beacon Services for a given public key.
71
- * @param {GenerateBeaconServicesParams} params Required parameters for generating Beacon Services.
72
- * @param {KeyBytes} params.publicKey Public key bytes used to generate the beacon object serviceEndpoint.
73
- * @param {Network} params.network Bitcoin network interface from bitcoinlib-js.
74
- * @param {string} params.beaconType The type of beacon service to create.
75
- * @param {string} params.addressType The type of address to create (p2pkh, p2wpkh, p2tr).
40
+ * @param {string} did The did for the beacon service.
41
+ * @param {string} addressType The type of bitcoin address to generate (p2pkh, p2wpkh, p2tr).
42
+ * @param {string} beaconType The type of beacon service to create.
76
43
  * @returns {BeaconService} A BeaconService object.
77
44
  * @throws {DidMethodError} if the bitcoin address is invalid.
78
45
  */
79
- static generateBeaconService({ id, publicKey: pubkey, network, addressType, type }: {
80
- id: string;
81
- publicKey: KeyBytes;
82
- network: networks.Network;
83
- addressType: 'p2pkh' | 'p2wpkh' | 'p2tr';
84
- type: string;
85
- }): BeaconService;
46
+ static createBeaconService(did: string, addressType: 'p2pkh' | 'p2wpkh' | 'p2tr', beaconType: string): BeaconService;
86
47
  /**
87
- * Generate a custom Beacon Service.
88
- * @param {GenerateBeaconServicesParams} params Required parameters for generating Beacon Services.
89
- * @returns
48
+ * Generate three default Beacon Service Endpoints for a given `k` (public-key-based) identifier.
49
+ * @param {string} did The DID for which to create the beacon services.
50
+ * @returns {Array<Array<string>>} 2D Array of bitcoin addresses (p2pkh, p2wpkh, p2tr).
51
+ * @throws {DidMethodError} if the bitcoin address is invalid.
90
52
  */
91
- static generateBeaconServiceCustom({ id, publicKey: pubkey, network, addressType, type }: {
53
+ static generateBeaconServices({ id, publicKey, network, beaconType }: {
92
54
  id: string;
93
55
  publicKey: KeyBytes;
94
56
  network: networks.Network;
95
- addressType: 'p2pkh' | 'p2wpkh' | 'p2tr';
96
- type: string;
97
- }): BeaconService;
98
- /**
99
- * Generate beacon services.
100
- * @param {GenerateBeaconServicesParams} params Required parameters for generating Beacon Services.
101
- * @param {string} params.network The name of the Bitcoin network to use.
102
- * @param {Uint8Array} params.publicKey Byte array representation of a public key used to generate a new btcr2 key-id-type.
103
- * @param {string} params.beaconType Optional beacon type to use (default: SingletonBeacon).
104
- * @returns {DidService[]} Array of DidService objects.
105
- */
106
- static generateBeaconServices({ identifier, network, type, publicKey }: {
107
- identifier: string;
108
- publicKey: KeyBytes;
109
- network: networks.Network;
110
- type: string;
57
+ beaconType: string;
111
58
  }): Array<BeaconService>;
112
- /**
113
- * Generate a single beacon service.
114
- * @param {GenerateBeaconParams} params Required parameters for generating a single Beacon Service.
115
- * @param {string} params.identifier The identifier for the beacon service.
116
- * @param {string} params.network The name of the Bitcoin network to use.
117
- * @param {Uint8Array} params.publicKey Byte array representation of a public key used to generate a new btcr2 key-id-type.
118
- * @param {string} params.type The type of beacon service to create.
119
- * @returns {BeaconService} A BeaconService object.
120
- * @throws {DidMethodError} if the bitcoin address is invalid.
121
- */
122
- static generateBeacon({ identifier, network, type, publicKey }: {
123
- identifier: string;
124
- publicKey: KeyBytes;
125
- network: networks.Network;
126
- type: string;
127
- }): BeaconService;
128
- /**
129
- * Manufacture a pre-filled Beacon using the BeaconFactory.
130
- * @param {BeaconServicesParams} params Required parameters for generating a single Beacon Service.
131
- * @param {string} params.serviceId The type of service being created (#initialP2PKH, #initialP2WPKH, #initialP2TR).
132
- * @param {string} params.beaconType The type of beacon service being created (SingletonBeacon, SMTAggregatorBeacon).
133
- * @param {string} params.bitcoinAddress The bitcoin address to use for the service endpoint.
134
- * @returns {BeaconService} One BeaconService object.
135
- */
136
- static manufactureBeacon(params: BeaconService): BeaconService;
137
59
  /**
138
60
  * Convert beacon service endpoints from BIP-21 URIs to addresses.
139
- * @param {Array<BeaconService>} beacons The list of beacon services.
140
- * @returns {Array<BeaconServiceAddress>} An array of beacon services with address: bitcoinAddress.
61
+ * @param {BeaconService} beacon The beacon service to parse.
62
+ * @returns {BeaconServiceAddress} The beacon service with the address field extracted from the serviceEndpoint.
141
63
  */
142
- static toBeaconServiceAddress(beacons: Array<BeaconService>): Array<BeaconServiceAddress>;
64
+ static parseBeaconServiceEndpoint(beacon: BeaconService): BeaconService;
143
65
  /**
144
66
  * Create a map of address => beaconService with address field.
145
67
  * @param {Array<BeaconService>} beacons The list of beacon services.
146
- * @returns {Map<string, BeaconServiceAddress>} A map of address => beaconService.
68
+ * @returns {Map<string, BeaconService>} A map of address => beaconService.
147
69
  */
148
- static getBeaconServiceAddressMap(beacons: Array<BeaconService>): Map<string, BeaconServiceAddress>;
70
+ static getBeaconServicesMap(beacons: Array<BeaconService>): Map<string, BeaconService>;
149
71
  /**
150
72
  * Get the beacon service ids from a list of beacon services.
151
73
  * @param {DidDocument} didDocument The DID Document to extract the services from.