@did-btcr2/method 0.13.1
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/LICENSE +373 -0
- package/README.md +7 -0
- package/dist/browser.js +2364 -0
- package/dist/browser.js.map +7 -0
- package/dist/browser.mjs +2364 -0
- package/dist/browser.mjs.map +7 -0
- package/dist/cjs/bitcoin/constants.js +20 -0
- package/dist/cjs/bitcoin/constants.js.map +1 -0
- package/dist/cjs/bitcoin/errors.js +11 -0
- package/dist/cjs/bitcoin/errors.js.map +1 -0
- package/dist/cjs/bitcoin/index.js +95 -0
- package/dist/cjs/bitcoin/index.js.map +1 -0
- package/dist/cjs/bitcoin/interface.js +2 -0
- package/dist/cjs/bitcoin/interface.js.map +1 -0
- package/dist/cjs/bitcoin/network.js +17 -0
- package/dist/cjs/bitcoin/network.js.map +1 -0
- package/dist/cjs/bitcoin/rest-client.js +289 -0
- package/dist/cjs/bitcoin/rest-client.js.map +1 -0
- package/dist/cjs/bitcoin/rpc-client.js +722 -0
- package/dist/cjs/bitcoin/rpc-client.js.map +1 -0
- package/dist/cjs/bitcoin/taproot.js +219 -0
- package/dist/cjs/bitcoin/taproot.js.map +1 -0
- package/dist/cjs/btcr2/beacon/aggregation/coordinator.js +120 -0
- package/dist/cjs/btcr2/beacon/aggregation/coordinator.js.map +1 -0
- package/dist/cjs/btcr2/beacon/aggregation/messages/advert.js +24 -0
- package/dist/cjs/btcr2/beacon/aggregation/messages/advert.js.map +1 -0
- package/dist/cjs/btcr2/beacon/aggregation/messages/base.js +37 -0
- package/dist/cjs/btcr2/beacon/aggregation/messages/base.js.map +1 -0
- package/dist/cjs/btcr2/beacon/aggregation/messages/cohort-set.js +25 -0
- package/dist/cjs/btcr2/beacon/aggregation/messages/cohort-set.js.map +1 -0
- package/dist/cjs/btcr2/beacon/aggregation/messages/keygen.js +8 -0
- package/dist/cjs/btcr2/beacon/aggregation/messages/keygen.js.map +1 -0
- package/dist/cjs/btcr2/beacon/aggregation/messages/opt-in.js +23 -0
- package/dist/cjs/btcr2/beacon/aggregation/messages/opt-in.js.map +1 -0
- package/dist/cjs/btcr2/beacon/aggregation/messages/sign.js +7 -0
- package/dist/cjs/btcr2/beacon/aggregation/messages/sign.js.map +1 -0
- package/dist/cjs/btcr2/beacon/aggregation/models/cohort/index.js +92 -0
- package/dist/cjs/btcr2/beacon/aggregation/models/cohort/index.js.map +1 -0
- package/dist/cjs/btcr2/beacon/aggregation/models/cohort/status.js +8 -0
- package/dist/cjs/btcr2/beacon/aggregation/models/cohort/status.js.map +1 -0
- package/dist/cjs/btcr2/beacon/aggregation/participant.js +2 -0
- package/dist/cjs/btcr2/beacon/aggregation/participant.js.map +1 -0
- package/dist/cjs/btcr2/beacon/aggregation/protocol/nostr.js +57 -0
- package/dist/cjs/btcr2/beacon/aggregation/protocol/nostr.js.map +1 -0
- package/dist/cjs/btcr2/beacon/aggregation/protocol/service.js +2 -0
- package/dist/cjs/btcr2/beacon/aggregation/protocol/service.js.map +1 -0
- package/dist/cjs/btcr2/beacon/cid-aggregate.js +116 -0
- package/dist/cjs/btcr2/beacon/cid-aggregate.js.map +1 -0
- package/dist/cjs/btcr2/beacon/factory.js +30 -0
- package/dist/cjs/btcr2/beacon/factory.js.map +1 -0
- package/dist/cjs/btcr2/beacon/singleton.js +220 -0
- package/dist/cjs/btcr2/beacon/singleton.js.map +1 -0
- package/dist/cjs/btcr2/beacon/smt-aggregate.js +126 -0
- package/dist/cjs/btcr2/beacon/smt-aggregate.js.map +1 -0
- package/dist/cjs/btcr2/crud/create.js +102 -0
- package/dist/cjs/btcr2/crud/create.js.map +1 -0
- package/dist/cjs/btcr2/crud/deactivate.js +14 -0
- package/dist/cjs/btcr2/crud/deactivate.js.map +1 -0
- package/dist/cjs/btcr2/crud/read.js +686 -0
- package/dist/cjs/btcr2/crud/read.js.map +1 -0
- package/dist/cjs/btcr2/crud/update.js +195 -0
- package/dist/cjs/btcr2/crud/update.js.map +1 -0
- package/dist/cjs/btcr2/key-manager/index.js +290 -0
- package/dist/cjs/btcr2/key-manager/index.js.map +1 -0
- package/dist/cjs/btcr2/key-manager/interface.js +2 -0
- package/dist/cjs/btcr2/key-manager/interface.js.map +1 -0
- package/dist/cjs/did-btcr2.js +222 -0
- package/dist/cjs/did-btcr2.js.map +1 -0
- package/dist/cjs/index.js +27 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/interfaces/beacon.js +41 -0
- package/dist/cjs/interfaces/beacon.js.map +1 -0
- package/dist/cjs/interfaces/crud.js +2 -0
- package/dist/cjs/interfaces/crud.js.map +1 -0
- package/dist/cjs/interfaces/ibeacon.js +2 -0
- package/dist/cjs/interfaces/ibeacon.js.map +1 -0
- package/dist/cjs/package.json +1 -0
- package/dist/cjs/types/bitcoin.js +62 -0
- package/dist/cjs/types/bitcoin.js.map +1 -0
- package/dist/cjs/types/crud.js +2 -0
- package/dist/cjs/types/crud.js.map +1 -0
- package/dist/cjs/utils/appendix.js +221 -0
- package/dist/cjs/utils/appendix.js.map +1 -0
- package/dist/cjs/utils/beacons.js +206 -0
- package/dist/cjs/utils/beacons.js.map +1 -0
- package/dist/cjs/utils/did-document-builder.js +61 -0
- package/dist/cjs/utils/did-document-builder.js.map +1 -0
- package/dist/cjs/utils/did-document.js +380 -0
- package/dist/cjs/utils/did-document.js.map +1 -0
- package/dist/cjs/utils/general.js +195 -0
- package/dist/cjs/utils/general.js.map +1 -0
- package/dist/cjs/utils/identifier.js +238 -0
- package/dist/cjs/utils/identifier.js.map +1 -0
- package/dist/esm/bitcoin/constants.js +20 -0
- package/dist/esm/bitcoin/constants.js.map +1 -0
- package/dist/esm/bitcoin/errors.js +11 -0
- package/dist/esm/bitcoin/errors.js.map +1 -0
- package/dist/esm/bitcoin/index.js +95 -0
- package/dist/esm/bitcoin/index.js.map +1 -0
- package/dist/esm/bitcoin/interface.js +2 -0
- package/dist/esm/bitcoin/interface.js.map +1 -0
- package/dist/esm/bitcoin/network.js +17 -0
- package/dist/esm/bitcoin/network.js.map +1 -0
- package/dist/esm/bitcoin/rest-client.js +289 -0
- package/dist/esm/bitcoin/rest-client.js.map +1 -0
- package/dist/esm/bitcoin/rpc-client.js +722 -0
- package/dist/esm/bitcoin/rpc-client.js.map +1 -0
- package/dist/esm/bitcoin/taproot.js +219 -0
- package/dist/esm/bitcoin/taproot.js.map +1 -0
- package/dist/esm/btcr2/beacon/aggregation/coordinator.js +120 -0
- package/dist/esm/btcr2/beacon/aggregation/coordinator.js.map +1 -0
- package/dist/esm/btcr2/beacon/aggregation/messages/advert.js +24 -0
- package/dist/esm/btcr2/beacon/aggregation/messages/advert.js.map +1 -0
- package/dist/esm/btcr2/beacon/aggregation/messages/base.js +37 -0
- package/dist/esm/btcr2/beacon/aggregation/messages/base.js.map +1 -0
- package/dist/esm/btcr2/beacon/aggregation/messages/cohort-set.js +25 -0
- package/dist/esm/btcr2/beacon/aggregation/messages/cohort-set.js.map +1 -0
- package/dist/esm/btcr2/beacon/aggregation/messages/keygen.js +8 -0
- package/dist/esm/btcr2/beacon/aggregation/messages/keygen.js.map +1 -0
- package/dist/esm/btcr2/beacon/aggregation/messages/opt-in.js +23 -0
- package/dist/esm/btcr2/beacon/aggregation/messages/opt-in.js.map +1 -0
- package/dist/esm/btcr2/beacon/aggregation/messages/sign.js +7 -0
- package/dist/esm/btcr2/beacon/aggregation/messages/sign.js.map +1 -0
- package/dist/esm/btcr2/beacon/aggregation/models/cohort/index.js +92 -0
- package/dist/esm/btcr2/beacon/aggregation/models/cohort/index.js.map +1 -0
- package/dist/esm/btcr2/beacon/aggregation/models/cohort/status.js +8 -0
- package/dist/esm/btcr2/beacon/aggregation/models/cohort/status.js.map +1 -0
- package/dist/esm/btcr2/beacon/aggregation/participant.js +2 -0
- package/dist/esm/btcr2/beacon/aggregation/participant.js.map +1 -0
- package/dist/esm/btcr2/beacon/aggregation/protocol/nostr.js +57 -0
- package/dist/esm/btcr2/beacon/aggregation/protocol/nostr.js.map +1 -0
- package/dist/esm/btcr2/beacon/aggregation/protocol/service.js +2 -0
- package/dist/esm/btcr2/beacon/aggregation/protocol/service.js.map +1 -0
- package/dist/esm/btcr2/beacon/cid-aggregate.js +116 -0
- package/dist/esm/btcr2/beacon/cid-aggregate.js.map +1 -0
- package/dist/esm/btcr2/beacon/factory.js +30 -0
- package/dist/esm/btcr2/beacon/factory.js.map +1 -0
- package/dist/esm/btcr2/beacon/singleton.js +220 -0
- package/dist/esm/btcr2/beacon/singleton.js.map +1 -0
- package/dist/esm/btcr2/beacon/smt-aggregate.js +126 -0
- package/dist/esm/btcr2/beacon/smt-aggregate.js.map +1 -0
- package/dist/esm/btcr2/crud/create.js +102 -0
- package/dist/esm/btcr2/crud/create.js.map +1 -0
- package/dist/esm/btcr2/crud/deactivate.js +14 -0
- package/dist/esm/btcr2/crud/deactivate.js.map +1 -0
- package/dist/esm/btcr2/crud/read.js +686 -0
- package/dist/esm/btcr2/crud/read.js.map +1 -0
- package/dist/esm/btcr2/crud/update.js +195 -0
- package/dist/esm/btcr2/crud/update.js.map +1 -0
- package/dist/esm/btcr2/key-manager/index.js +290 -0
- package/dist/esm/btcr2/key-manager/index.js.map +1 -0
- package/dist/esm/btcr2/key-manager/interface.js +2 -0
- package/dist/esm/btcr2/key-manager/interface.js.map +1 -0
- package/dist/esm/did-btcr2.js +222 -0
- package/dist/esm/did-btcr2.js.map +1 -0
- package/dist/esm/index.js +27 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/interfaces/beacon.js +41 -0
- package/dist/esm/interfaces/beacon.js.map +1 -0
- package/dist/esm/interfaces/crud.js +2 -0
- package/dist/esm/interfaces/crud.js.map +1 -0
- package/dist/esm/interfaces/ibeacon.js +2 -0
- package/dist/esm/interfaces/ibeacon.js.map +1 -0
- package/dist/esm/types/bitcoin.js +62 -0
- package/dist/esm/types/bitcoin.js.map +1 -0
- package/dist/esm/types/crud.js +2 -0
- package/dist/esm/types/crud.js.map +1 -0
- package/dist/esm/utils/appendix.js +221 -0
- package/dist/esm/utils/appendix.js.map +1 -0
- package/dist/esm/utils/beacons.js +206 -0
- package/dist/esm/utils/beacons.js.map +1 -0
- package/dist/esm/utils/did-document-builder.js +61 -0
- package/dist/esm/utils/did-document-builder.js.map +1 -0
- package/dist/esm/utils/did-document.js +380 -0
- package/dist/esm/utils/did-document.js.map +1 -0
- package/dist/esm/utils/general.js +195 -0
- package/dist/esm/utils/general.js.map +1 -0
- package/dist/esm/utils/identifier.js +238 -0
- package/dist/esm/utils/identifier.js.map +1 -0
- package/dist/types/bitcoin/constants.d.ts +19 -0
- package/dist/types/bitcoin/constants.d.ts.map +1 -0
- package/dist/types/bitcoin/errors.d.ts +5 -0
- package/dist/types/bitcoin/errors.d.ts.map +1 -0
- package/dist/types/bitcoin/index.d.ts +75 -0
- package/dist/types/bitcoin/index.d.ts.map +1 -0
- package/dist/types/bitcoin/interface.d.ts +86 -0
- package/dist/types/bitcoin/interface.d.ts.map +1 -0
- package/dist/types/bitcoin/network.d.ts +2 -0
- package/dist/types/bitcoin/network.d.ts.map +1 -0
- package/dist/types/bitcoin/rest-client.d.ts +268 -0
- package/dist/types/bitcoin/rest-client.d.ts.map +1 -0
- package/dist/types/bitcoin/rpc-client.d.ts +506 -0
- package/dist/types/bitcoin/rpc-client.d.ts.map +1 -0
- package/dist/types/bitcoin/taproot.d.ts +34 -0
- package/dist/types/bitcoin/taproot.d.ts.map +1 -0
- package/dist/types/btcr2/beacon/aggregation/coordinator.d.ts +74 -0
- package/dist/types/btcr2/beacon/aggregation/coordinator.d.ts.map +1 -0
- package/dist/types/btcr2/beacon/aggregation/messages/advert.d.ts +22 -0
- package/dist/types/btcr2/beacon/aggregation/messages/advert.d.ts.map +1 -0
- package/dist/types/btcr2/beacon/aggregation/messages/base.d.ts +36 -0
- package/dist/types/btcr2/beacon/aggregation/messages/base.d.ts.map +1 -0
- package/dist/types/btcr2/beacon/aggregation/messages/cohort-set.d.ts +23 -0
- package/dist/types/btcr2/beacon/aggregation/messages/cohort-set.d.ts.map +1 -0
- package/dist/types/btcr2/beacon/aggregation/messages/keygen.d.ts +6 -0
- package/dist/types/btcr2/beacon/aggregation/messages/keygen.d.ts.map +1 -0
- package/dist/types/btcr2/beacon/aggregation/messages/opt-in.d.ts +22 -0
- package/dist/types/btcr2/beacon/aggregation/messages/opt-in.d.ts.map +1 -0
- package/dist/types/btcr2/beacon/aggregation/messages/sign.d.ts +5 -0
- package/dist/types/btcr2/beacon/aggregation/messages/sign.d.ts.map +1 -0
- package/dist/types/btcr2/beacon/aggregation/models/cohort/index.d.ts +77 -0
- package/dist/types/btcr2/beacon/aggregation/models/cohort/index.d.ts.map +1 -0
- package/dist/types/btcr2/beacon/aggregation/models/cohort/status.d.ts +7 -0
- package/dist/types/btcr2/beacon/aggregation/models/cohort/status.d.ts.map +1 -0
- package/dist/types/btcr2/beacon/aggregation/participant.d.ts +1 -0
- package/dist/types/btcr2/beacon/aggregation/participant.d.ts.map +1 -0
- package/dist/types/btcr2/beacon/aggregation/protocol/nostr.d.ts +36 -0
- package/dist/types/btcr2/beacon/aggregation/protocol/nostr.d.ts.map +1 -0
- package/dist/types/btcr2/beacon/aggregation/protocol/service.d.ts +6 -0
- package/dist/types/btcr2/beacon/aggregation/protocol/service.d.ts.map +1 -0
- package/dist/types/btcr2/beacon/cid-aggregate.d.ts +103 -0
- package/dist/types/btcr2/beacon/cid-aggregate.d.ts.map +1 -0
- package/dist/types/btcr2/beacon/factory.d.ts +17 -0
- package/dist/types/btcr2/beacon/factory.d.ts.map +1 -0
- package/dist/types/btcr2/beacon/singleton.d.ts +93 -0
- package/dist/types/btcr2/beacon/singleton.d.ts.map +1 -0
- package/dist/types/btcr2/beacon/smt-aggregate.d.ts +112 -0
- package/dist/types/btcr2/beacon/smt-aggregate.d.ts.map +1 -0
- package/dist/types/btcr2/crud/create.d.ts +92 -0
- package/dist/types/btcr2/crud/create.d.ts.map +1 -0
- package/dist/types/btcr2/crud/deactivate.d.ts +13 -0
- package/dist/types/btcr2/crud/deactivate.d.ts.map +1 -0
- package/dist/types/btcr2/crud/read.d.ts +341 -0
- package/dist/types/btcr2/crud/read.d.ts.map +1 -0
- package/dist/types/btcr2/crud/update.d.ts +83 -0
- package/dist/types/btcr2/crud/update.d.ts.map +1 -0
- package/dist/types/btcr2/key-manager/index.d.ts +145 -0
- package/dist/types/btcr2/key-manager/index.d.ts.map +1 -0
- package/dist/types/btcr2/key-manager/interface.d.ts +113 -0
- package/dist/types/btcr2/key-manager/interface.d.ts.map +1 -0
- package/dist/types/did-btcr2.d.ts +117 -0
- package/dist/types/did-btcr2.d.ts.map +1 -0
- package/dist/types/index.d.ts +26 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/interfaces/beacon.d.ts +57 -0
- package/dist/types/interfaces/beacon.d.ts.map +1 -0
- package/dist/types/interfaces/crud.d.ts +35 -0
- package/dist/types/interfaces/crud.d.ts.map +1 -0
- package/dist/types/interfaces/ibeacon.d.ts +66 -0
- package/dist/types/interfaces/ibeacon.d.ts.map +1 -0
- package/dist/types/types/bitcoin.d.ts +827 -0
- package/dist/types/types/bitcoin.d.ts.map +1 -0
- package/dist/types/types/crud.d.ts +38 -0
- package/dist/types/types/crud.d.ts.map +1 -0
- package/dist/types/utils/appendix.d.ts +118 -0
- package/dist/types/utils/appendix.d.ts.map +1 -0
- package/dist/types/utils/beacons.d.ts +156 -0
- package/dist/types/utils/beacons.d.ts.map +1 -0
- package/dist/types/utils/did-document-builder.d.ts +13 -0
- package/dist/types/utils/did-document-builder.d.ts.map +1 -0
- package/dist/types/utils/did-document.d.ts +211 -0
- package/dist/types/utils/did-document.d.ts.map +1 -0
- package/dist/types/utils/general.d.ts +85 -0
- package/dist/types/utils/general.d.ts.map +1 -0
- package/dist/types/utils/identifier.d.ts +59 -0
- package/dist/types/utils/identifier.d.ts.map +1 -0
- package/package.json +137 -0
- package/src/bitcoin/constants.ts +19 -0
- package/src/bitcoin/errors.ts +10 -0
- package/src/bitcoin/index.ts +154 -0
- package/src/bitcoin/interface.ts +160 -0
- package/src/bitcoin/network.ts +17 -0
- package/src/bitcoin/rest-client.ts +415 -0
- package/src/bitcoin/rpc-client.ts +888 -0
- package/src/bitcoin/taproot.ts +237 -0
- package/src/btcr2/beacon/aggregation/coordinator.ts +135 -0
- package/src/btcr2/beacon/aggregation/messages/advert.ts +36 -0
- package/src/btcr2/beacon/aggregation/messages/base.ts +59 -0
- package/src/btcr2/beacon/aggregation/messages/cohort-set.ts +37 -0
- package/src/btcr2/beacon/aggregation/messages/keygen.ts +8 -0
- package/src/btcr2/beacon/aggregation/messages/opt-in.ts +35 -0
- package/src/btcr2/beacon/aggregation/messages/sign.ts +7 -0
- package/src/btcr2/beacon/aggregation/models/cohort/index.ts +112 -0
- package/src/btcr2/beacon/aggregation/models/cohort/status.ts +7 -0
- package/src/btcr2/beacon/aggregation/participant.ts +0 -0
- package/src/btcr2/beacon/aggregation/protocol/nostr.ts +81 -0
- package/src/btcr2/beacon/aggregation/protocol/service.ts +6 -0
- package/src/btcr2/beacon/cid-aggregate.ts +154 -0
- package/src/btcr2/beacon/factory.ts +36 -0
- package/src/btcr2/beacon/singleton.ts +257 -0
- package/src/btcr2/beacon/smt-aggregate.ts +136 -0
- package/src/btcr2/crud/create.ts +160 -0
- package/src/btcr2/crud/deactivate.ts +13 -0
- package/src/btcr2/crud/read.ts +946 -0
- package/src/btcr2/crud/update.ts +277 -0
- package/src/btcr2/key-manager/index.ts +364 -0
- package/src/btcr2/key-manager/interface.ts +129 -0
- package/src/canonicalize.d.ts +6 -0
- package/src/did-btcr2.ts +288 -0
- package/src/index.ts +34 -0
- package/src/interfaces/beacon.ts +68 -0
- package/src/interfaces/crud.ts +36 -0
- package/src/interfaces/ibeacon.ts +76 -0
- package/src/types/bitcoin.ts +1028 -0
- package/src/types/crud.ts +41 -0
- package/src/utils/appendix.ts +257 -0
- package/src/utils/beacons.ts +276 -0
- package/src/utils/did-document-builder.ts +73 -0
- package/src/utils/did-document.ts +474 -0
- package/src/utils/general.ts +204 -0
- package/src/utils/identifier.ts +276 -0
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { KeyBytes, PatchOperation } from '@did-btcr2/common';
|
|
2
|
+
import { DidCreateOptions as IDidCreateOptions } from '@web5/dids';
|
|
3
|
+
import { Btc1DidDocument, IntermediateDidDocument } from '../../utils/did-document.js';
|
|
4
|
+
import { Btc1KeyManager } from '../key-manager/index.js';
|
|
5
|
+
export type Btc1CreateParams = Btc1CreateKeyParams | Btc1CreateExternalParams;
|
|
6
|
+
export interface CreateIdentifierParams {
|
|
7
|
+
genesisBytes: Uint8Array;
|
|
8
|
+
newtork?: string;
|
|
9
|
+
version?: string;
|
|
10
|
+
}
|
|
11
|
+
export type Btc1CreateResponse = {
|
|
12
|
+
did: string;
|
|
13
|
+
initialDocument: Btc1DidDocument;
|
|
14
|
+
};
|
|
15
|
+
export interface Btc1UpdateConstructParams {
|
|
16
|
+
identifier: string;
|
|
17
|
+
sourceDocument: Btc1DidDocument;
|
|
18
|
+
sourceVersionId: number;
|
|
19
|
+
patch: PatchOperation[];
|
|
20
|
+
}
|
|
21
|
+
export interface Btc1UpdateParams extends Btc1UpdateConstructParams {
|
|
22
|
+
verificationMethodId: string;
|
|
23
|
+
beaconIds: string[];
|
|
24
|
+
}
|
|
25
|
+
export interface DidCreateOptions extends IDidCreateOptions<Btc1KeyManager> {
|
|
26
|
+
/** DID BTCR2 Version Number */
|
|
27
|
+
version?: number;
|
|
28
|
+
/** Bitcoin Network */
|
|
29
|
+
network?: string;
|
|
30
|
+
}
|
|
31
|
+
export type Btc1CreateKeyParams = {
|
|
32
|
+
idType: 'KEY';
|
|
33
|
+
pubKeyBytes: KeyBytes;
|
|
34
|
+
options?: DidCreateOptions;
|
|
35
|
+
};
|
|
36
|
+
export type Btc1CreateExternalParams = {
|
|
37
|
+
idType: 'EXTERNAL';
|
|
38
|
+
intermediateDocument: IntermediateDidDocument;
|
|
39
|
+
options?: DidCreateOptions;
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* Implements section {@link https://dcdpr.github.io/did-btcr2/#create | 4.1 Create}.
|
|
43
|
+
*
|
|
44
|
+
* A did:btcr2 identifier and associated DID document can either be created deterministically from a cryptographic seed,
|
|
45
|
+
* or it can be created from an arbitrary genesis intermediate DID document representation. In both cases, DID creation
|
|
46
|
+
* can be undertaken in an offline manner, i.e., the DID controller does not need to interact with the Bitcoin network
|
|
47
|
+
* to create their DID.
|
|
48
|
+
*
|
|
49
|
+
* @class Btc1Create
|
|
50
|
+
* @type {Btc1Create}
|
|
51
|
+
*/
|
|
52
|
+
export declare class Btc1Create {
|
|
53
|
+
/**
|
|
54
|
+
* Implements {@link https://dcdpr.github.io/did-btcr2/#deterministic-key-based-creation | 4.1.1 Deterministic Key-Based Creation}.
|
|
55
|
+
*
|
|
56
|
+
* For deterministic key-based creation, the did:btcr2 identifier encodes a secp256k1 public key. The key is then used
|
|
57
|
+
* to deterministically generate the initial DID document.
|
|
58
|
+
*
|
|
59
|
+
* @param {Btc1CreateKeyParams} params See {@link Btc1CreateKeyParams} for details.
|
|
60
|
+
* @param {number} params.version did-btcr2 identifier version.
|
|
61
|
+
* @param {string} params.network did-btcr2 bitcoin network.
|
|
62
|
+
* @param {KeyBytes} params.pubKeyBytes public key bytes for id creation.
|
|
63
|
+
* @returns {Btc1CreateResponse} A response object of type {@link Btc1CreateResponse}.
|
|
64
|
+
* @throws {DidError} if the public key is missing or invalid.
|
|
65
|
+
*/
|
|
66
|
+
static deterministic({ pubKeyBytes, options }: {
|
|
67
|
+
pubKeyBytes: KeyBytes;
|
|
68
|
+
options: DidCreateOptions;
|
|
69
|
+
}): Btc1CreateResponse;
|
|
70
|
+
/**
|
|
71
|
+
* Implements {@link https://dcdpr.github.io/did-btcr2/#external-initial-document-creation | 4.1.2 External Initial Document Creation}.
|
|
72
|
+
*
|
|
73
|
+
* Creates a did:btcr2 identifier from some initiating arbitrary DID document. This allows for more complex
|
|
74
|
+
* initial DID documents, including the ability to include Service Endpoints and Beacons that support aggregation.
|
|
75
|
+
* Inputs include `intermediateDocument`, optional version and network returning initialDidDocument. The
|
|
76
|
+
* intermediateDocument should be a valid DID document except all places where the DID document requires the use of
|
|
77
|
+
* the identifier (e.g. the id field). These fields should use placeholder value
|
|
78
|
+
* `did:btcr2:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx`. The intermediateDocument should include at
|
|
79
|
+
* least one verificationMethod and service of the type SingletonBeacon.
|
|
80
|
+
*
|
|
81
|
+
* @param {Btc1CreateExternalParams} params See {@link Btc1CreateExternalParams} for details.
|
|
82
|
+
* @param {number} params.version Identifier version.
|
|
83
|
+
* @param {string} params.network Identifier network name.
|
|
84
|
+
* @param {string} params.documentBytes Intermediate DID Document bytes.
|
|
85
|
+
* @returns {Btc1CreateResponse} A Promise resolving to {@link Btc1CreateResponses}.
|
|
86
|
+
* @throws {DidError} if the verificationMethod or service objects are missing required properties
|
|
87
|
+
*/
|
|
88
|
+
static external({ intermediateDocument, options }: {
|
|
89
|
+
intermediateDocument: IntermediateDidDocument;
|
|
90
|
+
options: DidCreateOptions;
|
|
91
|
+
}): Promise<Btc1CreateResponse>;
|
|
92
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../../../src/btcr2/crud/create.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwB,QAAQ,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEnF,OAAO,EAAE,gBAAgB,IAAI,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAGnE,OAAO,EAAE,eAAe,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AAEvF,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAEzD,MAAM,MAAM,gBAAgB,GAAG,mBAAmB,GAAG,wBAAwB,CAAC;AAC9E,MAAM,WAAW,sBAAsB;IACrC,YAAY,EAAE,UAAU,C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AoB,EAAE,uBAAuB,CAAC;QAC9C,OAAO,EAAE,gBAAgB,CAAC;KAC3B,GAAG,OAAO,CAAC,kBAAkB,CAAC;CA0BhC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { DidBtc1 } from '../../did-btcr2.js';
|
|
2
|
+
/**
|
|
3
|
+
* Implements {@link https://dcdpr.github.io/did-btcr2/#deactivate | 4.4 Deactivate}
|
|
4
|
+
* To deactivate a did:btcr2, the DID controller MUST add the property deactivated with the value true on the DID
|
|
5
|
+
* document. To do this, the DID controller constructs a valid DID Update Payload with a JSON patch that adds this
|
|
6
|
+
* property and announces the payload through a Beacon in their current DID document following the algorithm in Update.
|
|
7
|
+
* Once a did:btcr2 has been deactivated this state is considered permanent and resolution MUST terminate.
|
|
8
|
+
* @class Btc1Deactivate
|
|
9
|
+
* @type {Btc1Deactivate}
|
|
10
|
+
* @extends {DidBtc1}
|
|
11
|
+
*/
|
|
12
|
+
export declare class Btc1Deactivate extends DidBtc1 {
|
|
13
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deactivate.d.ts","sourceRoot":"","sources":["../../../../src/btcr2/crud/deactivate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAE7C;;;;;;;;;GASG;AACH,qBAAa,cAAe,SAAQ,OAAO;CAAG"}
|
|
@@ -0,0 +1,341 @@
|
|
|
1
|
+
import { BitcoinNetworkNames, DidUpdatePayload, UnixTimestamp } from '@did-btcr2/common';
|
|
2
|
+
import BitcoinRest from '../../bitcoin/rest-client.js';
|
|
3
|
+
import BitcoinRpc from '../../bitcoin/rpc-client.js';
|
|
4
|
+
import { DidResolutionOptions } from '../../interfaces/crud.js';
|
|
5
|
+
import { BeaconService, BeaconServiceAddress, BeaconSignal } from '../../interfaces/ibeacon.js';
|
|
6
|
+
import { BlockV3 } from '../../types/bitcoin.js';
|
|
7
|
+
import { SignalsMetadata } from '../../types/crud.js';
|
|
8
|
+
import { DidComponents } from '../../utils/appendix.js';
|
|
9
|
+
import { Btc1DidDocument } from '../../utils/did-document.js';
|
|
10
|
+
export type FindNextSignalsRestParams = {
|
|
11
|
+
connection: BitcoinRest;
|
|
12
|
+
beaconSignals: Array<BeaconSignal>;
|
|
13
|
+
block: BlockV3;
|
|
14
|
+
beacons: Array<BeaconServiceAddress>;
|
|
15
|
+
};
|
|
16
|
+
export type BeaconSignals = Array<BeaconSignal>;
|
|
17
|
+
export type BitcoinClient = BitcoinRpc | BitcoinRest;
|
|
18
|
+
export type NetworkVersion = {
|
|
19
|
+
version?: string;
|
|
20
|
+
network?: string;
|
|
21
|
+
};
|
|
22
|
+
export type ResolveInitialDocument = {
|
|
23
|
+
identifier: string;
|
|
24
|
+
components: DidComponents;
|
|
25
|
+
resolutionsOptions: DidResolutionOptions;
|
|
26
|
+
};
|
|
27
|
+
export interface Btc1ReadDeterministic {
|
|
28
|
+
components: DidComponents;
|
|
29
|
+
identifier: string;
|
|
30
|
+
}
|
|
31
|
+
export interface Btc1ReadExternal {
|
|
32
|
+
components: DidComponents;
|
|
33
|
+
identifier: string;
|
|
34
|
+
resolutionsOptions: DidResolutionOptions;
|
|
35
|
+
}
|
|
36
|
+
export interface Btc1ReadSidecar {
|
|
37
|
+
identifierComponents: DidComponents;
|
|
38
|
+
initialDocument: Btc1DidDocument;
|
|
39
|
+
}
|
|
40
|
+
export interface DidReadCas {
|
|
41
|
+
identifier: string;
|
|
42
|
+
identifierComponents: DidComponents;
|
|
43
|
+
}
|
|
44
|
+
export interface ApplyDidUpdateParams {
|
|
45
|
+
contemporaryDidDocument: Btc1DidDocument;
|
|
46
|
+
update: DidUpdatePayload;
|
|
47
|
+
}
|
|
48
|
+
export interface TargetDocumentParams {
|
|
49
|
+
initialDocument: Btc1DidDocument;
|
|
50
|
+
resolutionsOptions: DidResolutionOptions;
|
|
51
|
+
}
|
|
52
|
+
export interface TargetBlockheightParams {
|
|
53
|
+
network: BitcoinNetworkNames;
|
|
54
|
+
targetTime?: UnixTimestamp;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Implements {@link https://dcdpr.github.io/did-btcr2/#read | 4.2 Read}.
|
|
58
|
+
* The read operation is executed by a resolver after a resolution request identifying a specific did:btcr2 identifier is
|
|
59
|
+
* received from a client at Resolution Time. The request MAY contain a resolutionOptions object containing additional
|
|
60
|
+
* information to be used in resolution. The resolver then attempts to resolve the DID document of the identifier at a
|
|
61
|
+
* specific Target Time. The Target Time is either provided in resolutionOptions or is set to the Resolution Time of the
|
|
62
|
+
* request.
|
|
63
|
+
* To do so it executes the following algorithm:
|
|
64
|
+
* 1. Let identifierComponents be the result of running the algorithm
|
|
65
|
+
* in Parse did:btcr2 identifier, passing in the identifier.
|
|
66
|
+
* 2. Set initialDocument to the result of running Resolve Initial Document
|
|
67
|
+
* passing identifier, identifierComponents and resolutionOptions.
|
|
68
|
+
* 3. Set targetDocument to the result of running the algorithm in Resolve
|
|
69
|
+
* Target Document passing in initialDocument and resolutionOptions.
|
|
70
|
+
* 4. Return targetDocument.
|
|
71
|
+
*
|
|
72
|
+
* @class Btc1Read
|
|
73
|
+
* @type {Btc1Read}
|
|
74
|
+
*/
|
|
75
|
+
export declare class Btc1Read {
|
|
76
|
+
/**
|
|
77
|
+
* Implements {@link https://dcdpr.github.io/did-btcr2/#deterministically-generate-initial-did-document | 4.2.2.1 Deterministically Generate Initial DID Document}.
|
|
78
|
+
*
|
|
79
|
+
* The Deterministically Generate Initial DID Document algorithm deterministically generates an initial DID
|
|
80
|
+
* Document from a secp256k1 public key. It takes in a did:btcr2 identifier and a identifierComponents object and
|
|
81
|
+
* returns an initialDocument.
|
|
82
|
+
*
|
|
83
|
+
* @param {Btc1ReadDeterministic} params See {@link Btc1ReadDeterministic} for details.
|
|
84
|
+
* @param {string} params.identifier The did-btcr2 version.
|
|
85
|
+
* @param {DidComponents} params.identifierComponents The decoded components of the identifier.
|
|
86
|
+
* @returns {Btc1DidDocument} The resolved DID Document object.
|
|
87
|
+
*/
|
|
88
|
+
static deterministic({ identifier, identifierComponents }: {
|
|
89
|
+
identifier: string;
|
|
90
|
+
identifierComponents: DidComponents;
|
|
91
|
+
}): Btc1DidDocument;
|
|
92
|
+
/**
|
|
93
|
+
* Implements {@link https://dcdpr.github.io/did-btcr2/#external-resolution | 4.2.2.2 External Resolution}.
|
|
94
|
+
*
|
|
95
|
+
* The External Resolution algorithm externally retrieves an intermediateDocumentRepresentation, either by retrieving
|
|
96
|
+
* it from {@link https://dcdpr.github.io/did-btcr2/#def-content-addressable-storage | Content Addressable Storage (CAS)}
|
|
97
|
+
* or from the {@link https://dcdpr.github.io/did-btcr2/#def-sidecar-data | Sidecar Data} provided as part of the
|
|
98
|
+
* resolution request. It takes in a did:btcr2 identifier, a identifierComponents object and a resolutionOptions object.
|
|
99
|
+
* It returns an initialDocument, which is a conformant DID document validated against the identifier.
|
|
100
|
+
*
|
|
101
|
+
* @param {Btc1ReadExternal} params Required params for calling the external method.
|
|
102
|
+
* @param {string} params.identifier The DID to be resolved.
|
|
103
|
+
* @param {DidComponents} params.identifierComponents The decoded components of the identifier.
|
|
104
|
+
* @param {DidResolutionOptions} params.resolutionsOptions The options for resolving the DID Document.
|
|
105
|
+
* @param {Btc1DidDocument} params.resolutionsOptions.sidecarData The sidecar data for resolving the DID Document.
|
|
106
|
+
* @param {Btc1DidDocument} params.resolutionsOptions.sidecarData.initialDocument The offline user-provided DID Document
|
|
107
|
+
* @returns {Btc1DidDocument} The resolved DID Document object
|
|
108
|
+
*/
|
|
109
|
+
static external({ identifier, identifierComponents, resolutionsOptions }: {
|
|
110
|
+
identifier: string;
|
|
111
|
+
identifierComponents: DidComponents;
|
|
112
|
+
resolutionsOptions: DidResolutionOptions;
|
|
113
|
+
}): Promise<Btc1DidDocument>;
|
|
114
|
+
/**
|
|
115
|
+
* Implements {@link https://dcdpr.github.io/did-btcr2/#sidecar-initial-document-validation | 4.2.2.2.1 Sidecar Initial Document Validation}.
|
|
116
|
+
*
|
|
117
|
+
* The Sidecar Initial Document Validation algorithm validates an initialDocument against its identifier, by first
|
|
118
|
+
* constructing the intermediateDocumentRepresentation and verifying the hash of this document matches the bytes
|
|
119
|
+
* encoded within the identifier. It takes in a did:btcr2 identifier, identifierComponents and a
|
|
120
|
+
* initialDocument. It returns the initialDocument if validated, otherwise it throws an error.
|
|
121
|
+
*
|
|
122
|
+
* @param {Btc1ReadSidecar} params Required params for calling the sidecar method
|
|
123
|
+
* @param {string} params.identifier The DID to be resolved
|
|
124
|
+
* @param {DidComponents} params.identifierComponents The components of the DID identifier
|
|
125
|
+
* @param {Btc1DidDocument} params.initialDocument The initial DID Document provided by the user
|
|
126
|
+
* @returns {Btc1DidDocument} The resolved DID Document object
|
|
127
|
+
* @throws {DidError} InvalidDidDocument if genesisBytes !== initialDocument hashBytes
|
|
128
|
+
*/
|
|
129
|
+
static sidecar({ identifierComponents, initialDocument }: Btc1ReadSidecar): Promise<Btc1DidDocument>;
|
|
130
|
+
/**
|
|
131
|
+
* Implements {@link https://dcdpr.github.io/did-btcr2/#cas-retrieval | 4.2.2.2.2 CAS Retrieval}.
|
|
132
|
+
*
|
|
133
|
+
* The CAS Retrieval algorithm attempts to retrieve an initialDocument from a Content Addressable Storage (CAS) system
|
|
134
|
+
* by converting the bytes in the identifier into a Content Identifier (CID). It takes in an identifier and
|
|
135
|
+
* an identifierComponents object. It returns an initialDocument.
|
|
136
|
+
*
|
|
137
|
+
* @param {DidReadCas} params Required params for calling the cas method
|
|
138
|
+
* @param {string} params.identifier BTCR2 DID used to resolve the DID Document
|
|
139
|
+
* @param {DidComponents} params.identifierComponents BTCR2 DID components used to resolve the DID Document
|
|
140
|
+
* @returns {Btc1DidDocument} The resolved DID Document object
|
|
141
|
+
* @throws {Btcr2Error} if the DID Document content is invalid
|
|
142
|
+
*/
|
|
143
|
+
static cas({ identifier, identifierComponents }: DidReadCas): Promise<Btc1DidDocument>;
|
|
144
|
+
/**
|
|
145
|
+
* Implements {@link https://dcdpr.github.io/did-btcr2/#resolve-initial-document | 4.2.2 Resolve Initial Document}.
|
|
146
|
+
*
|
|
147
|
+
* This algorithm resolves an initial DID document and validates it against the identifier for a specific did:btcr2.
|
|
148
|
+
* The algorithm takes in a did:btcr2 identifier, identifier components object, resolutionsOptions object and returns
|
|
149
|
+
* a valid initialDocument for that identifier.
|
|
150
|
+
*
|
|
151
|
+
* @public
|
|
152
|
+
* @param {ResolveInitialDocument} params See {@link ResolveInitialDocument} for parameter details.
|
|
153
|
+
* @param {string} params.identifier The DID to be resolved.
|
|
154
|
+
* @param {DidComponents} params.identifierComponents The decoded components of the identifier.
|
|
155
|
+
* @param {DidResolutionOptions} params.resolutionsOptions Options for resolving the DID Document. See {@link DidResolutionOptions}.
|
|
156
|
+
* @returns {Promise<Btc1DidDocument>} The resolved DID Document object.
|
|
157
|
+
* @throws {DidError} if the DID hrp is invalid, no sidecarData passed and hrp = "x".
|
|
158
|
+
*/
|
|
159
|
+
static initialDocument({ identifier, identifierComponents, resolutionsOptions }: {
|
|
160
|
+
identifier: string;
|
|
161
|
+
identifierComponents: DidComponents;
|
|
162
|
+
resolutionsOptions: DidResolutionOptions;
|
|
163
|
+
}): Promise<Btc1DidDocument>;
|
|
164
|
+
/**
|
|
165
|
+
* Implements {@link https://dcdpr.github.io/did-btcr2/#resolve-target-document | 4.2.3 Resolve Target Document}.
|
|
166
|
+
*
|
|
167
|
+
* The Resolve Target Document algorithm resolves a DID document from an initial document by walking the Bitcoin
|
|
168
|
+
* blockchain to identify Beacon Signals that announce DID Update Payloads applicable to the did:btcr2 identifier being
|
|
169
|
+
* resolved. It takes as inputs initialDocument, resolutionOptions and network. It returns a valid DID document.
|
|
170
|
+
*
|
|
171
|
+
* @public
|
|
172
|
+
* @param {TargetDocumentParams} params See {@link TargetDocumentParams} for details.
|
|
173
|
+
* @param {Btc1DidDocument} params.initialDocument The initial DID Document to resolve
|
|
174
|
+
* @param {ResolutionOptions} params.options See {@link DidResolutionOptions} for details.
|
|
175
|
+
* @returns {Btc1DidDocument} The resolved DID Document object with a validated single, canonical history
|
|
176
|
+
*/
|
|
177
|
+
static targetDocument({ initialDocument, resolutionsOptions }: {
|
|
178
|
+
initialDocument: Btc1DidDocument;
|
|
179
|
+
resolutionsOptions: DidResolutionOptions;
|
|
180
|
+
}): Promise<Btc1DidDocument>;
|
|
181
|
+
/**
|
|
182
|
+
* Implements {@link https://dcdpr.github.io/did-btcr2/#traverse-blockchain-history | 4.2.3.2 Traverse Blockchain History}.
|
|
183
|
+
*
|
|
184
|
+
* The Traverse Blockchain History algorithm traverses Bitcoin blocks, starting from the block with the
|
|
185
|
+
* contemporaryBlockheight, to find beaconSignals emitted by Beacons within the contemporaryDidDocument. Each
|
|
186
|
+
* beaconSignal is processed to retrieve a didUpdatePayload to the DID document. Each update is applied to the
|
|
187
|
+
* document and duplicates are ignored. If the algorithm reaches the block with the blockheight specified by a
|
|
188
|
+
* targetBlockheight, the contemporaryDidDocument at that blockheight is returned assuming a single canonical history
|
|
189
|
+
* of the DID document has been constructed up to that point. It takes in contemporaryDidDocument,
|
|
190
|
+
* contemporaryBlockHeight, currentVersionId, targetVersionId, targetBlockheight, updateHashHistory, signalsMetadata
|
|
191
|
+
* and network. It returns the contemporaryDidDocument once either the targetBlockheight or targetVersionId have been
|
|
192
|
+
* reached.
|
|
193
|
+
*
|
|
194
|
+
* @protected
|
|
195
|
+
* @param {ReadBlockchainParams} params The parameters for the traverseBlockchainHistory operation.
|
|
196
|
+
* @param {Btc1DidDocument} params.contemporaryDidDocument The DID document for the did:btcr2 identifier being resolved.
|
|
197
|
+
* It should be "current" (contemporary) at the blockheight of the contemporaryBlockheight.
|
|
198
|
+
* It should be a DID Core conformant DID document.
|
|
199
|
+
* @param {number} params.contemporaryBlockHeight The Bitcoin blockheight signaling the "contemporary time" of the
|
|
200
|
+
* contemporary DID Document that is being resolved and updated using the Traverse Blockchain History algorithm.
|
|
201
|
+
* @param {number} params.currentVersionId The version of the contemporary DID document starting from 1 and
|
|
202
|
+
* incrementing by 1 with each BTCR2 Update applied to the DID document.
|
|
203
|
+
* @param {number} params.targetVersionId The version of the DID document where resolution will complete.
|
|
204
|
+
* @param {UnixTimestamp} params.targetTime The timestamp used to target specific historical states of a DID document.
|
|
205
|
+
* Only Beacon Signals included in the Bitcoin blockchain before the targetTime are processed.
|
|
206
|
+
* @param {boolean} params.didDocumentHistory An array of DID documents ordered ascensing by version (1...N).
|
|
207
|
+
* @param {boolean} params.btc1UpdateHashHistory An array of SHA256 hashes of BTCR2 Updates ordered by version that are
|
|
208
|
+
* applied to the DID document in order to construct the contemporaryDIDDocument.
|
|
209
|
+
* @param {SignalsMetadata} params.signalsMetadata See {@link SignalsMetadata} for details.
|
|
210
|
+
* @param {BitcoinNetworkNames} params.network The bitcoin network to connect to (mainnet, signet, testnet, regtest).
|
|
211
|
+
* @returns {Promise<Btc1DidDocument>} The resolved DID Document object with a validated single, canonical history.
|
|
212
|
+
*/
|
|
213
|
+
protected static traverseBlockchainHistory({ contemporaryDidDocument, contemporaryBlockHeight, currentVersionId, targetVersionId, targetTime, didDocumentHistory, btc1UpdateHashHistory, signalsMetadata, network }: {
|
|
214
|
+
contemporaryDidDocument: Btc1DidDocument;
|
|
215
|
+
contemporaryBlockHeight: number;
|
|
216
|
+
currentVersionId: number;
|
|
217
|
+
targetVersionId?: number;
|
|
218
|
+
targetTime: number;
|
|
219
|
+
didDocumentHistory: Btc1DidDocument[];
|
|
220
|
+
btc1UpdateHashHistory: string[];
|
|
221
|
+
signalsMetadata: SignalsMetadata;
|
|
222
|
+
network: BitcoinNetworkNames;
|
|
223
|
+
}): Promise<Btc1DidDocument>;
|
|
224
|
+
/**
|
|
225
|
+
* Implements {@link https://dcdpr.github.io/did-btcr2/#find-next-signals | 4.2.3.3 Find Next Signals}.
|
|
226
|
+
*
|
|
227
|
+
* The Find Next Signals algorithm finds the next Bitcoin block containing Beacon Signals from one or more of the
|
|
228
|
+
* beacons and retuns all Beacon Signals within that block.
|
|
229
|
+
*
|
|
230
|
+
* It takes the following inputs:
|
|
231
|
+
* - `contemporaryBlockhieght`: The height of the block this function is looking for Beacon Signals in.
|
|
232
|
+
* An integer greater or equal to 0.
|
|
233
|
+
* - `targetBlockheight`: The height of the Bitcoin block that the resolution algorithm searches for Beacon Signals
|
|
234
|
+
* up to. An integer greater or equal to 0.
|
|
235
|
+
* - `beacons`: An array of Beacon services in the contemporary DID document. Each Beacon contains properties:
|
|
236
|
+
* - `id`: The id of the Beacon service in the DID document. A string.
|
|
237
|
+
* - `type`: The type of the Beacon service in the DID document. A string whose values MUST be
|
|
238
|
+
* either SingletonBeacon, CIDAggregateBeacon or SMTAggregateBeacon.
|
|
239
|
+
* - `serviceEndpoint`: A BIP21 URI representing a Bitcoin address.
|
|
240
|
+
* - `address`: The Bitcoin address decoded from the `serviceEndpoint value.
|
|
241
|
+
* - `network`: A string identifying the Bitcoin network of the did:btcr2 identifier. This algorithm MUST query the
|
|
242
|
+
* Bitcoin blockchain identified by the network.
|
|
243
|
+
*
|
|
244
|
+
* It returns a nextSignals struct, containing the following properties:
|
|
245
|
+
* - blockheight: The Bitcoin blockheight for the block containing the Beacon Signals.
|
|
246
|
+
* - signals: An array of signals. Each signal is a struct containing the following:
|
|
247
|
+
* - beaconId: The id for the Beacon that the signal was announced by.
|
|
248
|
+
* - beaconType: The type of the Beacon that announced the signal.
|
|
249
|
+
* - tx: The Bitcoin transaction that is the Beacon Signal.
|
|
250
|
+
*
|
|
251
|
+
* @public
|
|
252
|
+
* @param {FindNextSignals} params The parameters for the findNextSignals operation.
|
|
253
|
+
* @param {number} params.blockheight The blockheight to start looking for beacon signals.
|
|
254
|
+
* @param {Array<BeaconService>} params.target The target blockheight at which to stop finding signals.
|
|
255
|
+
* @param {Array<BeaconService>} params.beacons The beacons to look for in the block.
|
|
256
|
+
* @returns {Promise<Array<BeaconSignal>>} An array of BeaconSignal objects with blockHeight and signals.
|
|
257
|
+
*/
|
|
258
|
+
static findNextSignals({ contemporaryBlockHeight, targetTime, beacons }: {
|
|
259
|
+
contemporaryBlockHeight: number;
|
|
260
|
+
beacons: Array<BeaconServiceAddress>;
|
|
261
|
+
network: BitcoinNetworkNames;
|
|
262
|
+
targetTime: UnixTimestamp;
|
|
263
|
+
}): Promise<Array<BeaconSignal>>;
|
|
264
|
+
/**
|
|
265
|
+
* Helper method for the {@link findNextSignals | Find Next Signals} algorithm.
|
|
266
|
+
*
|
|
267
|
+
* @param params See {@link FindNextSignalsRestParams} for details.
|
|
268
|
+
* @param {BitcoinClient} params.connection The bitcoin connection to use.
|
|
269
|
+
* @param {Array<BeaconSignal>} params.beaconSignals The beacon signals to process.
|
|
270
|
+
* @param {BlockV3} params.block The block to process.
|
|
271
|
+
* @param {Array<BeaconService>} params.beacons The beacons to process.
|
|
272
|
+
* @returns {Promise<Array<BeaconSignal>>} The beacon signals found in the block.
|
|
273
|
+
*/
|
|
274
|
+
static findSignalsRest({ beacons }: {
|
|
275
|
+
beacons: Array<BeaconService>;
|
|
276
|
+
}): Promise<Array<BeaconSignal>>;
|
|
277
|
+
/**
|
|
278
|
+
* Implements {@link https://dcdpr.github.io/did-btcr2/#process-beacon-signals | 4.2.3.4 Process Beacon Signals}.
|
|
279
|
+
*
|
|
280
|
+
* The Process Beacon Signals algorithm processes each Beacon Signal by attempting to retrieve and validate an
|
|
281
|
+
* announce DID Update Payload for that signal according to the type of the Beacon.
|
|
282
|
+
*
|
|
283
|
+
* It takes as inputs
|
|
284
|
+
* - `beaconSignals`: An array of Beacon Signals retrieved from the Find Next Signals algorithm. Each signal contains:
|
|
285
|
+
* - `beaconId`: The id for the Beacon that the signal was announced by.
|
|
286
|
+
* - `beaconType`: The type of the Beacon that announced the signal.
|
|
287
|
+
* - `tx`: The Bitcoin transaction that is the Beacon Signal.
|
|
288
|
+
* - `signalsMetadata`: Maps Beacon Signal Bitcoin transaction ids to a SignalMetadata object containing:
|
|
289
|
+
* - `updatePayload`: A DID Update Payload which should match the update announced by the Beacon Signal.
|
|
290
|
+
* In the case of a SMT proof of non-inclusion, no DID Update Payload may be provided.
|
|
291
|
+
* - `proofs`: Sparse Merkle Tree proof used to verify that the `updatePayload` exists as the leaf indexed by the
|
|
292
|
+
* did:btcr2 identifier being resolved.
|
|
293
|
+
*
|
|
294
|
+
* It returns an array of {@link https://dcdpr.github.io/did-btcr2/#def-did-update-payload | DID Update Payloads}.
|
|
295
|
+
*
|
|
296
|
+
* @public
|
|
297
|
+
* @param {BeaconSignal} signal The beacon signals to process.
|
|
298
|
+
* @param {SignalsMetadata} signalsMetadata The sidecar data for the DID Document.
|
|
299
|
+
* @returns {DidUpdatePayload[]} The updated DID Document object.
|
|
300
|
+
*/
|
|
301
|
+
static processBeaconSignal(signal: BeaconSignal, signalsMetadata: SignalsMetadata): Promise<DidUpdatePayload>;
|
|
302
|
+
/**
|
|
303
|
+
* Implements {@link https://dcdpr.github.io/did-btcr2/#confirm-duplicate-update | 7.2.2.4 Confirm Duplicate Update}.
|
|
304
|
+
*
|
|
305
|
+
* The Confirm Duplicate Update algorithm takes in a {@link DidUpdatePayload | DID Update Payload} and verifies that
|
|
306
|
+
* the update is a duplicate against the hash history of previously applied updates. The algorithm takes in an update
|
|
307
|
+
* and an array of hashes, updateHashHistory. It throws an error if the update is not a duplicate, otherwise it
|
|
308
|
+
* returns.
|
|
309
|
+
*
|
|
310
|
+
* @public
|
|
311
|
+
* @param {{ update: DidUpdatePayload; updateHashHistory: string[]; }} params Parameters for confirmDuplicateUpdate.
|
|
312
|
+
* @param {DidUpdatePayload} params.update The DID Update Payload to confirm.
|
|
313
|
+
* @param {Array<string>} params.updateHashHistory The history of hashes for previously applied updates.
|
|
314
|
+
* @returns {Promise<void>} A promise that resolves if the update is a duplicate, otherwise throws an error.
|
|
315
|
+
* @throws {DidBtc1Error} if the update hash does not match the historical hash.
|
|
316
|
+
*/
|
|
317
|
+
static confirmDuplicateUpdate({ update, updateHashHistory }: {
|
|
318
|
+
update: DidUpdatePayload;
|
|
319
|
+
updateHashHistory: string[];
|
|
320
|
+
}): Promise<void>;
|
|
321
|
+
/**
|
|
322
|
+
* Implements {@link https://dcdpr.github.io/did-btcr2/#apply-did-update | 4.2.3.6 Apply DID Update}.
|
|
323
|
+
*
|
|
324
|
+
* This algorithm attempts to apply a DID Update to a DID document, it first verifies the proof on the update is a
|
|
325
|
+
* valid capabilityInvocation of the root authority over the DID being resolved. Then it applies the JSON patch
|
|
326
|
+
* transformation to the DID document, checks the transformed DID document matches the targetHash specified by the
|
|
327
|
+
* update and validates it is a conformant DID document before returning it. This algorithm takes inputs
|
|
328
|
+
* contemporaryDidDocument and an update.
|
|
329
|
+
*
|
|
330
|
+
* @public
|
|
331
|
+
* @param {ApplyDidUpdateParams} params Parameters for applyDidUpdate.
|
|
332
|
+
* @param {Btc1DidDocument} params.contemporaryDidDocument The current DID Document to update.
|
|
333
|
+
* @param {DidUpdatePayload} params.update The DID Update Payload to apply.
|
|
334
|
+
* @param {Bytes} params.genesisBytes The genesis bytes for the DID Document.
|
|
335
|
+
* @returns {Promise<Btc1DidDocument>}
|
|
336
|
+
*/
|
|
337
|
+
static applyDidUpdate({ contemporaryDidDocument, update }: {
|
|
338
|
+
contemporaryDidDocument: Btc1DidDocument;
|
|
339
|
+
update: DidUpdatePayload;
|
|
340
|
+
}): Promise<Btc1DidDocument>;
|
|
341
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"read.d.ts","sourceRoot":"","sources":["../../../../src/btcr2/crud/read.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EAInB,gBAAgB,EAOhB,aAAa,EACd,MAAM,mBAAmB,CAAC;AAO3B,OAAO,WAAmC,MAAM,8BAA8B,CAAC;AAC/E,OAAO,UAAU,MAAM,6BAA6B,CAAC;AAErD,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;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AAC,MAAM,EAAE,YAAY,EAAE,eAAe,EAAE,eAAe,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAqE1H;;;;;;;;;;;;;;OAcG;WACiB,sBAAsB,CAAC,EAAE,MAAM,EAAE,iBAAiB,EAAE,EAAE;QACxE,MAAM,EAAE,gBAAgB,CAAC;QACzB,iBAAiB,EAAE,MAAM,EAAE,CAAC;KAC7B,GAAG,OAAO,CAAC,IAAI,CAAC;IAyBjB;;;;;;;;;;;;;;;OAeG;WACiB,cAAc,CAAC,EAAE,uBAAuB,EAAE,MAAM,EAAE,EAAE;QACtE,uBAAuB,EAAE,eAAe,CAAC;QACzC,MAAM,EAAE,gBAAgB,CAAC;KAC1B,GAAG,OAAO,CAAC,eAAe,CAAC;CAiF7B"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { DidUpdateInvocation, DidUpdatePayload, PatchOperation } from '@did-btcr2/common';
|
|
2
|
+
import { SignalsMetadata } from '../../types/crud.js';
|
|
3
|
+
import { Btc1DidDocument, Btc1VerificationMethod } from '../../utils/did-document.js';
|
|
4
|
+
export type InvokePayloadParams = {
|
|
5
|
+
identifier: string;
|
|
6
|
+
didUpdatePayload: DidUpdatePayload;
|
|
7
|
+
verificationMethod: Btc1VerificationMethod;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Implements {@link https://dcdpr.github.io/did-btcr2/#update | 4.3 Update}.
|
|
11
|
+
*
|
|
12
|
+
* An update to a did:btcr2 document is an invoked capability using the ZCAP-LD
|
|
13
|
+
* data format, signed by a verificationMethod that has the authority to make
|
|
14
|
+
* the update as specified in the previous DID document. Capability invocations
|
|
15
|
+
* for updates MUST be authorized using Data Integrity following the
|
|
16
|
+
* bip340-jcs-2025 cryptosuite with a proofPurpose of capabilityInvocation.
|
|
17
|
+
*
|
|
18
|
+
* @class Btc1Update
|
|
19
|
+
* @type {Btc1Update}
|
|
20
|
+
*/
|
|
21
|
+
export declare class Btc1Update {
|
|
22
|
+
/**
|
|
23
|
+
* Implements {@link https://dcdpr.github.io/did-btcr2/#construct-did-update-payload | 4.3.1 Construct DID Update Payload}.
|
|
24
|
+
*
|
|
25
|
+
* The Construct DID Update Payload algorithm applies the documentPatch to the sourceDocument and verifies the
|
|
26
|
+
* resulting targetDocument is a conformant DID document. It takes in a btc1Identifier, sourceDocument,
|
|
27
|
+
* sourceVersionId, and documentPatch objects. It returns an unsigned DID Update Payload.
|
|
28
|
+
*
|
|
29
|
+
* @param {ConstructPayloadParams} params See {@link ConstructPayloadParams} for more details.
|
|
30
|
+
* @param {string} params.identifier The did-btcr2 identifier to use for verification.
|
|
31
|
+
* @param {Btc1DidDocument} params.sourceDocument The source document to be updated.
|
|
32
|
+
* @param {string} params.sourceVersionId The versionId of the source document.
|
|
33
|
+
* @param {DidDocumentPatch} params.patch The JSON patch to be applied to the source document.
|
|
34
|
+
* @returns {Promise<DidUpdatePayload>} The constructed DidUpdatePayload object.
|
|
35
|
+
* @throws {Btcr2Error} InvalidDid if sourceDocument.id does not match identifier.
|
|
36
|
+
*/
|
|
37
|
+
static construct({ identifier, sourceDocument, sourceVersionId, patch, }: {
|
|
38
|
+
identifier: string;
|
|
39
|
+
sourceDocument: Btc1DidDocument;
|
|
40
|
+
sourceVersionId: number;
|
|
41
|
+
patch: PatchOperation[];
|
|
42
|
+
}): Promise<DidUpdatePayload>;
|
|
43
|
+
/**
|
|
44
|
+
* {@link https://dcdpr.github.io/did-btcr2/#invoke-did-update-payload | 4.3.2 Invoke DID Update Payload}.
|
|
45
|
+
*
|
|
46
|
+
* The Invoke DID Update Payload algorithm takes in a btc1Identifier, an unsigned didUpdatePayload, and a
|
|
47
|
+
* verificationMethod. It retrieves the privateKeyBytes for the verificationMethod and adds a capability invocation in
|
|
48
|
+
* the form of a Data Integrity proof following the Authorization Capabilities (ZCAP-LD) and VC Data Integrity
|
|
49
|
+
* specifications. It returns the invoked DID Update Payload.
|
|
50
|
+
*
|
|
51
|
+
* @param {InvokePayloadParams} params Required params for calling the invokePayload method
|
|
52
|
+
* @param {string} params.identifier The did-btcr2 identifier to derive the root capability from
|
|
53
|
+
* @param {DidUpdatePayload} params.didUpdatePayload The updatePayload object to be signed
|
|
54
|
+
* @param {DidVerificationMethod} params.verificationMethod The verificationMethod object to be used for signing
|
|
55
|
+
* @returns {DidUpdateInvocation} Did update payload secured with a proof => DidUpdateInvocation
|
|
56
|
+
* @throws {Btcr2Error} if the privateKeyBytes are invalid
|
|
57
|
+
*/
|
|
58
|
+
static invoke({ identifier, didUpdatePayload, verificationMethod }: {
|
|
59
|
+
identifier: string;
|
|
60
|
+
didUpdatePayload: DidUpdatePayload;
|
|
61
|
+
verificationMethod: Btc1VerificationMethod;
|
|
62
|
+
}): Promise<DidUpdateInvocation>;
|
|
63
|
+
/**
|
|
64
|
+
* Implements {@link https://dcdpr.github.io/did-btcr2/#announce-did-update | 4.3.3 Announce DID Update}.
|
|
65
|
+
*
|
|
66
|
+
* The Announce DID Update algorithm retrieves beaconServices from the sourceDocument and calls the Broadcast DID
|
|
67
|
+
* Update algorithm corresponding to the type of the Beacon. It takes in a btc1Identifier, sourceDocument, an array of
|
|
68
|
+
* beaconIds, and a didUpdateInvocation. It returns an array of signalsMetadata, containing the necessary
|
|
69
|
+
* data to validate the Beacon Signal against the didUpdateInvocation.
|
|
70
|
+
*
|
|
71
|
+
* @param {AnnounceUpdatePayloadParams} params Required params for calling the announcePayload method
|
|
72
|
+
* @param {Btc1DidDocument} params.sourceDocument The did-btcr2 did document to derive the root capability from
|
|
73
|
+
* @param {string[]} params.beaconIds The didUpdatePayload object to be signed
|
|
74
|
+
* @param {DidUpdateInvocation} params.didUpdatePayload The verificationMethod object to be used for signing
|
|
75
|
+
* @returns {SignalsMetadata} The signalsMetadata object containing data to validate the Beacon Signal
|
|
76
|
+
* @throws {Btcr2Error} if the beaconService type is invalid
|
|
77
|
+
*/
|
|
78
|
+
static announce({ sourceDocument, beaconIds, didUpdateInvocation }: {
|
|
79
|
+
sourceDocument: Btc1DidDocument;
|
|
80
|
+
beaconIds: string[];
|
|
81
|
+
didUpdateInvocation: DidUpdateInvocation;
|
|
82
|
+
}): Promise<SignalsMetadata>;
|
|
83
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../../../../src/btcr2/crud/update.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,mBAAmB,EACnB,gBAAgB,EAMhB,cAAc,EAEf,MAAM,mBAAmB,CAAC;AAK3B,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEtD,OAAO,EAAE,eAAe,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAItF,MAAM,MAAM,mBAAmB,GAAG;IAChC,UAAU,EAAE,MAAM,CAAC;IACnB,gBAAgB,EAAE,gBAAgB,CAAC;IACnC,kBAAkB,EAAE,sBAAsB,CAAC;CAC5C,CAAA;AAED;;;;;;;;;;;GAWG;AACH,qBAAa,UAAU;IACrB;;;;;;;;;;;;;;OAcG;WACiB,SAAS,CAAC,EAC5B,UAAU,EACV,cAAc,EACd,eAAe,EACf,KAAK,GACN,EAAE;QACD,UAAU,EAAE,MAAM,CAAC;QACnB,cAAc,EAAE,eAAe,CAAC;QAChC,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,sBAAsB,CAAC;KAC5C,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAqEhC;;;;;;;;;;;;;;OAcG;WACiB,QAAQ,CAAC,EAC3B,cAAc,EACd,SAAS,EACT,mBAAmB,EACpB,EAAE;QACD,cAAc,EAAE,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