@did-btcr2/method 0.22.0 → 0.24.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/README.md +96 -50
- package/dist/browser.js +35708 -37764
- package/dist/browser.mjs +35707 -37763
- package/dist/cjs/core/beacon/aggregation/cohort/index.js +13 -2
- package/dist/cjs/core/beacon/aggregation/cohort/index.js.map +1 -1
- package/dist/cjs/core/beacon/aggregation/cohort/messages/base.js +7 -2
- package/dist/cjs/core/beacon/aggregation/cohort/messages/base.js.map +1 -1
- package/dist/cjs/core/beacon/aggregation/communication/adapter/did-comm.js +6 -11
- package/dist/cjs/core/beacon/aggregation/communication/adapter/did-comm.js.map +1 -1
- package/dist/cjs/core/beacon/aggregation/communication/adapter/nostr.js +5 -8
- package/dist/cjs/core/beacon/aggregation/communication/adapter/nostr.js.map +1 -1
- package/dist/cjs/core/beacon/aggregation/coordinator.js +40 -44
- package/dist/cjs/core/beacon/aggregation/coordinator.js.map +1 -1
- package/dist/cjs/core/beacon/aggregation/participant.js +35 -38
- package/dist/cjs/core/beacon/aggregation/participant.js.map +1 -1
- package/dist/cjs/core/beacon/aggregation/session/index.js +18 -7
- package/dist/cjs/core/beacon/aggregation/session/index.js.map +1 -1
- package/dist/cjs/core/beacon/cas-beacon.js +1 -1
- package/dist/cjs/core/beacon/cas-beacon.js.map +1 -1
- package/dist/cjs/core/beacon/signal-discovery.js +6 -6
- package/dist/cjs/core/beacon/signal-discovery.js.map +1 -1
- package/dist/cjs/core/beacon/singleton.js +18 -17
- package/dist/cjs/core/beacon/singleton.js.map +1 -1
- package/dist/cjs/core/beacon/smt-beacon.js +1 -1
- package/dist/cjs/core/beacon/smt-beacon.js.map +1 -1
- package/dist/cjs/core/identifier.js +11 -13
- package/dist/cjs/core/identifier.js.map +1 -1
- package/dist/cjs/core/resolve.js +25 -22
- package/dist/cjs/core/resolve.js.map +1 -1
- package/dist/cjs/core/update.js +4 -4
- package/dist/cjs/core/update.js.map +1 -1
- package/dist/cjs/did-btcr2.js +11 -16
- package/dist/cjs/did-btcr2.js.map +1 -1
- package/dist/cjs/index.js +0 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/utils/did-document.js +22 -21
- package/dist/cjs/utils/did-document.js.map +1 -1
- package/dist/esm/core/beacon/aggregation/cohort/index.js +13 -2
- package/dist/esm/core/beacon/aggregation/cohort/index.js.map +1 -1
- package/dist/esm/core/beacon/aggregation/cohort/messages/base.js +7 -2
- package/dist/esm/core/beacon/aggregation/cohort/messages/base.js.map +1 -1
- package/dist/esm/core/beacon/aggregation/communication/adapter/did-comm.js +6 -11
- package/dist/esm/core/beacon/aggregation/communication/adapter/did-comm.js.map +1 -1
- package/dist/esm/core/beacon/aggregation/communication/adapter/nostr.js +5 -8
- package/dist/esm/core/beacon/aggregation/communication/adapter/nostr.js.map +1 -1
- package/dist/esm/core/beacon/aggregation/coordinator.js +40 -44
- package/dist/esm/core/beacon/aggregation/coordinator.js.map +1 -1
- package/dist/esm/core/beacon/aggregation/participant.js +35 -38
- package/dist/esm/core/beacon/aggregation/participant.js.map +1 -1
- package/dist/esm/core/beacon/aggregation/session/index.js +18 -7
- package/dist/esm/core/beacon/aggregation/session/index.js.map +1 -1
- package/dist/esm/core/beacon/cas-beacon.js +1 -1
- package/dist/esm/core/beacon/cas-beacon.js.map +1 -1
- package/dist/esm/core/beacon/signal-discovery.js +6 -6
- package/dist/esm/core/beacon/signal-discovery.js.map +1 -1
- package/dist/esm/core/beacon/singleton.js +18 -17
- package/dist/esm/core/beacon/singleton.js.map +1 -1
- package/dist/esm/core/beacon/smt-beacon.js +1 -1
- package/dist/esm/core/beacon/smt-beacon.js.map +1 -1
- package/dist/esm/core/identifier.js +11 -13
- package/dist/esm/core/identifier.js.map +1 -1
- package/dist/esm/core/resolve.js +25 -22
- package/dist/esm/core/resolve.js.map +1 -1
- package/dist/esm/core/update.js +4 -4
- package/dist/esm/core/update.js.map +1 -1
- package/dist/esm/did-btcr2.js +11 -16
- package/dist/esm/did-btcr2.js.map +1 -1
- package/dist/esm/index.js +0 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/utils/did-document.js +22 -21
- package/dist/esm/utils/did-document.js.map +1 -1
- package/dist/types/core/beacon/aggregation/cohort/index.d.ts +2 -1
- package/dist/types/core/beacon/aggregation/cohort/index.d.ts.map +1 -1
- package/dist/types/core/beacon/aggregation/cohort/messages/base.d.ts +2 -1
- package/dist/types/core/beacon/aggregation/cohort/messages/base.d.ts.map +1 -1
- package/dist/types/core/beacon/aggregation/cohort/messages/constants.d.ts +1 -0
- package/dist/types/core/beacon/aggregation/cohort/messages/index.d.ts +1 -0
- package/dist/types/core/beacon/aggregation/cohort/messages/keygen/cohort-advert.d.ts +1 -0
- package/dist/types/core/beacon/aggregation/cohort/messages/keygen/cohort-ready.d.ts +2 -2
- package/dist/types/core/beacon/aggregation/cohort/messages/keygen/cohort-ready.d.ts.map +1 -1
- package/dist/types/core/beacon/aggregation/cohort/messages/keygen/opt-in-accept.d.ts +1 -0
- package/dist/types/core/beacon/aggregation/cohort/messages/keygen/opt-in.d.ts +1 -0
- package/dist/types/core/beacon/aggregation/cohort/messages/keygen/subscribe.d.ts +1 -0
- package/dist/types/core/beacon/aggregation/cohort/messages/sign/aggregated-nonce.d.ts +1 -0
- package/dist/types/core/beacon/aggregation/cohort/messages/sign/authorization-request.d.ts +1 -0
- package/dist/types/core/beacon/aggregation/cohort/messages/sign/nonce-contribution.d.ts +1 -0
- package/dist/types/core/beacon/aggregation/cohort/messages/sign/request-signature.d.ts +1 -0
- package/dist/types/core/beacon/aggregation/cohort/messages/sign/signature-authorization.d.ts +1 -0
- package/dist/types/core/beacon/aggregation/cohort/status.d.ts +1 -0
- package/dist/types/core/beacon/aggregation/communication/adapter/did-comm.d.ts +4 -3
- package/dist/types/core/beacon/aggregation/communication/adapter/did-comm.d.ts.map +1 -1
- package/dist/types/core/beacon/aggregation/communication/adapter/nostr.d.ts +5 -3
- package/dist/types/core/beacon/aggregation/communication/adapter/nostr.d.ts.map +1 -1
- package/dist/types/core/beacon/aggregation/communication/error.d.ts +1 -0
- package/dist/types/core/beacon/aggregation/communication/factory.d.ts +1 -0
- package/dist/types/core/beacon/aggregation/communication/service.d.ts +3 -2
- package/dist/types/core/beacon/aggregation/communication/service.d.ts.map +1 -1
- package/dist/types/core/beacon/aggregation/coordinator.d.ts +1 -0
- package/dist/types/core/beacon/aggregation/coordinator.d.ts.map +1 -1
- package/dist/types/core/beacon/aggregation/participant.d.ts +1 -0
- package/dist/types/core/beacon/aggregation/participant.d.ts.map +1 -1
- package/dist/types/core/beacon/aggregation/session/index.d.ts +2 -1
- package/dist/types/core/beacon/aggregation/session/index.d.ts.map +1 -1
- package/dist/types/core/beacon/aggregation/session/status.d.ts +1 -0
- package/dist/types/core/beacon/beacon.d.ts +4 -3
- package/dist/types/core/beacon/beacon.d.ts.map +1 -1
- package/dist/types/core/beacon/cas-beacon.d.ts +4 -3
- package/dist/types/core/beacon/cas-beacon.d.ts.map +1 -1
- package/dist/types/core/beacon/error.d.ts +1 -0
- package/dist/types/core/beacon/factory.d.ts +1 -0
- package/dist/types/core/beacon/interfaces.d.ts +1 -0
- package/dist/types/core/beacon/signal-discovery.d.ts +6 -5
- package/dist/types/core/beacon/signal-discovery.d.ts.map +1 -1
- package/dist/types/core/beacon/singleton.d.ts +4 -4
- package/dist/types/core/beacon/singleton.d.ts.map +1 -1
- package/dist/types/core/beacon/smt-beacon.d.ts +4 -3
- package/dist/types/core/beacon/smt-beacon.d.ts.map +1 -1
- package/dist/types/core/beacon/utils.d.ts +1 -0
- package/dist/types/core/identifier.d.ts +18 -21
- package/dist/types/core/identifier.d.ts.map +1 -1
- package/dist/types/core/interfaces.d.ts +3 -2
- package/dist/types/core/interfaces.d.ts.map +1 -1
- package/dist/types/core/resolve.d.ts +4 -3
- package/dist/types/core/resolve.d.ts.map +1 -1
- package/dist/types/core/types.d.ts +1 -0
- package/dist/types/core/update.d.ts +3 -2
- package/dist/types/core/update.d.ts.map +1 -1
- package/dist/types/did-btcr2.d.ts +5 -4
- package/dist/types/did-btcr2.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/utils/appendix.d.ts +1 -0
- package/dist/types/utils/did-document-builder.d.ts +1 -0
- package/dist/types/utils/did-document.d.ts +5 -7
- package/dist/types/utils/did-document.d.ts.map +1 -1
- package/package.json +5 -6
- package/src/core/beacon/aggregation/cohort/index.ts +13 -2
- package/src/core/beacon/aggregation/cohort/messages/base.ts +7 -2
- package/src/core/beacon/aggregation/cohort/messages/keygen/cohort-ready.ts +1 -1
- package/src/core/beacon/aggregation/communication/adapter/did-comm.ts +9 -15
- package/src/core/beacon/aggregation/communication/adapter/nostr.ts +9 -11
- package/src/core/beacon/aggregation/communication/service.ts +2 -2
- package/src/core/beacon/aggregation/coordinator.ts +40 -44
- package/src/core/beacon/aggregation/participant.ts +38 -40
- package/src/core/beacon/aggregation/session/index.ts +18 -7
- package/src/core/beacon/beacon.ts +3 -3
- package/src/core/beacon/cas-beacon.ts +3 -3
- package/src/core/beacon/signal-discovery.ts +9 -9
- package/src/core/beacon/singleton.ts +20 -20
- package/src/core/beacon/smt-beacon.ts +3 -3
- package/src/core/identifier.ts +31 -28
- package/src/core/interfaces.ts +2 -2
- package/src/core/resolve.ts +32 -26
- package/src/core/update.ts +6 -6
- package/src/did-btcr2.ts +21 -21
- package/src/index.ts +0 -1
- package/src/utils/did-document.ts +24 -20
- package/dist/cjs/utils/general.js +0 -195
- package/dist/cjs/utils/general.js.map +0 -1
- package/dist/esm/utils/general.js +0 -195
- package/dist/esm/utils/general.js.map +0 -1
- package/dist/types/utils/general.d.ts +0 -85
- package/dist/types/utils/general.d.ts.map +0 -1
- package/src/utils/general.ts +0 -204
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BitcoinConnection } from '@did-btcr2/bitcoin';
|
|
2
2
|
import { SignedBTCR2Update } from '@did-btcr2/cryptosuite';
|
|
3
3
|
import { DidDocument } from '../utils/did-document.js';
|
|
4
4
|
import { BeaconService, BlockMetadata } from './beacon/interfaces.js';
|
|
@@ -61,10 +61,10 @@ export declare class Resolve {
|
|
|
61
61
|
* Signal Bytes (last output in OP_RETURN transaction).
|
|
62
62
|
* @param {Array<BeaconService>} beaconServices The array of BeaconService objects to search for signals.
|
|
63
63
|
* @param {SidecarData} sidecarData The sidecar data containing maps of updates, CAS announcements, and SMT proofs.
|
|
64
|
-
* @param {
|
|
64
|
+
* @param {BitcoinConnection} bitcoin The bitcoin network connection used to fetch beacon signals
|
|
65
65
|
* @returns {Promise<Array<[SignedBTCR2Update, BlockMetadata]>>} The array of BTCR2 Signed Updates announced by the Beacon Signals.
|
|
66
66
|
*/
|
|
67
|
-
static beaconSignals(beaconServices: Array<BeaconService>, sidecarData: SidecarData, bitcoin:
|
|
67
|
+
static beaconSignals(beaconServices: Array<BeaconService>, sidecarData: SidecarData, bitcoin: BitcoinConnection): Promise<Array<[SignedBTCR2Update, BlockMetadata]>>;
|
|
68
68
|
/**
|
|
69
69
|
* Implements subsection {@link https://dcdpr.github.io/did-btcr2/operations/resolve.html#process-updates | 7.2.f Process updates Array}.
|
|
70
70
|
* @param {DidDocument} currentDocument The current DID Document to apply the updates to.
|
|
@@ -90,3 +90,4 @@ export declare class Resolve {
|
|
|
90
90
|
*/
|
|
91
91
|
static applyUpdate(currentDocument: DidDocument, update: SignedBTCR2Update): Promise<DidDocument>;
|
|
92
92
|
}
|
|
93
|
+
//# sourceMappingURL=resolve.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolve.d.ts","sourceRoot":"","sources":["../../../src/core/resolve.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,
|
|
1
|
+
{"version":3,"file":"resolve.d.ts","sourceRoot":"","sources":["../../../src/core/resolve.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EAElB,MAAM,oBAAoB,C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KAAK,CAAC,CAAC,iBAAiB,EAAE,aAAa,CAAC,CAAC,EAC1D,WAAW,CAAC,EAAE,MAAM,EACpB,SAAS,CAAC,EAAE,MAAM,GACjB,OAAO,CAAC,qBAAqB,CAAC;IA4GjC;;;;;OAKG;IACH,MAAM,CAAC,gBAAgB,CAAC,MAAM,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,EAAE,GAAG,IAAI;IAmBrF;;;;;;OAMG;WACU,WAAW,CACtB,eAAe,EAAE,WAAW,EAC5B,MAAM,EAAE,iBAAiB,GACxB,OAAO,CAAC,WAAW,CAAC;CAiFxB"}
|
|
@@ -2,7 +2,7 @@ import { KeyBytes, PatchOperation } from '@did-btcr2/common';
|
|
|
2
2
|
import { SignedBTCR2Update, UnsignedBTCR2Update } from '@did-btcr2/cryptosuite';
|
|
3
3
|
import { Btcr2DidDocument, DidVerificationMethod } from '../utils/did-document.js';
|
|
4
4
|
import { BeaconService } from './beacon/interfaces.js';
|
|
5
|
-
import {
|
|
5
|
+
import { BitcoinConnection } from '@did-btcr2/bitcoin';
|
|
6
6
|
/**
|
|
7
7
|
* Implements {@link https://dcdpr.github.io/did-btcr2/operations/update.html | 7.3 Update}.
|
|
8
8
|
*
|
|
@@ -47,5 +47,6 @@ export declare class Update {
|
|
|
47
47
|
* @returns {SignedBTCR2Update} The SignedBTCR2Update object containing data to validate the Beacon Signal
|
|
48
48
|
* @throws {UpdateError} if the beaconService type is invalid
|
|
49
49
|
*/
|
|
50
|
-
static announce(beaconService: BeaconService, update: SignedBTCR2Update, secretKey: KeyBytes, bitcoin:
|
|
50
|
+
static announce(beaconService: BeaconService, update: SignedBTCR2Update, secretKey: KeyBytes, bitcoin: BitcoinConnection): Promise<SignedBTCR2Update>;
|
|
51
51
|
}
|
|
52
|
+
//# sourceMappingURL=update.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../../../src/core/update.ts"],"names":[],"mappings":"A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1
|
+
import { BitcoinConnection } from '@did-btcr2/bitcoin';
|
|
2
2
|
import { DocumentBytes, HexString, KeyBytes, PatchOperation } from '@did-btcr2/common';
|
|
3
3
|
import { SignedBTCR2Update } from '@did-btcr2/cryptosuite';
|
|
4
4
|
import { DidMethod, DidResolutionResult } from '@web5/dids';
|
|
@@ -7,7 +7,7 @@ import { Btcr2DidDocument, DidVerificationMethod } from './utils/did-document.js
|
|
|
7
7
|
export type Btcr2Identifier = string;
|
|
8
8
|
export interface DidCreateOptions {
|
|
9
9
|
/** Type of identifier to create (key or external) */
|
|
10
|
-
idType:
|
|
10
|
+
idType: string;
|
|
11
11
|
/** DID BTCR2 Version Number */
|
|
12
12
|
version?: number;
|
|
13
13
|
/** Bitcoin Network */
|
|
@@ -85,7 +85,7 @@ export declare class DidBtcr2 implements DidMethod {
|
|
|
85
85
|
* @param {string} params.verificationMethodId The verificationMethod ID to sign the update with.
|
|
86
86
|
* @param {string} params.beaconId The beacon ID associated with the update.
|
|
87
87
|
* @param {KeyBytes | HexString} [params.signingMaterial] Optional signing material (key bytes or hex string).
|
|
88
|
-
* @param {
|
|
88
|
+
* @param {BitcoinConnection} [params.bitcoin] Optional Bitcoin network connection for announcing the update. If not provided, a default connection will be initialized.
|
|
89
89
|
* @return {Promise<SignedBTCR2Update>} Promise resolving to the signed BTCR2 update.
|
|
90
90
|
* @throws {UpdateError} if no verificationMethod, verificationMethod type is not `Multikey` or the publicKeyMultibase
|
|
91
91
|
* header is not `zQ3s`
|
|
@@ -97,7 +97,7 @@ export declare class DidBtcr2 implements DidMethod {
|
|
|
97
97
|
verificationMethodId: string;
|
|
98
98
|
beaconId: string;
|
|
99
99
|
signingMaterial?: KeyBytes | HexString;
|
|
100
|
-
bitcoin?:
|
|
100
|
+
bitcoin?: BitcoinConnection;
|
|
101
101
|
}): Promise<SignedBTCR2Update>;
|
|
102
102
|
/**
|
|
103
103
|
* Given the W3C DID Document of a `did:btcr2` identifier, return the signing verification method that will be used
|
|
@@ -111,3 +111,4 @@ export declare class DidBtcr2 implements DidMethod {
|
|
|
111
111
|
*/
|
|
112
112
|
static getSigningMethod(didDocument: Btcr2DidDocument, methodId?: string): DidVerificationMethod;
|
|
113
113
|
}
|
|
114
|
+
//# sourceMappingURL=did-btcr2.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"did-btcr2.d.ts","sourceRoot":"","sources":["../../src/did-btcr2.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"did-btcr2.d.ts","sourceRoot":"","sources":["../../src/did-btcr2.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EACL,aAAa,EACb,SAAS,EAIT,QAAQ,EAKR,cAAc,EAGf,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAIL,SAAS,EACT,mBAAmB,EAEpB,MAAM,YAAY,CAAC;AAMpB,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAIzD,OAAO,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAElF,MAAM,MAAM,eAAe,GAAG,MAAM,CAAC;AAErC,MAAM,WAAW,gBAAgB;IAC/B,qDAAqD;IACrD,MAAM,EAAE,MAAM,CAAC;IACf,+BAA+B;IAC/B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,sBAAsB;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAKD;;;;;;;;;;;;GAYG;AACH,qBAAa,QAAS,YAAW,SAAS;IACxC;;OAEG;IACH,MAAM,CAAC,UAAU,EAAE,MAAM,CAAW;IAEpC;;;;;;;;;;;;;;;OAeG;IACH,MAAM,CAAC,MAAM,CAAC,YAAY,EAAE,QAAQ,GAAG,aAAa,EAAE,OAAO,CAAC,EAAE,gBAAgB,GAAG,eAAe;IAelG;;;;;;;;;;;;;;;;;;;;OAoBG;WACU,OAAO,CAClB,GAAG,EAAE,MAAM,EACX,iBAAiB,GAAE,iBAAsB,GACxC,OAAO,CAAC,mBAAmB,CAAC;IAyG/B;;;;;;;;;;;;;;;;;;;OAmBG;WACU,MAAM,CAAC,EAClB,cAAc,EACd,OAAO,EACP,eAAe,EACf,oBAAoB,EACpB,QAAQ,EACR,eAAe,EACf,OAAO,GACR,EAAE;QACD,cAAc,EAAE,gBAAgB,CAAC;QACjC,OAAO,EAAE,cAAc,EAAE,CAAC;QAC1B,eAAe,EAAE,MAAM,CAAC;QACxB,oBAAoB,EAAE,MAAM,CAAC;QAC7B,QAAQ,EAAE,MAAM,CAAC;QACjB,eAAe,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAC;QACvC,OAAO,CAAC,EAAE,iBAAiB,CAAC;KAC7B,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAoF9B;;;;;;;;;OASG;IACH,MAAM,CAAC,gBAAgB,CAAC,WAAW,EAAE,gBAAgB,EAAG,QAAQ,CAAC,EAAE,MAAM,GAAG,qBAAqB;CA0BlG"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -39,5 +39,5 @@ export * from './core/update.js';
|
|
|
39
39
|
export * from './utils/appendix.js';
|
|
40
40
|
export * from './utils/did-document-builder.js';
|
|
41
41
|
export * from './utils/did-document.js';
|
|
42
|
-
export * from './utils/general.js';
|
|
43
42
|
export * from './did-btcr2.js';
|
|
43
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,2CAA2C,CAAC;AAC1D,cAAc,4CAA4C,CAAC;AAE3D,cAAc,mDAAmD,CAAC;AAClE,cAAc,wDAAwD,CAAC;AACvE,cAAc,oDAAoD,CAAC;AACnE,cAAc,gEAAgE,CAAC;AAC/E,cAAc,mEAAmE,CAAC;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AAClF,cAAc,4DAA4D,CAAC;AAC3E,cAAc,oEAAoE,CAAC;AACnF,cAAc,yEAAyE,CAAC;AACxF,cAAc,sEAAsE,CAAC;AACrF,cAAc,qEAAqE,CAAC;AACpF,cAAc,2EAA2E,CAAC;AAE1F,cAAc,6DAA6D,CAAC;AAC5E,cAAc,0DAA0D,CAAC;AAEzE,cAAc,kDAAkD,CAAC;AACjE,cAAc,oDAAoD,CAAC;AACnE,cAAc,oDAAoD,CAAC;AAEnE,cAAc,0CAA0C,CAAC;AACzD,cAAc,0CAA0C,CAAC;AACzD,cAAc,4CAA4C,CAAC;AAC3D,cAAc,6CAA6C,CAAC;AAE5D,cAAc,yBAAyB,CAAC;AACxC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,wBAAwB,CAAC;AACvC,cAAc,0BAA0B,CAAC;AACzC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,mCAAmC,CAAC;AAClD,cAAc,4BAA4B,CAAC;AAC3C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,wBAAwB,CAAC;AAEvC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AAEjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,iCAAiC,CAAC;AAChD,cAAc,yBAAyB,CAAC;AAExC,cAAc,gBAAgB,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { HashBytes, JSONObject, KeyBytes } from '@did-btcr2/common';
|
|
2
2
|
import { DidDocument as W3CDidDocument, DidVerificationMethod as W3CDidVerificationMethod } from '@web5/dids';
|
|
3
3
|
import { BeaconService } from '../core/beacon/interfaces.js';
|
|
4
|
+
export declare const BTCR2_DID_DOCUMENT_CONTEXT: string[];
|
|
4
5
|
export declare const ID_PLACEHOLDER_VALUE = "did:btcr2:_";
|
|
5
6
|
export declare const BECH32M_CHARS = "";
|
|
6
7
|
export declare const DID_REGEX: RegExp;
|
|
@@ -66,6 +67,7 @@ export interface Btcr2DidDocument extends W3CDidDocument {
|
|
|
66
67
|
capabilityInvocation?: Array<string | DidVerificationMethod>;
|
|
67
68
|
capabilityDelegation?: Array<string | DidVerificationMethod>;
|
|
68
69
|
service: Array<BeaconService>;
|
|
70
|
+
deactivated?: boolean;
|
|
69
71
|
}
|
|
70
72
|
/**
|
|
71
73
|
* BTCR2 DID Document extends the DidDocument class adding helper methods and properties
|
|
@@ -80,6 +82,7 @@ export interface Btcr2DidDocument extends W3CDidDocument {
|
|
|
80
82
|
* @property {Array<string | DidVerificationMethod>} [capabilityInvocation] - The capability invocation methods of the DID Document.
|
|
81
83
|
* @property {Array<string | DidVerificationMethod>} [capabilityDelegation] - The capability delegation methods of the DID Document.
|
|
82
84
|
* @property {Array<BeaconService>} service - The services of the DID Document.
|
|
85
|
+
* @property {boolean} [deactivated] - Indicates if the DID Document is deactivated.
|
|
83
86
|
*/
|
|
84
87
|
export declare class DidDocument implements Btcr2DidDocument {
|
|
85
88
|
id: string;
|
|
@@ -96,7 +99,7 @@ export declare class DidDocument implements Btcr2DidDocument {
|
|
|
96
99
|
* Convert the DidDocument to a JSON object.
|
|
97
100
|
* @returns {DidDocument} The JSON representation of the DidDocument.
|
|
98
101
|
*/
|
|
99
|
-
|
|
102
|
+
toJSON(): DidDocumentLike;
|
|
100
103
|
/**
|
|
101
104
|
* Create a minimal DidDocument from "k1" btcr2 identifier.
|
|
102
105
|
* @param {string} publicKeyMultibase The public key in multibase format.
|
|
@@ -136,12 +139,6 @@ export declare class DidDocument implements Btcr2DidDocument {
|
|
|
136
139
|
* @returns {boolean} True if the id is valid.
|
|
137
140
|
*/
|
|
138
141
|
private static isValidId;
|
|
139
|
-
/**
|
|
140
|
-
* Validates that the controller exists and is correctly formatted.
|
|
141
|
-
* @param {Array<string>} controller The controller to validate.
|
|
142
|
-
* @returns {boolean} True if the controller is valid.
|
|
143
|
-
*/
|
|
144
|
-
private static isValidController;
|
|
145
142
|
/**
|
|
146
143
|
* Validates that verification methods exist and are correctly formatted.
|
|
147
144
|
* @private
|
|
@@ -231,3 +228,4 @@ export declare class GenesisDocument extends DidDocument {
|
|
|
231
228
|
*/
|
|
232
229
|
static toGenesisBytes(genesisDocument: GenesisDocumentLike): HashBytes;
|
|
233
230
|
}
|
|
231
|
+
//# sourceMappingURL=did-document.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"did-document.d.ts","sourceRoot":"","sources":["../../../src/utils/did-document.ts"],"names":[],"mappings":"AACA,OAAO,EAIL,SAAS,EAGT,UAAU,EAEV,QAAQ,EACT,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,WAAW,IAAI,cAAc,EAAE,qBAAqB,IAAI,wBAAwB,EAAE,MAAM,YAAY,CAAC;AAE9G,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAK7D,eAAO,MAAM,oBAAoB,gBAAgB,CAAC;AAClD,eAAO,MAAM,aAAa,KAAK,CAAC;AAChC,eAAO,MAAM,SAAS,QAAuD,CAAC;AAE9E,MAAM,MAAM,YAAY,GAAG;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,kBAAkB,EAAE,KAAK,CAAC,qBAAqB,CAAC,CAAC;IACjD,cAAc,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,qBAAqB,CAAC,CAAC;IACvD,eAAe,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,qBAAqB,CAAC,CAAC;IACxD,oBAAoB,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,qBAAqB,CAAC,CAAC;IAC7D,oBAAoB,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,qBAAqB,CAAC,CAAC;IAC7D,OAAO,EAAE,KAAK,CAAC,aAAa,CAAC,CAAA;CAC9B,CAAA;AACD,MAAM,MAAM,yBAAyB,GAAG;IACtC,cAAc,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,qBAAqB,CAA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
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.24.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Reference implementation for the did:btcr2 DID method written in TypeScript and JavaScript. did:btcr2 is a censorship resistant DID Method using the Bitcoin blockchain as a Verifiable Data Registry to announce changes to the DID document. This is the core method implementation for the did-btcr2-js monorepo.",
|
|
6
6
|
"main": "./dist/cjs/index.js",
|
|
@@ -83,11 +83,10 @@
|
|
|
83
83
|
"multiformats": "^13.3.1",
|
|
84
84
|
"nostr-tools": "^2.15.0",
|
|
85
85
|
"tiny-secp256k1": "^2.2.3",
|
|
86
|
-
"@did-btcr2/
|
|
87
|
-
"@did-btcr2/cryptosuite": "
|
|
88
|
-
"@did-btcr2/
|
|
89
|
-
"@did-btcr2/
|
|
90
|
-
"@did-btcr2/common": "4.0.1"
|
|
86
|
+
"@did-btcr2/common": "7.0.0",
|
|
87
|
+
"@did-btcr2/cryptosuite": "6.0.2",
|
|
88
|
+
"@did-btcr2/keypair": "0.11.0",
|
|
89
|
+
"@did-btcr2/bitcoin": "0.5.0"
|
|
91
90
|
},
|
|
92
91
|
"devDependencies": {
|
|
93
92
|
"@eslint/js": "^9.22.0",
|
|
@@ -286,7 +286,18 @@ export class AggregateBeaconCohort implements BeaconCohort {
|
|
|
286
286
|
* Converts the cohort instance to a JSON object representation.
|
|
287
287
|
* @returns {BeaconCohort} The JSON object representation of the cohort.
|
|
288
288
|
*/
|
|
289
|
-
public
|
|
290
|
-
return
|
|
289
|
+
public toJSON(): BeaconCohort {
|
|
290
|
+
return {
|
|
291
|
+
id : this.id,
|
|
292
|
+
coordinatorDid : this.coordinatorDid,
|
|
293
|
+
minParticipants : this.minParticipants,
|
|
294
|
+
status : this.status,
|
|
295
|
+
network : this.network,
|
|
296
|
+
pendingSignatureRequests : this.pendingSignatureRequests,
|
|
297
|
+
participants : this.participants,
|
|
298
|
+
cohortKeys : this.cohortKeys,
|
|
299
|
+
trMerkleRoot : this.trMerkleRoot,
|
|
300
|
+
beaconAddress : this.beaconAddress,
|
|
301
|
+
};
|
|
291
302
|
}
|
|
292
303
|
}
|
|
@@ -40,7 +40,12 @@ export class BaseMessage {
|
|
|
40
40
|
* Converts a BaseMessage to a JSON object.
|
|
41
41
|
* @returns {Base} The JSON representation of the BaseMessage.
|
|
42
42
|
*/
|
|
43
|
-
public
|
|
44
|
-
return
|
|
43
|
+
public toJSON(): Base {
|
|
44
|
+
return {
|
|
45
|
+
type : this.type,
|
|
46
|
+
to : this.to,
|
|
47
|
+
from : this.from,
|
|
48
|
+
body : this.body
|
|
49
|
+
};
|
|
45
50
|
}
|
|
46
51
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { NotImplementedError } from '@did-btcr2/common';
|
|
2
2
|
import { RawSchnorrKeyPair, SchnorrKeyPair, Secp256k1SecretKey } from '@did-btcr2/keypair';
|
|
3
3
|
import { Identifier } from '../../../../identifier.js';
|
|
4
4
|
import { AggregateBeaconMessageType } from '../../cohort/messages/index.js';
|
|
5
|
+
import { BaseMessage } from '../../cohort/messages/base.js';
|
|
5
6
|
import { CommunicationService, MessageHandler, ServiceAdapterConfig, ServiceAdapterIdentity } from '../service.js';
|
|
6
7
|
|
|
7
8
|
/**
|
|
@@ -34,12 +35,7 @@ export class DidCommAdapterConfig implements ServiceAdapterConfig {
|
|
|
34
35
|
idType : 'KEY',
|
|
35
36
|
network : 'mutinynet'
|
|
36
37
|
};
|
|
37
|
-
this.did = config?.did || Identifier.encode(
|
|
38
|
-
{
|
|
39
|
-
...this.components,
|
|
40
|
-
genesisBytes : this.keys.public
|
|
41
|
-
}
|
|
42
|
-
);
|
|
38
|
+
this.did = config?.did || Identifier.encode(this.keys.public, this.components);
|
|
43
39
|
this.coordinatorDids = config?.coordinatorDids || [];
|
|
44
40
|
}
|
|
45
41
|
}
|
|
@@ -106,13 +102,13 @@ export class DidCommAdapter implements CommunicationService {
|
|
|
106
102
|
/**
|
|
107
103
|
* Sends a message to a recipient using the Nostr protocol.
|
|
108
104
|
* This method is a placeholder and should be implemented with actual Nostr message sending logic.
|
|
109
|
-
* @param {
|
|
105
|
+
* @param {AggregateBeaconMessageType} _message The message to send, typically containing the content and metadata.
|
|
110
106
|
* @param {string} _recipient The public key or identifier of the recipient.
|
|
111
107
|
* @param {string} _sender The public key or identifier of the sender.
|
|
112
108
|
* @returns {Promise<void>} A promise that resolves when the message is sent.
|
|
113
109
|
*/
|
|
114
110
|
public async sendMessage(
|
|
115
|
-
_message:
|
|
111
|
+
_message: AggregateBeaconMessageType | BaseMessage,
|
|
116
112
|
_recipient: string,
|
|
117
113
|
_sender: string
|
|
118
114
|
): Promise<void | Promise<string>[]> {
|
|
@@ -128,24 +124,22 @@ export class DidCommAdapter implements CommunicationService {
|
|
|
128
124
|
if(!keys) {
|
|
129
125
|
this.config.keys.secret = Secp256k1SecretKey.random();
|
|
130
126
|
this.config.keys.public = Secp256k1SecretKey.getPublicKey(this.config.keys.secret).compressed;
|
|
131
|
-
this.config.did = Identifier.encode(
|
|
127
|
+
this.config.did = Identifier.encode(this.config.keys.public,
|
|
132
128
|
{
|
|
133
129
|
idType : this.config.components.idType || 'KEY',
|
|
134
130
|
version : this.config.components.version || 1,
|
|
135
|
-
network : this.config.components.network || '
|
|
136
|
-
genesisBytes : this.config.keys.public
|
|
131
|
+
network : this.config.components.network || 'regtest',
|
|
137
132
|
}
|
|
138
133
|
);
|
|
139
134
|
return this.config as ServiceAdapterConfig;
|
|
140
135
|
}
|
|
141
136
|
|
|
142
137
|
this.config.keys = keys;
|
|
143
|
-
this.config.did = Identifier.encode(
|
|
138
|
+
this.config.did = Identifier.encode(this.config.keys.public,
|
|
144
139
|
{
|
|
145
140
|
idType : this.config.components.idType || 'KEY',
|
|
146
141
|
version : this.config.components.version || 1,
|
|
147
|
-
network : this.config.components.network || '
|
|
148
|
-
genesisBytes : this.config.keys.public
|
|
142
|
+
network : this.config.components.network || 'regtest',
|
|
149
143
|
}
|
|
150
144
|
);
|
|
151
145
|
return this.config as ServiceAdapterConfig;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// TODO: Finish nostr adapter implementation. Rethink patterns used.
|
|
2
2
|
|
|
3
|
-
import { Did
|
|
3
|
+
import { Did } from '@did-btcr2/common';
|
|
4
4
|
import { CompressedSecp256k1PublicKey, RawSchnorrKeyPair, SchnorrKeyPair, Secp256k1SecretKey } from '@did-btcr2/keypair';
|
|
5
5
|
import { nonceGen } from '@scure/btc-signer/musig2';
|
|
6
6
|
import { Event, EventTemplate, Filter, finalizeEvent, nip44 } from 'nostr-tools';
|
|
@@ -18,6 +18,7 @@ import {
|
|
|
18
18
|
BEACON_COHORT_SIGNATURE_AUTHORIZATION
|
|
19
19
|
} from '../../cohort/messages/constants.js';
|
|
20
20
|
import { AggregateBeaconMessage, AggregateBeaconMessageType } from '../../cohort/messages/index.js';
|
|
21
|
+
import { BaseMessage } from '../../cohort/messages/base.js';
|
|
21
22
|
import { CommunicationAdapterError } from '../error.js';
|
|
22
23
|
import { CommunicationService, MessageHandler, ServiceAdapter, ServiceAdapterConfig, ServiceAdapterIdentity } from '../service.js';
|
|
23
24
|
|
|
@@ -93,11 +94,10 @@ export class NostrAdapter implements CommunicationService {
|
|
|
93
94
|
constructor(config: NostrAdapterConfig = { keys: {} as RawSchnorrKeyPair, components: {}, relays: DEFAULT_NOSTR_RELAYS }) {
|
|
94
95
|
this.config = config;
|
|
95
96
|
this.config.keys = this.config.keys || SchnorrKeyPair.generate().raw;
|
|
96
|
-
this.config.did = config.did || Identifier.encode({
|
|
97
|
-
idType : config.components.idType
|
|
97
|
+
this.config.did = config.did || Identifier.encode(this.config.keys.public!, {
|
|
98
|
+
idType : config.components.idType || 'KEY',
|
|
98
99
|
version : config.components.version || 1,
|
|
99
|
-
network : config.components.network || 'signet'
|
|
100
|
-
genesisBytes : this.config.keys.public!
|
|
100
|
+
network : config.components.network || 'signet'
|
|
101
101
|
});
|
|
102
102
|
}
|
|
103
103
|
|
|
@@ -191,12 +191,12 @@ export class NostrAdapter implements CommunicationService {
|
|
|
191
191
|
* TODO: Clean up and complete this method.
|
|
192
192
|
* Sends a message to a recipient using the Nostr protocol.
|
|
193
193
|
* This method is a placeholder and should be implemented with actual Nostr message sending logic.
|
|
194
|
-
* @param {
|
|
194
|
+
* @param {AggregateBeaconMessageType} message The message to send, typically containing the content and metadata.
|
|
195
195
|
* @param {Did} from The identifier of the sender.
|
|
196
196
|
* @param {Did} [to] The identifier of the recipient.
|
|
197
197
|
* @returns {Promise<void>} A promise that resolves when the message is sent.
|
|
198
198
|
*/
|
|
199
|
-
public async sendMessage(message:
|
|
199
|
+
public async sendMessage(message: AggregateBeaconMessageType | BaseMessage, from: Did, to?: Did): Promise<void | Promise<string>[]> {
|
|
200
200
|
// Check if the sender and recipient DIDs are valid identifiers
|
|
201
201
|
if(
|
|
202
202
|
[from, to]
|
|
@@ -297,24 +297,22 @@ export class NostrAdapter implements CommunicationService {
|
|
|
297
297
|
if(!keys) {
|
|
298
298
|
this.config.keys.secret = Secp256k1SecretKey.random();
|
|
299
299
|
this.config.keys.public = Secp256k1SecretKey.getPublicKey(this.config.keys.secret).compressed;
|
|
300
|
-
this.config.did = Identifier.encode(
|
|
300
|
+
this.config.did = Identifier.encode(this.config.keys.public,
|
|
301
301
|
{
|
|
302
302
|
idType : this.config.components.idType || 'KEY',
|
|
303
303
|
version : this.config.components.version || 1,
|
|
304
304
|
network : this.config.components.network || 'signet',
|
|
305
|
-
genesisBytes : this.config.keys.public
|
|
306
305
|
}
|
|
307
306
|
);
|
|
308
307
|
return this.config as ServiceAdapterConfig;
|
|
309
308
|
}
|
|
310
309
|
|
|
311
310
|
this.config.keys = keys;
|
|
312
|
-
this.config.did = Identifier.encode(
|
|
311
|
+
this.config.did = Identifier.encode(this.config.keys.public,
|
|
313
312
|
{
|
|
314
313
|
idType : this.config.components.idType || 'KEY',
|
|
315
314
|
version : this.config.components.version || 1,
|
|
316
315
|
network : this.config.components.network || 'signet',
|
|
317
|
-
genesisBytes : this.config.keys.public
|
|
318
316
|
}
|
|
319
317
|
);
|
|
320
318
|
return this.config as ServiceAdapterConfig;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Maybe } from '@did-btcr2/common';
|
|
2
1
|
import { AggregateBeaconMessageType } from '../cohort/messages/index.js';
|
|
2
|
+
import { BaseMessage } from '../cohort/messages/base.js';
|
|
3
3
|
import { RawSchnorrKeyPair } from '@did-btcr2/keypair';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -34,7 +34,7 @@ export interface CommunicationService {
|
|
|
34
34
|
setKeys(keys: ServiceAdapterIdentity<RawSchnorrKeyPair>): void;
|
|
35
35
|
registerMessageHandler(messageType: string, handler: MessageHandler): void;
|
|
36
36
|
sendMessage(
|
|
37
|
-
message:
|
|
37
|
+
message: AggregateBeaconMessageType | BaseMessage,
|
|
38
38
|
sender: string,
|
|
39
39
|
recipient?: string
|
|
40
40
|
): Promise<void | Promise<string>[]>;
|