@did-btcr2/method 0.18.0 → 0.19.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 +5240 -6079
- package/dist/browser.mjs +5240 -6079
- 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/cas-beacon.js +55 -0
- package/dist/cjs/core/beacon/cas-beacon.js.map +1 -0
- package/dist/cjs/core/beacon/factory.js +11 -10
- package/dist/cjs/core/beacon/factory.js.map +1 -1
- package/dist/cjs/core/beacon/interfaces.js +32 -0
- package/dist/cjs/core/beacon/interfaces.js.map +1 -0
- package/dist/cjs/core/beacon/singleton.js +59 -135
- package/dist/cjs/core/beacon/singleton.js.map +1 -1
- package/dist/cjs/core/beacon/smt-beacon.js +56 -0
- package/dist/cjs/core/beacon/smt-beacon.js.map +1 -0
- package/dist/cjs/core/beacon/utils.js +67 -105
- 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 +511 -0
- package/dist/cjs/core/resolve.js.map +1 -0
- package/dist/cjs/{utils → core}/types.js.map +1 -1
- package/dist/cjs/core/{crud/update.js → update.js} +62 -52
- package/dist/cjs/core/update.js.map +1 -0
- package/dist/cjs/did-btcr2.js +109 -75
- package/dist/cjs/did-btcr2.js.map +1 -1
- package/dist/cjs/index.js +14 -15
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/utils/appendix.js +10 -18
- package/dist/cjs/utils/appendix.js.map +1 -1
- package/dist/cjs/utils/did-document.js +51 -58
- 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/cas-beacon.js +55 -0
- package/dist/esm/core/beacon/cas-beacon.js.map +1 -0
- package/dist/esm/core/beacon/factory.js +11 -10
- package/dist/esm/core/beacon/factory.js.map +1 -1
- package/dist/esm/core/beacon/interfaces.js +32 -0
- package/dist/esm/core/beacon/interfaces.js.map +1 -0
- package/dist/esm/core/beacon/singleton.js +59 -135
- package/dist/esm/core/beacon/singleton.js.map +1 -1
- package/dist/esm/core/beacon/smt-beacon.js +56 -0
- package/dist/esm/core/beacon/smt-beacon.js.map +1 -0
- package/dist/esm/core/beacon/utils.js +67 -105
- 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 +511 -0
- package/dist/esm/core/resolve.js.map +1 -0
- package/dist/esm/{utils → core}/types.js.map +1 -1
- package/dist/esm/core/{crud/update.js → update.js} +62 -52
- package/dist/esm/core/update.js.map +1 -0
- package/dist/esm/did-btcr2.js +109 -75
- package/dist/esm/did-btcr2.js.map +1 -1
- package/dist/esm/index.js +14 -15
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/utils/appendix.js +10 -18
- package/dist/esm/utils/appendix.js.map +1 -1
- package/dist/esm/utils/did-document.js +51 -58
- 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/cas-beacon.d.ts +47 -0
- package/dist/types/core/beacon/cas-beacon.d.ts.map +1 -0
- package/dist/types/core/beacon/factory.d.ts +5 -4
- package/dist/types/core/beacon/factory.d.ts.map +1 -1
- package/dist/types/core/beacon/interfaces.d.ts +98 -0
- package/dist/types/core/beacon/interfaces.d.ts.map +1 -0
- package/dist/types/core/beacon/singleton.d.ts +22 -65
- package/dist/types/core/beacon/singleton.d.ts.map +1 -1
- package/dist/types/core/beacon/smt-beacon.d.ts +48 -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 +94 -0
- package/dist/types/core/interfaces.d.ts.map +1 -0
- package/dist/types/core/resolve.d.ts +105 -0
- package/dist/types/core/resolve.d.ts.map +1 -0
- package/dist/types/core/types.d.ts +71 -0
- package/dist/types/core/types.d.ts.map +1 -0
- package/dist/types/core/{crud/update.d.ts → update.d.ts} +21 -20
- package/dist/types/core/update.d.ts.map +1 -0
- package/dist/types/did-btcr2.d.ts +45 -57
- package/dist/types/did-btcr2.d.ts.map +1 -1
- package/dist/types/index.d.ts +14 -15
- 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 +1 -1
- package/dist/types/utils/did-document-builder.d.ts.map +1 -1
- package/dist/types/utils/did-document.d.ts +31 -29
- package/dist/types/utils/did-document.d.ts.map +1 -1
- package/package.json +5 -5
- 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/cas-beacon.ts +67 -0
- package/src/core/beacon/factory.ts +13 -15
- package/src/core/beacon/interfaces.ts +124 -0
- package/src/core/beacon/singleton.ts +75 -145
- package/src/core/beacon/smt-beacon.ts +70 -0
- package/src/core/beacon/utils.ts +80 -170
- package/src/core/identifier.ts +21 -24
- package/src/core/interfaces.ts +101 -0
- package/src/core/resolve.ts +707 -0
- package/src/core/types.ts +78 -0
- package/src/core/{crud/update.ts → update.ts} +75 -68
- package/src/did-btcr2.ts +152 -92
- package/src/index.ts +14 -24
- package/src/utils/appendix.ts +18 -22
- package/src/utils/did-document-builder.ts +1 -1
- package/src/utils/did-document.ts +67 -71
- 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.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.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.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/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
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { INVALID_DID_DOCUMENT, INVALID_DID_UPDATE, INVALID_PUBLIC_KEY_TYPE, JSONPatch, MethodError, NOT_FOUND, UpdateError } from '@did-btcr2/common';
|
|
2
2
|
import { SchnorrMultikey } from '@did-btcr2/cryptosuite';
|
|
3
3
|
import { CompressedSecp256k1PublicKey, SchnorrKeyPair, Secp256k1SecretKey } from '@did-btcr2/keypair';
|
|
4
4
|
import { Kms } from '@did-btcr2/kms';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { Identifier } from '
|
|
5
|
+
import { canonicalization } from '../did-btcr2.js';
|
|
6
|
+
import { Appendix } from '../utils/appendix.js';
|
|
7
|
+
import { DidDocument } from '../utils/did-document.js';
|
|
8
|
+
import { Identifier } from './identifier.js';
|
|
9
9
|
/**
|
|
10
10
|
* Implements {@link https://dcdpr.github.io/did-btcr2/#update | 4.3 Update}.
|
|
11
11
|
*
|
|
@@ -31,58 +31,62 @@ export class Update {
|
|
|
31
31
|
* @param {DidDocument} params.sourceDocument The source document to be updated.
|
|
32
32
|
* @param {string} params.sourceVersionId The versionId of the source document.
|
|
33
33
|
* @param {DidDocumentPatch} params.patch The JSON patch to be applied to the source document.
|
|
34
|
-
* @returns {Promise<
|
|
34
|
+
* @returns {Promise<BTCR2SignedUpdate>} The constructed BTCR2SignedUpdate object.
|
|
35
35
|
* @throws {MethodError} InvalidDid if sourceDocument.id does not match identifier.
|
|
36
36
|
*/
|
|
37
37
|
static async construct({ identifier, sourceDocument, sourceVersionId, patch, }) {
|
|
38
38
|
// 1. Check that sourceDocument.id equals identifier else MUST raise invalidDIDUpdate error.
|
|
39
39
|
if (sourceDocument.id !== identifier) {
|
|
40
|
-
throw new
|
|
40
|
+
throw new UpdateError('Identifier mismatch: sourceDocument.id !== identifier', INVALID_DID_UPDATE, { sourceDocument, identifier });
|
|
41
41
|
}
|
|
42
|
-
// 2. Initialize
|
|
43
|
-
const
|
|
44
|
-
// 3. Set
|
|
45
|
-
'@context':
|
|
46
|
-
|
|
42
|
+
// 2. Initialize an unsigned update.
|
|
43
|
+
const unsignedUpdate = {
|
|
44
|
+
// 3. Set BTCR2SignedUpdate.@context to the following list
|
|
45
|
+
'@context': [
|
|
46
|
+
'https://w3id.org/security/v2',
|
|
47
|
+
'https://w3id.org/zcap/v1',
|
|
48
|
+
'https://w3id.org/json-ld-patch/v1',
|
|
49
|
+
'https://btcr2.dev/context/v1'
|
|
50
|
+
],
|
|
51
|
+
// 4. Set BTCR2SignedUpdate.patch to documentPatch.
|
|
47
52
|
patch,
|
|
48
53
|
targetHash: '',
|
|
49
54
|
targetVersionId: 0,
|
|
50
55
|
sourceHash: '',
|
|
51
56
|
};
|
|
52
|
-
// TODO: Need to add btcr2 context. ["https://w3id.org/zcap/v1", "https://w3id.org/security/data-integrity/v2", "https://w3id.org/json-ld-patch/v1"]
|
|
53
57
|
// 5. Set targetDocument to the result of applying the documentPatch to the sourceDocument, following the JSON Patch
|
|
54
58
|
// specification.
|
|
55
|
-
const targetDocument =
|
|
59
|
+
const targetDocument = JSONPatch.apply(sourceDocument, patch);
|
|
56
60
|
// 6. Validate targetDocument is a conformant DID document, else MUST raise invalidDIDUpdate error.
|
|
57
61
|
DidDocument.validate(targetDocument);
|
|
58
62
|
// 7. Set sourceHashBytes to the result of passing sourceDocument into the JSON Canonicalization and Hash algorithm.
|
|
59
|
-
// 8. Set
|
|
60
|
-
|
|
63
|
+
// 8. Set BTCR2SignedUpdate.sourceHash to the base58-btc Multibase encoding of sourceHashBytes.
|
|
64
|
+
unsignedUpdate.sourceHash = (canonicalization.process(sourceDocument, { encoding: 'base58' })).slice(1);
|
|
61
65
|
// TODO: Question - is base58btc the correct encoding scheme?
|
|
62
66
|
// 9. Set targetHashBytes to the result of passing targetDocument into the JSON Canonicalization and Hash algorithm.
|
|
63
|
-
// 10. Set
|
|
64
|
-
|
|
65
|
-
// 11. Set
|
|
66
|
-
|
|
67
|
+
// 10. Set BTCR2SignedUpdate.targetHash to the base58-btc Multibase encoding of targetHashBytes.
|
|
68
|
+
unsignedUpdate.targetHash = (canonicalization.process(targetDocument, { encoding: 'base58' })).slice(1);
|
|
69
|
+
// 11. Set BTCR2SignedUpdate.targetVersionId to sourceVersionId + 1.
|
|
70
|
+
unsignedUpdate.targetVersionId = sourceVersionId + 1;
|
|
67
71
|
// 12. Return updatePayload.
|
|
68
|
-
return
|
|
72
|
+
return unsignedUpdate;
|
|
69
73
|
}
|
|
70
74
|
/**
|
|
71
75
|
* {@link https://dcdpr.github.io/did-btcr2/#invoke-did-update-payload | 4.3.2 Invoke DID Update Payload}.
|
|
72
76
|
*
|
|
73
|
-
* The Invoke DID Update Payload algorithm takes in a Identifier, an unsigned
|
|
77
|
+
* The Invoke DID Update Payload algorithm takes in a Identifier, an unsigned BTCR2SignedUpdate, and a
|
|
74
78
|
* verificationMethod. It retrieves the privateKeyBytes for the verificationMethod and adds a capability invocation in
|
|
75
79
|
* the form of a Data Integrity proof following the Authorization Capabilities (ZCAP-LD) and VC Data Integrity
|
|
76
80
|
* specifications. It returns the invoked DID Update Payload.
|
|
77
81
|
*
|
|
78
82
|
* @param {InvokePayloadParams} params Required params for calling the invokePayload method
|
|
79
83
|
* @param {string} params.identifier The did-btcr2 identifier to derive the root capability from
|
|
80
|
-
* @param {
|
|
84
|
+
* @param {BTCR2SignedUpdate} params.BTCR2SignedUpdate The updatePayload object to be signed
|
|
81
85
|
* @param {DidVerificationMethod} params.verificationMethod The verificationMethod object to be used for signing
|
|
82
|
-
* @returns {
|
|
86
|
+
* @returns {BTCR2SignedUpdate} Did update payload secured with a proof => BTCR2SignedUpdate
|
|
83
87
|
* @throws {MethodError} if the privateKeyBytes are invalid
|
|
84
88
|
*/
|
|
85
|
-
static async invoke({ identifier,
|
|
89
|
+
static async invoke({ identifier, unsignedUpdate, verificationMethod }) {
|
|
86
90
|
// Deconstruct the verificationMethod
|
|
87
91
|
const { id: fullId, controller, publicKeyMultibase, secretKeyMultibase } = verificationMethod;
|
|
88
92
|
// Validate the verificationMethod
|
|
@@ -98,7 +102,7 @@ export class Update {
|
|
|
98
102
|
const keyUri = new CompressedSecp256k1PublicKey(components.genesisBytes).hex;
|
|
99
103
|
const keys = secretKeyMultibase
|
|
100
104
|
? new SchnorrKeyPair({ secretKey: Secp256k1SecretKey.decode(secretKeyMultibase) })
|
|
101
|
-
:
|
|
105
|
+
: Kms.getKey(keyUri);
|
|
102
106
|
if (!keys) {
|
|
103
107
|
throw new MethodError('No privateKey found in kms or vm', NOT_FOUND, verificationMethod);
|
|
104
108
|
}
|
|
@@ -119,7 +123,13 @@ export class Update {
|
|
|
119
123
|
// 7. Set proofOptions.proofPurpose to capabilityInvocation.
|
|
120
124
|
// 8. Set proofOptions.capability to rootCapability.id.
|
|
121
125
|
// 9. Set proofOptions.capabilityAction to Write.
|
|
122
|
-
const
|
|
126
|
+
const config = {
|
|
127
|
+
'@context': [
|
|
128
|
+
'https://w3id.org/security/v2',
|
|
129
|
+
'https://w3id.org/zcap/v1',
|
|
130
|
+
'https://w3id.org/json-ld-patch/v1',
|
|
131
|
+
'https://btcr2.dev/context/v1'
|
|
132
|
+
],
|
|
123
133
|
cryptosuite,
|
|
124
134
|
type: 'DataIntegrityProof',
|
|
125
135
|
verificationMethod: fullId,
|
|
@@ -129,32 +139,32 @@ export class Update {
|
|
|
129
139
|
};
|
|
130
140
|
// 10. Set cryptosuite to the result of executing the Cryptosuite Instantiation algorithm from the BIP340 Data
|
|
131
141
|
// Integrity specification passing in proofOptions.
|
|
132
|
-
const diproof = multikey.toCryptosuite(
|
|
133
|
-
// 12. Set
|
|
134
|
-
//
|
|
135
|
-
// 13. Return
|
|
136
|
-
return await diproof.addProof(
|
|
142
|
+
const diproof = multikey.toCryptosuite().toDataIntegrityProof();
|
|
143
|
+
// 12. Set BTCR2SignedUpdate to the result of executing the Add Proof algorithm from VC Data Integrity passing
|
|
144
|
+
// BTCR2SignedUpdate as the input document, cryptosuite, and the set of proofOptions.
|
|
145
|
+
// 13. Return BTCR2SignedUpdate.
|
|
146
|
+
return await diproof.addProof(unsignedUpdate, config);
|
|
137
147
|
}
|
|
138
148
|
/**
|
|
139
149
|
* Implements {@link https://dcdpr.github.io/did-btcr2/#announce-did-update | 4.3.3 Announce DID Update}.
|
|
140
150
|
*
|
|
141
151
|
* The Announce DID Update algorithm retrieves beaconServices from the sourceDocument and calls the Broadcast DID
|
|
142
152
|
* Update algorithm corresponding to the type of the Beacon. It takes in a Identifier, sourceDocument, an array of
|
|
143
|
-
* beaconIds, and a
|
|
144
|
-
* data to validate the Beacon Signal against the
|
|
153
|
+
* beaconIds, and a BTCR2SignedUpdate. It returns an array of signalsMetadata, containing the necessary
|
|
154
|
+
* data to validate the Beacon Signal against the BTCR2SignedUpdate.
|
|
145
155
|
*
|
|
146
156
|
* @param {AnnounceUpdatePayloadParams} params Required params for calling the announcePayload method
|
|
147
157
|
* @param {DidDocument} params.sourceDocument The did-btcr2 did document to derive the root capability from
|
|
148
|
-
* @param {string[]} params.beaconIds The
|
|
149
|
-
* @param {
|
|
150
|
-
* @returns {
|
|
158
|
+
* @param {string[]} params.beaconIds The BTCR2SignedUpdate object to be signed
|
|
159
|
+
* @param {BTCR2SignedUpdate} params.BTCR2SignedUpdate The verificationMethod object to be used for signing
|
|
160
|
+
* @returns {BTCR2SignedUpdate} The BTCR2SignedUpdate object containing data to validate the Beacon Signal
|
|
151
161
|
* @throws {MethodError} if the beaconService type is invalid
|
|
152
162
|
*/
|
|
153
|
-
static async announce({ sourceDocument, beaconIds,
|
|
163
|
+
static async announce({ sourceDocument, beaconIds, signedUpdate }) {
|
|
154
164
|
// 1. Set beaconServices to an empty array.
|
|
155
165
|
const beaconServices = [];
|
|
156
|
-
// 2.
|
|
157
|
-
let
|
|
166
|
+
// 2. sidecarData to an empty array.
|
|
167
|
+
let sidecarData;
|
|
158
168
|
// 3. For beaconId in beaconIds:
|
|
159
169
|
for (const beaconId of beaconIds) {
|
|
160
170
|
// 3.1 Find the beacon services in the sourceDocument
|
|
@@ -170,25 +180,25 @@ export class Update {
|
|
|
170
180
|
for (const beaconService of beaconServices) {
|
|
171
181
|
// 4.1 Set signalMetadata to null.
|
|
172
182
|
// 4.2 If beaconService.type == SingletonBeacon:
|
|
173
|
-
// 4.2.1 Set signalMetadata to the result of passing beaconService and
|
|
183
|
+
// 4.2.1 Set signalMetadata to the result of passing beaconService and BTCR2SignedUpdate to the Broadcast
|
|
174
184
|
// Singleton Beacon Signal algorithm.
|
|
175
|
-
// 4.3 Else If beaconService.type ==
|
|
176
|
-
// 4.3.1 Set signalMetadata to the result of passing Identifier, beaconService and
|
|
185
|
+
// 4.3 Else If beaconService.type == CASBeacon:
|
|
186
|
+
// 4.3.1 Set signalMetadata to the result of passing Identifier, beaconService and BTCR2SignedUpdate to
|
|
177
187
|
// the Broadcast CIDAggregate Beacon Signal algorithm.
|
|
178
|
-
// 4.4 Else If beaconService.type ==
|
|
179
|
-
// 4.4.1 Set signalMetadata to the result of passing Identifier, beaconService and
|
|
188
|
+
// 4.4 Else If beaconService.type == SMTBeacon:
|
|
189
|
+
// 4.4.1 Set signalMetadata to the result of passing Identifier, beaconService and BTCR2SignedUpdate to
|
|
180
190
|
// the Broadcast SMTAggregate Beacon Signal algorithm.
|
|
181
191
|
// 4.5 Else:
|
|
182
192
|
// 4.5.1 MUST throw invalidBeacon error.
|
|
183
|
-
const beacon = BeaconFactory.establish(beaconService);
|
|
184
|
-
|
|
193
|
+
// const beacon = BeaconFactory.establish(beaconService);
|
|
194
|
+
// sidecarData = await beacon.broadcastSignal(signedUpdate);
|
|
195
|
+
console.log('TODO: refactor this code', signedUpdate, beaconService);
|
|
185
196
|
}
|
|
186
|
-
if (!
|
|
187
|
-
throw new MethodError('Invalid beacon: no
|
|
197
|
+
if (!sidecarData) {
|
|
198
|
+
throw new MethodError('Invalid beacon: no sidecarData found', INVALID_DID_DOCUMENT, { beaconServices });
|
|
188
199
|
}
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
return signalsMetadata;
|
|
200
|
+
// Return the sidecarData
|
|
201
|
+
return sidecarData;
|
|
192
202
|
}
|
|
193
203
|
}
|
|
194
204
|
//# sourceMappingURL=update.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update.js","sourceRoot":"","sources":["../../../src/core/update.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EACpB,kBAAkB,EAClB,uBAAuB,EACvB,SAAS,EACT,WAAW,EACX,SAAS,EAET,WAAW,EACZ,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAA+D,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACtH,OAAO,EAAE,4BAA4B,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACtG,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAErC,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAyB,MAAM,0BAA0B,CAAC;AAE9E,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAqB7C;;;;;;;;;;;GAWG;AACH,MAAM,OAAO,MAAM;IACjB;;;;;;;;;;;;;;OAcG;IACI,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,EAC5B,UAAU,EACV,cAAc,EACd,eAAe,EACf,KAAK,GAMN;QAEC,4FAA4F;QAC5F,IAAI,cAAc,CAAC,EAAE,KAAK,UAAU,EAAE,CAAC;YACrC,MAAM,IAAI,WAAW,CAC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C;QAED,0CAA0C;QAC1C,KAAK,MAAM,aAAa,IAAI,cAAc,EAAE,CAAC;YAC3C,kCAAkC;YAClC,gDAAgD;YAChD,4GAA4G;YAC5G,8CAA8C;YAC9C,+CAA+C;YAC/C,0GAA0G;YAC1G,+DAA+D;YAC/D,+CAA+C;YAC/C,0GAA0G;YAC1G,+DAA+D;YAC/D,YAAY;YACZ,2CAA2C;YAC3C,yDAAyD;YACzD,4DAA4D;YAC5D,OAAO,CAAC,GAAG,CAAC,0BAA0B,EAAE,YAAY,EAAE,aAAa,CAAC,CAAC;QACvE,CAAC;QACD,IAAG,CAAC,WAAW,EAAE,CAAC;YAChB,MAAM,IAAI,WAAW,CACnB,sCAAsC,EACtC,oBAAoB,EAAE,EAAE,cAAc,EAAE,CACzC,CAAC;QACJ,CAAC;QAED,yBAAyB;QACzB,OAAO,WAAW,CAAC;IACrB,CAAC;CACF"}
|
package/dist/cjs/did-btcr2.js
CHANGED
|
@@ -1,19 +1,26 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BitcoinNetworkConnection } from '@did-btcr2/bitcoin';
|
|
2
|
+
import { Canonicalization, IdentifierHrp, INVALID_DID_DOCUMENT, METHOD_NOT_SUPPORTED, MethodError, MISSING_UPDATE_DATA, ResolveError } 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}
|
|
@@ -23,90 +30,119 @@ export class DidBtcr2 {
|
|
|
23
30
|
/** @type {string} Name of the DID method, as defined in the DID BTCR2 specification */
|
|
24
31
|
static methodName = 'btcr2';
|
|
25
32
|
/**
|
|
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
|
|
33
|
+
* Implements section {@link https://dcdpr.github.io/did-btcr2/operations/create.html | 7.1 Create}.
|
|
34
|
+
* @param {KeyBytes | DocumentBytes} genesisBytes The bytes used to create the genesis document for a did:btcr2 identifier.
|
|
35
|
+
* 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.
|
|
36
|
+
* @param {DidCreateOptions} options Options for creating the identifier, including the idType (key or external), version, and network.
|
|
37
|
+
* @param {string} options.idType The type of identifier to create, either 'KEY' or 'EXTERNAL'. Defaults to 'KEY'.
|
|
38
|
+
* @param {number} options.version The version number of the did:btcr2 specification to use for creating the identifier. Defaults to 1.
|
|
39
|
+
* @param {string} options.network The Bitcoin network to use for the identifier, e.g. 'bitcoin', 'testnet', etc. Defaults to 'bitcoin'.
|
|
40
|
+
* @returns {Promise<Btcr2Identifier>} Promise resolving to a Btcr2Identifier string.
|
|
41
|
+
* @throws {MethodError} if any of the checks fail
|
|
42
42
|
*/
|
|
43
|
-
static async create(
|
|
44
|
-
// Deconstruct the idType and
|
|
45
|
-
const { idType,
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
43
|
+
static async create(genesisBytes, options) {
|
|
44
|
+
// Deconstruct the idType, version and network from the options, setting defaults if not given
|
|
45
|
+
const { idType, version = 1, network = 'bitcoin' } = options || {};
|
|
46
|
+
if (!idType) {
|
|
47
|
+
throw new MethodError('idType is required for creating a did:btcr2 identifier', INVALID_DID_DOCUMENT, options);
|
|
48
|
+
}
|
|
49
|
+
// Call identifier encoding algorithm
|
|
50
50
|
return Identifier.encode({ idType, genesisBytes, version, network });
|
|
51
51
|
}
|
|
52
52
|
/**
|
|
53
|
-
* Entry point for section {@link https://dcdpr.github.io/did-btcr2/#read | 7.2
|
|
54
|
-
* See {@link
|
|
53
|
+
* Entry point for section {@link https://dcdpr.github.io/did-btcr2/#read | 7.2 Resolve}.
|
|
54
|
+
* See specification for the {@link https://dcdpr.github.io/did-btcr2/operations/resolve.html#process | Resolve Process}.
|
|
55
|
+
* See {@link Resolve | Resolve (class)} for class implementation.
|
|
55
56
|
*
|
|
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.
|
|
57
|
+
* Resolving a did:btcr2 identifier iteratively builds a DID document by applying
|
|
58
|
+
* BTCR2 Updates to an Initial DID Document that have been committed to the Bitcoin
|
|
59
|
+
* blockchain by Authorized Beacon Signals. The Initial DID Document is either
|
|
60
|
+
* deterministically created from the DID or provided by Sidecar Data.
|
|
62
61
|
*
|
|
63
|
-
* @param {string}
|
|
64
|
-
* @param {
|
|
65
|
-
* @param {number}
|
|
66
|
-
* @param {number}
|
|
67
|
-
* @param {DidDocument}
|
|
68
|
-
* @
|
|
69
|
-
* @returns {DidResolutionResult} Promise resolving to a DID Resolution Result containing the `targetDocument`
|
|
62
|
+
* @param {string} did a valid did:btcr2 identifier to be resolved
|
|
63
|
+
* @param {ResolutionOptions} resolutionOptions see {@link https://www.w3.org/TR/did-1.0/#did-resolution-options | ResolutionOptions}
|
|
64
|
+
* @param {number} resolutionOptions.versionId optional version of the identifier and/or DID document
|
|
65
|
+
* @param {number} resolutionOptions.versionTime optional timestamp used during resolution as a bound for when to stop resolving
|
|
66
|
+
* @param {DidDocument} resolutionOptions.sidecar optional data necessary for resolving a DID
|
|
67
|
+
* @returns {Promise<DidResolutionResult>} Promise resolving to a DID Resolution Result containing the `targetDocument`
|
|
70
68
|
* @throws {Error} if the resolution fails for any reason
|
|
71
69
|
* @throws {DidError} InvalidDid if the identifier is invalid
|
|
72
70
|
* @example
|
|
73
71
|
* ```ts
|
|
74
|
-
* const resolution = await DidBtcr2.resolve(
|
|
72
|
+
* const resolution = await DidBtcr2.resolve(
|
|
73
|
+
* 'did:btcr2:k1q0dygyp3gz969tp46dychzy4q78c2k3js68kvyr0shanzg67jnuez2cfplh'
|
|
74
|
+
* )
|
|
75
75
|
* ```
|
|
76
76
|
*/
|
|
77
|
-
static async resolve(
|
|
77
|
+
static async resolve(did, resolutionOptions = { drivers: {} }) {
|
|
78
78
|
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.
|
|
79
|
+
// Initialize an empty DID Resolution Result
|
|
91
80
|
const didResolutionResult = {
|
|
92
|
-
'@context':
|
|
81
|
+
'@context': 'https://w3id.org/did-resolution/v1',
|
|
93
82
|
didResolutionMetadata: { contentType: 'application/ld+json' },
|
|
94
|
-
didDocumentMetadata: {
|
|
95
|
-
|
|
83
|
+
didDocumentMetadata: {
|
|
84
|
+
deactivated: false,
|
|
85
|
+
updated: undefined,
|
|
86
|
+
versionId: resolutionOptions.versionId,
|
|
87
|
+
confirmations: undefined,
|
|
88
|
+
},
|
|
89
|
+
didDocument: null,
|
|
96
90
|
};
|
|
91
|
+
// Decode the did to be resolved
|
|
92
|
+
const didComponents = Identifier.decode(did);
|
|
93
|
+
// Process sidecar if provided
|
|
94
|
+
const sidecarData = Resolve.processSidecarData(resolutionOptions.sidecar);
|
|
95
|
+
// Establish a connection to a bitcoin network
|
|
96
|
+
if (!resolutionOptions.drivers.bitcoin) {
|
|
97
|
+
resolutionOptions.drivers.bitcoin = new BitcoinNetworkConnection();
|
|
98
|
+
// Set the network based on the decoded identifier
|
|
99
|
+
resolutionOptions.drivers.bitcoin.setActiveNetwork(didComponents.network);
|
|
100
|
+
}
|
|
101
|
+
// Parse the genesis document from the resolution options if provided
|
|
102
|
+
const genesisDocument = resolutionOptions.sidecar?.genesisDocument;
|
|
103
|
+
// Since genesisDocument is optional, check if it exists
|
|
104
|
+
if (!genesisDocument) {
|
|
105
|
+
// If no genesisDocument and x HRP, throw MISSING_UPDATE_DATA error
|
|
106
|
+
if (didComponents.hrp === IdentifierHrp.x)
|
|
107
|
+
throw new ResolveError('External resolution requires genesisDocument', MISSING_UPDATE_DATA, { resolutionOptions });
|
|
108
|
+
}
|
|
109
|
+
// Establish the current document
|
|
110
|
+
const currentDocument = await Resolve.establishCurrentDocument(didComponents, genesisDocument);
|
|
111
|
+
// Extract all Beacon services from the current DID Document
|
|
112
|
+
const beaconServices = currentDocument.service
|
|
113
|
+
.filter(BeaconUtils.isBeaconService)
|
|
114
|
+
.map(BeaconUtils.parseBeaconServiceEndpoint);
|
|
115
|
+
// Process the Beacon Signals to get the required updates
|
|
116
|
+
const unsortedUpdates = await Resolve.processBeaconSignals(beaconServices, sidecarData, resolutionOptions.drivers.bitcoin, resolutionOptions.fullBlockchainTraversal);
|
|
117
|
+
// If no updates found, return the current document
|
|
118
|
+
if (!unsortedUpdates.length) {
|
|
119
|
+
// Set the current document in the didResolutionResult
|
|
120
|
+
didResolutionResult.didDocument = currentDocument;
|
|
121
|
+
// Set the deactivated status in the didDocumentMetadata
|
|
122
|
+
didResolutionResult.didDocumentMetadata.deactivated = !!currentDocument.deactivated;
|
|
123
|
+
// Return the didResolutionResult early
|
|
124
|
+
return didResolutionResult;
|
|
125
|
+
}
|
|
126
|
+
// Process the updates to apply updates to bring the current DID Document to its more current state
|
|
127
|
+
const result = await Resolve.processUpdatesArray(currentDocument, unsortedUpdates, resolutionOptions.versionTime, resolutionOptions.versionId);
|
|
128
|
+
// Set all of the required fields in the didResolutionResult
|
|
129
|
+
didResolutionResult.didDocument = result.currentDocument;
|
|
130
|
+
didResolutionResult.didDocumentMetadata.confirmations = result.confirmations;
|
|
131
|
+
didResolutionResult.didDocumentMetadata.versionId = result.versionId;
|
|
132
|
+
didResolutionResult.didDocumentMetadata.deactivated = !!result.currentDocument.deactivated;
|
|
97
133
|
// Return didResolutionResult;
|
|
98
134
|
return didResolutionResult;
|
|
99
135
|
}
|
|
100
136
|
catch (error) {
|
|
101
137
|
console.error(error);
|
|
102
|
-
// Rethrow any unexpected errors that are not a `
|
|
103
|
-
if (!(error instanceof
|
|
138
|
+
// Rethrow any unexpected errors that are not a `ResolveError`.
|
|
139
|
+
if (!(error instanceof ResolveError))
|
|
104
140
|
throw new Error(error);
|
|
105
141
|
// Return a DID Resolution Result with the appropriate error code.
|
|
106
142
|
return {
|
|
107
143
|
...EMPTY_DID_RESOLUTION_RESULT,
|
|
108
144
|
didResolutionMetadata: {
|
|
109
|
-
error: error.
|
|
145
|
+
error: error.type,
|
|
110
146
|
...error.message && { errorMessage: error.message }
|
|
111
147
|
}
|
|
112
148
|
};
|
|
@@ -127,7 +163,7 @@ export class DidBtcr2 {
|
|
|
127
163
|
* The result of these transformations MUST produce a DID document conformant to the DID Core specification. The
|
|
128
164
|
* verificationMethodId is an identifier for a verificationMethod within the sourceDocument. The verificationMethod
|
|
129
165
|
* identified MUST be a BIP340 Multikey. The beaconIds MUST identify service endpoints with one of the three Beacon
|
|
130
|
-
* Types SingletonBeacon,
|
|
166
|
+
* Types SingletonBeacon, CASBeacon, and SMTBeacon.
|
|
131
167
|
*
|
|
132
168
|
* @param {UpdateParams} params Required parameters for the update operation.
|
|
133
169
|
* @param {string} params.identifier The btcr2 identifier to be updated.
|
|
@@ -145,7 +181,7 @@ export class DidBtcr2 {
|
|
|
145
181
|
// 1. Set unsignedUpdate to the result of passing Identifier, sourceDocument,
|
|
146
182
|
// sourceVersionId, and documentPatch into the Construct DID Update
|
|
147
183
|
// Payload algorithm.
|
|
148
|
-
const
|
|
184
|
+
const unsignedUpdate = await Update.construct({
|
|
149
185
|
identifier,
|
|
150
186
|
sourceDocument,
|
|
151
187
|
sourceVersionId,
|
|
@@ -153,7 +189,7 @@ export class DidBtcr2 {
|
|
|
153
189
|
});
|
|
154
190
|
// 2. Set verificationMethod to the result of retrieving the verificationMethod
|
|
155
191
|
// from sourceDocument using the verificationMethodId.
|
|
156
|
-
const verificationMethod = this.getSigningMethod(
|
|
192
|
+
const verificationMethod = this.getSigningMethod(sourceDocument, methodId);
|
|
157
193
|
// Validate the verificationMethod exists in the sourceDocument
|
|
158
194
|
if (!verificationMethod) {
|
|
159
195
|
throw new MethodError('Verification method not found in did document', INVALID_DID_DOCUMENT, sourceDocument);
|
|
@@ -170,10 +206,10 @@ export class DidBtcr2 {
|
|
|
170
206
|
}
|
|
171
207
|
// 4. Set didUpdateInvocation to the result of passing Identifier, unsignedUpdate as didUpdatePayload, and
|
|
172
208
|
// verificationMethod to the Invoke DID Update Payload algorithm.
|
|
173
|
-
const
|
|
209
|
+
const signedUpdate = await Update.invoke({ identifier, verificationMethod, unsignedUpdate });
|
|
174
210
|
// 5. Set signalsMetadata to the result of passing Identifier, sourceDocument, beaconIds and didUpdateInvocation
|
|
175
211
|
// to the Announce DID Update algorithm.
|
|
176
|
-
const signalsMetadata = await Update.announce({ sourceDocument, beaconIds,
|
|
212
|
+
const signalsMetadata = await Update.announce({ sourceDocument, beaconIds, signedUpdate });
|
|
177
213
|
// 6. Return signalsMetadata. It is up to implementations to ensure that the signalsMetadata is persisted.
|
|
178
214
|
return signalsMetadata;
|
|
179
215
|
// TODO: Should we be applying the patch, producing a target did document and returning it?
|
|
@@ -183,14 +219,12 @@ export class DidBtcr2 {
|
|
|
183
219
|
* for signing messages and credentials. If given, the `methodId` parameter is used to select the
|
|
184
220
|
* verification method. If not given, the Identity Key's verification method with an ID fragment
|
|
185
221
|
* 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.
|
|
222
|
+
* @param {DidDocument} didDocument The DID Document of the `did:btcr2` identifier.
|
|
223
|
+
* @param {string} [methodId] Optional verification method ID to be used for signing.
|
|
190
224
|
* @returns {DidVerificationMethod} Promise resolving to the {@link DidVerificationMethod} object used for signing.
|
|
191
225
|
* @throws {DidError} if the parsed did method does not match `btcr2` or signing method could not be determined.
|
|
192
226
|
*/
|
|
193
|
-
static getSigningMethod(
|
|
227
|
+
static getSigningMethod(didDocument, methodId) {
|
|
194
228
|
// Set the default methodId to the first assertionMethod if not given
|
|
195
229
|
methodId ??= '#initialKey';
|
|
196
230
|
// 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,EAEhB,aAAa,EACb,oBAAoB,EAEpB,oBAAoB,EACpB,WAAW,EACX,mBAAmB,EAEnB,YAAY,EACb,MAAM,mBAAmB,CAAC;AAC3B,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;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAElD,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAE5C,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1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'./core/beacon/aggregation/cohort/messages/base.js';
|
|
3
|
+
export * from './core/beacon/aggregation/cohort/messages/constants.js';
|
|
4
|
+
export * from './core/beacon/aggregation/cohort/messages/index.js';
|
|
5
|
+
export * from './core/beacon/aggregation/cohort/messages/keygen//subscribe.js';
|
|
1
6
|
export * from './core/beacon/aggregation/cohort/messages/keygen/cohort-advert.js';
|
|
2
7
|
export * from './core/beacon/aggregation/cohort/messages/keygen/cohort-ready.js';
|
|
3
8
|
export * from './core/beacon/aggregation/cohort/messages/keygen/opt-in-accept.js';
|
|
4
9
|
export * from './core/beacon/aggregation/cohort/messages/keygen/opt-in.js';
|
|
5
|
-
export * from './core/beacon/aggregation/cohort/messages/keygen//subscribe.js';
|
|
6
10
|
export * from './core/beacon/aggregation/cohort/messages/sign/aggregated-nonce.js';
|
|
7
11
|
export * from './core/beacon/aggregation/cohort/messages/sign/authorization-request.js';
|
|
8
12
|
export * from './core/beacon/aggregation/cohort/messages/sign/nonce-contribution.js';
|
|
9
13
|
export * from './core/beacon/aggregation/cohort/messages/sign/request-signature.js';
|
|
10
14
|
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
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/cas-beacon.js';
|
|
26
26
|
export * from './core/beacon/error.js';
|
|
27
27
|
export * from './core/beacon/factory.js';
|
|
28
|
+
export * from './core/beacon/interfaces.js';
|
|
28
29
|
export * from './core/beacon/singleton.js';
|
|
29
|
-
export * from './core/beacon/smt-
|
|
30
|
+
export * from './core/beacon/smt-beacon.js';
|
|
30
31
|
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
32
|
export * from './core/identifier.js';
|
|
35
|
-
export * from './interfaces
|
|
36
|
-
export * from './
|
|
33
|
+
export * from './core/interfaces.js';
|
|
34
|
+
export * from './core/resolve.js';
|
|
35
|
+
export * from './core/types.js';
|
|
36
|
+
export * from './core/update.js';
|
|
37
37
|
export * from './utils/appendix.js';
|
|
38
38
|
export * from './utils/did-document-builder.js';
|
|
39
39
|
export * from './utils/did-document.js';
|
|
40
40
|
export * from './utils/general.js';
|
|
41
|
-
export * from './utils/types.js';
|
|
42
41
|
export * from './did-btcr2.js';
|
|
43
42
|
//# 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,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;AAC1F,cAAc,4CAA4C,CAAC;AAC3D,cAAc,6DAA6D,CAAC;AAC5E,cAAc,0DAA0D,CAAC;AACzE,cAAc,kDAAkD,CAAC;AACjE,cAAc,oDAAoD,CAAC;AACnE,cAAc,oDAAoD,CAAC;AACnE,cAAc,0CAA0C,CAAC;AACzD,cAAc,0CAA0C,CAAC;AACzD,cAAc,4CAA4C,CAAC;AAC3D,cAAc,6CAA6C,CAAC;AAC5D,cAAc,6BAA6B,CAAC;AAC5C,cAAc,wBAAwB,CAAC;AACvC,cAAc,0BAA0B,CAAC;AACzC,cAAc,6BAA6B,CAAC;AAC5C,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"}
|