@did-btcr2/method 0.18.1 → 0.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser.js +4917 -6487
- package/dist/browser.mjs +4917 -6487
- package/dist/cjs/core/beacon/aggregation/cohort/index.js +3 -3
- package/dist/cjs/core/beacon/aggregation/cohort/index.js.map +1 -1
- package/dist/cjs/core/beacon/aggregation/cohort/messages/base.js +1 -9
- package/dist/cjs/core/beacon/aggregation/cohort/messages/base.js.map +1 -1
- package/dist/cjs/core/beacon/aggregation/cohort/messages/keygen/cohort-advert.js +2 -1
- package/dist/cjs/core/beacon/aggregation/cohort/messages/keygen/cohort-advert.js.map +1 -1
- package/dist/cjs/core/beacon/aggregation/cohort/messages/keygen/cohort-ready.js +2 -1
- package/dist/cjs/core/beacon/aggregation/cohort/messages/keygen/cohort-ready.js.map +1 -1
- package/dist/cjs/core/beacon/aggregation/cohort/messages/keygen/opt-in-accept.js +2 -1
- package/dist/cjs/core/beacon/aggregation/cohort/messages/keygen/opt-in-accept.js.map +1 -1
- package/dist/cjs/core/beacon/aggregation/cohort/messages/keygen/opt-in.js +2 -1
- package/dist/cjs/core/beacon/aggregation/cohort/messages/keygen/opt-in.js.map +1 -1
- package/dist/cjs/core/beacon/aggregation/cohort/messages/keygen/subscribe.js +2 -1
- package/dist/cjs/core/beacon/aggregation/cohort/messages/keygen/subscribe.js.map +1 -1
- package/dist/cjs/core/beacon/aggregation/cohort/messages/sign/aggregated-nonce.js +2 -1
- package/dist/cjs/core/beacon/aggregation/cohort/messages/sign/aggregated-nonce.js.map +1 -1
- package/dist/cjs/core/beacon/aggregation/cohort/messages/sign/authorization-request.js +2 -1
- package/dist/cjs/core/beacon/aggregation/cohort/messages/sign/authorization-request.js.map +1 -1
- package/dist/cjs/core/beacon/aggregation/cohort/messages/sign/nonce-contribution.js +2 -1
- package/dist/cjs/core/beacon/aggregation/cohort/messages/sign/nonce-contribution.js.map +1 -1
- package/dist/cjs/core/beacon/aggregation/cohort/messages/sign/request-signature.js +2 -1
- package/dist/cjs/core/beacon/aggregation/cohort/messages/sign/request-signature.js.map +1 -1
- package/dist/cjs/core/beacon/aggregation/cohort/messages/sign/signature-authorization.js +2 -1
- package/dist/cjs/core/beacon/aggregation/cohort/messages/sign/signature-authorization.js.map +1 -1
- package/dist/cjs/core/beacon/aggregation/communication/adapter/nostr.js +36 -18
- package/dist/cjs/core/beacon/aggregation/communication/adapter/nostr.js.map +1 -1
- package/dist/cjs/core/beacon/aggregation/coordinator.js +14 -14
- package/dist/cjs/core/beacon/aggregation/coordinator.js.map +1 -1
- package/dist/cjs/core/beacon/aggregation/participant.js +4 -3
- package/dist/cjs/core/beacon/aggregation/participant.js.map +1 -1
- package/dist/cjs/core/beacon/aggregation/session/index.js +1 -1
- package/dist/cjs/core/beacon/aggregation/session/index.js.map +1 -1
- package/dist/cjs/core/beacon/beacon.js +25 -0
- package/dist/cjs/core/beacon/beacon.js.map +1 -0
- package/dist/cjs/core/beacon/cas-beacon.js +39 -0
- package/dist/cjs/core/beacon/cas-beacon.js.map +1 -0
- package/dist/cjs/core/beacon/error.js +4 -4
- package/dist/cjs/core/beacon/error.js.map +1 -1
- package/dist/cjs/core/beacon/factory.js +10 -11
- package/dist/cjs/core/beacon/factory.js.map +1 -1
- package/dist/cjs/core/beacon/interfaces.js +2 -0
- package/dist/cjs/core/beacon/interfaces.js.map +1 -0
- package/dist/cjs/core/beacon/signal-discovery.js +183 -0
- package/dist/cjs/core/beacon/signal-discovery.js.map +1 -0
- package/dist/cjs/core/beacon/singleton.js +75 -178
- package/dist/cjs/core/beacon/singleton.js.map +1 -1
- package/dist/cjs/core/beacon/smt-beacon.js +39 -0
- package/dist/cjs/core/beacon/smt-beacon.js.map +1 -0
- package/dist/cjs/core/beacon/utils.js +71 -114
- package/dist/cjs/core/beacon/utils.js.map +1 -1
- package/dist/cjs/core/identifier.js +18 -21
- package/dist/cjs/core/identifier.js.map +1 -1
- package/dist/cjs/core/interfaces.js +2 -0
- package/dist/cjs/core/interfaces.js.map +1 -0
- package/dist/cjs/core/resolve.js +321 -0
- package/dist/cjs/core/resolve.js.map +1 -0
- package/dist/cjs/{utils → core}/types.js.map +1 -1
- package/dist/cjs/core/update.js +113 -0
- package/dist/cjs/core/update.js.map +1 -0
- package/dist/cjs/did-btcr2.js +168 -129
- package/dist/cjs/did-btcr2.js.map +1 -1
- package/dist/cjs/index.js +17 -16
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/utils/appendix.js +16 -33
- package/dist/cjs/utils/appendix.js.map +1 -1
- package/dist/cjs/utils/did-document-builder.js +5 -0
- package/dist/cjs/utils/did-document-builder.js.map +1 -1
- package/dist/cjs/utils/did-document.js +62 -72
- package/dist/cjs/utils/did-document.js.map +1 -1
- package/dist/cjs/utils/general.js +1 -1
- package/dist/cjs/utils/general.js.map +1 -1
- package/dist/esm/core/beacon/aggregation/cohort/index.js +3 -3
- package/dist/esm/core/beacon/aggregation/cohort/index.js.map +1 -1
- package/dist/esm/core/beacon/aggregation/cohort/messages/base.js +1 -9
- package/dist/esm/core/beacon/aggregation/cohort/messages/base.js.map +1 -1
- package/dist/esm/core/beacon/aggregation/cohort/messages/keygen/cohort-advert.js +2 -1
- package/dist/esm/core/beacon/aggregation/cohort/messages/keygen/cohort-advert.js.map +1 -1
- package/dist/esm/core/beacon/aggregation/cohort/messages/keygen/cohort-ready.js +2 -1
- package/dist/esm/core/beacon/aggregation/cohort/messages/keygen/cohort-ready.js.map +1 -1
- package/dist/esm/core/beacon/aggregation/cohort/messages/keygen/opt-in-accept.js +2 -1
- package/dist/esm/core/beacon/aggregation/cohort/messages/keygen/opt-in-accept.js.map +1 -1
- package/dist/esm/core/beacon/aggregation/cohort/messages/keygen/opt-in.js +2 -1
- package/dist/esm/core/beacon/aggregation/cohort/messages/keygen/opt-in.js.map +1 -1
- package/dist/esm/core/beacon/aggregation/cohort/messages/keygen/subscribe.js +2 -1
- package/dist/esm/core/beacon/aggregation/cohort/messages/keygen/subscribe.js.map +1 -1
- package/dist/esm/core/beacon/aggregation/cohort/messages/sign/aggregated-nonce.js +2 -1
- package/dist/esm/core/beacon/aggregation/cohort/messages/sign/aggregated-nonce.js.map +1 -1
- package/dist/esm/core/beacon/aggregation/cohort/messages/sign/authorization-request.js +2 -1
- package/dist/esm/core/beacon/aggregation/cohort/messages/sign/authorization-request.js.map +1 -1
- package/dist/esm/core/beacon/aggregation/cohort/messages/sign/nonce-contribution.js +2 -1
- package/dist/esm/core/beacon/aggregation/cohort/messages/sign/nonce-contribution.js.map +1 -1
- package/dist/esm/core/beacon/aggregation/cohort/messages/sign/request-signature.js +2 -1
- package/dist/esm/core/beacon/aggregation/cohort/messages/sign/request-signature.js.map +1 -1
- package/dist/esm/core/beacon/aggregation/cohort/messages/sign/signature-authorization.js +2 -1
- package/dist/esm/core/beacon/aggregation/cohort/messages/sign/signature-authorization.js.map +1 -1
- package/dist/esm/core/beacon/aggregation/communication/adapter/nostr.js +36 -18
- package/dist/esm/core/beacon/aggregation/communication/adapter/nostr.js.map +1 -1
- package/dist/esm/core/beacon/aggregation/coordinator.js +14 -14
- package/dist/esm/core/beacon/aggregation/coordinator.js.map +1 -1
- package/dist/esm/core/beacon/aggregation/participant.js +4 -3
- package/dist/esm/core/beacon/aggregation/participant.js.map +1 -1
- package/dist/esm/core/beacon/aggregation/session/index.js +1 -1
- package/dist/esm/core/beacon/aggregation/session/index.js.map +1 -1
- package/dist/esm/core/beacon/beacon.js +25 -0
- package/dist/esm/core/beacon/beacon.js.map +1 -0
- package/dist/esm/core/beacon/cas-beacon.js +39 -0
- package/dist/esm/core/beacon/cas-beacon.js.map +1 -0
- package/dist/esm/core/beacon/error.js +4 -4
- package/dist/esm/core/beacon/error.js.map +1 -1
- package/dist/esm/core/beacon/factory.js +10 -11
- package/dist/esm/core/beacon/factory.js.map +1 -1
- package/dist/esm/core/beacon/interfaces.js +2 -0
- package/dist/esm/core/beacon/interfaces.js.map +1 -0
- package/dist/esm/core/beacon/signal-discovery.js +183 -0
- package/dist/esm/core/beacon/signal-discovery.js.map +1 -0
- package/dist/esm/core/beacon/singleton.js +75 -178
- package/dist/esm/core/beacon/singleton.js.map +1 -1
- package/dist/esm/core/beacon/smt-beacon.js +39 -0
- package/dist/esm/core/beacon/smt-beacon.js.map +1 -0
- package/dist/esm/core/beacon/utils.js +71 -114
- package/dist/esm/core/beacon/utils.js.map +1 -1
- package/dist/esm/core/identifier.js +18 -21
- package/dist/esm/core/identifier.js.map +1 -1
- package/dist/esm/core/interfaces.js +2 -0
- package/dist/esm/core/interfaces.js.map +1 -0
- package/dist/esm/core/resolve.js +321 -0
- package/dist/esm/core/resolve.js.map +1 -0
- package/dist/esm/{utils → core}/types.js.map +1 -1
- package/dist/esm/core/update.js +113 -0
- package/dist/esm/core/update.js.map +1 -0
- package/dist/esm/did-btcr2.js +168 -129
- package/dist/esm/did-btcr2.js.map +1 -1
- package/dist/esm/index.js +17 -16
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/utils/appendix.js +16 -33
- package/dist/esm/utils/appendix.js.map +1 -1
- package/dist/esm/utils/did-document-builder.js +5 -0
- package/dist/esm/utils/did-document-builder.js.map +1 -1
- package/dist/esm/utils/did-document.js +62 -72
- package/dist/esm/utils/did-document.js.map +1 -1
- package/dist/esm/utils/general.js +1 -1
- package/dist/esm/utils/general.js.map +1 -1
- package/dist/types/core/beacon/aggregation/cohort/index.d.ts +1 -1
- package/dist/types/core/beacon/aggregation/cohort/messages/base.d.ts +0 -7
- package/dist/types/core/beacon/aggregation/cohort/messages/base.d.ts.map +1 -1
- package/dist/types/core/beacon/aggregation/cohort/messages/keygen/cohort-advert.d.ts.map +1 -1
- package/dist/types/core/beacon/aggregation/cohort/messages/keygen/cohort-ready.d.ts.map +1 -1
- package/dist/types/core/beacon/aggregation/cohort/messages/keygen/opt-in-accept.d.ts.map +1 -1
- package/dist/types/core/beacon/aggregation/cohort/messages/keygen/opt-in.d.ts.map +1 -1
- package/dist/types/core/beacon/aggregation/cohort/messages/keygen/subscribe.d.ts.map +1 -1
- package/dist/types/core/beacon/aggregation/cohort/messages/sign/aggregated-nonce.d.ts.map +1 -1
- package/dist/types/core/beacon/aggregation/cohort/messages/sign/authorization-request.d.ts.map +1 -1
- package/dist/types/core/beacon/aggregation/cohort/messages/sign/nonce-contribution.d.ts.map +1 -1
- package/dist/types/core/beacon/aggregation/cohort/messages/sign/request-signature.d.ts.map +1 -1
- package/dist/types/core/beacon/aggregation/cohort/messages/sign/signature-authorization.d.ts.map +1 -1
- package/dist/types/core/beacon/aggregation/communication/adapter/nostr.d.ts +13 -5
- package/dist/types/core/beacon/aggregation/communication/adapter/nostr.d.ts.map +1 -1
- package/dist/types/core/beacon/aggregation/coordinator.d.ts +17 -29
- package/dist/types/core/beacon/aggregation/coordinator.d.ts.map +1 -1
- package/dist/types/core/beacon/aggregation/participant.d.ts.map +1 -1
- package/dist/types/core/beacon/beacon.d.ts +44 -0
- package/dist/types/core/beacon/beacon.d.ts.map +1 -0
- package/dist/types/core/beacon/cas-beacon.d.ts +36 -0
- package/dist/types/core/beacon/cas-beacon.d.ts.map +1 -0
- package/dist/types/core/beacon/error.d.ts +2 -2
- package/dist/types/core/beacon/error.d.ts.map +1 -1
- package/dist/types/core/beacon/factory.d.ts +4 -5
- package/dist/types/core/beacon/factory.d.ts.map +1 -1
- package/dist/types/core/beacon/interfaces.d.ts +59 -0
- package/dist/types/core/beacon/interfaces.d.ts.map +1 -0
- package/dist/types/core/beacon/signal-discovery.d.ts +25 -0
- package/dist/types/core/beacon/signal-discovery.d.ts.map +1 -0
- package/dist/types/core/beacon/singleton.d.ts +20 -76
- package/dist/types/core/beacon/singleton.d.ts.map +1 -1
- package/dist/types/core/beacon/smt-beacon.d.ts +36 -0
- package/dist/types/core/beacon/smt-beacon.d.ts.map +1 -0
- package/dist/types/core/beacon/utils.d.ts +19 -97
- package/dist/types/core/beacon/utils.d.ts.map +1 -1
- package/dist/types/core/identifier.d.ts.map +1 -1
- package/dist/types/core/interfaces.d.ts +87 -0
- package/dist/types/core/interfaces.d.ts.map +1 -0
- package/dist/types/core/resolve.d.ts +89 -0
- package/dist/types/core/resolve.d.ts.map +1 -0
- package/dist/types/core/types.d.ts +84 -0
- package/dist/types/core/types.d.ts.map +1 -0
- package/dist/types/core/update.d.ts +51 -0
- package/dist/types/core/update.d.ts.map +1 -0
- package/dist/types/did-btcr2.d.ts +70 -89
- package/dist/types/did-btcr2.d.ts.map +1 -1
- package/dist/types/index.d.ts +17 -16
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/utils/appendix.d.ts +5 -10
- package/dist/types/utils/appendix.d.ts.map +1 -1
- package/dist/types/utils/did-document-builder.d.ts +6 -1
- package/dist/types/utils/did-document-builder.d.ts.map +1 -1
- package/dist/types/utils/did-document.d.ts +46 -42
- package/dist/types/utils/did-document.d.ts.map +1 -1
- package/package.json +6 -6
- package/src/core/beacon/aggregation/cohort/index.ts +3 -3
- package/src/core/beacon/aggregation/cohort/messages/base.ts +1 -12
- package/src/core/beacon/aggregation/cohort/messages/keygen/cohort-advert.ts +2 -2
- package/src/core/beacon/aggregation/cohort/messages/keygen/cohort-ready.ts +2 -2
- package/src/core/beacon/aggregation/cohort/messages/keygen/opt-in-accept.ts +2 -2
- package/src/core/beacon/aggregation/cohort/messages/keygen/opt-in.ts +2 -2
- package/src/core/beacon/aggregation/cohort/messages/keygen/subscribe.ts +2 -2
- package/src/core/beacon/aggregation/cohort/messages/sign/aggregated-nonce.ts +2 -2
- package/src/core/beacon/aggregation/cohort/messages/sign/authorization-request.ts +2 -2
- package/src/core/beacon/aggregation/cohort/messages/sign/nonce-contribution.ts +2 -2
- package/src/core/beacon/aggregation/cohort/messages/sign/request-signature.ts +2 -2
- package/src/core/beacon/aggregation/cohort/messages/sign/signature-authorization.ts +2 -2
- package/src/core/beacon/aggregation/communication/adapter/nostr.ts +43 -21
- package/src/core/beacon/aggregation/coordinator.ts +41 -29
- package/src/core/beacon/aggregation/participant.ts +4 -3
- package/src/core/beacon/aggregation/session/index.ts +1 -1
- package/src/core/beacon/beacon.ts +58 -0
- package/src/core/beacon/cas-beacon.ts +53 -0
- package/src/core/beacon/error.ts +5 -6
- package/src/core/beacon/factory.ts +12 -16
- package/src/core/beacon/interfaces.ts +67 -0
- package/src/core/beacon/signal-discovery.ts +237 -0
- package/src/core/beacon/singleton.ts +107 -197
- package/src/core/beacon/smt-beacon.ts +53 -0
- package/src/core/beacon/utils.ts +95 -182
- package/src/core/identifier.ts +21 -24
- package/src/core/interfaces.ts +93 -0
- package/src/core/resolve.ts +463 -0
- package/src/core/types.ts +95 -0
- package/src/core/update.ts +154 -0
- package/src/did-btcr2.ts +255 -159
- package/src/index.ts +19 -22
- package/src/utils/appendix.ts +26 -44
- package/src/utils/did-document-builder.ts +6 -1
- package/src/utils/did-document.ts +105 -113
- package/src/utils/general.ts +1 -1
- package/dist/cjs/core/beacon/cid-aggregate.js +0 -116
- package/dist/cjs/core/beacon/cid-aggregate.js.map +0 -1
- package/dist/cjs/core/beacon/smt-aggregate.js +0 -126
- package/dist/cjs/core/beacon/smt-aggregate.js.map +0 -1
- package/dist/cjs/core/crud/deactivate.js +0 -14
- package/dist/cjs/core/crud/deactivate.js.map +0 -1
- package/dist/cjs/core/crud/read.js +0 -679
- package/dist/cjs/core/crud/read.js.map +0 -1
- package/dist/cjs/core/crud/update.js +0 -194
- package/dist/cjs/core/crud/update.js.map +0 -1
- package/dist/cjs/interfaces/beacon.js +0 -41
- package/dist/cjs/interfaces/beacon.js.map +0 -1
- package/dist/cjs/interfaces/crud.js +0 -2
- package/dist/cjs/interfaces/crud.js.map +0 -1
- package/dist/esm/core/beacon/cid-aggregate.js +0 -116
- package/dist/esm/core/beacon/cid-aggregate.js.map +0 -1
- package/dist/esm/core/beacon/smt-aggregate.js +0 -126
- package/dist/esm/core/beacon/smt-aggregate.js.map +0 -1
- package/dist/esm/core/crud/deactivate.js +0 -14
- package/dist/esm/core/crud/deactivate.js.map +0 -1
- package/dist/esm/core/crud/read.js +0 -679
- package/dist/esm/core/crud/read.js.map +0 -1
- package/dist/esm/core/crud/update.js +0 -194
- package/dist/esm/core/crud/update.js.map +0 -1
- package/dist/esm/interfaces/beacon.js +0 -41
- package/dist/esm/interfaces/beacon.js.map +0 -1
- package/dist/esm/interfaces/crud.js +0 -2
- package/dist/esm/interfaces/crud.js.map +0 -1
- package/dist/types/core/beacon/cid-aggregate.d.ts +0 -102
- package/dist/types/core/beacon/cid-aggregate.d.ts.map +0 -1
- package/dist/types/core/beacon/smt-aggregate.d.ts +0 -111
- package/dist/types/core/beacon/smt-aggregate.d.ts.map +0 -1
- package/dist/types/core/crud/deactivate.d.ts +0 -13
- package/dist/types/core/crud/deactivate.d.ts.map +0 -1
- package/dist/types/core/crud/read.d.ts +0 -334
- package/dist/types/core/crud/read.d.ts.map +0 -1
- package/dist/types/core/crud/update.d.ts +0 -93
- package/dist/types/core/crud/update.d.ts.map +0 -1
- package/dist/types/interfaces/beacon.d.ts +0 -116
- package/dist/types/interfaces/beacon.d.ts.map +0 -1
- package/dist/types/interfaces/crud.d.ts +0 -32
- package/dist/types/interfaces/crud.d.ts.map +0 -1
- package/dist/types/utils/types.d.ts +0 -38
- package/dist/types/utils/types.d.ts.map +0 -1
- package/src/canonicalize.d.ts +0 -6
- package/src/core/beacon/cid-aggregate.ts +0 -153
- package/src/core/beacon/smt-aggregate.ts +0 -135
- package/src/core/crud/deactivate.ts +0 -13
- package/src/core/crud/read.ts +0 -948
- package/src/core/crud/update.ts +0 -292
- package/src/interfaces/beacon.ts +0 -137
- package/src/interfaces/crud.ts +0 -33
- package/src/utils/types.ts +0 -41
- /package/dist/cjs/{utils → core}/types.js +0 -0
- /package/dist/esm/{utils → core}/types.js +0 -0
package/dist/cjs/did-btcr2.js
CHANGED
|
@@ -1,196 +1,235 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BitcoinNetworkConnection } from '@did-btcr2/bitcoin';
|
|
2
|
+
import { Canonicalization, IdentifierHrp, INVALID_DID_DOCUMENT, INVALID_DID_UPDATE, METHOD_NOT_SUPPORTED, MethodError, MISSING_UPDATE_DATA, ResolveError, UpdateError } from '@did-btcr2/common';
|
|
2
3
|
import { Did, DidError, DidErrorCode, EMPTY_DID_RESOLUTION_RESULT } from '@web5/dids';
|
|
3
4
|
import { initEccLib } from 'bitcoinjs-lib';
|
|
4
5
|
import * as tinysecp from 'tiny-secp256k1';
|
|
5
|
-
import {
|
|
6
|
-
import { Update } from './core/crud/update.js';
|
|
6
|
+
import { BeaconUtils } from './core/beacon/utils.js';
|
|
7
7
|
import { Identifier } from './core/identifier.js';
|
|
8
|
+
import { Resolve } from './core/resolve.js';
|
|
9
|
+
import { Update } from './core/update.js';
|
|
8
10
|
import { Appendix } from './utils/appendix.js';
|
|
11
|
+
// TODO: convert to API driver?
|
|
12
|
+
export const canonicalization = new Canonicalization();
|
|
13
|
+
// TODO: convert to API driver?
|
|
9
14
|
/** Initialize tiny secp256k1 */
|
|
10
15
|
initEccLib(tinysecp);
|
|
11
16
|
/**
|
|
12
17
|
* Implements {@link https://dcdpr.github.io/did-btcr2 | did:btcr2 DID Method Specification}.
|
|
13
|
-
* did:btcr2 is a censorship
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
18
|
+
* did:btcr2 is a censorship-resistant Decentralized Identifier (DID) method using
|
|
19
|
+
* the Bitcoin blockchain as a Verifiable Data Registry to announce changes to the
|
|
20
|
+
* DID document. It supports zero-cost off-chain DID creation; aggregated updates
|
|
21
|
+
* for scalable on-chain update costs; long-term identifiers that can support
|
|
22
|
+
* frequent updates; private communication of the DID document; private DID resolution;
|
|
23
|
+
* and non-repudiation.
|
|
17
24
|
*
|
|
18
25
|
* @class DidBtcr2
|
|
19
26
|
* @type {DidBtcr2}
|
|
20
27
|
* @implements {DidMethod}
|
|
21
28
|
*/
|
|
22
29
|
export class DidBtcr2 {
|
|
23
|
-
/**
|
|
30
|
+
/**
|
|
31
|
+
* Name of the DID method, as defined in the DID BTCR2 specification
|
|
32
|
+
*/
|
|
24
33
|
static methodName = 'btcr2';
|
|
25
34
|
/**
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
* Bitcoin network to
|
|
33
|
-
* @
|
|
34
|
-
* @
|
|
35
|
-
* @param {KeyBytes} params.pubKeyBytes Public key byte array used to create a btcr2 "key" identifier.
|
|
36
|
-
* @param {IntermediateDocument} params.intermediateDocument DID Document used to create a btcr2 "external" identifier.
|
|
37
|
-
* @param {DidCreateOptions} params.options See {@link DidCreateOptions} for create options.
|
|
38
|
-
* @param {number} params.options.version Version number of the btcr2 method.
|
|
39
|
-
* @param {string} params.options.network Bitcoin network name (mainnet, testnet, signet, regtest).
|
|
40
|
-
* @returns {Promise<CreateResponse>} Promise resolving to a CreateResponse object.
|
|
41
|
-
* @throws {DidBtcr2Error} if any of the checks fail
|
|
35
|
+
* Implements section {@link https://dcdpr.github.io/did-btcr2/operations/create.html | 7.1 Create}.
|
|
36
|
+
* @param {KeyBytes | DocumentBytes} genesisBytes The bytes used to create the genesis document for a did:btcr2 identifier.
|
|
37
|
+
* This can be either the bytes of the genesis document itself or the bytes of a key that will be used to create the genesis document.
|
|
38
|
+
* @param {DidCreateOptions} options Options for creating the identifier, including the idType (key or external), version, and network.
|
|
39
|
+
* @param {string} options.idType The type of identifier to create, either 'KEY' or 'EXTERNAL'. Defaults to 'KEY'.
|
|
40
|
+
* @param {number} options.version The version number of the did:btcr2 specification to use for creating the identifier. Defaults to 1.
|
|
41
|
+
* @param {string} options.network The Bitcoin network to use for the identifier, e.g. 'bitcoin', 'testnet', etc. Defaults to 'bitcoin'.
|
|
42
|
+
* @returns {Promise<Btcr2Identifier>} Promise resolving to a Btcr2Identifier string.
|
|
43
|
+
* @throws {MethodError} if any of the checks fail
|
|
42
44
|
*/
|
|
43
|
-
static async create(
|
|
44
|
-
// Deconstruct the idType and
|
|
45
|
-
const { idType,
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
45
|
+
static async create(genesisBytes, options) {
|
|
46
|
+
// Deconstruct the idType, version and network from the options, setting defaults if not given
|
|
47
|
+
const { idType, version = 1, network = 'bitcoin' } = options || {};
|
|
48
|
+
if (!idType) {
|
|
49
|
+
throw new MethodError('idType is required for creating a did:btcr2 identifier', INVALID_DID_DOCUMENT, options);
|
|
50
|
+
}
|
|
51
|
+
// Call identifier encoding algorithm
|
|
50
52
|
return Identifier.encode({ idType, genesisBytes, version, network });
|
|
51
53
|
}
|
|
52
54
|
/**
|
|
53
|
-
* Entry point for section {@link https://dcdpr.github.io/did-btcr2
|
|
54
|
-
* See {@link
|
|
55
|
+
* Entry point for section {@link https://dcdpr.github.io/did-btcr2/operations/resolve.html | 7.2 Resolve}.
|
|
56
|
+
* See specification for the {@link https://dcdpr.github.io/did-btcr2/operations/resolve.html#process | Resolve Process}.
|
|
57
|
+
* See {@link Resolve | Resolve (class)} for class implementation.
|
|
55
58
|
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
* object. The resolver then attempts to resolve the DID document of the identifier at a specific Target Time. The
|
|
61
|
-
* Target Time is either provided in resolutionOptions or is set to the Resolution Time of the request.
|
|
59
|
+
* Resolving a did:btcr2 identifier iteratively builds a DID document by applying
|
|
60
|
+
* BTCR2 Updates to an Initial DID Document that have been committed to the Bitcoin
|
|
61
|
+
* blockchain by Authorized Beacon Signals. The Initial DID Document is either
|
|
62
|
+
* deterministically created from the DID or provided by Sidecar Data.
|
|
62
63
|
*
|
|
63
|
-
* @param {string}
|
|
64
|
-
* @param {
|
|
65
|
-
* @
|
|
66
|
-
* @
|
|
67
|
-
* @param {DidDocument} options.sidecarData data necessary for resolving a DID
|
|
68
|
-
* @param {string} options.network Bitcoin network name (mainnet, testnet, signet, regtest).
|
|
69
|
-
* @returns {DidResolutionResult} Promise resolving to a DID Resolution Result containing the `targetDocument`
|
|
70
|
-
* @throws {Error} if the resolution fails for any reason
|
|
71
|
-
* @throws {DidError} InvalidDid if the identifier is invalid
|
|
64
|
+
* @param {string} did The did:btcr2 identifier to be resolved.
|
|
65
|
+
* @param {ResolutionOptions} resolutionOptions Options used during the resolution process.
|
|
66
|
+
* @returns {Promise<DidResolutionResult>} Promise resolving to a DID Resolution Result containing the `targetDocument`
|
|
67
|
+
* @throws {ResolveError} If the resolution process fails at any step.
|
|
72
68
|
* @example
|
|
73
69
|
* ```ts
|
|
74
|
-
* const resolution = await DidBtcr2.resolve(
|
|
70
|
+
* const resolution = await DidBtcr2.resolve(
|
|
71
|
+
* 'did:btcr2:k1q0dygyp3gz969tp46dychzy4q78c2k3js68kvyr0shanzg67jnuez2cfplh'
|
|
72
|
+
* )
|
|
75
73
|
* ```
|
|
76
74
|
*/
|
|
77
|
-
static async resolve(
|
|
75
|
+
static async resolve(did, resolutionOptions = { drivers: {} }) {
|
|
78
76
|
try {
|
|
79
|
-
//
|
|
80
|
-
// 2. Set identifierComponents to a map of idType, version, network, and genesisBytes.
|
|
81
|
-
const identifierComponents = Identifier.decode(identifier);
|
|
82
|
-
// Set the network based on the decoded identifier
|
|
83
|
-
resolutionsOptions.network ??= identifierComponents.network;
|
|
84
|
-
// 3. Set initialDocument to the result of running the algorithm in Resolve Initial Document passing in the
|
|
85
|
-
// identifier, identifierComponents and resolutionOptions.
|
|
86
|
-
const initialDocument = await Resolve.initialDocument({ identifier, identifierComponents, resolutionsOptions });
|
|
87
|
-
// 4. Set targetDocument to the result of running the algorithm in Resolve Target Document passing in
|
|
88
|
-
// initialDocument and resolutionOptions.
|
|
89
|
-
const targetDocument = await Resolve.targetDocument({ initialDocument, resolutionsOptions });
|
|
90
|
-
// 5. Return targetDocument.
|
|
77
|
+
// Initialize an empty DID Resolution Result
|
|
91
78
|
const didResolutionResult = {
|
|
92
|
-
'@context':
|
|
79
|
+
'@context': 'https://w3id.org/did-resolution/v1',
|
|
93
80
|
didResolutionMetadata: { contentType: 'application/ld+json' },
|
|
94
|
-
didDocumentMetadata: {
|
|
95
|
-
|
|
81
|
+
didDocumentMetadata: {
|
|
82
|
+
deactivated: false,
|
|
83
|
+
updated: undefined,
|
|
84
|
+
versionId: resolutionOptions.versionId,
|
|
85
|
+
confirmations: undefined,
|
|
86
|
+
},
|
|
87
|
+
didDocument: null,
|
|
96
88
|
};
|
|
89
|
+
// Decode the did to be resolved
|
|
90
|
+
const didComponents = Identifier.decode(did);
|
|
91
|
+
// Process sidecar if provided
|
|
92
|
+
const sidecarData = Resolve.sidecarData(resolutionOptions.sidecar);
|
|
93
|
+
// Check if bitcoin driver provided
|
|
94
|
+
if (!resolutionOptions?.drivers?.bitcoin) {
|
|
95
|
+
// If not, initialize default drivers
|
|
96
|
+
resolutionOptions.drivers = resolutionOptions.drivers || {};
|
|
97
|
+
// Set bitcoin driver to default BitcoinNetworkConnection
|
|
98
|
+
resolutionOptions.drivers.bitcoin = new BitcoinNetworkConnection();
|
|
99
|
+
// Set the network based on the decoded identifier
|
|
100
|
+
resolutionOptions.drivers.bitcoin.setActiveNetwork(didComponents.network);
|
|
101
|
+
}
|
|
102
|
+
// Parse the genesis document from the resolution options if provided
|
|
103
|
+
const genesisDocument = resolutionOptions.sidecar?.genesisDocument;
|
|
104
|
+
// Since genesisDocument is optional, check if it exists
|
|
105
|
+
if (!genesisDocument) {
|
|
106
|
+
// If no genesisDocument and x HRP, throw MISSING_UPDATE_DATA error
|
|
107
|
+
if (didComponents.hrp === IdentifierHrp.x)
|
|
108
|
+
throw new ResolveError('External resolution requires genesisDocument', MISSING_UPDATE_DATA, { resolutionOptions });
|
|
109
|
+
}
|
|
110
|
+
// Establish the current document
|
|
111
|
+
const currentDocument = await Resolve.currentDocument(didComponents, genesisDocument);
|
|
112
|
+
// Extract all Beacon services from the current DID Document
|
|
113
|
+
const beaconServices = currentDocument.service
|
|
114
|
+
.filter(BeaconUtils.isBeaconService)
|
|
115
|
+
.map(BeaconUtils.parseBeaconServiceEndpoint);
|
|
116
|
+
console.log('beaconServices', beaconServices);
|
|
117
|
+
// Process the Beacon Signals to get the required updates
|
|
118
|
+
const unsortedUpdates = await Resolve.beaconSignals(beaconServices, sidecarData, resolutionOptions.drivers.bitcoin);
|
|
119
|
+
console.log('unsortedUpdates', unsortedUpdates);
|
|
120
|
+
// If no updates found, return the current document
|
|
121
|
+
if (!unsortedUpdates.length) {
|
|
122
|
+
// Set the current document in the didResolutionResult
|
|
123
|
+
didResolutionResult.didDocument = currentDocument;
|
|
124
|
+
// Set the deactivated status in the didDocumentMetadata
|
|
125
|
+
didResolutionResult.didDocumentMetadata.deactivated = !!currentDocument.deactivated;
|
|
126
|
+
// Return the didResolutionResult early
|
|
127
|
+
return didResolutionResult;
|
|
128
|
+
}
|
|
129
|
+
// Process the updates to apply updates to bring the current DID Document to its more current state
|
|
130
|
+
const result = await Resolve.updates(currentDocument, unsortedUpdates, resolutionOptions.versionTime, resolutionOptions.versionId);
|
|
131
|
+
// Set all of the required fields in the didResolutionResult
|
|
132
|
+
didResolutionResult.didDocument = result.currentDocument;
|
|
133
|
+
didResolutionResult.didDocumentMetadata.confirmations = result.confirmations;
|
|
134
|
+
didResolutionResult.didDocumentMetadata.versionId = result.versionId;
|
|
135
|
+
didResolutionResult.didDocumentMetadata.deactivated = !!result.currentDocument.deactivated;
|
|
97
136
|
// Return didResolutionResult;
|
|
98
137
|
return didResolutionResult;
|
|
99
138
|
}
|
|
100
139
|
catch (error) {
|
|
101
140
|
console.error(error);
|
|
102
|
-
// Rethrow any unexpected errors that are not a `
|
|
103
|
-
if (!(error instanceof
|
|
141
|
+
// Rethrow any unexpected errors that are not a `ResolveError`.
|
|
142
|
+
if (!(error instanceof ResolveError))
|
|
104
143
|
throw new Error(error);
|
|
105
144
|
// Return a DID Resolution Result with the appropriate error code.
|
|
106
145
|
return {
|
|
107
146
|
...EMPTY_DID_RESOLUTION_RESULT,
|
|
108
147
|
didResolutionMetadata: {
|
|
109
|
-
error: error.
|
|
148
|
+
error: error.type,
|
|
110
149
|
...error.message && { errorMessage: error.message }
|
|
111
150
|
}
|
|
112
151
|
};
|
|
113
152
|
}
|
|
114
153
|
}
|
|
115
154
|
/**
|
|
116
|
-
* Entry point for section {@link https://dcdpr.github.io/did-btcr2/#
|
|
117
|
-
* See {@link
|
|
118
|
-
*
|
|
119
|
-
* An update to a did:btcr2 document is an invoked capability using the ZCAP-LD data format, signed by a
|
|
120
|
-
* verificationMethod that has the authority to make the update as specified in the previous DID document. Capability
|
|
121
|
-
* invocations for updates MUST be authorized using Data Integrity following the bip340-jcs-2025
|
|
122
|
-
* cryptosuite with a proofPurpose of capabilityInvocation.
|
|
155
|
+
* Entry point for section {@link https://dcdpr.github.io/did-btcr2/#read | 7.3 Update}.
|
|
156
|
+
* See specification for the {@link https://dcdpr.github.io/did-btcr2/operations/resolve.html#process | Resolve Process}.
|
|
157
|
+
* See {@link Update | Update (class)} for class implementation.
|
|
123
158
|
*
|
|
124
|
-
*
|
|
125
|
-
*
|
|
126
|
-
*
|
|
127
|
-
*
|
|
128
|
-
*
|
|
129
|
-
*
|
|
130
|
-
*
|
|
131
|
-
*
|
|
132
|
-
* @param {
|
|
133
|
-
* @param {
|
|
134
|
-
* @param {
|
|
135
|
-
* @
|
|
136
|
-
* @
|
|
137
|
-
*
|
|
138
|
-
* @param {string[]} params.beaconIds The beacon IDs to announce the update
|
|
139
|
-
* @returns {Promise<void>} Promise resolving to void
|
|
140
|
-
* @throws {MethodError} if the verificationMethod type is not `Multikey` or the publicKeyMultibase header is not `zQ3s`
|
|
159
|
+
* BTCR2 DID documents can be updated by anchoring BTCR2 Updates to Bitcoin transactions. These transactions MAY be
|
|
160
|
+
* published to the Bitcoin network. Any property in the DID document may be updated except the id. Doing so would
|
|
161
|
+
* invalidate the DID document.
|
|
162
|
+
* @param params An object containing the parameters for the update operation.
|
|
163
|
+
* @param {Btcr2DidDocument} params.sourceDocument The DID document being updated.
|
|
164
|
+
* @param {PatchOperation[]} params.patches The array of JSON Patch operations to apply to the sourceDocument.
|
|
165
|
+
* @param {string} params.sourceVersionId The version ID before applying the update.
|
|
166
|
+
* @param {string} params.verificationMethodId The verificationMethod ID to sign the update with.
|
|
167
|
+
* @param {string} params.beaconId The beacon ID associated with the update.
|
|
168
|
+
* @param {KeyBytes | HexString} [params.signingMaterial] Optional signing material (key bytes or hex string).
|
|
169
|
+
* @param {BitcoinNetworkConnection} [params.bitcoin] Optional Bitcoin network connection for announcing the update. If not provided, a default connection will be initialized.
|
|
170
|
+
* @return {Promise<SignedBTCR2Update>} Promise resolving to the signed BTCR2 update.
|
|
171
|
+
* @throws {UpdateError} if no verificationMethod, verificationMethod type is not `Multikey` or the publicKeyMultibase
|
|
172
|
+
* header is not `zQ3s`
|
|
141
173
|
*/
|
|
142
|
-
static async update(
|
|
143
|
-
//
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
174
|
+
static async update({ sourceDocument, patches, sourceVersionId, verificationMethodId, beaconId, signingMaterial, bitcoin, }) {
|
|
175
|
+
// TODO: provide KMS as alternative
|
|
176
|
+
// If no signingMaterial provided, throw an UpdateError with INVALID_DID_UPDATE.
|
|
177
|
+
if (!signingMaterial) {
|
|
178
|
+
throw new UpdateError('Missing signing material for update', INVALID_DID_UPDATE, { signingMaterial });
|
|
179
|
+
}
|
|
180
|
+
// Convert signingMaterial to bytes if it's a hex string
|
|
181
|
+
const secretKey = typeof signingMaterial === 'string'
|
|
182
|
+
? Buffer.from(signingMaterial, 'hex')
|
|
183
|
+
: signingMaterial;
|
|
184
|
+
// Validate that the verificationMethodId is authorized for capabilityInvocation
|
|
185
|
+
if (!sourceDocument.capabilityInvocation?.some(vr => vr === verificationMethodId)) {
|
|
186
|
+
throw new UpdateError('Invalid verificationMethodId: not authorized for capabilityInvocation', INVALID_DID_DOCUMENT, sourceDocument);
|
|
187
|
+
}
|
|
188
|
+
// Get the verification method to be used for signing the update
|
|
189
|
+
const verificationMethod = this.getSigningMethod(sourceDocument, verificationMethodId);
|
|
157
190
|
// Validate the verificationMethod exists in the sourceDocument
|
|
158
191
|
if (!verificationMethod) {
|
|
159
|
-
throw new
|
|
192
|
+
throw new UpdateError('Invalid verificationMethod: not found in source document', INVALID_DID_DOCUMENT, { sourceDocument, verificationMethodId });
|
|
160
193
|
}
|
|
161
|
-
//
|
|
162
|
-
// 3.1 verificationMethod.type == Multikey
|
|
194
|
+
// Validate the verificationMethod is of type 'Multikey'
|
|
163
195
|
if (verificationMethod.type !== 'Multikey') {
|
|
164
|
-
throw new
|
|
196
|
+
throw new UpdateError('Invalid verificationMethod: verificationMethod.type must be "Multikey"', INVALID_DID_DOCUMENT, verificationMethod);
|
|
165
197
|
}
|
|
166
|
-
//
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
throw new MethodError(`Invalid publicKeyMultibase prefix ${mbasePrefix}`, INVALID_DID_DOCUMENT, verificationMethod);
|
|
198
|
+
// Validate the publicKeyMultibase prefix is 'zQ3s'
|
|
199
|
+
if (verificationMethod.publicKeyMultibase?.slice(0, 4) !== 'zQ3s') {
|
|
200
|
+
throw new UpdateError('Invalid verificationMethodId: publicKeyMultibase prefix must start with "zQ3s"', INVALID_DID_DOCUMENT, verificationMethod);
|
|
170
201
|
}
|
|
171
|
-
//
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
//
|
|
176
|
-
const
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
202
|
+
// Construct an unsigned update following the BTCR2 Update construction algorithm
|
|
203
|
+
const update = await Update.construct(sourceDocument, patches, sourceVersionId);
|
|
204
|
+
// Sign the unsigned update using the specified verification method
|
|
205
|
+
const signed = await Update.sign(sourceDocument.id, update, verificationMethod, secretKey);
|
|
206
|
+
// Filter sourceDocument services to get beaconServices matching beaconIds
|
|
207
|
+
const beaconService = sourceDocument.service
|
|
208
|
+
.filter((service) => service.id === beaconId)
|
|
209
|
+
.filter((service) => !!service)
|
|
210
|
+
.shift();
|
|
211
|
+
// If no matching beacon service found, throw an UpdateError with INVALID_DID_UPDATE.
|
|
212
|
+
if (!beaconService) {
|
|
213
|
+
throw new UpdateError('No beacon service found for provided beaconId', INVALID_DID_UPDATE, { sourceDocument, beaconId });
|
|
214
|
+
}
|
|
215
|
+
// If no bitcoin network connection provided, initialize default
|
|
216
|
+
bitcoin ??= new BitcoinNetworkConnection();
|
|
217
|
+
// Announce the signed update to the blockchain using the specified beacon(s)
|
|
218
|
+
// await Update.announce(beaconService, signed, secretKey, bitcoin);
|
|
219
|
+
// Return signed update if announced successfully
|
|
220
|
+
return signed;
|
|
180
221
|
}
|
|
181
222
|
/**
|
|
182
223
|
* Given the W3C DID Document of a `did:btcr2` identifier, return the signing verification method that will be used
|
|
183
224
|
* for signing messages and credentials. If given, the `methodId` parameter is used to select the
|
|
184
225
|
* verification method. If not given, the Identity Key's verification method with an ID fragment
|
|
185
226
|
* of '#initialKey' is used.
|
|
186
|
-
*
|
|
187
|
-
* @param {
|
|
188
|
-
* @param {DidDocument} params.didDocument DID Document to get the verification method from.
|
|
189
|
-
* @param {string} params.methodId Optional ID of the verification method to use for signing.
|
|
227
|
+
* @param {Btcr2DidDocument} didDocument The DID Document of the `did:btcr2` identifier.
|
|
228
|
+
* @param {string} [methodId] Optional verification method ID to be used for signing.
|
|
190
229
|
* @returns {DidVerificationMethod} Promise resolving to the {@link DidVerificationMethod} object used for signing.
|
|
191
230
|
* @throws {DidError} if the parsed did method does not match `btcr2` or signing method could not be determined.
|
|
192
231
|
*/
|
|
193
|
-
static getSigningMethod(
|
|
232
|
+
static getSigningMethod(didDocument, methodId) {
|
|
194
233
|
// Set the default methodId to the first assertionMethod if not given
|
|
195
234
|
methodId ??= '#initialKey';
|
|
196
235
|
// Verify the DID method is supported.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"did-btcr2.js","sourceRoot":"","sources":["../../src/did-btcr2.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"did-btcr2.js","sourceRoot":"","sources":["../../src/did-btcr2.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EACL,gBAAgB,EAGhB,aAAa,EACb,oBAAoB,EACpB,kBAAkB,EAElB,oBAAoB,EACpB,WAAW,EACX,mBAAmB,EAEnB,YAAY,EACZ,WAAW,EACZ,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EACL,GAAG,EACH,QAAQ,EACR,YAAY,EAGZ,2BAA2B,EAC5B,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,KAAK,QAAQ,MAAM,gBAAgB,CAAC;AAE3C,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAElD,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAG/C,+BAA+B;AAC/B,MAAM,CAAC,MAAM,gBAAgB,GAAG,IAAI,gBAAgB,EAAE,CAAC;AAavD,+BAA+B;AAC/B,gCAAgC;AAChC,UAAU,CAAC,QAAQ,CAAC,CAAC;AAErB;;;;;;;;;;;;GAYG;AACH,MAAM,OAAO,QAAQ;IACnB;;OAEG;IACH,MAAM,CAAC,UAAU,GAAW,OAAO,CAAC;IAEpC;;;;;;;;;;OAUG;IACH,MAAM,CAAC,KAAK,CAAC,MAAM,CACjB,YAAsC,EACtC,OAA0B;QAE1B,8FAA8F;QAC9F,MAAM,EAAE,MAAM,EAAE,OAAO,GAAG,CAAC,EAAE,O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,QAAQ,CAAC;eACvG,QAAQ,CAAC,kBAAkB,CAAC,WAAW,CAAC,eAAe,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CACpE,CAAC;QAEF,qDAAqD;QACrD,IAAI,CAAC,CAAC,kBAAkB,IAAI,kBAAkB,CAAC,kBAAkB,CAAC,EAAE,CAAC;YACnE,MAAM,IAAI,QAAQ,CAChB,YAAY,CAAC,aAAa,EAC1B,0FAA0F,CAC3F,CAAC;QACJ,CAAC;QACD,OAAO,kBAA2C,CAAC;IACrD,CAAC"}
|
package/dist/cjs/index.js
CHANGED
|
@@ -1,43 +1,44 @@
|
|
|
1
|
+
export * from './core/beacon/aggregation/cohort/index.js';
|
|
2
|
+
export * from './core/beacon/aggregation/cohort/status.js';
|
|
3
|
+
export * from './core/beacon/aggregation/cohort/messages/base.js';
|
|
4
|
+
export * from './core/beacon/aggregation/cohort/messages/constants.js';
|
|
5
|
+
export * from './core/beacon/aggregation/cohort/messages/index.js';
|
|
6
|
+
export * from './core/beacon/aggregation/cohort/messages/keygen//subscribe.js';
|
|
1
7
|
export * from './core/beacon/aggregation/cohort/messages/keygen/cohort-advert.js';
|
|
2
8
|
export * from './core/beacon/aggregation/cohort/messages/keygen/cohort-ready.js';
|
|
3
9
|
export * from './core/beacon/aggregation/cohort/messages/keygen/opt-in-accept.js';
|
|
4
10
|
export * from './core/beacon/aggregation/cohort/messages/keygen/opt-in.js';
|
|
5
|
-
export * from './core/beacon/aggregation/cohort/messages/keygen//subscribe.js';
|
|
6
11
|
export * from './core/beacon/aggregation/cohort/messages/sign/aggregated-nonce.js';
|
|
7
12
|
export * from './core/beacon/aggregation/cohort/messages/sign/authorization-request.js';
|
|
8
13
|
export * from './core/beacon/aggregation/cohort/messages/sign/nonce-contribution.js';
|
|
9
14
|
export * from './core/beacon/aggregation/cohort/messages/sign/request-signature.js';
|
|
10
15
|
export * from './core/beacon/aggregation/cohort/messages/sign/signature-authorization.js';
|
|
11
|
-
export * from './core/beacon/aggregation/cohort/messages/base.js';
|
|
12
|
-
export * from './core/beacon/aggregation/cohort/messages/constants.js';
|
|
13
|
-
export * from './core/beacon/aggregation/cohort/messages/index.js';
|
|
14
|
-
export * from './core/beacon/aggregation/cohort/index.js';
|
|
15
|
-
export * from './core/beacon/aggregation/cohort/status.js';
|
|
16
16
|
export * from './core/beacon/aggregation/communication/adapter/did-comm.js';
|
|
17
17
|
export * from './core/beacon/aggregation/communication/adapter/nostr.js';
|
|
18
18
|
export * from './core/beacon/aggregation/communication/error.js';
|
|
19
19
|
export * from './core/beacon/aggregation/communication/factory.js';
|
|
20
20
|
export * from './core/beacon/aggregation/communication/service.js';
|
|
21
|
-
export * from './core/beacon/aggregation/session/index.js';
|
|
22
|
-
export * from './core/beacon/aggregation/session/status.js';
|
|
23
21
|
export * from './core/beacon/aggregation/coordinator.js';
|
|
24
22
|
export * from './core/beacon/aggregation/participant.js';
|
|
25
|
-
export * from './core/beacon/
|
|
23
|
+
export * from './core/beacon/aggregation/session/index.js';
|
|
24
|
+
export * from './core/beacon/aggregation/session/status.js';
|
|
25
|
+
export * from './core/beacon/beacon.js';
|
|
26
|
+
export * from './core/beacon/cas-beacon.js';
|
|
26
27
|
export * from './core/beacon/error.js';
|
|
27
28
|
export * from './core/beacon/factory.js';
|
|
29
|
+
export * from './core/beacon/interfaces.js';
|
|
30
|
+
export * from './core/beacon/signal-discovery.js';
|
|
28
31
|
export * from './core/beacon/singleton.js';
|
|
29
|
-
export * from './core/beacon/smt-
|
|
32
|
+
export * from './core/beacon/smt-beacon.js';
|
|
30
33
|
export * from './core/beacon/utils.js';
|
|
31
|
-
export * from './core/crud/deactivate.js';
|
|
32
|
-
export * from './core/crud/read.js';
|
|
33
|
-
export * from './core/crud/update.js';
|
|
34
34
|
export * from './core/identifier.js';
|
|
35
|
-
export * from './interfaces
|
|
36
|
-
export * from './
|
|
35
|
+
export * from './core/interfaces.js';
|
|
36
|
+
export * from './core/resolve.js';
|
|
37
|
+
export * from './core/types.js';
|
|
38
|
+
export * from './core/update.js';
|
|
37
39
|
export * from './utils/appendix.js';
|
|
38
40
|
export * from './utils/did-document-builder.js';
|
|
39
41
|
export * from './utils/did-document.js';
|
|
40
42
|
export * from './utils/general.js';
|
|
41
|
-
export * from './utils/types.js';
|
|
42
43
|
export * from './did-btcr2.js';
|
|
43
44
|
//# sourceMappingURL=index.js.map
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.js","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;AAClF,cAAc,kEAAkE,CAAC;AACjF,cAAc,mEAAmE,CAAC;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;AACxC,cAAc,oBAAoB,CAAC;AAEnC,cAAc,gBAAgB,CAAC"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { W3C_ZCAP_V1 } from '@did-btcr2/common';
|
|
2
1
|
import { strings } from '@helia/strings';
|
|
3
2
|
import { DidError, DidErrorCode, DidVerificationRelationship } from '@web5/dids';
|
|
4
3
|
import { createHelia } from 'helia';
|
|
@@ -104,20 +103,12 @@ export class Appendix {
|
|
|
104
103
|
* ```
|
|
105
104
|
*/
|
|
106
105
|
static deriveRootCapability(identifier) {
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
// 4. Set rootCapability.id to urn:zcap:root:${encodedIdentifier}.
|
|
114
|
-
rootCapability.id = `urn:zcap:root:${encodedIdentifier}`;
|
|
115
|
-
// 5. Set rootCapability.controller to identifier.
|
|
116
|
-
rootCapability.controller = identifier;
|
|
117
|
-
// 6. Set rootCapability.invocationTarget to identifier.
|
|
118
|
-
rootCapability.invocationTarget = identifier;
|
|
119
|
-
// 7. Return rootCapability.
|
|
120
|
-
return rootCapability;
|
|
106
|
+
return {
|
|
107
|
+
'@context': 'https://w3id.org/zcap/v1',
|
|
108
|
+
id: `urn:zcap:root:${encodeURIComponent(identifier)}`,
|
|
109
|
+
controller: identifier,
|
|
110
|
+
invocationTarget: identifier,
|
|
111
|
+
};
|
|
121
112
|
}
|
|
122
113
|
/**
|
|
123
114
|
* Implements {@link https://dcdpr.github.io/did-btcr2/#dereference-root-capability-identifier | 9.4.2 Dereference Root Capability Identifier}.
|
|
@@ -159,7 +150,7 @@ export class Appendix {
|
|
|
159
150
|
* }
|
|
160
151
|
* }
|
|
161
152
|
*/
|
|
162
|
-
static
|
|
153
|
+
static dereferenceZcapId(capabilityId) {
|
|
163
154
|
// 1. Set rootCapability to an empty object.
|
|
164
155
|
const rootCapability = {};
|
|
165
156
|
// 2. Set components to the result of capabilityId.split(":").
|
|
@@ -195,26 +186,18 @@ export class Appendix {
|
|
|
195
186
|
return rootCapability;
|
|
196
187
|
}
|
|
197
188
|
/**
|
|
198
|
-
* Implements {@link https://dcdpr.github.io/did-btcr2
|
|
199
|
-
*
|
|
200
|
-
*
|
|
201
|
-
* bytes to a IPFS v1 Content Identifier and attempts to retrieve the identified content from Content Addressable
|
|
202
|
-
* Storage (CAS). It returns the retrieved content or null.
|
|
203
|
-
*
|
|
204
|
-
* @param {HashBytes} hashBytes The SHA256 hash of the content to be fetched.
|
|
205
|
-
* @returns {string} The fetched content or null if not found.
|
|
189
|
+
* Implements CAS Lookup Step from {@link https://dcdpr.github.io/did-btcr2/operations/resolve.html#process-beacon-signals | 7.2.e Process Beacon Signals }.
|
|
190
|
+
* @param {HashBytes} hashBytes The hash bytes to look up in the CAS system.
|
|
191
|
+
* @returns {Promise<string | undefined>} The content fetched from the CAS system, or undefined if not found.
|
|
206
192
|
*/
|
|
207
193
|
static async fetchFromCas(hashBytes) {
|
|
208
|
-
//
|
|
194
|
+
// Construct CID from hash bytes
|
|
209
195
|
const cid = CID.create(1, 1, createDigest(1, hashBytes));
|
|
210
|
-
//
|
|
211
|
-
const helia =
|
|
212
|
-
|
|
213
|
-
//
|
|
214
|
-
|
|
215
|
-
// 3. If content for cid cannot be found, set content to null.
|
|
216
|
-
// 4. Return content.
|
|
217
|
-
return content;
|
|
196
|
+
// Connect to IPFS/Helia node
|
|
197
|
+
const helia = await createHelia();
|
|
198
|
+
const node = strings(helia);
|
|
199
|
+
// Return the IPFS get result
|
|
200
|
+
return await node.get(cid, {});
|
|
218
201
|
}
|
|
219
202
|
}
|
|
220
203
|
//# sourceMappingURL=appendix.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"appendix.js","sourceRoot":"","sources":["../../../src/utils/appendix.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"appendix.js","sourceRoot":"","sources":["../../../src/utils/appendix.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACzC,OAAO,EAEL,QAAQ,EACR,YAAY,EAGZ,2BAA2B,EAC5B,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AACpC,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AACnC,OAAO,EAAE,MAAM,IAAI,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAGpE;;;;;GAKG;AACH,MAAM,OAAO,QAAQ;IACnB;;;;OAIG;IACI,MAAM,CAAC,kBAAkB,CAAC,KAAc;QAC7C,IAAI,OAAO,KAAK,KAAK,QAAQ;YAAE,OAAO,SAAS,CAAC;QAChD,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO,SAAS,CAAC;QACzC,OAAO,KAAK,CAAC;IACf,CAAC;IAED;;;;OAIG;IACI,MAAM,CAAC,uBAAuB,CAAC,GAAY;QAChD,8CAA8C;QAC9C,IAAI,CAAC,GAAG,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,KAAK,IAAI;YAAE,OAAO,KAAK,CAAC;QAElE,oFAAoF;QACpF,IAAI,CAAC,CAAC,IAAI,IAAI,GAAG,IAAI,MAAM,IAAI,GAAG,IAAI,YAAY,IAAI,GAAG,CAAC;YAAE,OAAO,KAAK,CAAC;QAEzE,IAAI,OAAO,GAAG,CAAC,EAAE,KAAK,QAAQ;YAAE,OAAO,KAAK,CAAC;QAC7C,IAAI,OAAO,GAAG,CAAC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CAAC;QAED,+BAA+B;QAC/B,IAAI,CAAC,IAAI,IAAI,IAAI,KAAK,MAAM,EAAE,CAAC;YAC7B,MAAM,IAAI,QAAQ,CAAC,YAAY,CAAC,UAAU,EAAE,yBAAyB,YAAY,EAAE,CAAC,CAAC;QACvF,CAAC;QAED,wCAAwC;QACxC,MAAM,YAAY,GAAG,GAAG,CAAC;QAEzB,oEAAoE;QACpE,MAAM,UAAU,GAAG,kBAAkB,CAAC,YAAY,CAAC,CAAC;QAEpD,4CAA4C;QAC5C,cAAc,CAAC,EAAE,GAAG,YAAY,CAAC;QAEjC,kDAAkD;QAClD,cAAc,CAAC,UAAU,GAAG,UAAU,CAAC;QAEvC,wDAAwD;QACxD,cAAc,CAAC,gBAAgB,GAAG,UAAU,CAAC;QAE7C,4BAA4B;QAC5B,OAAO,cAAc,CAAC;IACxB,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,KAAK,CAAC,YAAY,CAAC,SAAoB;QAC5C,gCAAgC;QAChC,MAAM,GAAG,GAAG,GAAG,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,YAAY,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC,CAAC;QAEzD,6BAA6B;QAC7B,MAAM,KAAK,GAAG,MAAM,WAAW,EAAE,CAAC;QAClC,MAAM,IAAI,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;QAE5B,6BAA6B;QAC7B,OAAO,MAAM,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;IACjC,CAAC;CACF"}
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import { DidDocumentError, INVALID_DID_DOCUMENT } from '@did-btcr2/common';
|
|
2
2
|
import { DidDocument } from './did-document.js';
|
|
3
|
+
/**
|
|
4
|
+
* A builder class for constructing DID Documents.
|
|
5
|
+
* @type {DidDocumentBuilder}
|
|
6
|
+
* @class DidDocumentBuilder
|
|
7
|
+
*/
|
|
3
8
|
export class DidDocumentBuilder {
|
|
4
9
|
document = {};
|
|
5
10
|
constructor(initialDocument) {
|