@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
package/src/interfaces/beacon.ts
DELETED
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
import { RawTransactionRest, RawTransactionV2 } from '@did-btcr2/bitcoin';
|
|
2
|
-
import { DidUpdatePayload, UnixTimestamp } from '@did-btcr2/common';
|
|
3
|
-
import { DidServiceEndpoint, DidService as IDidService } from '@web5/dids';
|
|
4
|
-
import { SidecarData, SignalsMetadata } from '../utils/types.js';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Beacon interface
|
|
8
|
-
* @interface IBeacon
|
|
9
|
-
* @type {IBeacon}
|
|
10
|
-
*/
|
|
11
|
-
export interface IBeacon {
|
|
12
|
-
/**
|
|
13
|
-
* A unique identifier for the Beacon
|
|
14
|
-
* @type {string}
|
|
15
|
-
*/
|
|
16
|
-
id: string;
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* The type of the Beacon
|
|
20
|
-
* @type {string}
|
|
21
|
-
*/
|
|
22
|
-
type: string;
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* The service endpoint of the Beacon
|
|
26
|
-
* @type {string}
|
|
27
|
-
*/
|
|
28
|
-
serviceEndpoint: DidServiceEndpoint;
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Returns the Beacon Service object
|
|
32
|
-
* @type {BeaconService}
|
|
33
|
-
*/
|
|
34
|
-
service: BeaconService;
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* Generates a Beacon Signal Transaction
|
|
38
|
-
* @param {string} didUpdatePayload The DID update payload
|
|
39
|
-
* @returns {BeaconSignal} The Beacon Signal
|
|
40
|
-
*/
|
|
41
|
-
generateSignal(didUpdatePayload: string): BeaconSignal;
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* Processes a Beacon Signal.
|
|
45
|
-
* @param {RawTransactionV2} signal The raw transaction
|
|
46
|
-
* @param {SidecarData} signalsMetadata The signals metadata from the sidecar data
|
|
47
|
-
* @returns {Promise<DidUpdatePayload | undefined>} The DID update payload
|
|
48
|
-
*/
|
|
49
|
-
processSignal(signal: RawTransactionV2, signalsMetadata: SignalsMetadata): Promise<DidUpdatePayload | undefined>;
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* Broadcasts a signal.
|
|
54
|
-
* @param {DidUpdatePayload} didUpdatePayload The DID update payload.
|
|
55
|
-
* @returns {Promise<SignalMetadata>} The signal metadata.
|
|
56
|
-
*/
|
|
57
|
-
broadcastSignal(didUpdatePayload: DidUpdatePayload): Promise<SignalsMetadata>;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
export interface BeaconService extends IDidService {
|
|
61
|
-
serviceEndpoint: DidServiceEndpoint;
|
|
62
|
-
casType?: string;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
export interface BeaconServiceAddress extends BeaconService {
|
|
66
|
-
address: string;
|
|
67
|
-
}
|
|
68
|
-
export interface BeaconSignal {
|
|
69
|
-
beaconId: string;
|
|
70
|
-
beaconType: string;
|
|
71
|
-
beaconAddress: string;
|
|
72
|
-
tx: RawTransactionRest | RawTransactionV2;
|
|
73
|
-
blockheight: number;
|
|
74
|
-
blocktime: UnixTimestamp;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* Implements {@link https://dcdpr.github.io/did-btcr2/#update-beacons | 5. Beacons}.
|
|
79
|
-
* Beacons are the mechanism by which a DID controller announces an update to their DID document by broadcasting an
|
|
80
|
-
* attestation to this update onto the public Bitcoin network. Beacons are identified by a Bitcoin address and emit
|
|
81
|
-
* Beacon Signals by broadcasting a valid Bitcoin transaction that spends from this Beacon address. These transactions
|
|
82
|
-
* include attestations to a set of didUpdatePayloads, either in the form of Content Identifiers (CIDs) or Sparse Merkle
|
|
83
|
-
* Tree (SMT) roots. Beacons are included as a service in DID documents, with the Service Endpoint identifying a Bitcoin
|
|
84
|
-
* address to watch for Beacon Signals. All Beacon Signals broadcast from this Beacon MUST be processed as part of
|
|
85
|
-
* resolution (see Read). The type of the Beacon service in the DID document defines how Beacon Signals SHOULD be
|
|
86
|
-
* processed.
|
|
87
|
-
* did:btcr2 supports different Beacon Types, with each type defining a set of algorithms for:
|
|
88
|
-
* 1. How a Beacon can be established and added as a service to a DID document.
|
|
89
|
-
* 2. How attestations to DID updates are broadcast within Beacon Signals.
|
|
90
|
-
* 3. How a resolver processes a Beacon Signal, identifying, verifying, and applying the authorized mutations to a
|
|
91
|
-
* DID document for a specific DID.
|
|
92
|
-
* This is an extendable mechanism, such that in the future new Beacon Types could be added. It would be up to the
|
|
93
|
-
* resolver to determine if the Beacon Type is a mechanism they support and are willing to trust. If they are unable to
|
|
94
|
-
* support a Beacon Type and a DID they are resolving uses that type then the DID MUST be treated as invalid.
|
|
95
|
-
* The current, active Beacons of a DID document are specified in the document’s service property. By updating the DID
|
|
96
|
-
* document, a DID controller can change the set of Beacons they can use to broadcast updates to their DID document over
|
|
97
|
-
* time. Resolution of a DID MUST process signals from all Beacons identified in the latest DID document and apply them
|
|
98
|
-
* in order determined by the version specified by the didUpdatePayload.
|
|
99
|
-
* All resolvers of did:btcr2 DIDs MUST support the core Beacon Types defined in this specification.
|
|
100
|
-
*
|
|
101
|
-
* @abstract
|
|
102
|
-
* @class Beacon
|
|
103
|
-
* @type {Beacon}
|
|
104
|
-
*/
|
|
105
|
-
export abstract class Beacon implements IBeacon {
|
|
106
|
-
public id: string;
|
|
107
|
-
public type: string;
|
|
108
|
-
public serviceEndpoint: DidServiceEndpoint;
|
|
109
|
-
public sidecar?: SidecarData;
|
|
110
|
-
|
|
111
|
-
constructor({ id, type, serviceEndpoint }: BeaconService, sidecar?: SidecarData) {
|
|
112
|
-
this.id = id;
|
|
113
|
-
this.type = type;
|
|
114
|
-
this.serviceEndpoint = serviceEndpoint;
|
|
115
|
-
this.sidecar = sidecar;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
/**
|
|
119
|
-
* Returns the Beacon Service object.
|
|
120
|
-
*/
|
|
121
|
-
abstract get service(): BeaconService;
|
|
122
|
-
|
|
123
|
-
/**
|
|
124
|
-
* Generates a Beacon Signal (implemented by subclasses).
|
|
125
|
-
*/
|
|
126
|
-
abstract generateSignal(didUpdatePayload: string): BeaconSignal;
|
|
127
|
-
|
|
128
|
-
/**
|
|
129
|
-
* Processes a Beacon Signal (implemented by subclasses).
|
|
130
|
-
*/
|
|
131
|
-
abstract processSignal(signal: RawTransactionRest | RawTransactionV2, signalsMetadata: SignalsMetadata): Promise<DidUpdatePayload | undefined>
|
|
132
|
-
|
|
133
|
-
/**
|
|
134
|
-
* Broadcasts a Beacon Signal (implemented by subclasses).
|
|
135
|
-
*/
|
|
136
|
-
abstract broadcastSignal(didUpdatePayload: DidUpdatePayload): Promise<SignalsMetadata>;
|
|
137
|
-
}
|
package/src/interfaces/crud.ts
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { UnixTimestamp } from '@did-btcr2/common';
|
|
2
|
-
import { DidResolutionOptions as IDidResolutionOptions } from '@web5/dids';
|
|
3
|
-
import { DidDocument } from '../utils/did-document.js';
|
|
4
|
-
import { SidecarData } from '../utils/types.js';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Options for resolving a DID Document
|
|
8
|
-
* @param {?number} versionId The versionId for resolving the DID Document
|
|
9
|
-
* @param {?UnixTimestamp} versionTime The versionTime for resolving the DID Document
|
|
10
|
-
* @param {?SidecarData} sidecarData The sidecar data for resolving the DID Document
|
|
11
|
-
*/
|
|
12
|
-
export interface DidResolutionOptions extends IDidResolutionOptions {
|
|
13
|
-
versionId?: number
|
|
14
|
-
versionTime?: UnixTimestamp;
|
|
15
|
-
sidecarData?: SidecarData;
|
|
16
|
-
network?: string;
|
|
17
|
-
}
|
|
18
|
-
export interface RootCapability {
|
|
19
|
-
'@context': string;
|
|
20
|
-
id: string;
|
|
21
|
-
controller: string;
|
|
22
|
-
invocationTarget: string;
|
|
23
|
-
}
|
|
24
|
-
export interface ReadBlockchainParams {
|
|
25
|
-
contemporaryDidDocument: DidDocument;
|
|
26
|
-
contemporaryBlockHeight: number | 1;
|
|
27
|
-
currentVersionId: number | 1;
|
|
28
|
-
targetVersionId?: number;
|
|
29
|
-
targetBlockHeight: number;
|
|
30
|
-
updateHashHistory: string[];
|
|
31
|
-
sidecarData?: SidecarData;
|
|
32
|
-
options?: DidResolutionOptions;
|
|
33
|
-
}
|
package/src/utils/types.ts
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { DidUpdatePayload, ProofBytes } from '@did-btcr2/common';
|
|
2
|
-
import { BeaconService } from '../interfaces/beacon.js';
|
|
3
|
-
import { DidDocument } from './did-document.js';
|
|
4
|
-
import { BlockV3 } from '@did-btcr2/bitcoin';
|
|
5
|
-
|
|
6
|
-
export type FindNextSignals = {
|
|
7
|
-
block: BlockV3;
|
|
8
|
-
beacons: BeaconService[]
|
|
9
|
-
};
|
|
10
|
-
export type Metadata = {
|
|
11
|
-
didUpdate: DidUpdatePayload;
|
|
12
|
-
proofs?: string;
|
|
13
|
-
};
|
|
14
|
-
export type SignalSidecarData = Metadata;
|
|
15
|
-
export interface Sidecar {
|
|
16
|
-
did: string;
|
|
17
|
-
}
|
|
18
|
-
export type SignalsMetadata = { [signalId: string]: Metadata; };
|
|
19
|
-
export interface SingletonSidecar extends Sidecar {
|
|
20
|
-
signalsMetadata: SignalsMetadata;
|
|
21
|
-
}
|
|
22
|
-
export interface CIDAggregateSidecar extends Sidecar {
|
|
23
|
-
initialDocument: DidDocument;
|
|
24
|
-
signalsMetadata: SignalsMetadata;
|
|
25
|
-
cidUpdates: Array<string>;
|
|
26
|
-
}
|
|
27
|
-
export interface SMTAggregateSidecar extends Sidecar {
|
|
28
|
-
initialDocument: DidDocument;
|
|
29
|
-
signalsMetadata: SignalsMetadata;
|
|
30
|
-
smtProof: ProofBytes;
|
|
31
|
-
}
|
|
32
|
-
export type BeaconSidecarData<T> =
|
|
33
|
-
T extends 'SingletonBeacon' ? SingletonSidecar :
|
|
34
|
-
T extends 'CIDAggregateBeacon' ? CIDAggregateSidecar :
|
|
35
|
-
T extends 'SMTAggregateBeacon' ? SMTAggregateSidecar :
|
|
36
|
-
T;
|
|
37
|
-
export type SidecarData = BeaconSidecarData<SingletonSidecar | CIDAggregateSidecar | SMTAggregateSidecar>;
|
|
38
|
-
export type GetSigningMethodParams = {
|
|
39
|
-
didDocument: DidDocument;
|
|
40
|
-
methodId?: string;
|
|
41
|
-
};
|
|
File without changes
|
|
File without changes
|