@did-btcr2/method 0.25.3 → 0.26.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/.tsbuildinfo +1 -0
- package/dist/browser.js +125307 -122227
- package/dist/browser.mjs +125266 -122186
- package/dist/cjs/index.js +5043 -43
- package/dist/esm/core/beacon/aggregation/cohort/index.js.map +1 -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.map +1 -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.map +1 -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.map +1 -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.map +1 -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.map +1 -1
- package/dist/esm/core/beacon/aggregation/communication/adapter/did-comm.js.map +1 -1
- package/dist/esm/core/beacon/aggregation/communication/adapter/nostr.js +1 -2
- package/dist/esm/core/beacon/aggregation/communication/adapter/nostr.js.map +1 -1
- package/dist/esm/core/beacon/aggregation/coordinator.js.map +1 -1
- package/dist/esm/core/beacon/aggregation/participant.js.map +1 -1
- package/dist/esm/core/beacon/aggregation/session/index.js.map +1 -1
- package/dist/esm/core/beacon/cas-beacon.js +6 -4
- package/dist/esm/core/beacon/cas-beacon.js.map +1 -1
- package/dist/esm/core/beacon/signal-discovery.js +1 -1
- package/dist/esm/core/beacon/signal-discovery.js.map +1 -1
- package/dist/esm/core/beacon/singleton-beacon.js +3 -3
- package/dist/esm/core/beacon/singleton-beacon.js.map +1 -1
- package/dist/esm/core/beacon/utils.js.map +1 -1
- package/dist/esm/core/identifier.js.map +1 -1
- package/dist/esm/core/resolver.js +41 -35
- package/dist/esm/core/resolver.js.map +1 -1
- package/dist/esm/core/update.js.map +1 -1
- package/dist/esm/did-btcr2.js +1 -1
- package/dist/esm/did-btcr2.js.map +1 -1
- package/dist/esm/utils/appendix.js +7 -6
- package/dist/esm/utils/appendix.js.map +1 -1
- package/dist/esm/utils/did-document-builder.js.map +1 -1
- package/dist/esm/utils/did-document.js +2 -2
- package/dist/esm/utils/did-document.js.map +1 -1
- package/dist/types/core/beacon/aggregation/cohort/index.d.ts +2 -2
- package/dist/types/core/beacon/aggregation/cohort/index.d.ts.map +1 -1
- package/dist/types/core/beacon/aggregation/cohort/messages/index.d.ts +10 -10
- package/dist/types/core/beacon/aggregation/cohort/messages/index.d.ts.map +1 -1
- package/dist/types/core/beacon/aggregation/cohort/messages/keygen/cohort-advert.d.ts +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 +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 +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 +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 +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 +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 +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 +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 +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 +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/did-comm.d.ts +4 -4
- 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 +6 -6
- package/dist/types/core/beacon/aggregation/communication/adapter/nostr.d.ts.map +1 -1
- package/dist/types/core/beacon/aggregation/communication/factory.d.ts +1 -1
- package/dist/types/core/beacon/aggregation/communication/factory.d.ts.map +1 -1
- package/dist/types/core/beacon/aggregation/communication/service.d.ts +3 -3
- package/dist/types/core/beacon/aggregation/communication/service.d.ts.map +1 -1
- package/dist/types/core/beacon/aggregation/coordinator.d.ts +3 -3
- package/dist/types/core/beacon/aggregation/coordinator.d.ts.map +1 -1
- package/dist/types/core/beacon/aggregation/participant.d.ts +6 -6
- package/dist/types/core/beacon/aggregation/participant.d.ts.map +1 -1
- package/dist/types/core/beacon/aggregation/session/index.d.ts +2 -2
- package/dist/types/core/beacon/aggregation/session/index.d.ts.map +1 -1
- package/dist/types/core/beacon/beacon.d.ts +5 -5
- package/dist/types/core/beacon/beacon.d.ts.map +1 -1
- package/dist/types/core/beacon/cas-beacon.d.ts +5 -5
- package/dist/types/core/beacon/cas-beacon.d.ts.map +1 -1
- package/dist/types/core/beacon/factory.d.ts +2 -2
- package/dist/types/core/beacon/factory.d.ts.map +1 -1
- package/dist/types/core/beacon/interfaces.d.ts +3 -3
- package/dist/types/core/beacon/interfaces.d.ts.map +1 -1
- package/dist/types/core/beacon/signal-discovery.d.ts +3 -3
- package/dist/types/core/beacon/signal-discovery.d.ts.map +1 -1
- package/dist/types/core/beacon/singleton-beacon.d.ts +5 -5
- package/dist/types/core/beacon/singleton-beacon.d.ts.map +1 -1
- package/dist/types/core/beacon/smt-beacon.d.ts +5 -5
- package/dist/types/core/beacon/smt-beacon.d.ts.map +1 -1
- package/dist/types/core/beacon/utils.d.ts +4 -4
- package/dist/types/core/beacon/utils.d.ts.map +1 -1
- package/dist/types/core/identifier.d.ts +2 -2
- package/dist/types/core/identifier.d.ts.map +1 -1
- package/dist/types/core/interfaces.d.ts +2 -2
- package/dist/types/core/interfaces.d.ts.map +1 -1
- package/dist/types/core/resolver.d.ts +8 -8
- package/dist/types/core/resolver.d.ts.map +1 -1
- package/dist/types/core/types.d.ts +6 -5
- package/dist/types/core/types.d.ts.map +1 -1
- package/dist/types/core/update.d.ts +5 -5
- package/dist/types/core/update.d.ts.map +1 -1
- package/dist/types/did-btcr2.d.ts +6 -6
- package/dist/types/did-btcr2.d.ts.map +1 -1
- package/dist/types/utils/appendix.d.ts +7 -7
- package/dist/types/utils/appendix.d.ts.map +1 -1
- package/dist/types/utils/did-document-builder.d.ts +3 -2
- package/dist/types/utils/did-document-builder.d.ts.map +1 -1
- package/dist/types/utils/did-document.d.ts +3 -3
- package/dist/types/utils/did-document.d.ts.map +1 -1
- package/package.json +7 -6
- package/src/core/beacon/aggregation/cohort/index.ts +3 -2
- package/src/core/beacon/aggregation/cohort/messages/index.ts +10 -10
- package/src/core/beacon/aggregation/cohort/messages/keygen/cohort-advert.ts +2 -1
- package/src/core/beacon/aggregation/cohort/messages/keygen/cohort-ready.ts +2 -1
- package/src/core/beacon/aggregation/cohort/messages/keygen/opt-in-accept.ts +2 -1
- package/src/core/beacon/aggregation/cohort/messages/keygen/opt-in.ts +2 -1
- package/src/core/beacon/aggregation/cohort/messages/keygen/subscribe.ts +2 -1
- package/src/core/beacon/aggregation/cohort/messages/sign/aggregated-nonce.ts +2 -1
- package/src/core/beacon/aggregation/cohort/messages/sign/authorization-request.ts +2 -1
- package/src/core/beacon/aggregation/cohort/messages/sign/nonce-contribution.ts +2 -1
- package/src/core/beacon/aggregation/cohort/messages/sign/request-signature.ts +2 -1
- package/src/core/beacon/aggregation/cohort/messages/sign/signature-authorization.ts +2 -1
- package/src/core/beacon/aggregation/communication/adapter/did-comm.ts +5 -4
- package/src/core/beacon/aggregation/communication/adapter/nostr.ts +9 -7
- package/src/core/beacon/aggregation/communication/factory.ts +1 -1
- package/src/core/beacon/aggregation/communication/service.ts +3 -3
- package/src/core/beacon/aggregation/coordinator.ts +12 -8
- package/src/core/beacon/aggregation/participant.ts +12 -7
- package/src/core/beacon/aggregation/session/index.ts +3 -2
- package/src/core/beacon/beacon.ts +5 -5
- package/src/core/beacon/cas-beacon.ts +13 -9
- package/src/core/beacon/factory.ts +2 -2
- package/src/core/beacon/interfaces.ts +3 -3
- package/src/core/beacon/signal-discovery.ts +5 -4
- package/src/core/beacon/singleton-beacon.ts +8 -7
- package/src/core/beacon/smt-beacon.ts +5 -5
- package/src/core/beacon/utils.ts +6 -4
- package/src/core/identifier.ts +3 -2
- package/src/core/interfaces.ts +2 -2
- package/src/core/resolver.ts +59 -51
- package/src/core/types.ts +6 -5
- package/src/core/update.ts +11 -7
- package/src/did-btcr2.ts +12 -10
- package/src/utils/appendix.ts +14 -16
- package/src/utils/did-document-builder.ts +3 -2
- package/src/utils/did-document.ts +10 -8
- package/dist/cjs/core/beacon/aggregation/cohort/index.js +0 -237
- package/dist/cjs/core/beacon/aggregation/cohort/index.js.map +0 -1
- package/dist/cjs/core/beacon/aggregation/cohort/messages/base.js +0 -26
- package/dist/cjs/core/beacon/aggregation/cohort/messages/base.js.map +0 -1
- package/dist/cjs/core/beacon/aggregation/cohort/messages/constants.js +0 -11
- package/dist/cjs/core/beacon/aggregation/cohort/messages/constants.js.map +0 -1
- package/dist/cjs/core/beacon/aggregation/cohort/messages/index.js +0 -98
- package/dist/cjs/core/beacon/aggregation/cohort/messages/index.js.map +0 -1
- package/dist/cjs/core/beacon/aggregation/cohort/messages/keygen/cohort-advert.js +0 -31
- package/dist/cjs/core/beacon/aggregation/cohort/messages/keygen/cohort-advert.js.map +0 -1
- package/dist/cjs/core/beacon/aggregation/cohort/messages/keygen/cohort-ready.js +0 -29
- package/dist/cjs/core/beacon/aggregation/cohort/messages/keygen/cohort-ready.js.map +0 -1
- package/dist/cjs/core/beacon/aggregation/cohort/messages/keygen/opt-in-accept.js +0 -27
- package/dist/cjs/core/beacon/aggregation/cohort/messages/keygen/opt-in-accept.js.map +0 -1
- package/dist/cjs/core/beacon/aggregation/cohort/messages/keygen/opt-in.js +0 -23
- package/dist/cjs/core/beacon/aggregation/cohort/messages/keygen/opt-in.js.map +0 -1
- package/dist/cjs/core/beacon/aggregation/cohort/messages/keygen/subscribe.js +0 -28
- package/dist/cjs/core/beacon/aggregation/cohort/messages/keygen/subscribe.js.map +0 -1
- package/dist/cjs/core/beacon/aggregation/cohort/messages/sign/aggregated-nonce.js +0 -29
- package/dist/cjs/core/beacon/aggregation/cohort/messages/sign/aggregated-nonce.js.map +0 -1
- package/dist/cjs/core/beacon/aggregation/cohort/messages/sign/authorization-request.js +0 -30
- package/dist/cjs/core/beacon/aggregation/cohort/messages/sign/authorization-request.js.map +0 -1
- package/dist/cjs/core/beacon/aggregation/cohort/messages/sign/nonce-contribution.js +0 -30
- package/dist/cjs/core/beacon/aggregation/cohort/messages/sign/nonce-contribution.js.map +0 -1
- package/dist/cjs/core/beacon/aggregation/cohort/messages/sign/request-signature.js +0 -30
- package/dist/cjs/core/beacon/aggregation/cohort/messages/sign/request-signature.js.map +0 -1
- package/dist/cjs/core/beacon/aggregation/cohort/messages/sign/signature-authorization.js +0 -31
- package/dist/cjs/core/beacon/aggregation/cohort/messages/sign/signature-authorization.js.map +0 -1
- package/dist/cjs/core/beacon/aggregation/cohort/status.js +0 -8
- package/dist/cjs/core/beacon/aggregation/cohort/status.js.map +0 -1
- package/dist/cjs/core/beacon/aggregation/communication/adapter/did-comm.js +0 -121
- package/dist/cjs/core/beacon/aggregation/communication/adapter/did-comm.js.map +0 -1
- package/dist/cjs/core/beacon/aggregation/communication/adapter/nostr.js +0 -246
- package/dist/cjs/core/beacon/aggregation/communication/adapter/nostr.js.map +0 -1
- package/dist/cjs/core/beacon/aggregation/communication/error.js +0 -12
- package/dist/cjs/core/beacon/aggregation/communication/error.js.map +0 -1
- package/dist/cjs/core/beacon/aggregation/communication/factory.js +0 -21
- package/dist/cjs/core/beacon/aggregation/communication/factory.js.map +0 -1
- package/dist/cjs/core/beacon/aggregation/communication/service.js +0 -2
- package/dist/cjs/core/beacon/aggregation/communication/service.js.map +0 -1
- package/dist/cjs/core/beacon/aggregation/coordinator.js +0 -343
- package/dist/cjs/core/beacon/aggregation/coordinator.js.map +0 -1
- package/dist/cjs/core/beacon/aggregation/participant.js +0 -435
- package/dist/cjs/core/beacon/aggregation/participant.js.map +0 -1
- package/dist/cjs/core/beacon/aggregation/session/index.js +0 -244
- package/dist/cjs/core/beacon/aggregation/session/index.js.map +0 -1
- package/dist/cjs/core/beacon/aggregation/session/status.js +0 -11
- package/dist/cjs/core/beacon/aggregation/session/status.js.map +0 -1
- package/dist/cjs/core/beacon/beacon.js +0 -25
- package/dist/cjs/core/beacon/beacon.js.map +0 -1
- package/dist/cjs/core/beacon/cas-beacon.js +0 -152
- package/dist/cjs/core/beacon/cas-beacon.js.map +0 -1
- package/dist/cjs/core/beacon/error.js +0 -37
- package/dist/cjs/core/beacon/error.js.map +0 -1
- package/dist/cjs/core/beacon/factory.js +0 -29
- package/dist/cjs/core/beacon/factory.js.map +0 -1
- package/dist/cjs/core/beacon/interfaces.js +0 -2
- package/dist/cjs/core/beacon/interfaces.js.map +0 -1
- package/dist/cjs/core/beacon/signal-discovery.js +0 -183
- package/dist/cjs/core/beacon/signal-discovery.js.map +0 -1
- package/dist/cjs/core/beacon/singleton-beacon.js +0 -107
- package/dist/cjs/core/beacon/singleton-beacon.js.map +0 -1
- package/dist/cjs/core/beacon/smt-beacon.js +0 -39
- package/dist/cjs/core/beacon/smt-beacon.js.map +0 -1
- package/dist/cjs/core/beacon/utils.js +0 -163
- package/dist/cjs/core/beacon/utils.js.map +0 -1
- package/dist/cjs/core/identifier.js +0 -248
- package/dist/cjs/core/identifier.js.map +0 -1
- package/dist/cjs/core/interfaces.js +0 -2
- package/dist/cjs/core/interfaces.js.map +0 -1
- package/dist/cjs/core/resolver.js +0 -476
- package/dist/cjs/core/resolver.js.map +0 -1
- package/dist/cjs/core/types.js +0 -2
- package/dist/cjs/core/types.js.map +0 -1
- package/dist/cjs/core/update.js +0 -112
- package/dist/cjs/core/update.js.map +0 -1
- package/dist/cjs/did-btcr2.js +0 -193
- package/dist/cjs/did-btcr2.js.map +0 -1
- package/dist/cjs/index.js.map +0 -1
- package/dist/cjs/utils/appendix.js +0 -203
- package/dist/cjs/utils/appendix.js.map +0 -1
- package/dist/cjs/utils/did-document-builder.js +0 -60
- package/dist/cjs/utils/did-document-builder.js.map +0 -1
- package/dist/cjs/utils/did-document.js +0 -424
- package/dist/cjs/utils/did-document.js.map +0 -1
package/dist/cjs/did-btcr2.js
DELETED
|
@@ -1,193 +0,0 @@
|
|
|
1
|
-
import { IdentifierHrp, INVALID_DID_DOCUMENT, INVALID_DID_UPDATE, METHOD_NOT_SUPPORTED, MethodError, UpdateError } from '@did-btcr2/common';
|
|
2
|
-
import { Did, DidError, DidErrorCode, } from '@web5/dids';
|
|
3
|
-
import * as ecc from '@bitcoinerlab/secp256k1';
|
|
4
|
-
import { hexToBytes } from '@noble/hashes/utils';
|
|
5
|
-
import { initEccLib } from 'bitcoinjs-lib';
|
|
6
|
-
import { Identifier } from './core/identifier.js';
|
|
7
|
-
import { Resolver } from './core/resolver.js';
|
|
8
|
-
import { Update } from './core/update.js';
|
|
9
|
-
import { Appendix } from './utils/appendix.js';
|
|
10
|
-
/** Initialize secp256k1 ECC library */
|
|
11
|
-
initEccLib(ecc);
|
|
12
|
-
/**
|
|
13
|
-
* Implements {@link https://dcdpr.github.io/did-btcr2 | did:btcr2 DID Method Specification}.
|
|
14
|
-
* did:btcr2 is a censorship-resistant Decentralized Identifier (DID) method using
|
|
15
|
-
* the Bitcoin blockchain as a Verifiable Data Registry to announce changes to the
|
|
16
|
-
* DID document. It supports zero-cost off-chain DID creation; aggregated updates
|
|
17
|
-
* for scalable on-chain update costs; long-term identifiers that can support
|
|
18
|
-
* frequent updates; private communication of the DID document; private DID resolution;
|
|
19
|
-
* and non-repudiation.
|
|
20
|
-
*
|
|
21
|
-
* @class DidBtcr2
|
|
22
|
-
* @type {DidBtcr2}
|
|
23
|
-
* @implements {DidMethod}
|
|
24
|
-
*/
|
|
25
|
-
export class DidBtcr2 {
|
|
26
|
-
/**
|
|
27
|
-
* Name of the DID method, as defined in the DID BTCR2 specification
|
|
28
|
-
*/
|
|
29
|
-
static methodName = 'btcr2';
|
|
30
|
-
/**
|
|
31
|
-
* Implements section {@link https://dcdpr.github.io/did-btcr2/operations/create.html | 7.1 Create}.
|
|
32
|
-
* @param {KeyBytes | DocumentBytes} genesisBytes The bytes used to create the genesis document for a did:btcr2 identifier.
|
|
33
|
-
* 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.
|
|
34
|
-
* @param {DidCreateOptions} options Options for creating the identifier, including the idType (key or external), version, and network.
|
|
35
|
-
* @param {string} options.idType The type of identifier to create, either 'KEY' or 'EXTERNAL'. Defaults to 'KEY'.
|
|
36
|
-
* @param {number} options.version The version number of the did:btcr2 specification to use for creating the identifier. Defaults to 1.
|
|
37
|
-
* @param {string} options.network The Bitcoin network to use for the identifier, e.g. 'bitcoin', 'testnet', etc. Defaults to 'bitcoin'.
|
|
38
|
-
* @returns {Promise<string>} Promise resolving to an identifier string.
|
|
39
|
-
* @throws {MethodError} if any of the checks fail
|
|
40
|
-
* @example
|
|
41
|
-
* ```ts
|
|
42
|
-
* const genesisBytes = SchnorrKeyPair.generate().publicKey.compressed;
|
|
43
|
-
* const did = DidBtcr2.create(genesisBytes, { idType: 'KEY', network: 'regtest' });
|
|
44
|
-
* ```
|
|
45
|
-
*/
|
|
46
|
-
static create(genesisBytes, options) {
|
|
47
|
-
// Deconstruct the idType, version and network from the options, setting defaults if not given
|
|
48
|
-
const { idType, version = 1, network = 'bitcoin' } = options || {};
|
|
49
|
-
if (!idType) {
|
|
50
|
-
throw new MethodError('idType is required for creating a did:btcr2 identifier', INVALID_DID_DOCUMENT, options);
|
|
51
|
-
}
|
|
52
|
-
// Call identifier encoding algorithm
|
|
53
|
-
return Identifier.encode(genesisBytes, { idType, version, network });
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* Entry point for section {@link https://dcdpr.github.io/did-btcr2/operations/resolve.html | 7.2 Resolve}.
|
|
57
|
-
*
|
|
58
|
-
* Factory method that performs pure setup and returns a {@link Resolver} state machine.
|
|
59
|
-
* The caller drives resolution by calling `resolver.resolve()` and `resolver.provide()`.
|
|
60
|
-
* Analogous to Rust's `Document::read()`.
|
|
61
|
-
*
|
|
62
|
-
* @param {string} did The did:btcr2 identifier to be resolved.
|
|
63
|
-
* @param {ResolutionOptions} resolutionOptions Options used during the resolution process.
|
|
64
|
-
* @returns {Resolver} A sans-I/O state machine the caller drives to completion.
|
|
65
|
-
* @example
|
|
66
|
-
* ```ts
|
|
67
|
-
* const resolver = DidBtcr2.resolve(did, { sidecar });
|
|
68
|
-
* let state = resolver.resolve();
|
|
69
|
-
* while (state.status === 'action-required') {
|
|
70
|
-
* for (const need of state.needs) { ... provide data ... }
|
|
71
|
-
* state = resolver.resolve();
|
|
72
|
-
* }
|
|
73
|
-
* const { didDocument, metadata } = state.result;
|
|
74
|
-
* ```
|
|
75
|
-
*/
|
|
76
|
-
static resolve(did, resolutionOptions = {}) {
|
|
77
|
-
// Decode the did to be resolved
|
|
78
|
-
const didComponents = Identifier.decode(did);
|
|
79
|
-
// Process sidecar if provided
|
|
80
|
-
const sidecarData = Resolver.sidecarData(resolutionOptions.sidecar);
|
|
81
|
-
// Establish the current document for KEY identifiers (pure, synchronous).
|
|
82
|
-
// For EXTERNAL identifiers, defer to the Resolver's GenesisDocument phase
|
|
83
|
-
// since validation (Resolve.external) is async.
|
|
84
|
-
const currentDocument = didComponents.hrp === IdentifierHrp.k
|
|
85
|
-
? Resolver.deterministic(didComponents)
|
|
86
|
-
: null;
|
|
87
|
-
// Return the sans-I/O state machine
|
|
88
|
-
return new Resolver(didComponents, sidecarData, currentDocument, {
|
|
89
|
-
versionId: resolutionOptions.versionId,
|
|
90
|
-
versionTime: resolutionOptions.versionTime,
|
|
91
|
-
genesisDocument: resolutionOptions.sidecar?.genesisDocument
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
/**
|
|
95
|
-
* Entry point for section {@link https://dcdpr.github.io/did-btcr2/#read | 7.3 Update}.
|
|
96
|
-
* See specification for the {@link https://dcdpr.github.io/did-btcr2/operations/resolve.html#process | Resolve Process}.
|
|
97
|
-
* See {@link Update | Update (class)} for class implementation.
|
|
98
|
-
*
|
|
99
|
-
* BTCR2 DID documents can be updated by anchoring BTCR2 Updates to Bitcoin transactions. These transactions MAY be
|
|
100
|
-
* published to the Bitcoin network. Any property in the DID document may be updated except the id. Doing so would
|
|
101
|
-
* invalidate the DID document.
|
|
102
|
-
* @param params An object containing the parameters for the update operation.
|
|
103
|
-
* @param {Btcr2DidDocument} params.sourceDocument The DID document being updated.
|
|
104
|
-
* @param {PatchOperation[]} params.patches The array of JSON Patch operations to apply to the sourceDocument.
|
|
105
|
-
* @param {string} params.sourceVersionId The version ID before applying the update.
|
|
106
|
-
* @param {string} params.verificationMethodId The verificationMethod ID to sign the update with.
|
|
107
|
-
* @param {string} params.beaconId The beacon ID associated with the update.
|
|
108
|
-
* @param {KeyBytes | HexString} [params.signingMaterial] Optional signing material (key bytes or hex string).
|
|
109
|
-
* @param {BitcoinConnection} [params.bitcoin] Optional Bitcoin network connection for announcing the update. If not provided, a default connection will be initialized.
|
|
110
|
-
* @return {Promise<SignedBTCR2Update>} Promise resolving to the signed BTCR2 update.
|
|
111
|
-
* @throws {UpdateError} if no verificationMethod, verificationMethod type is not `Multikey` or the publicKeyMultibase
|
|
112
|
-
* header is not `zQ3s`
|
|
113
|
-
*/
|
|
114
|
-
static async update({ sourceDocument, patches, sourceVersionId, verificationMethodId, beaconId, signingMaterial, bitcoin, }) {
|
|
115
|
-
// If no signingMaterial provided, throw an UpdateError with INVALID_DID_UPDATE.
|
|
116
|
-
if (!signingMaterial) {
|
|
117
|
-
throw new UpdateError('Missing signing material for update', INVALID_DID_UPDATE, { signingMaterial });
|
|
118
|
-
}
|
|
119
|
-
// Convert signingMaterial to bytes if it's a hex string
|
|
120
|
-
const secretKey = typeof signingMaterial === 'string'
|
|
121
|
-
? hexToBytes(signingMaterial)
|
|
122
|
-
: signingMaterial;
|
|
123
|
-
// Validate that the verificationMethodId is authorized for capabilityInvocation
|
|
124
|
-
if (!sourceDocument.capabilityInvocation?.some(vr => vr === verificationMethodId)) {
|
|
125
|
-
throw new UpdateError('Invalid verificationMethodId: not authorized for capabilityInvocation', INVALID_DID_DOCUMENT, sourceDocument);
|
|
126
|
-
}
|
|
127
|
-
// Get the verification method to be used for signing the update
|
|
128
|
-
const verificationMethod = this.getSigningMethod(sourceDocument, verificationMethodId);
|
|
129
|
-
// Validate the verificationMethod exists in the sourceDocument
|
|
130
|
-
if (!verificationMethod) {
|
|
131
|
-
throw new UpdateError('Invalid verificationMethod: not found in source document', INVALID_DID_DOCUMENT, { sourceDocument, verificationMethodId });
|
|
132
|
-
}
|
|
133
|
-
// Validate the verificationMethod is of type 'Multikey'
|
|
134
|
-
if (verificationMethod.type !== 'Multikey') {
|
|
135
|
-
throw new UpdateError('Invalid verificationMethod: verificationMethod.type must be "Multikey"', INVALID_DID_DOCUMENT, verificationMethod);
|
|
136
|
-
}
|
|
137
|
-
// Validate the publicKeyMultibase prefix is 'zQ3s'
|
|
138
|
-
if (verificationMethod.publicKeyMultibase?.slice(0, 4) !== 'zQ3s') {
|
|
139
|
-
throw new UpdateError('Invalid verificationMethodId: publicKeyMultibase prefix must start with "zQ3s"', INVALID_DID_DOCUMENT, verificationMethod);
|
|
140
|
-
}
|
|
141
|
-
// Construct an unsigned update following the BTCR2 Update construction algorithm
|
|
142
|
-
const update = Update.construct(sourceDocument, patches, sourceVersionId);
|
|
143
|
-
// Sign the unsigned update using the specified verification method
|
|
144
|
-
const signed = Update.sign(sourceDocument.id, update, verificationMethod, secretKey);
|
|
145
|
-
// Filter sourceDocument services to get beaconServices matching beaconIds
|
|
146
|
-
const beaconService = sourceDocument.service
|
|
147
|
-
.filter((service) => service.id === beaconId)
|
|
148
|
-
.filter((service) => !!service)
|
|
149
|
-
.shift();
|
|
150
|
-
// If no matching beacon service found, throw an UpdateError with INVALID_DID_UPDATE.
|
|
151
|
-
if (!beaconService) {
|
|
152
|
-
throw new UpdateError('No beacon service found for provided beaconId', INVALID_DID_UPDATE, { sourceDocument, beaconId });
|
|
153
|
-
}
|
|
154
|
-
// Require an explicit bitcoin connection — no silent env-var fallback
|
|
155
|
-
if (!bitcoin) {
|
|
156
|
-
throw new UpdateError('Bitcoin connection required for update. Pass a configured `bitcoin` parameter '
|
|
157
|
-
+ 'or use DidBtcr2Api which injects it automatically.', INVALID_DID_UPDATE, { beaconId });
|
|
158
|
-
}
|
|
159
|
-
// Announce the signed update to the blockchain using the specified beacon(s)
|
|
160
|
-
await Update.announce(beaconService, signed, secretKey, bitcoin);
|
|
161
|
-
// Return signed update if announced successfully
|
|
162
|
-
return signed;
|
|
163
|
-
}
|
|
164
|
-
/**
|
|
165
|
-
* Given the W3C DID Document of a `did:btcr2` identifier, return the signing verification method that will be used
|
|
166
|
-
* for signing messages and credentials. If given, the `methodId` parameter is used to select the
|
|
167
|
-
* verification method. If not given, the Identity Key's verification method with an ID fragment
|
|
168
|
-
* of '#initialKey' is used.
|
|
169
|
-
* @param {Btcr2DidDocument} didDocument The DID Document of the `did:btcr2` identifier.
|
|
170
|
-
* @param {string} [methodId] Optional verification method ID to be used for signing.
|
|
171
|
-
* @returns {DidVerificationMethod} Promise resolving to the {@link DidVerificationMethod} object used for signing.
|
|
172
|
-
* @throws {DidError} if the parsed did method does not match `btcr2` or signing method could not be determined.
|
|
173
|
-
*/
|
|
174
|
-
static getSigningMethod(didDocument, methodId) {
|
|
175
|
-
// Set the default methodId to the first assertionMethod if not given
|
|
176
|
-
methodId ??= '#initialKey';
|
|
177
|
-
// Verify the DID method is supported.
|
|
178
|
-
const parsedDid = Did.parse(didDocument.id);
|
|
179
|
-
if (parsedDid && parsedDid.method !== this.methodName) {
|
|
180
|
-
throw new MethodError(`Method not supported: ${parsedDid.method}`, METHOD_NOT_SUPPORTED, { identifier: didDocument.id });
|
|
181
|
-
}
|
|
182
|
-
// Attempt to find a verification method that matches the given method ID, or if not given,
|
|
183
|
-
// find the first verification method intended for signing claims.
|
|
184
|
-
const verificationMethod = didDocument.verificationMethod?.find((vm) => Appendix.extractDidFragment(vm.id) === (Appendix.extractDidFragment(methodId)
|
|
185
|
-
?? Appendix.extractDidFragment(didDocument.assertionMethod?.[0])));
|
|
186
|
-
// If no verification method is found, throw an error
|
|
187
|
-
if (!(verificationMethod && verificationMethod.publicKeyMultibase)) {
|
|
188
|
-
throw new DidError(DidErrorCode.InternalError, 'A verification method intended for signing could not be determined from the DID Document');
|
|
189
|
-
}
|
|
190
|
-
return verificationMethod;
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
//# sourceMappingURL=did-btcr2.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"did-btcr2.js","sourceRoot":"","sources":["../../src/did-btcr2.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,aAAa,E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cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AAEjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,iCAAiC,CAAC;AAChD,cAAc,yBAAyB,CAAC;AAExC,cAAc,gBAAgB,CAAC"}
|
|
@@ -1,203 +0,0 @@
|
|
|
1
|
-
import { strings } from '@helia/strings';
|
|
2
|
-
import { DidError, DidErrorCode, DidVerificationRelationship } from '@web5/dids';
|
|
3
|
-
import { createHelia } from 'helia';
|
|
4
|
-
import { CID } from 'multiformats';
|
|
5
|
-
import { create as createDigest } from 'multiformats/hashes/digest';
|
|
6
|
-
/**
|
|
7
|
-
* Implements {@link https://dcdpr.github.io/did-btcr2/#appendix | 9. Appendix} methods.
|
|
8
|
-
*
|
|
9
|
-
* @class Appendix
|
|
10
|
-
* @type {Appendix}
|
|
11
|
-
*/
|
|
12
|
-
export class Appendix {
|
|
13
|
-
/**
|
|
14
|
-
* Extracts a DID fragment from a given input
|
|
15
|
-
* @param {unknown} input The input to extract the DID fragment from
|
|
16
|
-
* @returns {string | undefined} The extracted DID fragment or undefined if not found
|
|
17
|
-
*/
|
|
18
|
-
static extractDidFragment(input) {
|
|
19
|
-
if (typeof input !== 'string')
|
|
20
|
-
return undefined;
|
|
21
|
-
if (input.length === 0)
|
|
22
|
-
return undefined;
|
|
23
|
-
return input;
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Validates that the given object is a DidVerificationMethod
|
|
27
|
-
* @param {unknown} obj The object to validate
|
|
28
|
-
* @returns {boolean} A boolean indicating whether the object is a DidVerificationMethod
|
|
29
|
-
*/
|
|
30
|
-
static isDidVerificationMethod(obj) {
|
|
31
|
-
// Validate that the given value is an object.
|
|
32
|
-
if (!obj || typeof obj !== 'object' || obj === null)
|
|
33
|
-
return false;
|
|
34
|
-
// Validate that the object has the necessary properties of a DidVerificationMethod.
|
|
35
|
-
if (!('id' in obj && 'type' in obj && 'controller' in obj))
|
|
36
|
-
return false;
|
|
37
|
-
if (typeof obj.id !== 'string')
|
|
38
|
-
return false;
|
|
39
|
-
if (typeof obj.type !== 'string')
|
|
40
|
-
return false;
|
|
41
|
-
if (typeof obj.controller !== 'string')
|
|
42
|
-
return false;
|
|
43
|
-
return true;
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Validates that the given object is a DidService
|
|
47
|
-
* @param {unknown} obj The object to validate
|
|
48
|
-
* @returns {boolean} A boolean indicating whether the object is a DidService
|
|
49
|
-
*/
|
|
50
|
-
static isDidService(obj) {
|
|
51
|
-
// Validate that the given value is an object.
|
|
52
|
-
if (!obj || typeof obj !== 'object' || obj === null)
|
|
53
|
-
return false;
|
|
54
|
-
// Validate that the object has the necessary properties of a DidService.
|
|
55
|
-
if (!('id' in obj && 'type' in obj && 'serviceEndpoint' in obj))
|
|
56
|
-
return false;
|
|
57
|
-
if (typeof obj.id !== 'string')
|
|
58
|
-
return false;
|
|
59
|
-
if (typeof obj.type !== 'string')
|
|
60
|
-
return false;
|
|
61
|
-
if (typeof obj.serviceEndpoint !== 'string')
|
|
62
|
-
return false;
|
|
63
|
-
return true;
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* Extracts the verification methods from a given DID Document
|
|
67
|
-
* @param {DidDocument} params.didDocument The DID Document to extract the verification methods from
|
|
68
|
-
* @returns {DidVerificationMethod[]} An array of DidVerificationMethod objects
|
|
69
|
-
* @throws {TypeError} if the didDocument is not provided
|
|
70
|
-
*/
|
|
71
|
-
static getVerificationMethods(didDocument) {
|
|
72
|
-
if (!didDocument)
|
|
73
|
-
throw new TypeError(`Required parameter missing: 'didDocument'`);
|
|
74
|
-
const verificationMethods = [];
|
|
75
|
-
// Check the 'verificationMethod' array.
|
|
76
|
-
verificationMethods.push(...didDocument.verificationMethod?.filter(Appendix.isDidVerificationMethod) ?? []);
|
|
77
|
-
// Check verification relationship properties for embedded verification methods.
|
|
78
|
-
Object.keys(DidVerificationRelationship).forEach((relationship) => {
|
|
79
|
-
verificationMethods.push(...didDocument[relationship]
|
|
80
|
-
?.filter(Appendix.isDidVerificationMethod) ?? []);
|
|
81
|
-
});
|
|
82
|
-
return verificationMethods;
|
|
83
|
-
}
|
|
84
|
-
/**
|
|
85
|
-
* Implements {@link https://dcdpr.github.io/did-btcr2/#derive-root-capability-from-didbtcr2-identifier | 9.4.1 Derive Root Capability from did:btcr2 Identifier }.
|
|
86
|
-
*
|
|
87
|
-
* The Derive Root Capability algorithm deterministically generates a ZCAP-LD root capability from a given did:btcr2
|
|
88
|
-
* identifier. Each root capability is unique to the identifier. This root capability is defined and understood by the
|
|
89
|
-
* did:btcr2 specification as the root capability to authorize updates to the specific did:btcr2 identifiers DID
|
|
90
|
-
* document. It takes in a did:btcr2 identifier and returns a rootCapability object. It returns the root capability.
|
|
91
|
-
*
|
|
92
|
-
* @param {string} identifier The did-btcr2 identifier to derive the root capability from
|
|
93
|
-
* @returns {RootCapability} The root capability object
|
|
94
|
-
* @example Root capability for updating the DID document for
|
|
95
|
-
* did:btcr2:k1q0rnnwf657vuu8trztlczvlmphjgc6q598h79cm6sp7c4fgqh0fkc0vzd9u
|
|
96
|
-
* ```
|
|
97
|
-
* {
|
|
98
|
-
* "@context": "https://w3id.org/zcap/v1",
|
|
99
|
-
* "id": "urn:zcap:root:did:btcr2:k1q0rnnwf657vuu8trztlczvlmphjgc6q598h79cm6sp7c4fgqh0fkc0vzd9u",
|
|
100
|
-
* "controller": "did:btcr2:k1q0rnnwf657vuu8trztlczvlmphjgc6q598h79cm6sp7c4fgqh0fkc0vzd9u",
|
|
101
|
-
* "invocationTarget": "did:btcr2:k1q0rnnwf657vuu8trztlczvlmphjgc6q598h79cm6sp7c4fgqh0fkc0vzd9u"
|
|
102
|
-
* }
|
|
103
|
-
* ```
|
|
104
|
-
*/
|
|
105
|
-
static deriveRootCapability(identifier) {
|
|
106
|
-
return {
|
|
107
|
-
'@context': 'https://w3id.org/zcap/v1',
|
|
108
|
-
id: `urn:zcap:root:${encodeURIComponent(identifier)}`,
|
|
109
|
-
controller: identifier,
|
|
110
|
-
invocationTarget: identifier,
|
|
111
|
-
};
|
|
112
|
-
}
|
|
113
|
-
/**
|
|
114
|
-
* Implements {@link https://dcdpr.github.io/did-btcr2/#dereference-root-capability-identifier | 9.4.2 Dereference Root Capability Identifier}.
|
|
115
|
-
*
|
|
116
|
-
* This algorithm takes in capabilityId, a root capability identifier, and dereferences it to rootCapability, the root
|
|
117
|
-
* capability object.
|
|
118
|
-
*
|
|
119
|
-
* @param {string} capabilityId The root capability identifier to dereference.
|
|
120
|
-
* @returns {RootCapability} The root capability object.
|
|
121
|
-
* @example a didUpdatePayload with an invoked ZCAP-LD capability containing a patch defining how the DID document
|
|
122
|
-
* for did:btcr2:k1q0rnnwf657vuu8trztlczvlmphjgc6q598h79cm6sp7c4fgqh0fkc0vzd9u SHOULD be mutated.
|
|
123
|
-
* ```
|
|
124
|
-
* {
|
|
125
|
-
* "@context": [
|
|
126
|
-
* "https://w3id.org/zcap/v1",
|
|
127
|
-
* "https://w3id.org/security/data-integrity/v2",
|
|
128
|
-
* "https://w3id.org/json-ld-patch/v1"
|
|
129
|
-
* ],
|
|
130
|
-
* "patch": [
|
|
131
|
-
* {
|
|
132
|
-
* "op": "add",
|
|
133
|
-
* "path": "/service/4",
|
|
134
|
-
* "value": {
|
|
135
|
-
* "id": "#linked-domain",
|
|
136
|
-
* "type": "LinkedDomains",
|
|
137
|
-
* "serviceEndpoint": "https://contact-me.com"
|
|
138
|
-
* }
|
|
139
|
-
* }
|
|
140
|
-
* ],
|
|
141
|
-
* "proof": {
|
|
142
|
-
* "type": "DataIntegrityProof",
|
|
143
|
-
* "cryptosuite": "schnorr-secp256k1-jcs-2025",
|
|
144
|
-
* "verificationMethod": "did:btcr2:k1q0rnnwf657vuu8trztlczvlmphjgc6q598h79cm6sp7c4fgqh0fkc0vzd9u#initialKey",
|
|
145
|
-
* "invocationTarget": "did:btcr2:k1q0rnnwf657vuu8trztlczvlmphjgc6q598h79cm6sp7c4fgqh0fkc0vzd9u",
|
|
146
|
-
* "capability": "urn:zcap:root:did%3Abtcr2%3Ak1q0rnnwf657vuu8trztlczvlmphjgc6q598h79cm6sp7c4fgqh0fkc0vzd9u",
|
|
147
|
-
* "capabilityAction": "Write",
|
|
148
|
-
* "proofPurpose": "assertionMethod",
|
|
149
|
-
* "proofValue": "z381yXYmxU8NudZ4HXY56DfMN6zfD8syvWcRXzT9xD9uYoQToo8QsXD7ahM3gXTzuay5WJbqTswt2BKaGWYn2hHhVFKJLXaDz"
|
|
150
|
-
* }
|
|
151
|
-
* }
|
|
152
|
-
*/
|
|
153
|
-
static dereferenceZcapId(capabilityId) {
|
|
154
|
-
// 1. Set rootCapability to an empty object.
|
|
155
|
-
const rootCapability = {};
|
|
156
|
-
// 2. Set components to the result of capabilityId.split(":").
|
|
157
|
-
const [urn, zcap, root, did] = capabilityId.split(':') ?? [];
|
|
158
|
-
// 3. Validate components:
|
|
159
|
-
// 1. Assert length of components is 4.
|
|
160
|
-
if ([urn, zcap, root, did].length !== 4) {
|
|
161
|
-
throw new DidError(DidErrorCode.InvalidDid, `Invalid capabilityId: ${capabilityId}`);
|
|
162
|
-
}
|
|
163
|
-
// 2. components[0] == urn.
|
|
164
|
-
if (!urn || urn !== 'urn') {
|
|
165
|
-
throw new DidError(DidErrorCode.InvalidDid, `Invalid capabilityId: ${capabilityId}`);
|
|
166
|
-
}
|
|
167
|
-
// 3. components[1] == zcap.
|
|
168
|
-
if (!zcap || zcap !== 'zcap') {
|
|
169
|
-
throw new DidError(DidErrorCode.InvalidDid, `Invalid capabilityId: ${capabilityId}`);
|
|
170
|
-
}
|
|
171
|
-
// 4. components[2] == root.
|
|
172
|
-
if (!root || root !== 'root') {
|
|
173
|
-
throw new DidError(DidErrorCode.InvalidDid, `Invalid capabilityId: ${capabilityId}`);
|
|
174
|
-
}
|
|
175
|
-
// 4. Set uriEncodedId to components[3].
|
|
176
|
-
const uriEncodedId = did;
|
|
177
|
-
// 5. Set Identifier the result of decodeURIComponent(uriEncodedId).
|
|
178
|
-
const Identifier = decodeURIComponent(uriEncodedId);
|
|
179
|
-
// 6. Set rootCapability.id to capabilityId.
|
|
180
|
-
rootCapability.id = capabilityId;
|
|
181
|
-
// 7. Set rootCapability.controller to Identifier.
|
|
182
|
-
rootCapability.controller = Identifier;
|
|
183
|
-
// 8. Set rootCapability.invocationTarget to Identifier.
|
|
184
|
-
rootCapability.invocationTarget = Identifier;
|
|
185
|
-
// 9. Return rootCapability.
|
|
186
|
-
return rootCapability;
|
|
187
|
-
}
|
|
188
|
-
/**
|
|
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.
|
|
192
|
-
*/
|
|
193
|
-
static async fetchFromCas(hashBytes) {
|
|
194
|
-
// Construct CID from hash bytes
|
|
195
|
-
const cid = CID.create(1, 1, createDigest(1, hashBytes));
|
|
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, {});
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
//# sourceMappingURL=appendix.js.map
|
|
@@ -1 +0,0 @@
|
|
|
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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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,60 +0,0 @@
|
|
|
1
|
-
import { DidDocumentError, INVALID_DID_DOCUMENT } from '@did-btcr2/common';
|
|
2
|
-
import { DidDocument } from './did-document.js';
|
|
3
|
-
/**
|
|
4
|
-
* A builder class for constructing DID Documents.
|
|
5
|
-
* @type {DidDocumentBuilder}
|
|
6
|
-
* @class DidDocumentBuilder
|
|
7
|
-
*/
|
|
8
|
-
export class DidDocumentBuilder {
|
|
9
|
-
document = {};
|
|
10
|
-
constructor(initialDocument) {
|
|
11
|
-
if (!initialDocument.id) {
|
|
12
|
-
throw new DidDocumentError('Missing required "id" property', INVALID_DID_DOCUMENT, initialDocument);
|
|
13
|
-
}
|
|
14
|
-
this.document.id = initialDocument.id;
|
|
15
|
-
this.document.verificationMethod = initialDocument.verificationMethod ?? [];
|
|
16
|
-
if (initialDocument['@context']) {
|
|
17
|
-
this.document['@context'] = initialDocument['@context'];
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
withAuthentication(authentication) {
|
|
21
|
-
if (authentication) {
|
|
22
|
-
this.document.authentication = authentication;
|
|
23
|
-
}
|
|
24
|
-
return this;
|
|
25
|
-
}
|
|
26
|
-
withAssertionMethod(assertionMethod) {
|
|
27
|
-
if (assertionMethod) {
|
|
28
|
-
this.document.assertionMethod = assertionMethod;
|
|
29
|
-
}
|
|
30
|
-
return this;
|
|
31
|
-
}
|
|
32
|
-
withCapabilityInvocation(capabilityInvocation) {
|
|
33
|
-
if (capabilityInvocation) {
|
|
34
|
-
this.document.capabilityInvocation = capabilityInvocation;
|
|
35
|
-
}
|
|
36
|
-
return this;
|
|
37
|
-
}
|
|
38
|
-
withCapabilityDelegation(capabilityDelegation) {
|
|
39
|
-
if (capabilityDelegation) {
|
|
40
|
-
this.document.capabilityDelegation = capabilityDelegation;
|
|
41
|
-
}
|
|
42
|
-
return this;
|
|
43
|
-
}
|
|
44
|
-
withService(service) {
|
|
45
|
-
if (service) {
|
|
46
|
-
this.document.service = service;
|
|
47
|
-
}
|
|
48
|
-
return this;
|
|
49
|
-
}
|
|
50
|
-
build() {
|
|
51
|
-
const didDocument = new DidDocument(this.document);
|
|
52
|
-
for (const key of Object.keys(didDocument)) {
|
|
53
|
-
if (didDocument[key] === undefined) {
|
|
54
|
-
delete didDocument[key];
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
return didDocument;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
//# sourceMappingURL=did-document-builder.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"did-document-builder.js","sourceRoot":"","sources":["../../../src/utils/did-document-builder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAE3E,OAAO,EAAE,WAAW,EAAyB,MAAM,mBAAmB,CAAC;AAEvE;;;;GAIG;AACH,MAAM,OAAO,kBAAkB;IACrB,QAAQ,GAAyB,EAAE,CAAC;IAE5C,YAAY,eAAqC;QAC/C,IAAI,CAAC,eAAe,CAAC,EAAE,EAAE,CAAC;YACxB,MAAM,IAAI,gBAAgB,CAAC,gCAAgC,EAAE,oBAAoB,EAAE,eAAe,CAAC,CAAC;QACtG,CAAC;QACD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