@did-btcr2/method 0.18.1 → 0.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser.js +4917 -6487
- package/dist/browser.mjs +4917 -6487
- 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/beacon.js +25 -0
- package/dist/cjs/core/beacon/beacon.js.map +1 -0
- package/dist/cjs/core/beacon/cas-beacon.js +39 -0
- package/dist/cjs/core/beacon/cas-beacon.js.map +1 -0
- package/dist/cjs/core/beacon/error.js +4 -4
- package/dist/cjs/core/beacon/error.js.map +1 -1
- package/dist/cjs/core/beacon/factory.js +10 -11
- package/dist/cjs/core/beacon/factory.js.map +1 -1
- package/dist/cjs/core/beacon/interfaces.js +2 -0
- package/dist/cjs/core/beacon/interfaces.js.map +1 -0
- package/dist/cjs/core/beacon/signal-discovery.js +183 -0
- package/dist/cjs/core/beacon/signal-discovery.js.map +1 -0
- package/dist/cjs/core/beacon/singleton.js +75 -178
- package/dist/cjs/core/beacon/singleton.js.map +1 -1
- package/dist/cjs/core/beacon/smt-beacon.js +39 -0
- package/dist/cjs/core/beacon/smt-beacon.js.map +1 -0
- package/dist/cjs/core/beacon/utils.js +71 -114
- 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 +321 -0
- package/dist/cjs/core/resolve.js.map +1 -0
- package/dist/cjs/{utils → core}/types.js.map +1 -1
- package/dist/cjs/core/update.js +113 -0
- package/dist/cjs/core/update.js.map +1 -0
- package/dist/cjs/did-btcr2.js +168 -129
- package/dist/cjs/did-btcr2.js.map +1 -1
- package/dist/cjs/index.js +17 -16
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/utils/appendix.js +16 -33
- package/dist/cjs/utils/appendix.js.map +1 -1
- package/dist/cjs/utils/did-document-builder.js +5 -0
- package/dist/cjs/utils/did-document-builder.js.map +1 -1
- package/dist/cjs/utils/did-document.js +62 -72
- 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/beacon.js +25 -0
- package/dist/esm/core/beacon/beacon.js.map +1 -0
- package/dist/esm/core/beacon/cas-beacon.js +39 -0
- package/dist/esm/core/beacon/cas-beacon.js.map +1 -0
- package/dist/esm/core/beacon/error.js +4 -4
- package/dist/esm/core/beacon/error.js.map +1 -1
- package/dist/esm/core/beacon/factory.js +10 -11
- package/dist/esm/core/beacon/factory.js.map +1 -1
- package/dist/esm/core/beacon/interfaces.js +2 -0
- package/dist/esm/core/beacon/interfaces.js.map +1 -0
- package/dist/esm/core/beacon/signal-discovery.js +183 -0
- package/dist/esm/core/beacon/signal-discovery.js.map +1 -0
- package/dist/esm/core/beacon/singleton.js +75 -178
- package/dist/esm/core/beacon/singleton.js.map +1 -1
- package/dist/esm/core/beacon/smt-beacon.js +39 -0
- package/dist/esm/core/beacon/smt-beacon.js.map +1 -0
- package/dist/esm/core/beacon/utils.js +71 -114
- 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 +321 -0
- package/dist/esm/core/resolve.js.map +1 -0
- package/dist/esm/{utils → core}/types.js.map +1 -1
- package/dist/esm/core/update.js +113 -0
- package/dist/esm/core/update.js.map +1 -0
- package/dist/esm/did-btcr2.js +168 -129
- package/dist/esm/did-btcr2.js.map +1 -1
- package/dist/esm/index.js +17 -16
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/utils/appendix.js +16 -33
- package/dist/esm/utils/appendix.js.map +1 -1
- package/dist/esm/utils/did-document-builder.js +5 -0
- package/dist/esm/utils/did-document-builder.js.map +1 -1
- package/dist/esm/utils/did-document.js +62 -72
- 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/beacon.d.ts +44 -0
- package/dist/types/core/beacon/beacon.d.ts.map +1 -0
- package/dist/types/core/beacon/cas-beacon.d.ts +36 -0
- package/dist/types/core/beacon/cas-beacon.d.ts.map +1 -0
- package/dist/types/core/beacon/error.d.ts +2 -2
- package/dist/types/core/beacon/error.d.ts.map +1 -1
- package/dist/types/core/beacon/factory.d.ts +4 -5
- package/dist/types/core/beacon/factory.d.ts.map +1 -1
- package/dist/types/core/beacon/interfaces.d.ts +59 -0
- package/dist/types/core/beacon/interfaces.d.ts.map +1 -0
- package/dist/types/core/beacon/signal-discovery.d.ts +25 -0
- package/dist/types/core/beacon/signal-discovery.d.ts.map +1 -0
- package/dist/types/core/beacon/singleton.d.ts +20 -76
- package/dist/types/core/beacon/singleton.d.ts.map +1 -1
- package/dist/types/core/beacon/smt-beacon.d.ts +36 -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 +87 -0
- package/dist/types/core/interfaces.d.ts.map +1 -0
- package/dist/types/core/resolve.d.ts +89 -0
- package/dist/types/core/resolve.d.ts.map +1 -0
- package/dist/types/core/types.d.ts +84 -0
- package/dist/types/core/types.d.ts.map +1 -0
- package/dist/types/core/update.d.ts +51 -0
- package/dist/types/core/update.d.ts.map +1 -0
- package/dist/types/did-btcr2.d.ts +70 -89
- package/dist/types/did-btcr2.d.ts.map +1 -1
- package/dist/types/index.d.ts +17 -16
- 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 +6 -1
- package/dist/types/utils/did-document-builder.d.ts.map +1 -1
- package/dist/types/utils/did-document.d.ts +46 -42
- package/dist/types/utils/did-document.d.ts.map +1 -1
- package/package.json +6 -6
- 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/beacon.ts +58 -0
- package/src/core/beacon/cas-beacon.ts +53 -0
- package/src/core/beacon/error.ts +5 -6
- package/src/core/beacon/factory.ts +12 -16
- package/src/core/beacon/interfaces.ts +67 -0
- package/src/core/beacon/signal-discovery.ts +237 -0
- package/src/core/beacon/singleton.ts +107 -197
- package/src/core/beacon/smt-beacon.ts +53 -0
- package/src/core/beacon/utils.ts +95 -182
- package/src/core/identifier.ts +21 -24
- package/src/core/interfaces.ts +93 -0
- package/src/core/resolve.ts +463 -0
- package/src/core/types.ts +95 -0
- package/src/core/update.ts +154 -0
- package/src/did-btcr2.ts +255 -159
- package/src/index.ts +19 -22
- package/src/utils/appendix.ts +26 -44
- package/src/utils/did-document-builder.ts +6 -1
- package/src/utils/did-document.ts +105 -113
- 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 +0 -194
- 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 +0 -194
- 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 +0 -93
- 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/core/crud/update.ts +0 -292
- 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
|
@@ -1,334 +0,0 @@
|
|
|
1
|
-
import { BitcoinCoreRpcClient, BitcoinRestClient, BlockV3 } from '@did-btcr2/bitcoin';
|
|
2
|
-
import { BitcoinNetworkNames, DidUpdatePayload, UnixTimestamp } from '@did-btcr2/common';
|
|
3
|
-
import { BeaconService, BeaconServiceAddress, BeaconSignal } from '../../interfaces/beacon.js';
|
|
4
|
-
import { DidResolutionOptions } from '../../interfaces/crud.js';
|
|
5
|
-
import { DidDocument } from '../../utils/did-document.js';
|
|
6
|
-
import { SignalsMetadata } from '../../utils/types.js';
|
|
7
|
-
import { DidComponents } from '../identifier.js';
|
|
8
|
-
export type FindNextSignalsRestParams = {
|
|
9
|
-
connection: BitcoinRestClient;
|
|
10
|
-
beaconSignals: Array<BeaconSignal>;
|
|
11
|
-
block: BlockV3;
|
|
12
|
-
beacons: Array<BeaconServiceAddress>;
|
|
13
|
-
};
|
|
14
|
-
export type BeaconSignals = Array<BeaconSignal>;
|
|
15
|
-
export type BitcoinClient = BitcoinCoreRpcClient | BitcoinRestClient;
|
|
16
|
-
export type NetworkVersion = {
|
|
17
|
-
version?: string;
|
|
18
|
-
network?: string;
|
|
19
|
-
};
|
|
20
|
-
export type ResolveInitialDocument = {
|
|
21
|
-
identifier: string;
|
|
22
|
-
components: DidComponents;
|
|
23
|
-
resolutionsOptions: DidResolutionOptions;
|
|
24
|
-
};
|
|
25
|
-
export interface ResolveDeterministic {
|
|
26
|
-
components: DidComponents;
|
|
27
|
-
identifier: string;
|
|
28
|
-
}
|
|
29
|
-
export interface ResolveExternal {
|
|
30
|
-
components: DidComponents;
|
|
31
|
-
identifier: string;
|
|
32
|
-
resolutionsOptions: DidResolutionOptions;
|
|
33
|
-
}
|
|
34
|
-
export interface ResolveSidecar {
|
|
35
|
-
identifierComponents: DidComponents;
|
|
36
|
-
initialDocument: DidDocument;
|
|
37
|
-
}
|
|
38
|
-
export interface ResolveCas {
|
|
39
|
-
identifier: string;
|
|
40
|
-
identifierComponents: DidComponents;
|
|
41
|
-
}
|
|
42
|
-
export interface ApplyDidUpdateParams {
|
|
43
|
-
contemporaryDidDocument: DidDocument;
|
|
44
|
-
update: DidUpdatePayload;
|
|
45
|
-
}
|
|
46
|
-
export interface TargetDocumentParams {
|
|
47
|
-
initialDocument: DidDocument;
|
|
48
|
-
resolutionsOptions: DidResolutionOptions;
|
|
49
|
-
}
|
|
50
|
-
export interface TargetBlockheightParams {
|
|
51
|
-
network: BitcoinNetworkNames;
|
|
52
|
-
targetTime?: UnixTimestamp;
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* Implements {@link https://dcdpr.github.io/did-btcr2/#read | 4.2 Read}.
|
|
56
|
-
* The read operation is executed by a resolver after a resolution request identifying a specific did:btcr2 identifier is
|
|
57
|
-
* received from a client at Resolution Time. The request MAY contain a resolutionOptions object containing additional
|
|
58
|
-
* information to be used in resolution. The resolver then attempts to resolve the DID document of the identifier at a
|
|
59
|
-
* specific Target Time. The Target Time is either provided in resolutionOptions or is set to the Resolution Time of the
|
|
60
|
-
* request.
|
|
61
|
-
* To do so it executes the following algorithm:
|
|
62
|
-
* 1. Let identifierComponents be the result of running the algorithm
|
|
63
|
-
* in Parse did:btcr2 identifier, passing in the identifier.
|
|
64
|
-
* 2. Set initialDocument to the result of running Resolve Initial Document
|
|
65
|
-
* passing identifier, identifierComponents and resolutionOptions.
|
|
66
|
-
* 3. Set targetDocument to the result of running the algorithm in Resolve
|
|
67
|
-
* Target Document passing in initialDocument and resolutionOptions.
|
|
68
|
-
* 4. Return targetDocument.
|
|
69
|
-
*
|
|
70
|
-
* @class Resolve
|
|
71
|
-
* @type {Resolve}
|
|
72
|
-
*/
|
|
73
|
-
export declare class Resolve {
|
|
74
|
-
/**
|
|
75
|
-
* Implements {@link https://dcdpr.github.io/did-btcr2/#deterministically-generate-initial-did-document | 4.2.2.1 Deterministically Generate Initial DID Document}.
|
|
76
|
-
*
|
|
77
|
-
* The Deterministically Generate Initial DID Document algorithm deterministically generates an initial DID
|
|
78
|
-
* Document from a secp256k1 public key. It takes in a did:btcr2 identifier and a identifierComponents object and
|
|
79
|
-
* returns an initialDocument.
|
|
80
|
-
*
|
|
81
|
-
* @param {ResolveDeterministic} params See {@link ResolveDeterministic} for details.
|
|
82
|
-
* @param {string} params.identifier The did-btcr2 version.
|
|
83
|
-
* @param {DidComponents} params.identifierComponents The decoded components of the identifier.
|
|
84
|
-
* @returns {DidDocument} The resolved DID Document object.
|
|
85
|
-
*/
|
|
86
|
-
static deterministic({ identifier, identifierComponents }: {
|
|
87
|
-
identifier: string;
|
|
88
|
-
identifierComponents: DidComponents;
|
|
89
|
-
}): DidDocument;
|
|
90
|
-
/**
|
|
91
|
-
* Implements {@link https://dcdpr.github.io/did-btcr2/#external-resolution | 4.2.2.2 External Resolution}.
|
|
92
|
-
*
|
|
93
|
-
* The External Resolution algorithm externally retrieves an intermediateDocumentRepresentation, either by retrieving
|
|
94
|
-
* it from {@link https://dcdpr.github.io/did-btcr2/#def-content-addressable-storage | Content Addressable Storage (CAS)}
|
|
95
|
-
* or from the {@link https://dcdpr.github.io/did-btcr2/#def-sidecar-data | Sidecar Data} provided as part of the
|
|
96
|
-
* resolution request. It takes in a did:btcr2 identifier, a identifierComponents object and a resolutionOptions object.
|
|
97
|
-
* It returns an initialDocument, which is a conformant DID document validated against the identifier.
|
|
98
|
-
*
|
|
99
|
-
* @param {ResolveExternal} params Required params for calling the external method.
|
|
100
|
-
* @param {string} params.identifier The DID to be resolved.
|
|
101
|
-
* @param {DidComponents} params.identifierComponents The decoded components of the identifier.
|
|
102
|
-
* @param {DidResolutionOptions} params.resolutionsOptions The options for resolving the DID Document.
|
|
103
|
-
* @param {DidDocument} params.resolutionsOptions.sidecarData The sidecar data for resolving the DID Document.
|
|
104
|
-
* @param {DidDocument} params.resolutionsOptions.sidecarData.initialDocument The offline user-provided DID Document
|
|
105
|
-
* @returns {DidDocument} The resolved DID Document object
|
|
106
|
-
*/
|
|
107
|
-
static external({ identifier, identifierComponents, resolutionsOptions }: {
|
|
108
|
-
identifier: string;
|
|
109
|
-
identifierComponents: DidComponents;
|
|
110
|
-
resolutionsOptions: DidResolutionOptions;
|
|
111
|
-
}): Promise<DidDocument>;
|
|
112
|
-
/**
|
|
113
|
-
* Implements {@link https://dcdpr.github.io/did-btcr2/#sidecar-initial-document-validation | 4.2.2.2.1 Sidecar Initial Document Validation}.
|
|
114
|
-
*
|
|
115
|
-
* The Sidecar Initial Document Validation algorithm validates an initialDocument against its identifier, by first
|
|
116
|
-
* constructing the intermediateDocumentRepresentation and verifying the hash of this document matches the bytes
|
|
117
|
-
* encoded within the identifier. It takes in a did:btcr2 identifier, identifierComponents and a
|
|
118
|
-
* initialDocument. It returns the initialDocument if validated, otherwise it throws an error.
|
|
119
|
-
*
|
|
120
|
-
* @param {ResolveSidecar} params Required params for calling the sidecar method
|
|
121
|
-
* @param {string} params.identifier The DID to be resolved
|
|
122
|
-
* @param {DidComponents} params.identifierComponents The components of the DID identifier
|
|
123
|
-
* @param {DidDocument} params.initialDocument The initial DID Document provided by the user
|
|
124
|
-
* @returns {DidDocument} The resolved DID Document object
|
|
125
|
-
* @throws {DidError} InvalidDidDocument if genesisBytes !== initialDocument hashBytes
|
|
126
|
-
*/
|
|
127
|
-
static sidecar({ identifierComponents, initialDocument }: ResolveSidecar): Promise<DidDocument>;
|
|
128
|
-
/**
|
|
129
|
-
* Implements {@link https://dcdpr.github.io/did-btcr2/#cas-retrieval | 4.2.2.2.2 CAS Retrieval}.
|
|
130
|
-
*
|
|
131
|
-
* The CAS Retrieval algorithm attempts to retrieve an initialDocument from a Content Addressable Storage (CAS) system
|
|
132
|
-
* by converting the bytes in the identifier into a Content Identifier (CID). It takes in an identifier and
|
|
133
|
-
* an identifierComponents object. It returns an initialDocument.
|
|
134
|
-
*
|
|
135
|
-
* @param {ResolveCas} params Required params for calling the cas method
|
|
136
|
-
* @param {string} params.identifier BTCR2 DID used to resolve the DID Document
|
|
137
|
-
* @param {DidComponents} params.identifierComponents BTCR2 DID components used to resolve the DID Document
|
|
138
|
-
* @returns {DidDocument} The resolved DID Document object
|
|
139
|
-
* @throws {MethodError} if the DID Document content is invalid
|
|
140
|
-
*/
|
|
141
|
-
static cas({ identifier, identifierComponents }: ResolveCas): Promise<DidDocument>;
|
|
142
|
-
/**
|
|
143
|
-
* Implements {@link https://dcdpr.github.io/did-btcr2/#resolve-initial-document | 4.2.2 Resolve Initial Document}.
|
|
144
|
-
*
|
|
145
|
-
* This algorithm resolves an initial DID document and validates it against the identifier for a specific did:btcr2.
|
|
146
|
-
* The algorithm takes in a did:btcr2 identifier, identifier components object, resolutionsOptions object and returns
|
|
147
|
-
* a valid initialDocument for that identifier.
|
|
148
|
-
*
|
|
149
|
-
* @public
|
|
150
|
-
* @param {ResolveInitialDocument} params See {@link ResolveInitialDocument} for parameter details.
|
|
151
|
-
* @param {string} params.identifier The DID to be resolved.
|
|
152
|
-
* @param {DidComponents} params.identifierComponents The decoded components of the identifier.
|
|
153
|
-
* @param {DidResolutionOptions} params.resolutionsOptions Options for resolving the DID Document. See {@link DidResolutionOptions}.
|
|
154
|
-
* @returns {Promise<DidDocument>} The resolved DID Document object.
|
|
155
|
-
* @throws {DidError} if the DID hrp is invalid, no sidecarData passed and hrp = "x".
|
|
156
|
-
*/
|
|
157
|
-
static initialDocument({ identifier, identifierComponents, resolutionsOptions }: {
|
|
158
|
-
identifier: string;
|
|
159
|
-
identifierComponents: DidComponents;
|
|
160
|
-
resolutionsOptions: DidResolutionOptions;
|
|
161
|
-
}): Promise<DidDocument>;
|
|
162
|
-
/**
|
|
163
|
-
* Implements {@link https://dcdpr.github.io/did-btcr2/#resolve-target-document | 4.2.3 Resolve Target Document}.
|
|
164
|
-
*
|
|
165
|
-
* The Resolve Target Document algorithm resolves a DID document from an initial document by walking the Bitcoin
|
|
166
|
-
* blockchain to identify Beacon Signals that announce DID Update Payloads applicable to the did:btcr2 identifier being
|
|
167
|
-
* resolved. It takes as inputs initialDocument, resolutionOptions and network. It returns a valid DID document.
|
|
168
|
-
*
|
|
169
|
-
* @public
|
|
170
|
-
* @param {TargetDocumentParams} params See {@link TargetDocumentParams} for details.
|
|
171
|
-
* @param {DidDocument} params.initialDocument The initial DID Document to resolve
|
|
172
|
-
* @param {ResolutionOptions} params.options See {@link DidResolutionOptions} for details.
|
|
173
|
-
* @returns {DidDocument} The resolved DID Document object with a validated single, canonical history
|
|
174
|
-
*/
|
|
175
|
-
static targetDocument({ initialDocument, resolutionsOptions }: {
|
|
176
|
-
initialDocument: DidDocument;
|
|
177
|
-
resolutionsOptions: DidResolutionOptions;
|
|
178
|
-
}): Promise<DidDocument>;
|
|
179
|
-
/**
|
|
180
|
-
* Implements {@link https://dcdpr.github.io/did-btcr2/#traverse-blockchain-history | 4.2.3.2 Traverse Blockchain History}.
|
|
181
|
-
*
|
|
182
|
-
* The Traverse Blockchain History algorithm traverses Bitcoin blocks, starting from the block with the
|
|
183
|
-
* contemporaryBlockheight, to find beaconSignals emitted by Beacons within the contemporaryDidDocument. Each
|
|
184
|
-
* beaconSignal is processed to retrieve a didUpdatePayload to the DID document. Each update is applied to the
|
|
185
|
-
* document and duplicates are ignored. If the algorithm reaches the block with the blockheight specified by a
|
|
186
|
-
* targetBlockheight, the contemporaryDidDocument at that blockheight is returned assuming a single canonical history
|
|
187
|
-
* of the DID document has been constructed up to that point. It takes in contemporaryDidDocument,
|
|
188
|
-
* contemporaryBlockHeight, currentVersionId, targetVersionId, targetBlockheight, updateHashHistory, signalsMetadata
|
|
189
|
-
* and network. It returns the contemporaryDidDocument once either the targetBlockheight or targetVersionId have been
|
|
190
|
-
* reached.
|
|
191
|
-
*
|
|
192
|
-
* @protected
|
|
193
|
-
* @param {ReadBlockchainParams} params The parameters for the traverseBlockchainHistory operation.
|
|
194
|
-
* @param {DidDocument} params.contemporaryDidDocument The DID document for the did:btcr2 identifier being resolved.
|
|
195
|
-
* It should be "current" (contemporary) at the blockheight of the contemporaryBlockheight.
|
|
196
|
-
* It should be a DID Core conformant DID document.
|
|
197
|
-
* @param {number} params.contemporaryBlockHeight The Bitcoin blockheight signaling the "contemporary time" of the
|
|
198
|
-
* contemporary DID Document that is being resolved and updated using the Traverse Blockchain History algorithm.
|
|
199
|
-
* @param {number} params.currentVersionId The version of the contemporary DID document starting from 1 and
|
|
200
|
-
* incrementing by 1 with each BTCR2 Update applied to the DID document.
|
|
201
|
-
* @param {number} params.targetVersionId The version of the DID document where resolution will complete.
|
|
202
|
-
* @param {UnixTimestamp} params.targetTime The timestamp used to target specific historical states of a DID document.
|
|
203
|
-
* Only Beacon Signals included in the Bitcoin blockchain before the targetTime are processed.
|
|
204
|
-
* @param {boolean} params.didDocumentHistory An array of DID documents ordered ascensing by version (1...N).
|
|
205
|
-
* @param {boolean} params.updateHashHistory An array of SHA256 hashes of BTCR2 Updates ordered by version that are
|
|
206
|
-
* applied to the DID document in order to construct the contemporaryDIDDocument.
|
|
207
|
-
* @param {SignalsMetadata} params.signalsMetadata See {@link SignalsMetadata} for details.
|
|
208
|
-
* @param {string} params.network The bitcoin network to connect to (mainnet, signet, testnet, regtest).
|
|
209
|
-
* @returns {Promise<DidDocument>} The resolved DID Document object with a validated single, canonical history.
|
|
210
|
-
*/
|
|
211
|
-
protected static traverseBlockchainHistory({ contemporaryDidDocument, contemporaryBlockHeight, currentVersionId, targetVersionId, targetTime, didDocumentHistory, updateHashHistory, signalsMetadata, network }: {
|
|
212
|
-
contemporaryDidDocument: DidDocument;
|
|
213
|
-
contemporaryBlockHeight: number;
|
|
214
|
-
currentVersionId: number;
|
|
215
|
-
targetVersionId?: number;
|
|
216
|
-
targetTime: number;
|
|
217
|
-
didDocumentHistory: DidDocument[];
|
|
218
|
-
updateHashHistory: string[];
|
|
219
|
-
signalsMetadata: SignalsMetadata;
|
|
220
|
-
network: string;
|
|
221
|
-
}): Promise<DidDocument>;
|
|
222
|
-
/**
|
|
223
|
-
* Implements {@link https://dcdpr.github.io/did-btcr2/#find-next-signals | 4.2.3.3 Find Next Signals}.
|
|
224
|
-
*
|
|
225
|
-
* The Find Next Signals algorithm finds the next Bitcoin block containing Beacon Signals from one or more of the
|
|
226
|
-
* beacons and retuns all Beacon Signals within that block.
|
|
227
|
-
*
|
|
228
|
-
* It takes the following inputs:
|
|
229
|
-
* - `contemporaryBlockhieght`: The height of the block this function is looking for Beacon Signals in.
|
|
230
|
-
* An integer greater or equal to 0.
|
|
231
|
-
* - `targetBlockheight`: The height of the Bitcoin block that the resolution algorithm searches for Beacon Signals
|
|
232
|
-
* up to. An integer greater or equal to 0.
|
|
233
|
-
* - `beacons`: An array of Beacon services in the contemporary DID document. Each Beacon contains properties:
|
|
234
|
-
* - `id`: The id of the Beacon service in the DID document. A string.
|
|
235
|
-
* - `type`: The type of the Beacon service in the DID document. A string whose values MUST be
|
|
236
|
-
* either SingletonBeacon, CIDAggregateBeacon or SMTAggregateBeacon.
|
|
237
|
-
* - `serviceEndpoint`: A BIP21 URI representing a Bitcoin address.
|
|
238
|
-
* - `address`: The Bitcoin address decoded from the `serviceEndpoint value.
|
|
239
|
-
* - `network`: A string identifying the Bitcoin network of the did:btcr2 identifier. This algorithm MUST query the
|
|
240
|
-
* Bitcoin blockchain identified by the network.
|
|
241
|
-
*
|
|
242
|
-
* It returns a nextSignals struct, containing the following properties:
|
|
243
|
-
* - blockheight: The Bitcoin blockheight for the block containing the Beacon Signals.
|
|
244
|
-
* - signals: An array of signals. Each signal is a struct containing the following:
|
|
245
|
-
* - beaconId: The id for the Beacon that the signal was announced by.
|
|
246
|
-
* - beaconType: The type of the Beacon that announced the signal.
|
|
247
|
-
* - tx: The Bitcoin transaction that is the Beacon Signal.
|
|
248
|
-
*
|
|
249
|
-
* @public
|
|
250
|
-
* @param {FindNextSignals} params The parameters for the findNextSignals operation.
|
|
251
|
-
* @param {number} params.contemporaryBlockHeight The blockheight to start looking for beacon signals.
|
|
252
|
-
* @param {Array<BeaconService>} params.beacons The beacons to look for in the block.
|
|
253
|
-
* @param {Array<BeaconService>} params.network The bitcoin network to connect to (mainnet, signet, testnet, regtest).
|
|
254
|
-
* @param {UnixTimestamp} params.targetTime The timestamp used to target specific historical states of a DID document.
|
|
255
|
-
* Only Beacon Signals included in the Bitcoin blockchain before the targetTime are processed.
|
|
256
|
-
* @returns {Promise<Array<BeaconSignal>>} An array of BeaconSignal objects with blockHeight and signals.
|
|
257
|
-
*/
|
|
258
|
-
static findNextSignals({ contemporaryBlockHeight, targetTime, network, beacons }: {
|
|
259
|
-
contemporaryBlockHeight: number;
|
|
260
|
-
beacons: Array<BeaconServiceAddress>;
|
|
261
|
-
network: string;
|
|
262
|
-
targetTime: UnixTimestamp;
|
|
263
|
-
}): Promise<Array<BeaconSignal>>;
|
|
264
|
-
/**
|
|
265
|
-
* Helper method for the {@link findNextSignals | Find Next Signals} algorithm.
|
|
266
|
-
* @param {Array<BeaconService>} beacons The beacons to process.
|
|
267
|
-
* @returns {Promise<Array<BeaconSignal>>} The beacon signals found in the block.
|
|
268
|
-
*/
|
|
269
|
-
static findSignalsRest(beacons: Array<BeaconService>): Promise<Array<BeaconSignal>>;
|
|
270
|
-
/**
|
|
271
|
-
* Implements {@link https://dcdpr.github.io/did-btcr2/#process-beacon-signals | 4.2.3.4 Process Beacon Signals}.
|
|
272
|
-
*
|
|
273
|
-
* The Process Beacon Signals algorithm processes each Beacon Signal by attempting to retrieve and validate an
|
|
274
|
-
* announce DID Update Payload for that signal according to the type of the Beacon.
|
|
275
|
-
*
|
|
276
|
-
* It takes as inputs
|
|
277
|
-
* - `beaconSignals`: An array of Beacon Signals retrieved from the Find Next Signals algorithm. Each signal contains:
|
|
278
|
-
* - `beaconId`: The id for the Beacon that the signal was announced by.
|
|
279
|
-
* - `beaconType`: The type of the Beacon that announced the signal.
|
|
280
|
-
* - `tx`: The Bitcoin transaction that is the Beacon Signal.
|
|
281
|
-
* - `signalsMetadata`: Maps Beacon Signal Bitcoin transaction ids to a SignalMetadata object containing:
|
|
282
|
-
* - `updatePayload`: A DID Update Payload which should match the update announced by the Beacon Signal.
|
|
283
|
-
* In the case of a SMT proof of non-inclusion, no DID Update Payload may be provided.
|
|
284
|
-
* - `proofs`: Sparse Merkle Tree proof used to verify that the `updatePayload` exists as the leaf indexed by the
|
|
285
|
-
* did:btcr2 identifier being resolved.
|
|
286
|
-
*
|
|
287
|
-
* It returns an array of {@link https://dcdpr.github.io/did-btcr2/#def-did-update-payload | DID Update Payloads}.
|
|
288
|
-
*
|
|
289
|
-
* @public
|
|
290
|
-
* @param {BeaconSignal} signal The beacon signals to process.
|
|
291
|
-
* @param {SignalsMetadata} signalsMetadata The sidecar data for the DID Document.
|
|
292
|
-
* @returns {DidUpdatePayload[]} The updated DID Document object.
|
|
293
|
-
*/
|
|
294
|
-
static processBeaconSignal(signal: BeaconSignal, signalsMetadata: SignalsMetadata): Promise<DidUpdatePayload>;
|
|
295
|
-
/**
|
|
296
|
-
* Implements {@link https://dcdpr.github.io/did-btcr2/#confirm-duplicate-update | 7.2.2.4 Confirm Duplicate Update}.
|
|
297
|
-
*
|
|
298
|
-
* The Confirm Duplicate Update algorithm takes in a {@link DidUpdatePayload | DID Update Payload} and verifies that
|
|
299
|
-
* the update is a duplicate against the hash history of previously applied updates. The algorithm takes in an update
|
|
300
|
-
* and an array of hashes, updateHashHistory. It throws an error if the update is not a duplicate, otherwise it
|
|
301
|
-
* returns.
|
|
302
|
-
*
|
|
303
|
-
* @public
|
|
304
|
-
* @param {{ update: DidUpdatePayload; updateHashHistory: string[]; }} params Parameters for confirmDuplicateUpdate.
|
|
305
|
-
* @param {DidUpdatePayload} params.update The DID Update Payload to confirm.
|
|
306
|
-
* @param {Array<string>} params.updateHashHistory The history of hashes for previously applied updates.
|
|
307
|
-
* @returns {Promise<void>} A promise that resolves if the update is a duplicate, otherwise throws an error.
|
|
308
|
-
* @throws {ResolveError} if the update hash does not match the historical hash.
|
|
309
|
-
*/
|
|
310
|
-
static confirmDuplicateUpdate({ update, updateHashHistory }: {
|
|
311
|
-
update: DidUpdatePayload;
|
|
312
|
-
updateHashHistory: string[];
|
|
313
|
-
}): Promise<void>;
|
|
314
|
-
/**
|
|
315
|
-
* Implements {@link https://dcdpr.github.io/did-btcr2/#apply-did-update | 4.2.3.6 Apply DID Update}.
|
|
316
|
-
*
|
|
317
|
-
* This algorithm attempts to apply a DID Update to a DID document, it first verifies the proof on the update is a
|
|
318
|
-
* valid capabilityInvocation of the root authority over the DID being resolved. Then it applies the JSON patch
|
|
319
|
-
* transformation to the DID document, checks the transformed DID document matches the targetHash specified by the
|
|
320
|
-
* update and validates it is a conformant DID document before returning it. This algorithm takes inputs
|
|
321
|
-
* contemporaryDidDocument and an update.
|
|
322
|
-
*
|
|
323
|
-
* @public
|
|
324
|
-
* @param {ApplyDidUpdateParams} params Parameters for applyDidUpdate.
|
|
325
|
-
* @param {DidDocument} params.contemporaryDidDocument The current DID Document to update.
|
|
326
|
-
* @param {DidUpdatePayload} params.update The DID Update Payload to apply.
|
|
327
|
-
* @param {Bytes} params.genesisBytes The genesis bytes for the DID Document.
|
|
328
|
-
* @returns {Promise<DidDocument>}
|
|
329
|
-
*/
|
|
330
|
-
static applyDidUpdate({ contemporaryDidDocument, update }: {
|
|
331
|
-
contemporaryDidDocument: DidDocument;
|
|
332
|
-
update: DidUpdatePayload;
|
|
333
|
-
}): Promise<DidDocument>;
|
|
334
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"read.d.ts","sourceRoot":"","sources":["../../../../src/core/crud/read.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EAEpB,iBAAiB,EACjB,OAAO,EAMR,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,mBAAmB,EACnB,gBAAgB,EAUhB,aAAa,EACd,MAAM,mBAAmB,CAAC;AAK3B,OAAO,EAAE,aAAa,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC/F,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAEhE,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EAGL,eAAe,EAChB,MAAM,sBAAsB,CAAC;AAG9B,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD,MAAM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AAG,OAAO,CAAC,IAAI,CAAC;IAyBjB;;;;;;;;;;;;;;;OAeG;WACiB,cAAc,CAAC,EAAE,uBAAuB,EAAE,MAAM,EAAE,EAAE;QACtE,uBAAuB,EAAE,WAAW,CAAC;QACrC,MAAM,EAAE,gBAAgB,CAAC;KAC1B,GAAG,OAAO,CAAC,WAAW,CAAC;CAuEzB"}
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
import { DidUpdateInvocation, DidUpdatePayload, PatchOperation } from '@did-btcr2/common';
|
|
2
|
-
import { DidDocument, DidVerificationMethod } from '../../utils/did-document.js';
|
|
3
|
-
import { SignalsMetadata } from '../../utils/types.js';
|
|
4
|
-
export interface ConstructUpdateParams {
|
|
5
|
-
identifier: string;
|
|
6
|
-
sourceDocument: DidDocument;
|
|
7
|
-
sourceVersionId: number;
|
|
8
|
-
patch: PatchOperation[];
|
|
9
|
-
}
|
|
10
|
-
export interface UpdateParams extends ConstructUpdateParams {
|
|
11
|
-
verificationMethodId: string;
|
|
12
|
-
beaconIds: string[];
|
|
13
|
-
}
|
|
14
|
-
export type InvokePayloadParams = {
|
|
15
|
-
identifier: string;
|
|
16
|
-
didUpdatePayload: DidUpdatePayload;
|
|
17
|
-
verificationMethod: DidVerificationMethod;
|
|
18
|
-
};
|
|
19
|
-
/**
|
|
20
|
-
* Implements {@link https://dcdpr.github.io/did-btcr2/#update | 4.3 Update}.
|
|
21
|
-
*
|
|
22
|
-
* An update to a did:btcr2 document is an invoked capability using the ZCAP-LD
|
|
23
|
-
* data format, signed by a verificationMethod that has the authority to make
|
|
24
|
-
* the update as specified in the previous DID document. Capability invocations
|
|
25
|
-
* for updates MUST be authorized using Data Integrity following the
|
|
26
|
-
* bip340-jcs-2025 cryptosuite with a proofPurpose of capabilityInvocation.
|
|
27
|
-
*
|
|
28
|
-
* @class Update
|
|
29
|
-
* @type {Update}
|
|
30
|
-
*/
|
|
31
|
-
export declare class Update {
|
|
32
|
-
/**
|
|
33
|
-
* Implements {@link https://dcdpr.github.io/did-btcr2/#construct-did-update-payload | 4.3.1 Construct DID Update Payload}.
|
|
34
|
-
*
|
|
35
|
-
* The Construct DID Update Payload algorithm applies the documentPatch to the sourceDocument and verifies the
|
|
36
|
-
* resulting targetDocument is a conformant DID document. It takes in a Identifier, sourceDocument,
|
|
37
|
-
* sourceVersionId, and documentPatch objects. It returns an unsigned DID Update Payload.
|
|
38
|
-
*
|
|
39
|
-
* @param {ConstructPayloadParams} params See {@link ConstructPayloadParams} for more details.
|
|
40
|
-
* @param {string} params.identifier The did-btcr2 identifier to use for verification.
|
|
41
|
-
* @param {DidDocument} params.sourceDocument The source document to be updated.
|
|
42
|
-
* @param {string} params.sourceVersionId The versionId of the source document.
|
|
43
|
-
* @param {DidDocumentPatch} params.patch The JSON patch to be applied to the source document.
|
|
44
|
-
* @returns {Promise<DidUpdatePayload>} The constructed DidUpdatePayload object.
|
|
45
|
-
* @throws {MethodError} InvalidDid if sourceDocument.id does not match identifier.
|
|
46
|
-
*/
|
|
47
|
-
static construct({ identifier, sourceDocument, sourceVersionId, patch, }: {
|
|
48
|
-
identifier: string;
|
|
49
|
-
sourceDocument: DidDocument;
|
|
50
|
-
sourceVersionId: number;
|
|
51
|
-
patch: PatchOperation[];
|
|
52
|
-
}): Promise<DidUpdatePayload>;
|
|
53
|
-
/**
|
|
54
|
-
* {@link https://dcdpr.github.io/did-btcr2/#invoke-did-update-payload | 4.3.2 Invoke DID Update Payload}.
|
|
55
|
-
*
|
|
56
|
-
* The Invoke DID Update Payload algorithm takes in a Identifier, an unsigned didUpdatePayload, and a
|
|
57
|
-
* verificationMethod. It retrieves the privateKeyBytes for the verificationMethod and adds a capability invocation in
|
|
58
|
-
* the form of a Data Integrity proof following the Authorization Capabilities (ZCAP-LD) and VC Data Integrity
|
|
59
|
-
* specifications. It returns the invoked DID Update Payload.
|
|
60
|
-
*
|
|
61
|
-
* @param {InvokePayloadParams} params Required params for calling the invokePayload method
|
|
62
|
-
* @param {string} params.identifier The did-btcr2 identifier to derive the root capability from
|
|
63
|
-
* @param {DidUpdatePayload} params.didUpdatePayload The updatePayload object to be signed
|
|
64
|
-
* @param {DidVerificationMethod} params.verificationMethod The verificationMethod object to be used for signing
|
|
65
|
-
* @returns {DidUpdateInvocation} Did update payload secured with a proof => DidUpdateInvocation
|
|
66
|
-
* @throws {MethodError} if the privateKeyBytes are invalid
|
|
67
|
-
*/
|
|
68
|
-
static invoke({ identifier, didUpdatePayload, verificationMethod }: {
|
|
69
|
-
identifier: string;
|
|
70
|
-
didUpdatePayload: DidUpdatePayload;
|
|
71
|
-
verificationMethod: DidVerificationMethod;
|
|
72
|
-
}): Promise<DidUpdateInvocation>;
|
|
73
|
-
/**
|
|
74
|
-
* Implements {@link https://dcdpr.github.io/did-btcr2/#announce-did-update | 4.3.3 Announce DID Update}.
|
|
75
|
-
*
|
|
76
|
-
* The Announce DID Update algorithm retrieves beaconServices from the sourceDocument and calls the Broadcast DID
|
|
77
|
-
* Update algorithm corresponding to the type of the Beacon. It takes in a Identifier, sourceDocument, an array of
|
|
78
|
-
* beaconIds, and a didUpdateInvocation. It returns an array of signalsMetadata, containing the necessary
|
|
79
|
-
* data to validate the Beacon Signal against the didUpdateInvocation.
|
|
80
|
-
*
|
|
81
|
-
* @param {AnnounceUpdatePayloadParams} params Required params for calling the announcePayload method
|
|
82
|
-
* @param {DidDocument} params.sourceDocument The did-btcr2 did document to derive the root capability from
|
|
83
|
-
* @param {string[]} params.beaconIds The didUpdatePayload object to be signed
|
|
84
|
-
* @param {DidUpdateInvocation} params.didUpdatePayload The verificationMethod object to be used for signing
|
|
85
|
-
* @returns {SignalsMetadata} The signalsMetadata object containing data to validate the Beacon Signal
|
|
86
|
-
* @throws {MethodError} if the beaconService type is invalid
|
|
87
|
-
*/
|
|
88
|
-
static announce({ sourceDocument, beaconIds, didUpdateInvocation }: {
|
|
89
|
-
sourceDocument: DidDocument;
|
|
90
|
-
beaconIds: string[];
|
|
91
|
-
didUpdateInvocation: DidUpdateInvocation;
|
|
92
|
-
}): Promise<SignalsMetadata>;
|
|
93
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../../../../src/core/crud/update.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,mBAAmB,EACnB,gBAAgB,EAOhB,cAAc,EAEf,MAAM,mBAAmB,CAAC;AAO3B,OAAO,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AACjF,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAIvD,MAAM,WAAW,qBAAqB;IAClC,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE,WAAW,CAAC;IAC5B,eAAe,EAAE,MAAM,CAAC;IACxB,KAAK,EAAE,cAAc,EAAE,CAAC;CAC3B;AAED,MAAM,WAAW,YAAa,SAAQ,qBAAqB;IACvD,oBAAoB,EAAE,MAAM,CAAC;IAC7B,SAAS,EAAE,MAAM,EAAE,CAAC;CACvB;AAED,MAAM,MAAM,mBAAmB,GAAG;IAChC,UAAU,EAAE,MAAM,CAAC;IACnB,gBAAgB,EAAE,gBAAgB,CAAC;IACnC,kBAAkB,EAAE,qBAAqB,CAAC;CAC3C,CAAA;AAED;;;;;;;;;;;GAWG;AACH,qBAAa,MAAM;IACjB;;;;;;;;;;;;;;OAcG;WACiB,SAAS,CAAC,EAC5B,UAAU,EACV,cAAc,EACd,eAAe,EACf,KAAK,GACN,EAAE;QACD,UAAU,EAAE,MAAM,CAAC;QACnB,cAAc,EAAE,WAAW,CAAC;QAC5B,eAAe,EAAE,MAAM,CAAC;QACxB,KAAK,EAAE,cAAc,EAAE,CAAC;KACzB,GAAG,OAAO,CAAC,gBAAgB,CAAC;IA8C7B;;;;;;;;;;;;;;OAcG;WACiB,MAAM,CAAC,EACzB,UAAU,EACV,gBAAgB,EAChB,kBAAkB,EACnB,EAAE;QACD,UAAU,EAAE,MAAM,CAAC;QACnB,gBAAgB,EAAE,gBAAgB,CAAC;QACnC,kBAAkB,EAAE,qBAAqB,CAAC;KAC3C,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAuEhC;;;;;;;;;;;;;;OAcG;WACiB,QAAQ,CAAC,EAC3B,cAAc,EACd,SAAS,EACT,mBAAmB,EACpB,EAAE;QACD,cAAc,EAAE,WAAW,CAAC;QAC5B,SAAS,EAAE,MAAM,EAAE,CAAC;QACpB,mBAAmB,EAAE,mBAAmB,CAAC;KAC1C,GAAG,OAAO,CAAC,eAAe,CAAC;CAgD7B"}
|
|
@@ -1,116 +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
|
-
* Beacon interface
|
|
7
|
-
* @interface IBeacon
|
|
8
|
-
* @type {IBeacon}
|
|
9
|
-
*/
|
|
10
|
-
export interface IBeacon {
|
|
11
|
-
/**
|
|
12
|
-
* A unique identifier for the Beacon
|
|
13
|
-
* @type {string}
|
|
14
|
-
*/
|
|
15
|
-
id: string;
|
|
16
|
-
/**
|
|
17
|
-
* The type of the Beacon
|
|
18
|
-
* @type {string}
|
|
19
|
-
*/
|
|
20
|
-
type: string;
|
|
21
|
-
/**
|
|
22
|
-
* The service endpoint of the Beacon
|
|
23
|
-
* @type {string}
|
|
24
|
-
*/
|
|
25
|
-
serviceEndpoint: DidServiceEndpoint;
|
|
26
|
-
/**
|
|
27
|
-
* Returns the Beacon Service object
|
|
28
|
-
* @type {BeaconService}
|
|
29
|
-
*/
|
|
30
|
-
service: BeaconService;
|
|
31
|
-
/**
|
|
32
|
-
* Generates a Beacon Signal Transaction
|
|
33
|
-
* @param {string} didUpdatePayload The DID update payload
|
|
34
|
-
* @returns {BeaconSignal} The Beacon Signal
|
|
35
|
-
*/
|
|
36
|
-
generateSignal(didUpdatePayload: string): BeaconSignal;
|
|
37
|
-
/**
|
|
38
|
-
* Processes a Beacon Signal.
|
|
39
|
-
* @param {RawTransactionV2} signal The raw transaction
|
|
40
|
-
* @param {SidecarData} signalsMetadata The signals metadata from the sidecar data
|
|
41
|
-
* @returns {Promise<DidUpdatePayload | undefined>} The DID update payload
|
|
42
|
-
*/
|
|
43
|
-
processSignal(signal: RawTransactionV2, signalsMetadata: SignalsMetadata): Promise<DidUpdatePayload | undefined>;
|
|
44
|
-
/**
|
|
45
|
-
* Broadcasts a signal.
|
|
46
|
-
* @param {DidUpdatePayload} didUpdatePayload The DID update payload.
|
|
47
|
-
* @returns {Promise<SignalMetadata>} The signal metadata.
|
|
48
|
-
*/
|
|
49
|
-
broadcastSignal(didUpdatePayload: DidUpdatePayload): Promise<SignalsMetadata>;
|
|
50
|
-
}
|
|
51
|
-
export interface BeaconService extends IDidService {
|
|
52
|
-
serviceEndpoint: DidServiceEndpoint;
|
|
53
|
-
casType?: string;
|
|
54
|
-
}
|
|
55
|
-
export interface BeaconServiceAddress extends BeaconService {
|
|
56
|
-
address: string;
|
|
57
|
-
}
|
|
58
|
-
export interface BeaconSignal {
|
|
59
|
-
beaconId: string;
|
|
60
|
-
beaconType: string;
|
|
61
|
-
beaconAddress: string;
|
|
62
|
-
tx: RawTransactionRest | RawTransactionV2;
|
|
63
|
-
blockheight: number;
|
|
64
|
-
blocktime: UnixTimestamp;
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* Implements {@link https://dcdpr.github.io/did-btcr2/#update-beacons | 5. Beacons}.
|
|
68
|
-
* Beacons are the mechanism by which a DID controller announces an update to their DID document by broadcasting an
|
|
69
|
-
* attestation to this update onto the public Bitcoin network. Beacons are identified by a Bitcoin address and emit
|
|
70
|
-
* Beacon Signals by broadcasting a valid Bitcoin transaction that spends from this Beacon address. These transactions
|
|
71
|
-
* include attestations to a set of didUpdatePayloads, either in the form of Content Identifiers (CIDs) or Sparse Merkle
|
|
72
|
-
* Tree (SMT) roots. Beacons are included as a service in DID documents, with the Service Endpoint identifying a Bitcoin
|
|
73
|
-
* address to watch for Beacon Signals. All Beacon Signals broadcast from this Beacon MUST be processed as part of
|
|
74
|
-
* resolution (see Read). The type of the Beacon service in the DID document defines how Beacon Signals SHOULD be
|
|
75
|
-
* processed.
|
|
76
|
-
* did:btcr2 supports different Beacon Types, with each type defining a set of algorithms for:
|
|
77
|
-
* 1. How a Beacon can be established and added as a service to a DID document.
|
|
78
|
-
* 2. How attestations to DID updates are broadcast within Beacon Signals.
|
|
79
|
-
* 3. How a resolver processes a Beacon Signal, identifying, verifying, and applying the authorized mutations to a
|
|
80
|
-
* DID document for a specific DID.
|
|
81
|
-
* This is an extendable mechanism, such that in the future new Beacon Types could be added. It would be up to the
|
|
82
|
-
* resolver to determine if the Beacon Type is a mechanism they support and are willing to trust. If they are unable to
|
|
83
|
-
* support a Beacon Type and a DID they are resolving uses that type then the DID MUST be treated as invalid.
|
|
84
|
-
* The current, active Beacons of a DID document are specified in the document’s service property. By updating the DID
|
|
85
|
-
* document, a DID controller can change the set of Beacons they can use to broadcast updates to their DID document over
|
|
86
|
-
* time. Resolution of a DID MUST process signals from all Beacons identified in the latest DID document and apply them
|
|
87
|
-
* in order determined by the version specified by the didUpdatePayload.
|
|
88
|
-
* All resolvers of did:btcr2 DIDs MUST support the core Beacon Types defined in this specification.
|
|
89
|
-
*
|
|
90
|
-
* @abstract
|
|
91
|
-
* @class Beacon
|
|
92
|
-
* @type {Beacon}
|
|
93
|
-
*/
|
|
94
|
-
export declare abstract class Beacon implements IBeacon {
|
|
95
|
-
id: string;
|
|
96
|
-
type: string;
|
|
97
|
-
serviceEndpoint: DidServiceEndpoint;
|
|
98
|
-
sidecar?: SidecarData;
|
|
99
|
-
constructor({ id, type, serviceEndpoint }: BeaconService, sidecar?: SidecarData);
|
|
100
|
-
/**
|
|
101
|
-
* Returns the Beacon Service object.
|
|
102
|
-
*/
|
|
103
|
-
abstract get service(): BeaconService;
|
|
104
|
-
/**
|
|
105
|
-
* Generates a Beacon Signal (implemented by subclasses).
|
|
106
|
-
*/
|
|
107
|
-
abstract generateSignal(didUpdatePayload: string): BeaconSignal;
|
|
108
|
-
/**
|
|
109
|
-
* Processes a Beacon Signal (implemented by subclasses).
|
|
110
|
-
*/
|
|
111
|
-
abstract processSignal(signal: RawTransactionRest | RawTransactionV2, signalsMetadata: SignalsMetadata): Promise<DidUpdatePayload | undefined>;
|
|
112
|
-
/**
|
|
113
|
-
* Broadcasts a Beacon Signal (implemented by subclasses).
|
|
114
|
-
*/
|
|
115
|
-
abstract broadcastSignal(didUpdatePayload: DidUpdatePayload): Promise<SignalsMetadata>;
|
|
116
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"beacon.d.ts","sourceRoot":"","sources":["../../../src/interfaces/beacon.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC1E,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACpE,OAAO,EAAE,kBAAkB,EAAE,UAAU,IAAI,WAAW,EAAE,MAAM,YAAY,CAAC;AAC3E,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEjE;;;;GAIG;AACH,MAAM,WAAW,OAAO;IACpB;;;OAGG;IACH,EAAE,EAAE,MAAM,CAAC;IAEX;;;OAGG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;;OAGG;IACH,eAAe,EAAE,kBAAkB,CAAC;IAEpC;;;OAGG;IACH,OAAO,EAAE,aAAa,CAAC;IAEvB;;;;OAIG;IACH,cAAc,CAAC,gBAAgB,EAAE,MAAM,GAAG,YAAY,CAAC;IAEvD;;;;;OAKG;IACH,aAAa,CAAC,MAAM,EAAE,gBAAgB,EAAE,eAAe,EAAE,eAAe,GAAG,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;CACvF"}
|
|
@@ -1,32 +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
|
-
* Options for resolving a DID Document
|
|
7
|
-
* @param {?number} versionId The versionId for resolving the DID Document
|
|
8
|
-
* @param {?UnixTimestamp} versionTime The versionTime for resolving the DID Document
|
|
9
|
-
* @param {?SidecarData} sidecarData The sidecar data for resolving the DID Document
|
|
10
|
-
*/
|
|
11
|
-
export interface DidResolutionOptions extends IDidResolutionOptions {
|
|
12
|
-
versionId?: number;
|
|
13
|
-
versionTime?: UnixTimestamp;
|
|
14
|
-
sidecarData?: SidecarData;
|
|
15
|
-
network?: string;
|
|
16
|
-
}
|
|
17
|
-
export interface RootCapability {
|
|
18
|
-
'@context': string;
|
|
19
|
-
id: string;
|
|
20
|
-
controller: string;
|
|
21
|
-
invocationTarget: string;
|
|
22
|
-
}
|
|
23
|
-
export interface ReadBlockchainParams {
|
|
24
|
-
contemporaryDidDocument: DidDocument;
|
|
25
|
-
contemporaryBlockHeight: number | 1;
|
|
26
|
-
currentVersionId: number | 1;
|
|
27
|
-
targetVersionId?: number;
|
|
28
|
-
targetBlockHeight: number;
|
|
29
|
-
updateHashHistory: string[];
|
|
30
|
-
sidecarData?: SidecarData;
|
|
31
|
-
options?: DidResolutionOptions;
|
|
32
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"crud.d.ts","sourceRoot":"","sources":["../../../src/interfaces/crud.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,oBAAoB,IAAI,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAC3E,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD;;;;;GAKG;AACH,MAAM,WAAW,oBAAqB,SAAQ,qBAAqB;IACjE,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,WAAW,CAAC,EAAE,aAAa,CAAC;IAC5B,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AACD,MAAM,WAAW,cAAc;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,MAAM,CAAC;IACnB,gBAAgB,EAAE,MAAM,CAAC;CAC5B;AACD,MAAM,WAAW,oBAAoB;IACnC,uBAAuB,EAAE,WAAW,CAAC;IACrC,uBAAuB,EAAE,MAAM,GAAG,CAAC,CAAC;IACpC,gBAAgB,EAAE,MAAM,GAAG,CAAC,CAAC;IAC7B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,iBAAiB,EAAE,MAAM,EAAE,CAAC;IAC5B,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,OAAO,CAAC,EAAE,oBAAoB,CAAC;CAChC"}
|
|
@@ -1,38 +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
|
-
export type FindNextSignals = {
|
|
6
|
-
block: BlockV3;
|
|
7
|
-
beacons: BeaconService[];
|
|
8
|
-
};
|
|
9
|
-
export type Metadata = {
|
|
10
|
-
didUpdate: DidUpdatePayload;
|
|
11
|
-
proofs?: string;
|
|
12
|
-
};
|
|
13
|
-
export type SignalSidecarData = Metadata;
|
|
14
|
-
export interface Sidecar {
|
|
15
|
-
did: string;
|
|
16
|
-
}
|
|
17
|
-
export type SignalsMetadata = {
|
|
18
|
-
[signalId: string]: Metadata;
|
|
19
|
-
};
|
|
20
|
-
export interface SingletonSidecar extends Sidecar {
|
|
21
|
-
signalsMetadata: SignalsMetadata;
|
|
22
|
-
}
|
|
23
|
-
export interface CIDAggregateSidecar extends Sidecar {
|
|
24
|
-
initialDocument: DidDocument;
|
|
25
|
-
signalsMetadata: SignalsMetadata;
|
|
26
|
-
cidUpdates: Array<string>;
|
|
27
|
-
}
|
|
28
|
-
export interface SMTAggregateSidecar extends Sidecar {
|
|
29
|
-
initialDocument: DidDocument;
|
|
30
|
-
signalsMetadata: SignalsMetadata;
|
|
31
|
-
smtProof: ProofBytes;
|
|
32
|
-
}
|
|
33
|
-
export type BeaconSidecarData<T> = T extends 'SingletonBeacon' ? SingletonSidecar : T extends 'CIDAggregateBeacon' ? CIDAggregateSidecar : T extends 'SMTAggregateBeacon' ? SMTAggregateSidecar : T;
|
|
34
|
-
export type SidecarData = BeaconSidecarData<SingletonSidecar | CIDAggregateSidecar | SMTAggregateSidecar>;
|
|
35
|
-
export type GetSigningMethodParams = {
|
|
36
|
-
didDocument: DidDocument;
|
|
37
|
-
methodId?: string;
|
|
38
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/utils/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAE7C,MAAM,MAAM,eAAe,GAAG;IAC5B,KAAK,EAAE,OAAO,CAAC;IACf,OAAO,EAAE,aAAa,EAAE,CAAA;CACzB,CAAC;AACF,MAAM,MAAM,QAAQ,GAAG;IACrB,SAAS,EAAE,gBAAgB,CAAC;IAC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