@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,36 @@
|
|
|
1
|
+
import { Maybe } from '@did-btcr2/common';
|
|
2
|
+
export declare const MESSAGE_PREFIX = "https://btcr2.tools/";
|
|
3
|
+
export type BaseBody = {
|
|
4
|
+
cohortId: string;
|
|
5
|
+
cohortSize?: number;
|
|
6
|
+
network?: string;
|
|
7
|
+
participantPk?: Uint8Array;
|
|
8
|
+
beaconAddress?: string;
|
|
9
|
+
cohortKeys?: Array<Uint8Array>;
|
|
10
|
+
};
|
|
11
|
+
export type Base = {
|
|
12
|
+
type: string;
|
|
13
|
+
to: string;
|
|
14
|
+
from: string;
|
|
15
|
+
threadId?: string;
|
|
16
|
+
body: BaseBody;
|
|
17
|
+
};
|
|
18
|
+
export declare class BaseMessage {
|
|
19
|
+
type: string;
|
|
20
|
+
to: string;
|
|
21
|
+
from: string;
|
|
22
|
+
threadId?: string;
|
|
23
|
+
body: BaseBody;
|
|
24
|
+
constructor({ type, to, from, threadId, body }: Base);
|
|
25
|
+
/**
|
|
26
|
+
* Creates a BaseMessage from a JSON object.
|
|
27
|
+
* @param {Maybe<Base>} data - The JSON object to initialize the BaseMessage.
|
|
28
|
+
* @returns {BaseMessage} The initialized BaseMessage.
|
|
29
|
+
*/
|
|
30
|
+
static fromJSON(data: Maybe<Base>): BaseMessage;
|
|
31
|
+
/**
|
|
32
|
+
* Converts a BaseMessage to a JSON object.
|
|
33
|
+
* @returns {Base} The JSON representation of the BaseMessage.
|
|
34
|
+
*/
|
|
35
|
+
json(): Base;
|
|
36
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../../../../../src/btcr2/beacon/aggregation/messages/base.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAE1C,eAAO,MAAM,cAAc,yBAAyB,CAAC;AAErD,MAAM,MAAM,QAAQ,GAAG;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,aAAa,CAAC,EAAE,UAAU,CAAC;IAC3B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,UAAU,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC;CAChC,CAAC;AAEF,MAAM,MAAM,IAAI,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,QAAQ,CAAC;CAChB,CAAC;AAEF,qBAAa,WAAW;IACf,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,QAAQ,CAAC;gBAEV,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE,IAAI;IAQpD;;;;OAIG;WACW,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,GAAG,WAAW;IAItD;;;OAGG;IACI,IAAI,IAAI,IAAI;CASpB"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { BaseMessage } from './base.js';
|
|
2
|
+
import { COHORT_SET } from './keygen.js';
|
|
3
|
+
export type CohortSet = {
|
|
4
|
+
type?: typeof COHORT_SET;
|
|
5
|
+
to: string;
|
|
6
|
+
from: string;
|
|
7
|
+
cohortId: string;
|
|
8
|
+
beaconAddress: string;
|
|
9
|
+
cohortKeys: Array<Uint8Array>;
|
|
10
|
+
threadId?: string;
|
|
11
|
+
};
|
|
12
|
+
export declare class CohortSetMessage extends BaseMessage {
|
|
13
|
+
cohortId: string;
|
|
14
|
+
beaconAddress: string;
|
|
15
|
+
cohortKeys: Array<Uint8Array>;
|
|
16
|
+
constructor({ type, to, from, threadId, cohortId, beaconAddress, cohortKeys }: CohortSet);
|
|
17
|
+
/**
|
|
18
|
+
* Initializes an CohortSetMessage from a given OptIn object.
|
|
19
|
+
* @param {OptIn} data - The OptIn object to initialize the CohortSetMessage.
|
|
20
|
+
* @returns {object} The serialized CohortSetMessage.
|
|
21
|
+
*/
|
|
22
|
+
static fromJSON(data: CohortSet): CohortSetMessage;
|
|
23
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cohort-set.d.ts","sourceRoot":"","sources":["../../../../../../src/btcr2/beacon/aggregation/messages/cohort-set.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,MAAM,MAAM,SAAS,GAAG;IACtB,IAAI,CAAC,EAAE,OAAO,UAAU,CAAC;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC;IAC9B,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAA;AAED,qBAAa,gBAAiB,SAAQ,WAAW;IACxC,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC;gBAEzB,EAAE,IAAiB,EAAE,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,aAAa,EAAE,UAAU,EAAE,EAAE,SAAS;IAOrG;;;;OAIG;WACW,QAAQ,CAAC,IAAI,EAAE,SAAS,GAAG,gBAAgB;CAM1D"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const COHORT_ADVERT = "https://btcr2.tools/musig2/keygen/cohort_advert";
|
|
2
|
+
export declare const COHORT_INVITE = "https://btcr2.tools/musig2/keygen/cohort_invite";
|
|
3
|
+
export declare const OPT_IN = "https://btcr2.tools/musig2/keygen/opt_in";
|
|
4
|
+
export declare const COHORT_SET = "https://btcr2.tools/musig2/keygen/cohort_set";
|
|
5
|
+
export declare const SUBSCRIBE = "https://btcr2.tools/musig2/keygen/subscribe";
|
|
6
|
+
export declare const SUBSCRIBE_ACCEPT = "https://btcr2.tools/musig2/keygen/subscribe_accept";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"keygen.d.ts","sourceRoot":"","sources":["../../../../../../src/btcr2/beacon/aggregation/messages/keygen.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,aAAa,oDAAiD,CAAC;AAC5E,eAAO,MAAM,aAAa,oDAAiD,CAAC;AAC5E,eAAO,MAAM,MAAM,6CAA0C,CAAC;AAC9D,eAAO,MAAM,UAAU,iDAA8C,CAAC;AACtE,eAAO,MAAM,SAAS,gDAA6C,CAAC;AACpE,eAAO,MAAM,gBAAgB,uDAAoD,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Maybe } from '@did-btcr2/common';
|
|
2
|
+
import { BaseMessage } from './base.js';
|
|
3
|
+
import { OPT_IN } from './keygen.js';
|
|
4
|
+
export type OptIn = {
|
|
5
|
+
type: typeof OPT_IN;
|
|
6
|
+
to: string;
|
|
7
|
+
from: string;
|
|
8
|
+
cohortId: string;
|
|
9
|
+
participantPk: Uint8Array;
|
|
10
|
+
threadId?: string;
|
|
11
|
+
};
|
|
12
|
+
export declare class OptInMessage extends BaseMessage {
|
|
13
|
+
cohortId: string;
|
|
14
|
+
participantPk: Uint8Array;
|
|
15
|
+
constructor({ type, to, from, threadId, cohortId, participantPk }: OptIn);
|
|
16
|
+
/**
|
|
17
|
+
* Initializes an OptInMessage from a given OptIn object.
|
|
18
|
+
* @param {OptIn} data - The OptIn object to initialize the OptInMessage.
|
|
19
|
+
* @returns {object} The serialized OptInMessage.
|
|
20
|
+
*/
|
|
21
|
+
static fromJSON(data: Maybe<OptIn>): OptInMessage;
|
|
22
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"opt-in.d.ts","sourceRoot":"","sources":["../../../../../../src/btcr2/beacon/aggregation/messages/opt-in.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,MAAM,MAAM,KAAK,GAAG;IAClB,IAAI,EAAE,OAAO,MAAM,CAAC;IACpB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,UAAU,CAAC;IAC1B,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAA;AAED,qBAAa,YAAa,SAAQ,WAAW;IACpC,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,UAAU,CAAC;gBAErB,EAAE,IAAa,EAAE,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,aAAa,EAAE,EAAE,KAAK;IAMjF;;;;OAIG;WACW,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC,KAAK,CAAC,GAAG,YAAY;CAMzD"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const REQUEST_SIGNATURE = "https://btcr2.tools/musig2/sign/request_signature";
|
|
2
|
+
export declare const AUTHORIZATION_REQUEST = "https://btcr2.tools/musig2/sign/authorization_request";
|
|
3
|
+
export declare const NONCE_CONTRIBUTION = "https://btcr2.tools/musig2/sign/nonce_contribution";
|
|
4
|
+
export declare const AGGREGATED_NONCE = "https://btcr2.tools/musig2/sign/aggregated_nonce";
|
|
5
|
+
export declare const SIGNATURE_AUTHORIZATION = "https://btcr2.tools/musig2/sign/signature_authorization";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sign.d.ts","sourceRoot":"","sources":["../../../../../../src/btcr2/beacon/aggregation/messages/sign.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,iBAAiB,sDAAmD,CAAC;AAClF,eAAO,MAAM,qBAAqB,0DAAuD,CAAC;AAC1F,eAAO,MAAM,kBAAkB,uDAAoD,CAAC;AACpF,eAAO,MAAM,gBAAgB,qDAAkD,CAAC;AAChF,eAAO,MAAM,uBAAuB,4DAAyD,CAAC"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { COHORT_STATUS_TYPE } from './status.js';
|
|
2
|
+
export type Musig2CohortParams = {
|
|
3
|
+
id?: string;
|
|
4
|
+
minParticipants: number;
|
|
5
|
+
status: COHORT_STATUS_TYPE;
|
|
6
|
+
network: string;
|
|
7
|
+
coordinatorDid: string;
|
|
8
|
+
};
|
|
9
|
+
export declare class Musig2Cohort {
|
|
10
|
+
/**
|
|
11
|
+
* Unique identifier for the cohort.
|
|
12
|
+
* @type {string}
|
|
13
|
+
*/
|
|
14
|
+
id: string;
|
|
15
|
+
/**
|
|
16
|
+
* DID of the coordinator.
|
|
17
|
+
* @type {string}
|
|
18
|
+
*/
|
|
19
|
+
coordinatorDid: string;
|
|
20
|
+
/**
|
|
21
|
+
* Minimum number of participants required to finalize the cohort.
|
|
22
|
+
* @type {number}
|
|
23
|
+
*/
|
|
24
|
+
minParticipants: number;
|
|
25
|
+
/**
|
|
26
|
+
* Status of the cohort.
|
|
27
|
+
* @type {string}
|
|
28
|
+
*/
|
|
29
|
+
status: COHORT_STATUS_TYPE;
|
|
30
|
+
/**
|
|
31
|
+
* Network on which the cohort operates (e.g., 'mainnet', 'testnet').
|
|
32
|
+
* @type {string}
|
|
33
|
+
*/
|
|
34
|
+
network: string;
|
|
35
|
+
/**
|
|
36
|
+
* Pending signature requests, mapping participant DIDs to their pending signatures.
|
|
37
|
+
* @type {Record<string, string>}
|
|
38
|
+
*/
|
|
39
|
+
pendingSignatureRequests: Record<string, string>;
|
|
40
|
+
/**
|
|
41
|
+
* List of participant DIDs.
|
|
42
|
+
* @type {Array<string>}
|
|
43
|
+
*/
|
|
44
|
+
participants: Array<string>;
|
|
45
|
+
/**
|
|
46
|
+
* List of cohort keys (public keys).
|
|
47
|
+
* @type {Array<Uint8Array>}
|
|
48
|
+
*/
|
|
49
|
+
cohortKeys: Array<Uint8Array>;
|
|
50
|
+
/**
|
|
51
|
+
* Taproot Merkle root for the cohort.
|
|
52
|
+
* @type {Uint8Array}
|
|
53
|
+
*/
|
|
54
|
+
trMerkleRoot?: Uint8Array;
|
|
55
|
+
/**
|
|
56
|
+
* Beacon address for the cohort, calculated from the Taproot multisig.
|
|
57
|
+
* @type {string}
|
|
58
|
+
*/
|
|
59
|
+
beaconAddress?: string;
|
|
60
|
+
/**
|
|
61
|
+
* Creates a new Musig2Cohort instance.
|
|
62
|
+
* @param {Musig2CohortParams} params Parameters for initializing the cohort.
|
|
63
|
+
* @param {string} [params.id] Optional unique identifier for the cohort. If not provided, a random UUID will be generated.
|
|
64
|
+
* @param {number} params.minParticipants Minimum number of participants required to finalize the cohort.
|
|
65
|
+
* @param {string} params.coordinatorDid DID of the coordinator managing the cohort.
|
|
66
|
+
* @param {string} params.status Initial status of the cohort (e.g., 'PENDING', 'COHORT_SET').
|
|
67
|
+
* @param {string} params.network Network on which the cohort operates (e.g., 'mainnet', 'testnet').
|
|
68
|
+
*/
|
|
69
|
+
constructor(params: Musig2CohortParams);
|
|
70
|
+
finalize(): void;
|
|
71
|
+
/**
|
|
72
|
+
* Calculates the beacon Taproot multisig address for the cohort using participant keys.
|
|
73
|
+
* @returns {string} The Taproot address for the cohort.
|
|
74
|
+
* @throws {Error} If the Taproot address cannot be calculated.
|
|
75
|
+
*/
|
|
76
|
+
calulateBeaconAddress(): string;
|
|
77
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../src/btcr2/beacon/aggregation/models/cohort/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAiB,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEhE,MAAM,MAAM,kBAAkB,GAAG;IAC7B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,eAAe,EAAE,MAAM,CAAC;IACxB,MAAM,EAAE,kBAAkB,CAAC;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc,EAAE,MAAM,CAAC;CAC1B,CAAA;AAED,qBAAa,YAAY;IACvB;;;OAGG;IACI,EAAE,EAAE,MAAM,CAAC;IAElB;;;OAGG;IACI,cAAc,EAAE,MAAM,CAAC;IAE9B;;;OAGG;IACI,eAAe,EAAE,MAAM,CAAC;IAE/B;;;OAGG;IACI,MAAM,EAAE,kBAAkB,CAAC;IAElC;;;OAGG;IACI,OAAO,EAAE,MAAM,CAAC;IAEvB;;;OAGG;IACI,wBAAwB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAM;IAE7D;;;OAGG;IACI,YAAY,EAAE,KAAK,CAAC,MAAM,CAAC,CAAuB;IAEzD;;;OAGG;IACI,UAAU,EAAE,KAAK,CAAC,UAAU,CAAC,CAA2B;IAE/D;;;OAGG;IACI,YAAY,CAAC,EAAE,UAAU,CAAC;IAEjC;;;OAGG;IACI,aAAa,CAAC,EAAE,MAAM,CAAC;IAE9B;;;;;;;;OAQG;gBACS,MAAM,EAAE,kBAAkB;IAQ/B,QAAQ,IAAI,IAAI;IAQvB;;;;OAIG;IACI,qBAAqB,IAAI,MAAM;CASvC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../../../../../../src/btcr2/beacon/aggregation/models/cohort/status.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,kBAAkB,GAAG,YAAY,GAAG,UAAU,GAAG,YAAY,GAAG,QAAQ,CAAC;AACrF,oBAAY,aAAa;IACvB,iBAAiB,eAAe;IAChC,eAAe,aAAa;IAC5B,iBAAiB,eAAe;IAChC,aAAa,WAAW;CACzB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"participant.d.ts","sourceRoot":"","sources":["../../../../../src/btcr2/beacon/aggregation/participant.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { ProtocolService } from './service.js';
|
|
2
|
+
export interface NostrAdapterConfig {
|
|
3
|
+
keys: {
|
|
4
|
+
secret?: Uint8Array;
|
|
5
|
+
public?: Uint8Array;
|
|
6
|
+
};
|
|
7
|
+
did?: string;
|
|
8
|
+
components: {
|
|
9
|
+
idType?: string;
|
|
10
|
+
version?: number;
|
|
11
|
+
network?: string;
|
|
12
|
+
};
|
|
13
|
+
relays: string[];
|
|
14
|
+
[key: string]: any;
|
|
15
|
+
}
|
|
16
|
+
export declare class NostrAdapter implements ProtocolService {
|
|
17
|
+
name: string;
|
|
18
|
+
private config;
|
|
19
|
+
private handlers;
|
|
20
|
+
constructor(config?: NostrAdapterConfig);
|
|
21
|
+
start(): Promise<void>;
|
|
22
|
+
registerMessageHandler(messageType: string, handler: (msg: any) => Promise<void>): void;
|
|
23
|
+
/**
|
|
24
|
+
* Sends a message to a recipient using the Nostr protocol.
|
|
25
|
+
* This method is a placeholder and should be implemented with actual Nostr message sending logic.
|
|
26
|
+
* @param message
|
|
27
|
+
* @param recipient
|
|
28
|
+
* @param sender
|
|
29
|
+
*/
|
|
30
|
+
sendMessage(message: object, recipient: string, sender: string): Promise<void>;
|
|
31
|
+
/**
|
|
32
|
+
* Generates a Nostr identity using the SecretKey and Btc1Identifier classes.
|
|
33
|
+
* @returns {string} A BTCR2 DID used for communication over the nostr protocol
|
|
34
|
+
*/
|
|
35
|
+
generateIdentity(): string;
|
|
36
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nostr.d.ts","sourceRoot":"","sources":["../../../../../../src/btcr2/beacon/aggregation/protocol/nostr.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE/C,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE;QACJ,MAAM,CAAC,EAAE,UAAU,CAAC;QACpB,MAAM,CAAC,EAAE,UAAU,CAAC;KACrB,CAAC;IACF,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,UAAU,EAAE;QACV,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC;IACF,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB;AAED,qBAAa,YAAa,YAAW,eAAe;IAC3C,IAAI,EAAE,MAAM,CAAW;IAC9B,OAAO,CAAC,MAAM,CAAqB;IACnC,OAAO,CAAC,QAAQ,CAAuD;gBAE3D,MAAM,GAAE,kBAAmF;IAWjG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAU5B,sBAAsB,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI;IAIvF;;;;;;OAMG;IACG,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAKpF;;;OAGG;IACI,gBAAgB,IAAI,MAAM;CAalC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../../../../../src/btcr2/beacon/aggregation/protocol/service.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,eAAe;IAC9B,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACvB,sBAAsB,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;IACxF,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/E,gBAAgB,IAAI,MAAM,CAAC;CAC5B"}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { DidUpdateInvocation, DidUpdatePayload } from '@did-btcr2/common';
|
|
2
|
+
import { DidServiceEndpoint } from '@web5/dids';
|
|
3
|
+
import { Beacon } from '../../interfaces/beacon.js';
|
|
4
|
+
import { BeaconService, BeaconSignal } from '../../interfaces/ibeacon.js';
|
|
5
|
+
import { RawTransactionV2 } from '../../types/bitcoin.js';
|
|
6
|
+
import { BeaconSidecarData, CIDAggregateSidecar, SignalsMetadata } from '../../types/crud.js';
|
|
7
|
+
/**
|
|
8
|
+
* Implements {@link https://dcdpr.github.io/did-btcr2/#cidaggregate-beacon | 5.2 CIDAggregate Beacon}.
|
|
9
|
+
*
|
|
10
|
+
* A Beacon of the type CIDAggregatoBeacon is a Beacon that publishes Bitcoin transactions containing a Content
|
|
11
|
+
* Identifier (CID) announcing an Aggregated DID Update Bundle. An Aggregated DID Update Bundle is a JSON object that
|
|
12
|
+
* maps did:btcr2 identifiers to CID values for the individual DID Update Payloads. The Aggregated DID Update Bundle CID
|
|
13
|
+
* (bundleCID) SHOULD be resolvable against a Content Addressable Storage (CAS) system such as IPFS, while the CID for
|
|
14
|
+
* the DID Update Payload (payloadCID) MAY be resolvable against a CAS or provided through a Sidecar mechanism. It is
|
|
15
|
+
* RECOMMENDED that this type of Beacon is only included in a DID document if the DID controller is REQUIRED to
|
|
16
|
+
* participate in authorizing Bitcoin transactions from this Beacon. In other words, this Beacon SHOULD identify an
|
|
17
|
+
* n-of-n P2TR Bitcoin address where n is the number of unique DID controllers submitting updates through the Beacon.
|
|
18
|
+
*
|
|
19
|
+
* @class CIDAggregateBeacon
|
|
20
|
+
* @type {CIDAggregateBeacon}
|
|
21
|
+
* @extends {Beacon}
|
|
22
|
+
*/
|
|
23
|
+
export declare class CIDAggregateBeacon extends Beacon {
|
|
24
|
+
/**
|
|
25
|
+
* Creates an instance of CIDAggregateBeacon.
|
|
26
|
+
* @param {BeaconService} service The service of the Beacon.
|
|
27
|
+
* @param {?BeaconSidecarData} [sidecar] The sidecar data of the Beacon.
|
|
28
|
+
*/
|
|
29
|
+
constructor(service: BeaconService, sidecar?: BeaconSidecarData<CIDAggregateSidecar>);
|
|
30
|
+
get service(): BeaconService;
|
|
31
|
+
/**
|
|
32
|
+
* TODO: Finish implementation
|
|
33
|
+
*
|
|
34
|
+
* Implements {@link https://dcdpr.github.io/did-btcr2/#establish-cidaggregate-beacon | 5.2.1 Establish CIDAggregate Beacon}.
|
|
35
|
+
*
|
|
36
|
+
* To establish a CIDAggregatorBeacon, a cohort of cooperating parties SHOULD generate an n-of-n P2TR Bitcoin address
|
|
37
|
+
* where each party contributes a public key. Furthermore, each party SHOULD verify that their key is part of the
|
|
38
|
+
* address and all other keys that are part of the address are keys with controllers able to produce valid signatures.
|
|
39
|
+
* To establish a Beacon there are two roles. One is the cohort participant, they want to join a Beacon cohort and
|
|
40
|
+
* submit a request to do so with a key and proof of control over that key. The other is the Beacon coordinator, they
|
|
41
|
+
* advertise and curate Beacon cohorts by combining Beacon participants into cohorts, verifying proofs of control, and
|
|
42
|
+
* producing Beacon addresses.
|
|
43
|
+
*
|
|
44
|
+
* @param {string} id The identifier of the Beacon.
|
|
45
|
+
* @param {string} type The type of the Beacon.
|
|
46
|
+
* @param {DidServiceEndpoint} serviceEndpoint The service endpoint of the Beacon.
|
|
47
|
+
* @returns {CIDAggregateBeacon} The established CIDAggregate Beacon.
|
|
48
|
+
*/
|
|
49
|
+
static establish(id: string, type: string, serviceEndpoint: DidServiceEndpoint): CIDAggregateBeacon;
|
|
50
|
+
/**
|
|
51
|
+
* TODO: Figure out if this is necessary or not.
|
|
52
|
+
* @param {string} didUpdatePayload The DID Update Payload to generate the signal for.
|
|
53
|
+
* @returns {BeaconSignal} The generated signal.
|
|
54
|
+
* @throws {Btcr2Error} if the signal is invalid.
|
|
55
|
+
*/
|
|
56
|
+
generateSignal(didUpdatePayload: string): BeaconSignal;
|
|
57
|
+
/**
|
|
58
|
+
* TODO: Finish implementation
|
|
59
|
+
*
|
|
60
|
+
* Implements {@link https://dcdpr.github.io/did-btcr2/#process-cidaggregate-beacon-signal | 5.2.3 Process CIDAggregate Beacon Signal}.
|
|
61
|
+
*
|
|
62
|
+
* A Beacon Signal from a CIDAggregate Beacon is a Bitcoin transaction that contains the hashBytes of a DID Update
|
|
63
|
+
* Bundle in its first transaction output. The corresponding DID Update Bundle MUST either be provided through Sidecar
|
|
64
|
+
* Data or by converting hashBytes into a IPFS v1 Content Identifier and attempting to retrieve it from Content
|
|
65
|
+
* Addressable Storage. The DID Update Bundle maps from did:btcr2 identifiers to hashes of DID Update payloads
|
|
66
|
+
* applicable for that identifier. Again this algorithm attempts to retrieve and validate the DID Update Payload
|
|
67
|
+
* identified for the identifier being resolved. If successful, the DID Update Payload is returned.
|
|
68
|
+
*
|
|
69
|
+
* The Process CIDAggregate Beacon Signal algorithm is called by the Process Beacon Signals algorithm as part of the
|
|
70
|
+
* Read operation.
|
|
71
|
+
*
|
|
72
|
+
* It takes as inputs a did:btcr2 identifier, btc1Identifier, a Beacon Signal, tx, and a optional
|
|
73
|
+
* object, signalSidecarData, containing any sidecar data provided to the resolver for the Beacon Signal identified by
|
|
74
|
+
* the Bitcoin transaction identifier.
|
|
75
|
+
*
|
|
76
|
+
* It returns the DID Update payload announced by the Beacon Signal for the
|
|
77
|
+
* did:btcr2 identifier being resolved or throws an error.
|
|
78
|
+
*
|
|
79
|
+
* @param {RawTransactionV2} signal Bitcoin transaction representing a Beacon Signal.
|
|
80
|
+
* @param {SignalsMetadata} signalsMetadata Optional sidecar data for the Beacon Signal.
|
|
81
|
+
* @returns {Promise<DidUpdatePayload | undefined>} The DID Update payload announced by the Beacon Signal.
|
|
82
|
+
* @throws {DidError} if the signalTx is invalid or the signalsMetadata is invalid.
|
|
83
|
+
*/
|
|
84
|
+
processSignal(signal: RawTransactionV2, signalsMetadata: SignalsMetadata): Promise<DidUpdateInvocation | undefined>;
|
|
85
|
+
/**
|
|
86
|
+
* TODO: Finish implementation
|
|
87
|
+
*
|
|
88
|
+
* Implements {@link https://dcdpr.github.io/did-btcr2/#broadcast-cidaggregate-beacon-signal | 5.2.2 Broadcast CIDAggregate Beacon Signal}.
|
|
89
|
+
*
|
|
90
|
+
* The Broadcast CIDAggregate Beacon Signal algorithm involving two roles: a set of cohort participants and a Beacon
|
|
91
|
+
* coordinator. The Beacon coordinator collects individual DID Update Payload Content Identifiers (CIDs) for specific
|
|
92
|
+
* did:btc1s and aggregates them into a DID Update Bundle, which is then published to a Content Addressable Storage
|
|
93
|
+
* (CAS). The CID for the DID Update Bundle is included in a Partially Signed Bitcoin Transaction (PSBT) transaction
|
|
94
|
+
* output spent from the Beacon’s n-of-n address. Each of the n cohort participants in the Beacon MUST sign the
|
|
95
|
+
* transaction before it can be broadcast to the network. It is RECOMMENDED that cohort participants keep a copy of
|
|
96
|
+
* the DID Update Bundle and separately pin it to the CAS.
|
|
97
|
+
*
|
|
98
|
+
* @param {DidUpdatePayload} didUpdatePayload The verificationMethod object to be used for signing.
|
|
99
|
+
* @returns {SignalsMetadata} Successful output of a bitcoin transaction.
|
|
100
|
+
* @throws {SingletonBeaconError} if the bitcoin address is invalid or unfunded.
|
|
101
|
+
*/
|
|
102
|
+
broadcastSignal(didUpdatePayload: DidUpdatePayload): Promise<SignalsMetadata>;
|
|
103
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cid-aggregate.d.ts","sourceRoot":"","sources":["../../../../src/btcr2/beacon/cid-aggregate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACtF,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC1E,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAE9F;;;;;;;;;;;;;;;GAeG;AACH,qBAAa,kBAAmB,SAAQ,MAAM;IAC5C;;;;OAIG;gBACS,OAAO,EAAE,aAAa,EAAE,OAAO,CAAC,EAAE,iBAAiB,CAAC,mBAAmB,CAAC;IAGpF,IAAI,OAAO,IAAI,aAAa,CAM3B;IAGD;;;;;;;;;;;;;;;;;OAiBG;IACH,MAAM,CAAC,SAAS,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,eAAe,EAAE,kBAAkB,GAAG,kBAAkB;IAKnG;;;;;OAKG;IACH,cAAc,CAAC,gBAAgB,EAAE,MAAM,GAAG,YAAY;IAKtD;;;;;;;;;;;;;;;;;;;;;;;;;;OA0BG;IACH,aAAa,CAAC,MAAM,EAAE,gBAAgB,EAAE,eAAe,EAAE,eAAe,GAAG,OAAO,CAAC,mBAAmB,GAAG,SAAS,CAAC;IAInH;;;;;;;;;;;;;;;;OAgBG;IACH,eAAe,CAAC,gBAAgB,EAAE,gBAAgB,GAAG,OAAO,CAAC,eAAe,CAAC;CA8B9E"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Beacon } from '../../interfaces/beacon.js';
|
|
2
|
+
import { BeaconService } from '../../interfaces/ibeacon.js';
|
|
3
|
+
import { SidecarData } from '../../types/crud.js';
|
|
4
|
+
/**
|
|
5
|
+
* Beacon Factory pattern to create Beacon instances.
|
|
6
|
+
* @class BeaconFactory
|
|
7
|
+
* @type {BeaconFactory}
|
|
8
|
+
*/
|
|
9
|
+
export declare class BeaconFactory {
|
|
10
|
+
/**
|
|
11
|
+
* Establish a Beacon instance based on the provided service and optional sidecar data.
|
|
12
|
+
* @param {BeaconService} service - The beacon service configuration.
|
|
13
|
+
* @param {SidecarData} [sidecar] - The optional sidecar data.
|
|
14
|
+
* @returns {Beacon} The established Beacon instance.
|
|
15
|
+
*/
|
|
16
|
+
static establish(service: BeaconService, sidecar?: SidecarData): Beacon;
|
|
17
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../../src/btcr2/beacon/factory.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAuB,WAAW,EAAuB,MAAM,qBAAqB,CAAC;AAK5F;;;;GAIG;AACH,qBAAa,aAAa;IACxB;;;;;OAKG;IACH,MAAM,CAAC,SAAS,CAAC,OAAO,EAAE,aAAa,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,MAAM;CAexE"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { DidUpdatePayload } from '@did-btcr2/common';
|
|
2
|
+
import { RawTransactionRest } from '../../bitcoin/rest-client.js';
|
|
3
|
+
import { Beacon } from '../../interfaces/beacon.js';
|
|
4
|
+
import { BeaconService, BeaconSignal } from '../../interfaces/ibeacon.js';
|
|
5
|
+
import { RawTransactionV2 } from '../../types/bitcoin.js';
|
|
6
|
+
import { BeaconSidecarData, SignalsMetadata, SingletonSidecar } from '../../types/crud.js';
|
|
7
|
+
/**
|
|
8
|
+
* Implements {@link https://dcdpr.github.io/did-btcr2/#singleton-beacon | 5.1 Singleton Beacon}.
|
|
9
|
+
*
|
|
10
|
+
* A Singleton Beacon enables a single entity to independently post a DID Update Payload in a Beacon Signal. Its is a
|
|
11
|
+
* Beacon that can be used to publish a single DID Update Payload targeting a single DID document. The serviceEndpoint
|
|
12
|
+
* for this Beacon Type is a Bitcoin address represented as a URI following the BIP21 scheme. It is recommended that
|
|
13
|
+
* this Bitcoin address be under the sole control of the DID controller. How the Bitcoin address and the cryptographic
|
|
14
|
+
* material that controls it are generated is left to the implementation.
|
|
15
|
+
*
|
|
16
|
+
* @class SingletonBeacon
|
|
17
|
+
* @type {SingletonBeacon}
|
|
18
|
+
* @extends {Beacon}
|
|
19
|
+
*/
|
|
20
|
+
export declare class SingletonBeacon extends Beacon {
|
|
21
|
+
/**
|
|
22
|
+
* Creates an instance of SingletonBeacon.
|
|
23
|
+
* @param {BeaconService} service The Beacon service.
|
|
24
|
+
* @param {?BeaconSidecarData} [sidecar] Optional sidecar data.
|
|
25
|
+
*/
|
|
26
|
+
constructor(service: BeaconService, sidecar?: BeaconSidecarData<SingletonSidecar>);
|
|
27
|
+
/**
|
|
28
|
+
* Get the Beacon service.
|
|
29
|
+
* @readonly
|
|
30
|
+
* @type {BeaconService} The Beacon service.
|
|
31
|
+
*/
|
|
32
|
+
get service(): BeaconService;
|
|
33
|
+
/**
|
|
34
|
+
* Implements {@link https://dcdpr.github.io/did-btcr2/#establish-singleton-beacon | 5.1.1 Establish Singleton Beacon}.
|
|
35
|
+
*
|
|
36
|
+
* Static, convenience method for establishing a Beacon object.
|
|
37
|
+
*
|
|
38
|
+
* A Singleton Beacon is a Beacon that can be used to publish a single DID Update Payload targeting a single DID
|
|
39
|
+
* document. The serviceEndpoint for this Beacon Type is a Bitcoin address represented as a URI following the BIP21
|
|
40
|
+
* scheme. It is RECOMMENDED that this Bitcoin address be under the sole control of the DID controller. How the
|
|
41
|
+
* Bitcoin address and the cryptographic material that controls it are generated is left to the implementation.
|
|
42
|
+
* The Establish Singleton Beacon algorithm takes in a Bitcoin address and a serviceId and returns a Singleton Beacon service.
|
|
43
|
+
* It returns a SignletonBeacon object with the given id, type, and serviceEndpoint.
|
|
44
|
+
*
|
|
45
|
+
* @param {string} service The Beacon service.
|
|
46
|
+
* @param {BeaconSidecarData<SingletonSidecar>} sidecar The sidecar data.
|
|
47
|
+
* @returns {SingletonBeacon} The Singleton Beacon.
|
|
48
|
+
*/
|
|
49
|
+
static establish(service: BeaconService, sidecar: BeaconSidecarData<SingletonSidecar>): SingletonBeacon;
|
|
50
|
+
/**
|
|
51
|
+
* TODO: Figure out if this is necessary or not.
|
|
52
|
+
* @param {string} didUpdatePayload The DID Update Payload to generate the signal for.
|
|
53
|
+
* @returns {BeaconSignal} The generated signal.
|
|
54
|
+
* @throws {Btcr2Error} if the signal is invalid.
|
|
55
|
+
*/
|
|
56
|
+
generateSignal(didUpdatePayload: string): BeaconSignal;
|
|
57
|
+
/**
|
|
58
|
+
* TODO: Finish implementation per spec
|
|
59
|
+
*
|
|
60
|
+
* Implements {@link https://dcdpr.github.io/did-btcr2/#process-singleton-beacon-signal | 5.1.3 Process Singleton Beacon Signal}.
|
|
61
|
+
* See {@link Beacon.processSignal | Abstract Beacon Interface Method processSignal} for more details.
|
|
62
|
+
*
|
|
63
|
+
* The Process Singleton Beacon Signal algorithm is called by the Process Beacon Signals algorithm as part of the Read
|
|
64
|
+
* operation. It takes a Bitcoin transaction representing a Beacon Signal and optional signalSidecarData containing
|
|
65
|
+
* any sidecar data provided to the resolver for the Beacon Signal identified by the Bitcoin transaction identifier.
|
|
66
|
+
* It returns the DID Update payload announced by the Beacon Signal or throws an error.
|
|
67
|
+
*
|
|
68
|
+
* @param {RawTransactionV2} signal Bitcoin transaction representing a Beacon Signal.
|
|
69
|
+
* @param {SignalsMetadata} signalsMetadata: SignalsMetadata Optional sidecar data for the Beacon Signal.
|
|
70
|
+
* @returns {Promise<DidUpdatePayload | undefined>} The DID Update payload announced by the Beacon Signal.
|
|
71
|
+
* @throws {DidError} if the signalTx is invalid or the signalSidecarData is invalid.
|
|
72
|
+
*/
|
|
73
|
+
processSignal(signal: RawTransactionV2 | RawTransactionRest, signalsMetadata: SignalsMetadata): Promise<DidUpdatePayload | undefined>;
|
|
74
|
+
/**
|
|
75
|
+
* Implements {@link https://dcdpr.github.io/did-btcr2/#broadcast-singleton-beacon-signal | 5.1.2 Broadcast Singleton Beacon Signal}.
|
|
76
|
+
*
|
|
77
|
+
* The Broadcast Singleton Beacon Signal algorithm is called by the Announce DID Update algorithm as part of the
|
|
78
|
+
* Update operation, if the Beacon being used is of the type SingletonBeacon. It takes as input a Beacon service and a
|
|
79
|
+
* secured didUpdatePayload. The algorithm constructs a Bitcoin transaction that spends from the Beacon address
|
|
80
|
+
* identified in the service and contains a transaction output of the format [OP_RETURN, OP_PUSH32, <hashBytes>],
|
|
81
|
+
* where hashBytes is the SHA256 hash of the canonical didUpdatePayload. The Bitcoin transaction is then signed and
|
|
82
|
+
* broadcast to the Bitcoin network, thereby publicly announcing a DID update in a Beacon Signal. It returns a
|
|
83
|
+
* signalMetadata object mapping the Bitcoin transaction identifier of the Beacon Signal to the necessary data needed
|
|
84
|
+
* to verify the signal announces a specific DID Update Payload.
|
|
85
|
+
*
|
|
86
|
+
* TODO: Design and implement a way to construct, sign and send via RPC
|
|
87
|
+
*
|
|
88
|
+
* @param {DidUpdatePayload} didUpdatePayload The verificationMethod object to be used for signing.
|
|
89
|
+
* @returns {SignedRawTx} Successful output of a bitcoin transaction.
|
|
90
|
+
* @throws {SingletonBeaconError} if the bitcoin address is invalid or unfunded.
|
|
91
|
+
*/
|
|
92
|
+
broadcastSignal(didUpdatePayload: DidUpdatePayload): Promise<SignalsMetadata>;
|
|
93
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"singleton.d.ts","sourceRoot":"","sources":["../../../../src/btcr2/beacon/singleton.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAqE,MAAM,mBAAmB,CAAC;AAIxH,OAAO,EAAe,kBAAkB,EAAQ,MAAM,8BAA8B,CAAC;AACrF,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC1E,OAAO,EAAE,gBAAgB,EAAS,MAAM,wBAAwB,CAAC;AACjE,OAAO,EAAE,iBAAiB,EAAY,eAAe,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAIrG;;;;;;;;;;;;GAYG;AACH,qBAAa,eAAgB,SAAQ,MAAM;IAEzC;;;;OAIG;gBACS,OAAO,EAAE,aAAa,EAAE,OAAO,CAAC,EAAE,iBAAiB,CAAC,gBAAgB,CAAC;IAIjF;;;;OAIG;IACH,IAAI,OAAO,IAAI,aAAa,CAM3B;IAED;;;;;;;;;;;;;;;OAeG;WACW,SAAS,CAAC,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,iBAAiB,CAAC,gBAAgB,CAAC,GAAG,eAAe;IAI9G;;;;;OAKG;IACI,cAAc,CAAC,gBAAgB,EAAE,MAAM,GAAG,YAAY;IAI7D;;;;;;;;;;;;;;;OAeG;IACU,aAAa,CAAC,MAAM,EAAE,gBAAgB,GAAG,kBAAkB,EAAE,eAAe,EAAE,eAAe,GAAG,OAAO,CAAC,gBAAgB,GAAG,SAAS,CAAC;IAiElJ;;;;;;;;;;;;;;;;;OAiBG;IACU,eAAe,CAAC,gBAAgB,EAAE,gBAAgB,GAAG,OAAO,CAAC,eAAe,CAAC;CA8E3F"}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { DidUpdatePayload } from '@did-btcr2/common';
|
|
2
|
+
import { DidServiceEndpoint } from '@web5/dids';
|
|
3
|
+
import { Beacon } from '../../interfaces/beacon.js';
|
|
4
|
+
import { BeaconService, BeaconSignal } from '../../interfaces/ibeacon.js';
|
|
5
|
+
import { RawTransactionV2 } from '../../types/bitcoin.js';
|
|
6
|
+
import { BeaconSidecarData, SignalsMetadata, SMTAggregateSidecar } from '../../types/crud.js';
|
|
7
|
+
/**
|
|
8
|
+
* TODO: Finish implementation
|
|
9
|
+
*
|
|
10
|
+
* Implements {@link https://dcdpr.github.io/did-btcr2/#smtaggregate-beacon | 5.3 SMTAggregate Beacon}.
|
|
11
|
+
*
|
|
12
|
+
* A SMTAggregate Beacon is a Beacon whose Beacon Signals are Bitcoin transactions containing the root of a Sparse
|
|
13
|
+
* Merkle Tree (SMT). The SMT root attests to a set of DID Update Payloads, however, the updates themselves MUST be
|
|
14
|
+
* provided along with a proof of inclusion against the SMT root through a Sidecar mechanism during resolution. Using
|
|
15
|
+
* the SMT root a resolver can then verify the inclusion proof for the given DID Update Payload. If a DID document
|
|
16
|
+
* includes a SMTAggregator Beacon in their set of Beacon services, then they MUST provide proofs for each signal that
|
|
17
|
+
* the Beacon broadcasts. If they did not submit an update to their DID in a signal, then they MUST provide a proof of
|
|
18
|
+
* non-inclusion for that signal.
|
|
19
|
+
*
|
|
20
|
+
* @class SMTAggregateBeacon
|
|
21
|
+
* @type {SMTAggregateBeacon}
|
|
22
|
+
* @extends {Beacon}
|
|
23
|
+
*/
|
|
24
|
+
export declare class SMTAggregateBeacon extends Beacon {
|
|
25
|
+
/**
|
|
26
|
+
* Creates an instance of SMTAggregateBeacon.
|
|
27
|
+
* @param {BeaconService} service The Beacon service.
|
|
28
|
+
* @param {?BeaconSidecarData} [sidecar] Optional sidecar data.
|
|
29
|
+
*/
|
|
30
|
+
constructor(service: BeaconService, sidecar?: BeaconSidecarData<SMTAggregateSidecar>);
|
|
31
|
+
/**
|
|
32
|
+
* Get the Beacon service.
|
|
33
|
+
* @readonly
|
|
34
|
+
* @type {BeaconService} The Beacon service.
|
|
35
|
+
*/
|
|
36
|
+
get service(): BeaconService;
|
|
37
|
+
/**
|
|
38
|
+
* TODO: Figure out if this is necessary or not.
|
|
39
|
+
* @param {string} didUpdatePayload The DID Update Payload to generate the signal for.
|
|
40
|
+
* @returns {BeaconSignal} The generated signal.
|
|
41
|
+
* @throws {Btcr2Error} if the signal is invalid.
|
|
42
|
+
*/
|
|
43
|
+
generateSignal(didUpdatePayload: string): BeaconSignal;
|
|
44
|
+
/**
|
|
45
|
+
* Implements {@link https://dcdpr.github.io/did-btcr2/#establish-beacon | 5.3.1 Establish Beacon}.
|
|
46
|
+
*
|
|
47
|
+
* The Establish Beacon algorithm is essentially the same as for the CIDAggregate Beacon in Establish CIDAggregate
|
|
48
|
+
* Beacon. A cohort of DID controllers need to coordinate to produce a Bitcoin address that will act as the Beacon.
|
|
49
|
+
* It is RECOMMENDED this is an n-of-n P2TR address, with n being the set of DID controllers in the cohort. Once the
|
|
50
|
+
* address has been created, and all parties in the cohort acknowledge their intention to participate in that Beacon,
|
|
51
|
+
* each DID controller SHOULD add the Beacon as a service to their DID document.
|
|
52
|
+
*
|
|
53
|
+
* Additionally, the SMTAggregate Beacon cohort participants MUST register the did:btcr2 identifiers they intend use
|
|
54
|
+
* this Beacon with. This is so the Beacon coordinator can generate the necessary proofs of both inclusion and
|
|
55
|
+
* non-inclusion for each DID.
|
|
56
|
+
*
|
|
57
|
+
* Static, convenience method for establishing a Beacon object.
|
|
58
|
+
*
|
|
59
|
+
* @param {string} id The Beacon ID.
|
|
60
|
+
* @param {string} type The Beacon type.
|
|
61
|
+
* @param {DidServiceEndpoint} serviceEndpoint The service endpoint.
|
|
62
|
+
* @returns {Beacon} The Beacon.
|
|
63
|
+
*/
|
|
64
|
+
static establish(id: string, type: string, serviceEndpoint: DidServiceEndpoint): SMTAggregateBeacon;
|
|
65
|
+
/**
|
|
66
|
+
*
|
|
67
|
+
* Implements {@link https://dcdpr.github.io/did-btcr2/#broadcast-smtaggregate-beacon-signal | 5.3.2 Broadcast SMTAggregate Beacon Signal}.
|
|
68
|
+
*
|
|
69
|
+
* See {@link Beacon.broadcastSignal | Beacon Interface Method broadcastSignal} for more information.
|
|
70
|
+
*
|
|
71
|
+
* To publish a DID Update Payload, the DID controller MUST get a hash of the DID Update Payload included at the leaf
|
|
72
|
+
* of the Sparse Merkle Tree (SMT) identified by their did:btcr2 identifier and receive an inclusion proof for this
|
|
73
|
+
* data. If a member of the Beacon cohort does not wish to announce an update in a Beacon Signal, they MUST receive
|
|
74
|
+
* and verify a proof of non-inclusion for their DID. Upon verifying the non-inclusion proof against the SMT root
|
|
75
|
+
* contained in the Beacon Signal, they SHOULD accept and authorize the signal following the MuSig2 protocol. Once all
|
|
76
|
+
* members of the cohort have authorized the signal, it can be broadcast as a transaction to the Bitcoin network. DID
|
|
77
|
+
* controllers are responsible for persisting their DID updates and proofs, these will need to be provided through a
|
|
78
|
+
* Sidecar mechanism during a resolution process.
|
|
79
|
+
*
|
|
80
|
+
* @param {DidUpdatePayload} didUpdatePayload The DID Update Payload to broadcast.
|
|
81
|
+
* @returns {Promise<SignalMetadata>} The signal metadata.
|
|
82
|
+
* @throws {Btcr2Error} if the signal is invalid.
|
|
83
|
+
*/
|
|
84
|
+
broadcastSignal(didUpdatePayload: DidUpdatePayload): Promise<SignalsMetadata>;
|
|
85
|
+
/**
|
|
86
|
+
* Implements {@link https://dcdpr.github.io/did-btcr2/#process-smtaggregate-beacon-signal | 5.3.3 Process SMTAggregate Beacon Signal}.
|
|
87
|
+
*
|
|
88
|
+
* See {@link Beacon.processSignal | Beacon Interface Method processSignal} for more information.
|
|
89
|
+
*
|
|
90
|
+
* A Beacon Signal from a SMTAggregate Beacon is a Bitcoin transaction with the first transaction output of the format
|
|
91
|
+
* [OP_RETURN, OP_PUSH32, <32bytes>]. The 32 bytes of data contained within this transaction output represent the root
|
|
92
|
+
* of a Sparse Merkle Tree (SMT). This SMT aggregates a set of hashes of DID Update payloads. In order to process
|
|
93
|
+
* these Beacon Signals, the resolver MUST have been passed Sidecar data for this signal containing either the DID
|
|
94
|
+
* Update payload object and a SMT proof that the hash of this object is in the SMT at the leaf indexed by the
|
|
95
|
+
* did:btc1identifier being resolved. Or theSidecar data:: MUST contain a proof that the leaf indexed by the
|
|
96
|
+
* did:btc1identifier is empty, thereby proving that theSMT:: does not contain an update for their identifier.
|
|
97
|
+
*
|
|
98
|
+
* The Process SMTAggregate Beacon Signal is called by the Process Beacon Signals algorithm as part of the Read
|
|
99
|
+
* operation. It takes as inputs a did:btcr2 identifier, btc1Identifier, a Beacon Signal, tx, and a optional object,
|
|
100
|
+
* signalSidecarData, containing any sidecar data provided to the resolver for the Beacon Signal identified by the
|
|
101
|
+
* Bitcoin transaction identifier.
|
|
102
|
+
*
|
|
103
|
+
* It returns the DID Update payload announced by the Beacon Signal for the did:btcr2 identifier being resolved or
|
|
104
|
+
* throws an error.
|
|
105
|
+
*
|
|
106
|
+
* @param {RawTransactionV2} signal The raw transaction signal.
|
|
107
|
+
* @param {SignalsMetadata} signalsMetadata The signals metadata.
|
|
108
|
+
* @returns {Promise<DidUpdatePayload | undefined>} The updated DID document.
|
|
109
|
+
* @throws {Btcr2Error} if the signal is invalid.
|
|
110
|
+
*/
|
|
111
|
+
processSignal(signal: RawTransactionV2, signalsMetadata: SignalsMetadata): Promise<DidUpdatePayload | undefined>;
|
|
112
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"smt-aggregate.d.ts","sourceRoot":"","sources":["../../../../src/btcr2/beacon/smt-aggregate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACjE,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC1E,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAE9F;;;;;;;;;;;;;;;;GAgBG;AACH,qBAAa,kBAAmB,SAAQ,MAAM;IAC5C;;;;OAIG;gBACS,OAAO,EAAE,aAAa,EAAE,OAAO,CAAC,EAAE,iBAAiB,CAAC,mBAAmB,CAAC;IAIpF;;;;OAIG;IACH,IAAI,OAAO,IAAI,aAAa,CAO3B;IAED;;;;;OAKG;IACI,cAAc,CAAC,gBAAgB,EAAE,MAAM,GAAG,YAAY;IAI7D;;;;;;;;;;;;;;;;;;;OAmBG;WACW,SAAS,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,eAAe,EAAE,kBAAkB,GAAG,kBAAkB;IAI1G;;;;;;;;;;;;;;;;;;OAkBG;IACI,eAAe,CAAC,gBAAgB,EAAE,gBAAgB,GAAG,OAAO,CAAC,eAAe,CAAC;IAKpF;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;IACI,aAAa,CAAC,MAAM,EAAE,gBAAgB,EAAE,eAAe,EAAE,eAAe,GAAG,OAAO,CAAC,gBAAgB,GAAG,SAAS,CAAC;CAGxH"}
|