@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.
- package/dist/browser.js +5240 -6079
- package/dist/browser.mjs +5240 -6079
- package/dist/cjs/core/beacon/aggregation/cohort/index.js +3 -3
- package/dist/cjs/core/beacon/aggregation/cohort/index.js.map +1 -1
- package/dist/cjs/core/beacon/aggregation/cohort/messages/base.js +1 -9
- package/dist/cjs/core/beacon/aggregation/cohort/messages/base.js.map +1 -1
- package/dist/cjs/core/beacon/aggregation/cohort/messages/keygen/cohort-advert.js +2 -1
- package/dist/cjs/core/beacon/aggregation/cohort/messages/keygen/cohort-advert.js.map +1 -1
- package/dist/cjs/core/beacon/aggregation/cohort/messages/keygen/cohort-ready.js +2 -1
- package/dist/cjs/core/beacon/aggregation/cohort/messages/keygen/cohort-ready.js.map +1 -1
- package/dist/cjs/core/beacon/aggregation/cohort/messages/keygen/opt-in-accept.js +2 -1
- package/dist/cjs/core/beacon/aggregation/cohort/messages/keygen/opt-in-accept.js.map +1 -1
- package/dist/cjs/core/beacon/aggregation/cohort/messages/keygen/opt-in.js +2 -1
- package/dist/cjs/core/beacon/aggregation/cohort/messages/keygen/opt-in.js.map +1 -1
- package/dist/cjs/core/beacon/aggregation/cohort/messages/keygen/subscribe.js +2 -1
- package/dist/cjs/core/beacon/aggregation/cohort/messages/keygen/subscribe.js.map +1 -1
- package/dist/cjs/core/beacon/aggregation/cohort/messages/sign/aggregated-nonce.js +2 -1
- package/dist/cjs/core/beacon/aggregation/cohort/messages/sign/aggregated-nonce.js.map +1 -1
- package/dist/cjs/core/beacon/aggregation/cohort/messages/sign/authorization-request.js +2 -1
- package/dist/cjs/core/beacon/aggregation/cohort/messages/sign/authorization-request.js.map +1 -1
- package/dist/cjs/core/beacon/aggregation/cohort/messages/sign/nonce-contribution.js +2 -1
- package/dist/cjs/core/beacon/aggregation/cohort/messages/sign/nonce-contribution.js.map +1 -1
- package/dist/cjs/core/beacon/aggregation/cohort/messages/sign/request-signature.js +2 -1
- package/dist/cjs/core/beacon/aggregation/cohort/messages/sign/request-signature.js.map +1 -1
- package/dist/cjs/core/beacon/aggregation/cohort/messages/sign/signature-authorization.js +2 -1
- package/dist/cjs/core/beacon/aggregation/cohort/messages/sign/signature-authorization.js.map +1 -1
- package/dist/cjs/core/beacon/aggregation/communication/adapter/nostr.js +36 -18
- package/dist/cjs/core/beacon/aggregation/communication/adapter/nostr.js.map +1 -1
- package/dist/cjs/core/beacon/aggregation/coordinator.js +14 -14
- package/dist/cjs/core/beacon/aggregation/coordinator.js.map +1 -1
- package/dist/cjs/core/beacon/aggregation/participant.js +4 -3
- package/dist/cjs/core/beacon/aggregation/participant.js.map +1 -1
- package/dist/cjs/core/beacon/aggregation/session/index.js +1 -1
- package/dist/cjs/core/beacon/aggregation/session/index.js.map +1 -1
- package/dist/cjs/core/beacon/cas-beacon.js +55 -0
- package/dist/cjs/core/beacon/cas-beacon.js.map +1 -0
- package/dist/cjs/core/beacon/factory.js +11 -10
- package/dist/cjs/core/beacon/factory.js.map +1 -1
- package/dist/cjs/core/beacon/interfaces.js +32 -0
- package/dist/cjs/core/beacon/interfaces.js.map +1 -0
- package/dist/cjs/core/beacon/singleton.js +59 -135
- package/dist/cjs/core/beacon/singleton.js.map +1 -1
- package/dist/cjs/core/beacon/smt-beacon.js +56 -0
- package/dist/cjs/core/beacon/smt-beacon.js.map +1 -0
- package/dist/cjs/core/beacon/utils.js +67 -105
- package/dist/cjs/core/beacon/utils.js.map +1 -1
- package/dist/cjs/core/identifier.js +18 -21
- package/dist/cjs/core/identifier.js.map +1 -1
- package/dist/cjs/core/interfaces.js +2 -0
- package/dist/cjs/core/interfaces.js.map +1 -0
- package/dist/cjs/core/resolve.js +511 -0
- package/dist/cjs/core/resolve.js.map +1 -0
- package/dist/cjs/{utils → core}/types.js.map +1 -1
- package/dist/cjs/core/{crud/update.js → update.js} +62 -52
- package/dist/cjs/core/update.js.map +1 -0
- package/dist/cjs/did-btcr2.js +109 -75
- package/dist/cjs/did-btcr2.js.map +1 -1
- package/dist/cjs/index.js +14 -15
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/utils/appendix.js +10 -18
- package/dist/cjs/utils/appendix.js.map +1 -1
- package/dist/cjs/utils/did-document.js +51 -58
- package/dist/cjs/utils/did-document.js.map +1 -1
- package/dist/cjs/utils/general.js +1 -1
- package/dist/cjs/utils/general.js.map +1 -1
- package/dist/esm/core/beacon/aggregation/cohort/index.js +3 -3
- package/dist/esm/core/beacon/aggregation/cohort/index.js.map +1 -1
- package/dist/esm/core/beacon/aggregation/cohort/messages/base.js +1 -9
- package/dist/esm/core/beacon/aggregation/cohort/messages/base.js.map +1 -1
- package/dist/esm/core/beacon/aggregation/cohort/messages/keygen/cohort-advert.js +2 -1
- package/dist/esm/core/beacon/aggregation/cohort/messages/keygen/cohort-advert.js.map +1 -1
- package/dist/esm/core/beacon/aggregation/cohort/messages/keygen/cohort-ready.js +2 -1
- package/dist/esm/core/beacon/aggregation/cohort/messages/keygen/cohort-ready.js.map +1 -1
- package/dist/esm/core/beacon/aggregation/cohort/messages/keygen/opt-in-accept.js +2 -1
- package/dist/esm/core/beacon/aggregation/cohort/messages/keygen/opt-in-accept.js.map +1 -1
- package/dist/esm/core/beacon/aggregation/cohort/messages/keygen/opt-in.js +2 -1
- package/dist/esm/core/beacon/aggregation/cohort/messages/keygen/opt-in.js.map +1 -1
- package/dist/esm/core/beacon/aggregation/cohort/messages/keygen/subscribe.js +2 -1
- package/dist/esm/core/beacon/aggregation/cohort/messages/keygen/subscribe.js.map +1 -1
- package/dist/esm/core/beacon/aggregation/cohort/messages/sign/aggregated-nonce.js +2 -1
- package/dist/esm/core/beacon/aggregation/cohort/messages/sign/aggregated-nonce.js.map +1 -1
- package/dist/esm/core/beacon/aggregation/cohort/messages/sign/authorization-request.js +2 -1
- package/dist/esm/core/beacon/aggregation/cohort/messages/sign/authorization-request.js.map +1 -1
- package/dist/esm/core/beacon/aggregation/cohort/messages/sign/nonce-contribution.js +2 -1
- package/dist/esm/core/beacon/aggregation/cohort/messages/sign/nonce-contribution.js.map +1 -1
- package/dist/esm/core/beacon/aggregation/cohort/messages/sign/request-signature.js +2 -1
- package/dist/esm/core/beacon/aggregation/cohort/messages/sign/request-signature.js.map +1 -1
- package/dist/esm/core/beacon/aggregation/cohort/messages/sign/signature-authorization.js +2 -1
- package/dist/esm/core/beacon/aggregation/cohort/messages/sign/signature-authorization.js.map +1 -1
- package/dist/esm/core/beacon/aggregation/communication/adapter/nostr.js +36 -18
- package/dist/esm/core/beacon/aggregation/communication/adapter/nostr.js.map +1 -1
- package/dist/esm/core/beacon/aggregation/coordinator.js +14 -14
- package/dist/esm/core/beacon/aggregation/coordinator.js.map +1 -1
- package/dist/esm/core/beacon/aggregation/participant.js +4 -3
- package/dist/esm/core/beacon/aggregation/participant.js.map +1 -1
- package/dist/esm/core/beacon/aggregation/session/index.js +1 -1
- package/dist/esm/core/beacon/aggregation/session/index.js.map +1 -1
- package/dist/esm/core/beacon/cas-beacon.js +55 -0
- package/dist/esm/core/beacon/cas-beacon.js.map +1 -0
- package/dist/esm/core/beacon/factory.js +11 -10
- package/dist/esm/core/beacon/factory.js.map +1 -1
- package/dist/esm/core/beacon/interfaces.js +32 -0
- package/dist/esm/core/beacon/interfaces.js.map +1 -0
- package/dist/esm/core/beacon/singleton.js +59 -135
- package/dist/esm/core/beacon/singleton.js.map +1 -1
- package/dist/esm/core/beacon/smt-beacon.js +56 -0
- package/dist/esm/core/beacon/smt-beacon.js.map +1 -0
- package/dist/esm/core/beacon/utils.js +67 -105
- package/dist/esm/core/beacon/utils.js.map +1 -1
- package/dist/esm/core/identifier.js +18 -21
- package/dist/esm/core/identifier.js.map +1 -1
- package/dist/esm/core/interfaces.js +2 -0
- package/dist/esm/core/interfaces.js.map +1 -0
- package/dist/esm/core/resolve.js +511 -0
- package/dist/esm/core/resolve.js.map +1 -0
- package/dist/esm/{utils → core}/types.js.map +1 -1
- package/dist/esm/core/{crud/update.js → update.js} +62 -52
- package/dist/esm/core/update.js.map +1 -0
- package/dist/esm/did-btcr2.js +109 -75
- package/dist/esm/did-btcr2.js.map +1 -1
- package/dist/esm/index.js +14 -15
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/utils/appendix.js +10 -18
- package/dist/esm/utils/appendix.js.map +1 -1
- package/dist/esm/utils/did-document.js +51 -58
- package/dist/esm/utils/did-document.js.map +1 -1
- package/dist/esm/utils/general.js +1 -1
- package/dist/esm/utils/general.js.map +1 -1
- package/dist/types/core/beacon/aggregation/cohort/index.d.ts +1 -1
- package/dist/types/core/beacon/aggregation/cohort/messages/base.d.ts +0 -7
- package/dist/types/core/beacon/aggregation/cohort/messages/base.d.ts.map +1 -1
- package/dist/types/core/beacon/aggregation/cohort/messages/keygen/cohort-advert.d.ts.map +1 -1
- package/dist/types/core/beacon/aggregation/cohort/messages/keygen/cohort-ready.d.ts.map +1 -1
- package/dist/types/core/beacon/aggregation/cohort/messages/keygen/opt-in-accept.d.ts.map +1 -1
- package/dist/types/core/beacon/aggregation/cohort/messages/keygen/opt-in.d.ts.map +1 -1
- package/dist/types/core/beacon/aggregation/cohort/messages/keygen/subscribe.d.ts.map +1 -1
- package/dist/types/core/beacon/aggregation/cohort/messages/sign/aggregated-nonce.d.ts.map +1 -1
- package/dist/types/core/beacon/aggregation/cohort/messages/sign/authorization-request.d.ts.map +1 -1
- package/dist/types/core/beacon/aggregation/cohort/messages/sign/nonce-contribution.d.ts.map +1 -1
- package/dist/types/core/beacon/aggregation/cohort/messages/sign/request-signature.d.ts.map +1 -1
- package/dist/types/core/beacon/aggregation/cohort/messages/sign/signature-authorization.d.ts.map +1 -1
- package/dist/types/core/beacon/aggregation/communication/adapter/nostr.d.ts +13 -5
- package/dist/types/core/beacon/aggregation/communication/adapter/nostr.d.ts.map +1 -1
- package/dist/types/core/beacon/aggregation/coordinator.d.ts +17 -29
- package/dist/types/core/beacon/aggregation/coordinator.d.ts.map +1 -1
- package/dist/types/core/beacon/aggregation/participant.d.ts.map +1 -1
- package/dist/types/core/beacon/cas-beacon.d.ts +47 -0
- package/dist/types/core/beacon/cas-beacon.d.ts.map +1 -0
- package/dist/types/core/beacon/factory.d.ts +5 -4
- package/dist/types/core/beacon/factory.d.ts.map +1 -1
- package/dist/types/core/beacon/interfaces.d.ts +98 -0
- package/dist/types/core/beacon/interfaces.d.ts.map +1 -0
- package/dist/types/core/beacon/singleton.d.ts +22 -65
- package/dist/types/core/beacon/singleton.d.ts.map +1 -1
- package/dist/types/core/beacon/smt-beacon.d.ts +48 -0
- package/dist/types/core/beacon/smt-beacon.d.ts.map +1 -0
- package/dist/types/core/beacon/utils.d.ts +19 -97
- package/dist/types/core/beacon/utils.d.ts.map +1 -1
- package/dist/types/core/identifier.d.ts.map +1 -1
- package/dist/types/core/interfaces.d.ts +94 -0
- package/dist/types/core/interfaces.d.ts.map +1 -0
- package/dist/types/core/resolve.d.ts +105 -0
- package/dist/types/core/resolve.d.ts.map +1 -0
- package/dist/types/core/types.d.ts +71 -0
- package/dist/types/core/types.d.ts.map +1 -0
- package/dist/types/core/{crud/update.d.ts → update.d.ts} +21 -20
- package/dist/types/core/update.d.ts.map +1 -0
- package/dist/types/did-btcr2.d.ts +45 -57
- package/dist/types/did-btcr2.d.ts.map +1 -1
- package/dist/types/index.d.ts +14 -15
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/utils/appendix.d.ts +5 -10
- package/dist/types/utils/appendix.d.ts.map +1 -1
- package/dist/types/utils/did-document-builder.d.ts +1 -1
- package/dist/types/utils/did-document-builder.d.ts.map +1 -1
- package/dist/types/utils/did-document.d.ts +31 -29
- package/dist/types/utils/did-document.d.ts.map +1 -1
- package/package.json +5 -5
- package/src/core/beacon/aggregation/cohort/index.ts +3 -3
- package/src/core/beacon/aggregation/cohort/messages/base.ts +1 -12
- package/src/core/beacon/aggregation/cohort/messages/keygen/cohort-advert.ts +2 -2
- package/src/core/beacon/aggregation/cohort/messages/keygen/cohort-ready.ts +2 -2
- package/src/core/beacon/aggregation/cohort/messages/keygen/opt-in-accept.ts +2 -2
- package/src/core/beacon/aggregation/cohort/messages/keygen/opt-in.ts +2 -2
- package/src/core/beacon/aggregation/cohort/messages/keygen/subscribe.ts +2 -2
- package/src/core/beacon/aggregation/cohort/messages/sign/aggregated-nonce.ts +2 -2
- package/src/core/beacon/aggregation/cohort/messages/sign/authorization-request.ts +2 -2
- package/src/core/beacon/aggregation/cohort/messages/sign/nonce-contribution.ts +2 -2
- package/src/core/beacon/aggregation/cohort/messages/sign/request-signature.ts +2 -2
- package/src/core/beacon/aggregation/cohort/messages/sign/signature-authorization.ts +2 -2
- package/src/core/beacon/aggregation/communication/adapter/nostr.ts +43 -21
- package/src/core/beacon/aggregation/coordinator.ts +41 -29
- package/src/core/beacon/aggregation/participant.ts +4 -3
- package/src/core/beacon/aggregation/session/index.ts +1 -1
- package/src/core/beacon/cas-beacon.ts +67 -0
- package/src/core/beacon/factory.ts +13 -15
- package/src/core/beacon/interfaces.ts +124 -0
- package/src/core/beacon/singleton.ts +75 -145
- package/src/core/beacon/smt-beacon.ts +70 -0
- package/src/core/beacon/utils.ts +80 -170
- package/src/core/identifier.ts +21 -24
- package/src/core/interfaces.ts +101 -0
- package/src/core/resolve.ts +707 -0
- package/src/core/types.ts +78 -0
- package/src/core/{crud/update.ts → update.ts} +75 -68
- package/src/did-btcr2.ts +152 -92
- package/src/index.ts +14 -24
- package/src/utils/appendix.ts +18 -22
- package/src/utils/did-document-builder.ts +1 -1
- package/src/utils/did-document.ts +67 -71
- package/src/utils/general.ts +1 -1
- package/dist/cjs/core/beacon/cid-aggregate.js +0 -116
- package/dist/cjs/core/beacon/cid-aggregate.js.map +0 -1
- package/dist/cjs/core/beacon/smt-aggregate.js +0 -126
- package/dist/cjs/core/beacon/smt-aggregate.js.map +0 -1
- package/dist/cjs/core/crud/deactivate.js +0 -14
- package/dist/cjs/core/crud/deactivate.js.map +0 -1
- package/dist/cjs/core/crud/read.js +0 -679
- package/dist/cjs/core/crud/read.js.map +0 -1
- package/dist/cjs/core/crud/update.js.map +0 -1
- package/dist/cjs/interfaces/beacon.js +0 -41
- package/dist/cjs/interfaces/beacon.js.map +0 -1
- package/dist/cjs/interfaces/crud.js +0 -2
- package/dist/cjs/interfaces/crud.js.map +0 -1
- package/dist/esm/core/beacon/cid-aggregate.js +0 -116
- package/dist/esm/core/beacon/cid-aggregate.js.map +0 -1
- package/dist/esm/core/beacon/smt-aggregate.js +0 -126
- package/dist/esm/core/beacon/smt-aggregate.js.map +0 -1
- package/dist/esm/core/crud/deactivate.js +0 -14
- package/dist/esm/core/crud/deactivate.js.map +0 -1
- package/dist/esm/core/crud/read.js +0 -679
- package/dist/esm/core/crud/read.js.map +0 -1
- package/dist/esm/core/crud/update.js.map +0 -1
- package/dist/esm/interfaces/beacon.js +0 -41
- package/dist/esm/interfaces/beacon.js.map +0 -1
- package/dist/esm/interfaces/crud.js +0 -2
- package/dist/esm/interfaces/crud.js.map +0 -1
- package/dist/types/core/beacon/cid-aggregate.d.ts +0 -102
- package/dist/types/core/beacon/cid-aggregate.d.ts.map +0 -1
- package/dist/types/core/beacon/smt-aggregate.d.ts +0 -111
- package/dist/types/core/beacon/smt-aggregate.d.ts.map +0 -1
- package/dist/types/core/crud/deactivate.d.ts +0 -13
- package/dist/types/core/crud/deactivate.d.ts.map +0 -1
- package/dist/types/core/crud/read.d.ts +0 -334
- package/dist/types/core/crud/read.d.ts.map +0 -1
- package/dist/types/core/crud/update.d.ts.map +0 -1
- package/dist/types/interfaces/beacon.d.ts +0 -116
- package/dist/types/interfaces/beacon.d.ts.map +0 -1
- package/dist/types/interfaces/crud.d.ts +0 -32
- package/dist/types/interfaces/crud.d.ts.map +0 -1
- package/dist/types/utils/types.d.ts +0 -38
- package/dist/types/utils/types.d.ts.map +0 -1
- package/src/canonicalize.d.ts +0 -6
- package/src/core/beacon/cid-aggregate.ts +0 -153
- package/src/core/beacon/smt-aggregate.ts +0 -135
- package/src/core/crud/deactivate.ts +0 -13
- package/src/core/crud/read.ts +0 -948
- package/src/interfaces/beacon.ts +0 -137
- package/src/interfaces/crud.ts +0 -33
- package/src/utils/types.ts +0 -41
- /package/dist/cjs/{utils → core}/types.js +0 -0
- /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
|
-
|
|
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:
|
|
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='
|
|
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,
|
|
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;;;;;;;GAOG;AACH,MAAM,MAAM,uBAAuB,GAAG;IACpC,QAAQ,CAAC,EAAE,oBAAoB,CAAC;IAChC,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,sBAAsB,CAAC,iBA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AAE,qBAAqB,EAAE,OAAO,EAAE,0BAA0B,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 {
|
|
2
|
-
import {
|
|
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 {
|
|
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
|
|
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,
|
|
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,EA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AAO,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 {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
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
|
|
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 {
|
|
11
|
+
* @extends {AggregateBeacon}
|
|
17
12
|
*/
|
|
18
|
-
export declare class SingletonBeacon extends
|
|
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}
|
|
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
|
-
|
|
19
|
+
constructor(service: BeaconService, signals: Array<BeaconSignal>, sidecar: SidecarData, bitcoin?: BitcoinNetworkConnection);
|
|
31
20
|
/**
|
|
32
|
-
*
|
|
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 {
|
|
23
|
+
* @param {SidecarData} sidecar The sidecar data.
|
|
45
24
|
* @returns {SingletonBeacon} The Singleton Beacon.
|
|
46
25
|
*/
|
|
47
|
-
static establish(service: BeaconService, sidecar:
|
|
26
|
+
static establish(service: BeaconService, signals: Array<BeaconSignal>, sidecar: SidecarData): SingletonBeacon;
|
|
48
27
|
/**
|
|
49
|
-
*
|
|
50
|
-
* @param {
|
|
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(
|
|
33
|
+
generateSignal(updateHash: HexString): BeaconSignal;
|
|
55
34
|
/**
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
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
|
-
|
|
39
|
+
processSignals(): Promise<Array<[BTCR2SignedUpdate, BlockMetadata]>>;
|
|
72
40
|
/**
|
|
73
|
-
*
|
|
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(
|
|
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,
|
|
1
|
+
{"version":3,"file":"singleton.d.ts","sourceRoot":"","sources":["../../../../src/core/beacon/singleton.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAC3E,OAAO,EAAE,SAAS,EAAgF,MAAM,mBAAmB,CAAC;AAC5H,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAO3D,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,eAAgB,SAAQ,eAAe;IAElD;;;;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,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
|
-
|
|
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
|
-
*
|
|
58
|
-
* @param {
|
|
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
|
|
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 {
|
|
72
|
-
* @param {
|
|
73
|
-
* @param {
|
|
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
|
|
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
|
|
88
|
-
* @param {
|
|
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
|
|
53
|
+
static generateBeaconServices({ id, publicKey, network, beaconType }: {
|
|
92
54
|
id: string;
|
|
93
55
|
publicKey: KeyBytes;
|
|
94
56
|
network: networks.Network;
|
|
95
|
-
|
|
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 {
|
|
140
|
-
* @returns {
|
|
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
|
|
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,
|
|
68
|
+
* @returns {Map<string, BeaconService>} A map of address => beaconService.
|
|
147
69
|
*/
|
|
148
|
-
static
|
|
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.
|