@did-btcr2/method 0.59.0 → 0.61.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.
@@ -1 +1 @@
1
- {"version":3,"file":"btcr2-update.d.ts","sourceRoot":"","sources":["../../../src/core/btcr2-update.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,KAAK,EAAE,wBAAwB,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAC;AAElG;;;;;;;;GAQG;AACH,MAAM,MAAM,mBAAmB,GAAG;IAChC;;;OAGG;IACH,UAAU,EAAE,MAAM,EAAE,CAAC;IAErB;;;;OAIG;IACH,KAAK,EAAE,KAAK,CAAC,cAAc,CAAC,CAAC;IAE7B;;;;OAIG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;;;OAIG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;;OAGG;IACH,eAAe,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,uBAAuB,GAAG,wBAAwB,GAAG;IAC/D,gFAAgF;IAChF,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB,4FAA4F;IAC5F,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,iBAAiB,GAAG,mBAAmB,GAAG;IACpD,sFAAsF;IACtF,KAAK,EAAE,uBAAuB,CAAC;CAChC,CAAC;AAEF,qCAAqC;AACrC,MAAM,MAAM,WAAW,GAAG,mBAAmB,GAAG,iBAAiB,CAAC;AAElE;;;;;GAKG;AACH,MAAM,MAAM,wBAAwB,GAAG,yBAAyB,GAAG;IACjE,gFAAgF;IAChF,UAAU,EAAE,MAAM,EAAE,CAAC;IAErB,gFAAgF;IAChF,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB,4FAA4F;IAC5F,gBAAgB,CAAC,EAAE,MAA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;IAErB,gFAAgF;IAChF,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB,4FAA4F;IAC5F,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B,CAAC"}
@@ -1,4 +1,5 @@
1
1
  import type { Bytes, DocumentBytes, KeyBytes, SchnorrKeyPairObject } from '@did-btcr2/common';
2
+ import { IdentifierTypes } from '@did-btcr2/common';
2
3
  import { CompressedSecp256k1PublicKey } from '@did-btcr2/keypair';
3
4
  import type { DidCreateOptions } from '../did-btcr2.js';
4
5
  /**
@@ -24,6 +25,52 @@ export interface IdentifierComponents {
24
25
  network: string;
25
26
  genesisBytes: Bytes;
26
27
  }
28
+ /**
29
+ * The name of one check that {@link Identifier.validate} runs. The names are in run order.
30
+ * @typedef {string} IdentifierCheckName
31
+ */
32
+ export type IdentifierCheckName = 'prefix' | 'lowercase' | 'bech32m' | 'version' | 'network' | 'genesisBytes' | 'roundTrip' | 'genesisBytesMatch' | 'genesisDocument';
33
+ /**
34
+ * The result of one check that {@link Identifier.validate} ran.
35
+ * @interface IdentifierCheck
36
+ * @property {IdentifierCheckName} name The name of the check.
37
+ * @property {boolean} ok True if the check passed.
38
+ * @property {string} [detail] What the check found.
39
+ */
40
+ export interface IdentifierCheck {
41
+ name: IdentifierCheckName;
42
+ ok: boolean;
43
+ detail?: string;
44
+ }
45
+ /**
46
+ * Options for {@link Identifier.validate}.
47
+ * @interface IdentifierValidateOptions
48
+ * @property {Bytes} [genesisBytes] The genesis bytes that the identifier must encode: the 33-byte
49
+ * compressed public key of a KEY identifier, or the 32-byte genesis document hash of an EXTERNAL
50
+ * identifier. If present, the report includes the `genesisBytesMatch` check.
51
+ * @property {object} [genesisDocument] The genesis document of an EXTERNAL identifier.
52
+ * If present, the report includes the `genesisDocument` check.
53
+ */
54
+ export interface IdentifierValidateOptions {
55
+ genesisBytes?: Bytes;
56
+ genesisDocument?: object;
57
+ }
58
+ /**
59
+ * The report that {@link Identifier.validate} returns.
60
+ * @interface IdentifierReport
61
+ * @property {string} did The identifier that was verified.
62
+ * @property {boolean} valid True if every check passed.
63
+ * @property {IdentifierTypes} [idType] The identifier type, known after the `bech32m` check.
64
+ * @property {string} [network] The network name, known after the `network` check.
65
+ * @property {Array<IdentifierCheck>} checks The checks that ran, in run order. The run stops at the first failed check.
66
+ */
67
+ export interface IdentifierReport {
68
+ did: string;
69
+ valid: boolean;
70
+ idType?: IdentifierTypes;
71
+ network?: string;
72
+ checks: Array<IdentifierCheck>;
73
+ }
27
74
  /**
28
75
  * Implements {@link https://dcdpr.github.io/did-btcr2/#syntax | 3 Syntax}.
29
76
  * A did:btcr2 DID consists of a did:btcr2 prefix, followed by an id-bech32 value, which is a Bech32m encoding of:
@@ -60,6 +107,26 @@ export declare class Identifier {
60
107
  * @throws {DidErrorCode.MethodNotSupported} if the method is not supported
61
108
  */
62
109
  static decode(identifier: string): DidComponents;
110
+ /**
111
+ * Validates that a did:btcr2 identifier conforms to
112
+ * {@link https://dcdpr.github.io/did-btcr2/#didbtcr2-identifier-decoding | 3.3 did:btcr2 Identifier Decoding}
113
+ * and returns a report of the checks. The method does not throw on an invalid identifier.
114
+ *
115
+ * The checks run in this order: `prefix`, `lowercase`, `bech32m`, `version`, `network`,
116
+ * `genesisBytes`, `roundTrip`, `genesisBytesMatch`, and `genesisDocument`. The run stops at the
117
+ * first failed check. The `network` check accepts a named network only: a reserved value (6 to
118
+ * 11) and a custom value (12 to 15) fail, because this implementation supports no custom network.
119
+ * The `genesisBytesMatch` check runs only if `options.genesisBytes` is present: the supplied bytes
120
+ * must equal the genesis bytes of the identifier, for a KEY or an EXTERNAL identifier. The
121
+ * `genesisDocument` check runs only if `options.genesisDocument` is present. For an EXTERNAL
122
+ * identifier it confirms that the document is a valid Genesis Document and that its canonical
123
+ * SHA-256 hash equals the genesis bytes. For a KEY identifier it fails.
124
+ *
125
+ * @param {string} identifier The did:btcr2 identifier to validate.
126
+ * @param {IdentifierValidateOptions} [options] The validation options.
127
+ * @returns {IdentifierReport} The report. See {@link IdentifierReport} for details.
128
+ */
129
+ static validate(identifier: string, options?: IdentifierValidateOptions): IdentifierReport;
63
130
  /**
64
131
  * Generates a new did:btcr2 identifier based on a newly generated key pair.
65
132
  * @returns {string} The new did:btcr2 identifier.
@@ -1 +1 @@
1
- {"version":3,"file":"identifier.d.ts","sourceRoot":"","sources":["../../../src/core/identifier.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAE9F,OAAO,EAAE,4BAA4B,EAAkB,MAAM,oBAAoB,CAAC;AAElF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAExD;;;;;GAKG;AACH,MAAM,WAAW,aAAc,SAAQ,oBAAoB;IACvD,GAAG,EAAE,MAAM,CAAC;CACf;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,oBAAoB;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,KAAK,CAAC;CACvB;AACD;;;;;;;;;;GAUG;AACH,qBAAa,UAAU;IACrB;;;;;;;;;;;;;OAaG;IACH,MAAM,CAAC,MAAM,CAAC,YAAY,EAAE,QAAQ,GAAG,aAAa,EAAE,OAAO,EAAE,gBAAgB,GAAG,MAAM;IAuDxF;;;;;;;OAOG;IACH,MAAM,CAAC,MAAM,CAAC,UAAU,EAAE,MAAM,GAAG,aAAa;IAsFhD;;;OAGG;IACH,MAAM,CAAC,QAAQ,IAAI;QAAE,OAAO,EAAE,oBAAoB,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE;IAYjE;;;;;OAKG;IACH,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,4BAA4B;IAW9D;;;;OAIG;IACH,MAAM,CAAC,OAAO,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO;CAQ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AAC,eAAe,CAAC,CAAC;CAClC;AAKD;;;;;;;;;;GAUG;AACH,qBAAa,UAAU;IACrB;;;;;;;;;;;;;OAaG;IACH,MAAM,CAAC,MAAM,CAAC,YAAY,EAAE,QAAQ,GAAG,aAAa,EAAE,OAAO,EAAE,gBAAgB,GAAG,MAAM;IAuDxF;;;;;;;OAOG;IACH,MAAM,CAAC,MAAM,CAAC,UAAU,EAAE,MAAM,GAAG,aAAa;IAyFhD;;;;;;;;;;;;;;;;;;OAkBG;IACH,MAAM,CAAC,QAAQ,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,GAAE,yBAA8B,GAAG,gBAAgB;IAqJ9F;;;OAGG;IACH,MAAM,CAAC,QAAQ,IAAI;QAAE,OAAO,EAAE,oBAAoB,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE;IAYjE;;;;;OAKG;IACH,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,4BAA4B;IAW9D;;;;OAIG;IACH,MAAM,CAAC,OAAO,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO;CAQ5C"}
@@ -165,7 +165,8 @@ export declare class Resolver {
165
165
  */
166
166
  private static confirmDuplicate;
167
167
  /**
168
- * Implements subsection {@link https://dcdpr.github.io/did-btcr2/operations/resolve.html#apply-update | 7.2.f.3 Apply Update}.
168
+ * Implements subsection {@link https://dcdpr.github.io/did-btcr2/operations/resolve.html#apply-update | 7.2.f.3 Apply Update}
169
+ * and its step {@link https://dcdpr.github.io/did-btcr2/operations/resolve.html#check-update-proof | Check update.proof}.
169
170
  * @param {DidDocument} currentDocument The current DID Document to apply the update to.
170
171
  * @param {SignedBTCR2Update} update The BTCR2 Signed Update to apply.
171
172
  * @returns {DidDocument} The updated DID Document after applying the update.
@@ -1 +1 @@
1
- {"version":3,"file":"resolver.d.ts","sourceRoot":"","sources":["../../../src/core/resolver.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB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W,aAAa;IAC5B,cAAc,EAAE,gBAAgB,CAAC;IACjC,OAAO,EAAE,cAAc,EAAE,CAAC;IAC1B,eAAe,EAAE,MAAM,CAAC;IACxB,kBAAkB,EAAE,qBAAqB,CAAC;IAC1C,aAAa,EAAE,aAAa,CAAC;CAC9B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AACH,qBAAa,OAAO;;IAQlB;;OAEG;gBACS,MAAM,EAAE,aAAa;IAYjC;;;;;;;;OAQG;IACH,MAAM,CAAC,SAAS,CACd,cAAc,EAAE,gBAAgB,EAChC,OAAO,EAAE,cAAc,EAAE,EACzB,eAAe,EAAE,MAAM,GACtB,mBAAmB;IAoCtB;;;;;;;;OAQG;IACH,MAAM,CAAC,IAAI,CACT,GAAG,EAAE,MAAM,EACX,cAAc,EAAE,mBAAmB,EACnC,kBAAkB,EAAE,qBAAqB,EACzC,MAAM,EAAE,MAAM,GACb,iBAAiB;IAmEpB;;;;;;;;;;;;;;;OAeG;WACU,QAAQ,CACnB,aAAa,EAAE,aAAa,EAC5B,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,iBAAiB,EACzB,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,iBAAiB,EAC1B,OAAO,CAAC,EAAE,mBAAmB,GAC5B,OAAO,CAAC,eAAe,CAAC;IAa3B;;;;OAIG;IACH,OAAO,IAAI,YAAY;IAkEvB;;;;;;OAMG;IACH,OAAO,CAAC,IAAI,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI;IACjD,OAAO,CAAC,IAAI,EAAE,WAAW,EAAE,KAAK,CAAC,EAAE,YAAY,GAAG,IAAI;IACtD,OAAO,CAAC,IAAI,EAAE,aAAa,GAAG,IAAI;CAkEnC"}
@@ -93,9 +93,10 @@ export declare class Appendix {
93
93
  * ```
94
94
  * {
95
95
  * "@context": [
96
+ * "https://w3id.org/json-ld-patch/v1",
96
97
  * "https://w3id.org/zcap/v1",
97
98
  * "https://w3id.org/security/data-integrity/v2",
98
- * "https://w3id.org/json-ld-patch/v1"
99
+ * "https://btcr2.dev/context/v1"
99
100
  * ],
100
101
  * "patch": [
101
102
  * {
@@ -1 +1 @@
1
- {"version":3,"file":"appendix.d.ts","sourceRoot":"","sources":["../../../src/utils/appendix.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,WAAW,EACX,UAAU,EACV,qBAAqB,EAAC,MAAM,YAAY,CAAC;AAO3C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAE5D;;;;;GAKG;AACH,qBAAa,QAAQ;IACnB;;;;;;;;;;;OAWG;WACW,cAAc,CAAC,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAM7E;;;;;;;;;;;;;;;;;OAiBG;WACW,oBAAoB,CAAC,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAOnF;;;;OAIG;WACW,uBAAuB,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,qBAAqB;IAcjF;;;;OAIG;WACW,YAAY,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,UAAU;IAW3D;;;;;OAKG;WACW,sBAAsB,CAAC,WAAW,EAAE,WAAW,GAAG,qBAAqB,EAAE;IAgBvF;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,MAAM,CAAC,oBAAoB,CAAC,UAAU,EAAE,MAAM,GAAG,cAAc;IAU/D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAuCG;WACW,iBAAiB,CAAC,YAAY,EAAE,MAAM,GAAG,cAAc;CA8CtE"}
1
+ {"version":3,"file":"appendix.d.ts","sourceRoot":"","sources":["../../../src/utils/appendix.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,WAAW,EACX,UAAU,EACV,qBAAqB,EAAC,MAAM,YAAY,CAAC;AAO3C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAE5D;;;;;GAKG;AACH,qBAAa,QAAQ;IACnB;;;;;;;;;;;OAWG;WACW,cAAc,CAAC,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAM7E;;;;;;;;;;;;;;;;;OAiBG;WACW,oBAAoB,CAAC,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAOnF;;;;OAIG;WACW,uBAAuB,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,qBAAqB;IAcjF;;;;OAIG;WACW,YAAY,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,UAAU;IAW3D;;;;;OAKG;WACW,sBAAsB,CAAC,WAAW,EAAE,WAAW,GAAG,qBAAqB,EAAE;IAgBvF;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,MAAM,CAAC,oBAAoB,CAAC,UAAU,EAAE,MAAM,GAAG,cAAc;IAU/D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAwCG;WACW,iBAAiB,CAAC,YAAY,EAAE,MAAM,GAAG,cAAc;CA8CtE"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@did-btcr2/method",
3
- "version": "0.59.0",
3
+ "version": "0.61.0",
4
4
  "type": "module",
5
5
  "description": "Reference implementation for the did:btcr2 DID method written in TypeScript and JavaScript. did:btcr2 is a censorship resistant DID Method using the Bitcoin blockchain as a Verifiable Data Registry to announce changes to the DID document. This is the core method implementation for the did-btcr2-js monorepo.",
6
6
  "main": "./dist/cjs/index.js",
@@ -69,11 +69,11 @@
69
69
  "@scure/base": "^1.2.6",
70
70
  "@scure/btc-signer": "^1.8.1",
71
71
  "@web5/dids": "^1.2.0",
72
- "@did-btcr2/bitcoin": "^0.11.0",
73
72
  "@did-btcr2/cryptosuite": "^10.0.0",
74
- "@did-btcr2/common": "^9.4.0",
75
73
  "@did-btcr2/keypair": "^0.13.1",
76
- "@did-btcr2/smt": "^0.3.0"
74
+ "@did-btcr2/smt": "^0.3.0",
75
+ "@did-btcr2/bitcoin": "^0.11.0",
76
+ "@did-btcr2/common": "^9.4.0"
77
77
  },
78
78
  "devDependencies": {
79
79
  "@eslint/js": "^9.39.4",
@@ -1,6 +1,39 @@
1
1
  import type { PatchOperation } from '@did-btcr2/common';
2
2
  import type { DataIntegrityProofObject, DataIntegrityProofOptions } from '@did-btcr2/cryptosuite';
3
3
 
4
+ /**
5
+ * The `@context` array of a BTCR2 Update. The specification pins the members and their
6
+ * order. The array is part of the bytes that the JSON Document Hashing algorithm hashes
7
+ * and that the proof signs, so an update with a different array is a different update,
8
+ * and a conformant resolver rejects it. The proof of a signed update carries the same
9
+ * array. See
10
+ * {@link https://dcdpr.github.io/did-btcr2/data-structures.html#btcr2-unsigned-update | BTCR2 Unsigned Update (data structure)}.
11
+ */
12
+ export const BTCR2_UPDATE_CONTEXT = Object.freeze([
13
+ 'https://w3id.org/json-ld-patch/v1',
14
+ 'https://w3id.org/zcap/v1',
15
+ 'https://w3id.org/security/data-integrity/v2',
16
+ 'https://btcr2.dev/context/v1',
17
+ ] as const);
18
+
19
+ /**
20
+ * True if `value` is an array with the same context URLs as `expected`, in the same
21
+ * order, and with no other member. This is the equality rule of the specification for
22
+ * two `@context` arrays. `expected` defaults to {@link BTCR2_UPDATE_CONTEXT}.
23
+ *
24
+ * @param {unknown} value The `@context` value to check.
25
+ * @param {readonly string[]} expected The array that `value` must equal.
26
+ * @returns {boolean} True if the two arrays are equal.
27
+ */
28
+ export function isBtcr2UpdateContext(
29
+ value: unknown,
30
+ expected: readonly string[] = BTCR2_UPDATE_CONTEXT
31
+ ): value is string[] {
32
+ return Array.isArray(value)
33
+ && value.length === expected.length
34
+ && value.every((url, i) => url === expected[i]);
35
+ }
36
+
4
37
  /**
5
38
  * A {@link https://dcdpr.github.io/did-btcr2/terminology.html#btcr2-update | BTCR2 Update} without a data integrity proof.
6
39
  * See {@link https://dcdpr.github.io/did-btcr2/data-structures.html#btcr2-unsigned-update | BTCR2 Unsigned Update (data structure)}.
@@ -12,8 +45,8 @@ import type { DataIntegrityProofObject, DataIntegrityProofOptions } from '@did-b
12
45
  */
13
46
  export type UnsignedBTCR2Update = {
14
47
  /**
15
- * JSON-LD context URIs for interpreting this payload, including contexts
16
- * for ZCAP (capabilities), Data Integrity proofs, and JSON-LD patch ops.
48
+ * The JSON-LD context array of the update: exactly the members of
49
+ * {@link BTCR2_UPDATE_CONTEXT}, in that order.
17
50
  */
18
51
  '@context': string[];
19
52
 
@@ -76,7 +109,7 @@ export type BTCR2Update = UnsignedBTCR2Update | SignedBTCR2Update;
76
109
  * {@link https://dcdpr.github.io/did-btcr2/data-structures.html#data-integrity-config | Data Integrity Config}.
77
110
  */
78
111
  export type Btcr2DataIntegrityConfig = DataIntegrityProofOptions & {
79
- /** JSON-LD context URIs for the proof (ZCAP, Data Integrity, JSON-LD patch). */
112
+ /** The same array as the update `@context`: {@link BTCR2_UPDATE_CONTEXT}. */
80
113
  '@context': string[];
81
114
 
82
115
  /** The root capability being invoked, e.g. `urn:zcap:root:<urlencoded-did>`. */
@@ -1,8 +1,19 @@
1
1
  import type { Bytes, DocumentBytes, KeyBytes, SchnorrKeyPairObject } from '@did-btcr2/common';
2
- import { BitcoinNetworkNames, IdentifierError, IdentifierTypes, INVALID_DID, METHOD_NOT_SUPPORTED } from '@did-btcr2/common';
2
+ import {
3
+ BitcoinNetworkNames,
4
+ canonicalHashBytes,
5
+ IdentifierError,
6
+ IdentifierTypes,
7
+ INVALID_DID,
8
+ METHOD_NOT_SUPPORTED
9
+ } from '@did-btcr2/common';
3
10
  import { CompressedSecp256k1PublicKey, SchnorrKeyPair } from '@did-btcr2/keypair';
4
- import { bech32m } from '@scure/base';
11
+ import { equalBytes } from '@noble/curves/utils.js';
12
+ import { bech32m, hex } from '@scure/base';
5
13
  import type { DidCreateOptions } from '../did-btcr2.js';
14
+ // did-document.js imports this module. Both modules use the other only inside a
15
+ // method body, never at module evaluation, so the cycle is safe in ESM and CJS.
16
+ import { GenesisDocument, ID_PLACEHOLDER_VALUE } from '../utils/did-document.js';
6
17
 
7
18
  /**
8
19
  * Components of a did:btcr2 identifier.
@@ -28,6 +39,69 @@ export interface IdentifierComponents {
28
39
  network: string;
29
40
  genesisBytes: Bytes;
30
41
  }
42
+
43
+ /**
44
+ * The name of one check that {@link Identifier.validate} runs. The names are in run order.
45
+ * @typedef {string} IdentifierCheckName
46
+ */
47
+ export type IdentifierCheckName =
48
+ | 'prefix'
49
+ | 'lowercase'
50
+ | 'bech32m'
51
+ | 'version'
52
+ | 'network'
53
+ | 'genesisBytes'
54
+ | 'roundTrip'
55
+ | 'genesisBytesMatch'
56
+ | 'genesisDocument';
57
+
58
+ /**
59
+ * The result of one check that {@link Identifier.validate} ran.
60
+ * @interface IdentifierCheck
61
+ * @property {IdentifierCheckName} name The name of the check.
62
+ * @property {boolean} ok True if the check passed.
63
+ * @property {string} [detail] What the check found.
64
+ */
65
+ export interface IdentifierCheck {
66
+ name: IdentifierCheckName;
67
+ ok: boolean;
68
+ detail?: string;
69
+ }
70
+
71
+ /**
72
+ * Options for {@link Identifier.validate}.
73
+ * @interface IdentifierValidateOptions
74
+ * @property {Bytes} [genesisBytes] The genesis bytes that the identifier must encode: the 33-byte
75
+ * compressed public key of a KEY identifier, or the 32-byte genesis document hash of an EXTERNAL
76
+ * identifier. If present, the report includes the `genesisBytesMatch` check.
77
+ * @property {object} [genesisDocument] The genesis document of an EXTERNAL identifier.
78
+ * If present, the report includes the `genesisDocument` check.
79
+ */
80
+ export interface IdentifierValidateOptions {
81
+ genesisBytes?: Bytes;
82
+ genesisDocument?: object;
83
+ }
84
+
85
+ /**
86
+ * The report that {@link Identifier.validate} returns.
87
+ * @interface IdentifierReport
88
+ * @property {string} did The identifier that was verified.
89
+ * @property {boolean} valid True if every check passed.
90
+ * @property {IdentifierTypes} [idType] The identifier type, known after the `bech32m` check.
91
+ * @property {string} [network] The network name, known after the `network` check.
92
+ * @property {Array<IdentifierCheck>} checks The checks that ran, in run order. The run stops at the first failed check.
93
+ */
94
+ export interface IdentifierReport {
95
+ did: string;
96
+ valid: boolean;
97
+ idType?: IdentifierTypes;
98
+ network?: string;
99
+ checks: Array<IdentifierCheck>;
100
+ }
101
+
102
+ /** The prefix of every did:btcr2 identifier. */
103
+ const DID_PREFIX = 'did:btcr2:';
104
+
31
105
  /**
32
106
  * Implements {@link https://dcdpr.github.io/did-btcr2/#syntax | 3 Syntax}.
33
107
  * A did:btcr2 DID consists of a did:btcr2 prefix, followed by an id-bech32 value, which is a Bech32m encoding of:
@@ -106,7 +180,7 @@ export class Identifier {
106
180
  // byte, then append genesisBytes. Bech32m-encode the result.
107
181
  const firstByte = ((version - 1) << 4) | networkValue;
108
182
  const dataBytes = new Uint8Array([firstByte, ...genesisBytes]);
109
- return `did:btcr2:${bech32m.encodeFromBytes(hrp, dataBytes)}`;
183
+ return `${DID_PREFIX}${bech32m.encodeFromBytes(hrp, dataBytes)}`;
110
184
  }
111
185
 
112
186
  /**
@@ -143,23 +217,29 @@ export class Identifier {
143
217
  throw new IdentifierError(`Invalid method-specific id: ${identifier}`, INVALID_DID, { identifier });
144
218
  }
145
219
 
146
- // 6. Bech32m-decode the id into its hrp and dataBytes.
220
+ // 6. The method-specific id MUST be lowercase. A Bech32m decoder accepts an all-uppercase
221
+ // string, so this check runs before the Bech32m step.
222
+ if (encoded !== encoded.toLowerCase()) {
223
+ throw new IdentifierError(`Invalid method-specific id (must be lowercase): ${identifier}`, INVALID_DID, { identifier });
224
+ }
225
+
226
+ // 7. Bech32m-decode the id into its hrp and dataBytes.
147
227
  const { prefix: hrp, bytes: dataBytes } = bech32m.decodeToBytes(encoded);
148
228
 
149
- // 7. The hrp MUST be "k" (KEY) or "x" (EXTERNAL).
229
+ // 8. The hrp MUST be "k" (KEY) or "x" (EXTERNAL).
150
230
  if (!['x', 'k'].includes(hrp)) {
151
231
  throw new IdentifierError(`Invalid hrp: ${hrp}`, INVALID_DID, { identifier });
152
232
  }
153
233
 
154
- // 8. There MUST be at least one byte to read btcr2_version and network_value from.
234
+ // 9. There MUST be at least one byte to read btcr2_version and network_value from.
155
235
  if (!dataBytes || dataBytes.length < 1) {
156
236
  throw new IdentifierError(`Failed to decode id: ${encoded}`, INVALID_DID, { identifier });
157
237
  }
158
238
 
159
- // 9. Map hrp to idType.
239
+ // 10. Map hrp to idType.
160
240
  const idType = hrp === 'k' ? 'KEY' : 'EXTERNAL';
161
241
 
162
- // 10. btcr2_version is the high nibble of the first byte and MUST be 0, which is version_number 1.
242
+ // 11. btcr2_version is the high nibble of the first byte and MUST be 0, which is version_number 1.
163
243
  // The version-extension scheme (a leading nibble of 0xF chaining into further bytes) is reserved
164
244
  // and not valid under v1, so any non-zero high nibble (0x1 through 0xF) is a malformed or forged
165
245
  // identifier and is rejected here. Reading a single flat nibble (rather than looping on 0xF) is
@@ -171,23 +251,20 @@ export class Identifier {
171
251
  }
172
252
  const version = 1;
173
253
 
174
- // 11. network_value is the low nibble of the first byte. 0-5 map to named networks; 12-14 are custom
175
- // networks (returned as the numeric values 1-3); 6-11 and 15 are reserved/out-of-range and rejected.
254
+ // 12. network_value is the low nibble of the first byte. 0-5 map to named networks. 6-11 are
255
+ // reserved. 12-15 are custom networks; this implementation supports no custom network, so the
256
+ // decoder rejects them, as the specification recommends (ADR 107).
176
257
  const networkValue = dataBytes[0] & 0x0F;
177
- const networkName = BitcoinNetworkNames[networkValue] as string | undefined;
178
- let network: string | number;
179
- if (typeof networkName === 'string') {
180
- network = networkName;
181
- } else if (networkValue >= 12 && networkValue <= 14) {
182
- network = networkValue - 11;
183
- } else {
184
- throw new IdentifierError(`Invalid network: ${networkValue}`, INVALID_DID, { identifier });
258
+ const network = BitcoinNetworkNames[networkValue] as string | undefined;
259
+ if (typeof network !== 'string') {
260
+ const reason = networkValue >= 12 ? 'custom network not supported' : 'reserved';
261
+ throw new IdentifierError(`Invalid network (${reason}): ${networkValue}`, INVALID_DID, { identifier });
185
262
  }
186
263
 
187
- // 12. genesisBytes is everything after the first byte.
264
+ // 13. genesisBytes is everything after the first byte.
188
265
  const genesisBytes = dataBytes.slice(1);
189
266
 
190
- // 13. genesisBytes MUST match the identifier type: a valid compressed secp256k1 public key for KEY,
267
+ // 14. genesisBytes MUST match the identifier type: a valid compressed secp256k1 public key for KEY,
191
268
  // or a 32-byte hash for EXTERNAL.
192
269
  if (idType === 'KEY') {
193
270
  try {
@@ -199,10 +276,178 @@ export class Identifier {
199
276
  throw new IdentifierError(`Invalid genesisBytes: ${genesisBytes}`, INVALID_DID, { identifier });
200
277
  }
201
278
 
202
- // 14. Return idType, hrp, version, network, and genesisBytes.
279
+ // 15. Return idType, hrp, version, network, and genesisBytes.
203
280
  return { idType, hrp, version, network, genesisBytes } as DidComponents;
204
281
  }
205
282
 
283
+ /**
284
+ * Validates that a did:btcr2 identifier conforms to
285
+ * {@link https://dcdpr.github.io/did-btcr2/#didbtcr2-identifier-decoding | 3.3 did:btcr2 Identifier Decoding}
286
+ * and returns a report of the checks. The method does not throw on an invalid identifier.
287
+ *
288
+ * The checks run in this order: `prefix`, `lowercase`, `bech32m`, `version`, `network`,
289
+ * `genesisBytes`, `roundTrip`, `genesisBytesMatch`, and `genesisDocument`. The run stops at the
290
+ * first failed check. The `network` check accepts a named network only: a reserved value (6 to
291
+ * 11) and a custom value (12 to 15) fail, because this implementation supports no custom network.
292
+ * The `genesisBytesMatch` check runs only if `options.genesisBytes` is present: the supplied bytes
293
+ * must equal the genesis bytes of the identifier, for a KEY or an EXTERNAL identifier. The
294
+ * `genesisDocument` check runs only if `options.genesisDocument` is present. For an EXTERNAL
295
+ * identifier it confirms that the document is a valid Genesis Document and that its canonical
296
+ * SHA-256 hash equals the genesis bytes. For a KEY identifier it fails.
297
+ *
298
+ * @param {string} identifier The did:btcr2 identifier to validate.
299
+ * @param {IdentifierValidateOptions} [options] The validation options.
300
+ * @returns {IdentifierReport} The report. See {@link IdentifierReport} for details.
301
+ */
302
+ static validate(identifier: string, options: IdentifierValidateOptions = {}): IdentifierReport {
303
+ const checks: Array<IdentifierCheck> = [];
304
+ const pass = (name: IdentifierCheckName, detail?: string): void => {
305
+ checks.push(detail === undefined ? { name, ok: true } : { name, ok: true, detail });
306
+ };
307
+ const fail = (name: IdentifierCheckName, detail: string, partial: Partial<IdentifierReport> = {}): IdentifierReport => {
308
+ checks.push({ name, ok: false, detail });
309
+ return { did: identifier, valid: false, ...partial, checks };
310
+ };
311
+
312
+ // prefix: the string is "did:btcr2:" followed by a non-empty method-specific id.
313
+ if (typeof identifier !== 'string') {
314
+ return fail('prefix', 'The identifier is not a string.');
315
+ }
316
+ const parts = identifier.split(':');
317
+ if (parts.length !== 3 || parts[0] !== 'did' || parts[1] !== 'btcr2') {
318
+ return fail('prefix', `The identifier must be "${DID_PREFIX}" followed by the method-specific id.`);
319
+ }
320
+ const encoded = parts[2];
321
+ if (encoded.length === 0) {
322
+ return fail('prefix', 'The method-specific id is empty.');
323
+ }
324
+ pass('prefix');
325
+
326
+ // lowercase: the method-specific id is lowercase.
327
+ if (encoded !== encoded.toLowerCase()) {
328
+ return fail('lowercase', 'The method-specific id must be lowercase.');
329
+ }
330
+ pass('lowercase');
331
+
332
+ // bech32m: the id decodes, the hrp is "k" or "x", and the data bytes are not empty.
333
+ let hrp: string;
334
+ let dataBytes: Uint8Array;
335
+ try {
336
+ ({ prefix: hrp, bytes: dataBytes } = bech32m.decodeToBytes(encoded));
337
+ } catch (error: unknown) {
338
+ return fail('bech32m', `Bech32m decoding failed: ${error instanceof Error ? error.message : String(error)}`);
339
+ }
340
+ if (hrp !== 'k' && hrp !== 'x') {
341
+ return fail('bech32m', `The hrp must be "k" or "x", got "${hrp}".`);
342
+ }
343
+ const idType = hrp === 'k' ? IdentifierTypes.KEY : IdentifierTypes.EXTERNAL;
344
+ if (dataBytes.length < 1) {
345
+ return fail('bech32m', 'The data bytes are empty.', { idType });
346
+ }
347
+ pass('bech32m', `hrp "${hrp}", ${dataBytes.length} data bytes`);
348
+
349
+ // version: btcr2_version (the high nibble of the first byte) is 0.
350
+ const btcr2Version = dataBytes[0] >>> 4;
351
+ if (btcr2Version !== 0) {
352
+ return fail('version', `btcr2_version must be 0, got ${btcr2Version}.`, { idType });
353
+ }
354
+ pass('version', 'btcr2_version 0 (version_number 1)');
355
+
356
+ // network: network_value (the low nibble of the first byte) names a network.
357
+ const networkValue = dataBytes[0] & 0x0F;
358
+ const network = BitcoinNetworkNames[networkValue] as string | undefined;
359
+ if (typeof network !== 'string') {
360
+ const detail = networkValue >= 12
361
+ ? `network_value ${networkValue} is a custom network, not supported by this implementation.`
362
+ : `network_value ${networkValue} is reserved.`;
363
+ return fail('network', detail, { idType });
364
+ }
365
+ pass('network', `network_value ${networkValue} (${network})`);
366
+
367
+ // genesisBytes: a 33-byte SEC compressed secp256k1 public key (KEY) or a 32-byte hash (EXTERNAL).
368
+ const genesisBytes = dataBytes.slice(1);
369
+ if (idType === IdentifierTypes.KEY) {
370
+ try {
371
+ new CompressedSecp256k1PublicKey(genesisBytes);
372
+ } catch {
373
+ return fail(
374
+ 'genesisBytes',
375
+ `Expected a 33-byte SEC compressed secp256k1 public key, got ${genesisBytes.length} bytes that are not a valid key.`,
376
+ { idType, network }
377
+ );
378
+ }
379
+ pass('genesisBytes', '33-byte SEC compressed secp256k1 public key');
380
+ } else {
381
+ if (genesisBytes.length !== 32) {
382
+ return fail('genesisBytes', `Expected a 32-byte SHA-256 hash, got ${genesisBytes.length} bytes.`, { idType, network });
383
+ }
384
+ pass('genesisBytes', '32-byte SHA-256 hash');
385
+ }
386
+
387
+ // roundTrip: encoding the decoded components reproduces the identifier.
388
+ let reEncoded: string;
389
+ try {
390
+ reEncoded = Identifier.encode(genesisBytes, { idType, version: 1, network: network as DidCreateOptions['network'] });
391
+ } catch (error: unknown) {
392
+ return fail('roundTrip', `Re-encoding failed: ${error instanceof Error ? error.message : String(error)}`, { idType, network });
393
+ }
394
+ if (reEncoded !== identifier) {
395
+ return fail('roundTrip', `Re-encoding produced "${reEncoded}".`, { idType, network });
396
+ }
397
+ pass('roundTrip');
398
+
399
+ // genesisBytesMatch: only if the caller supplied genesis bytes.
400
+ if (options.genesisBytes !== undefined) {
401
+ const supplied = options.genesisBytes;
402
+ if (!(supplied instanceof Uint8Array)) {
403
+ return fail('genesisBytesMatch', 'The supplied genesis bytes are not a Uint8Array.', { idType, network });
404
+ }
405
+ if (supplied.length !== genesisBytes.length) {
406
+ return fail(
407
+ 'genesisBytesMatch',
408
+ `Expected ${genesisBytes.length} genesis bytes for a ${idType} identifier, got ${supplied.length}.`,
409
+ { idType, network }
410
+ );
411
+ }
412
+ if (!equalBytes(supplied, genesisBytes)) {
413
+ return fail(
414
+ 'genesisBytesMatch',
415
+ `The supplied genesis bytes ${hex.encode(supplied)} do not equal the genesis bytes of the identifier ${hex.encode(genesisBytes)}.`,
416
+ { idType, network }
417
+ );
418
+ }
419
+ pass('genesisBytesMatch', 'The supplied genesis bytes equal the genesis bytes of the identifier.');
420
+ }
421
+
422
+ // genesisDocument: only if the caller supplied a document.
423
+ if (options.genesisDocument !== undefined) {
424
+ const document = options.genesisDocument;
425
+ if (idType === IdentifierTypes.KEY) {
426
+ return fail('genesisDocument', 'A KEY identifier has no genesis document.', { idType, network });
427
+ }
428
+ const id = (document as { id?: unknown }).id;
429
+ if (id !== ID_PLACEHOLDER_VALUE) {
430
+ return fail('genesisDocument', `The genesis document id must be "${ID_PLACEHOLDER_VALUE}", got ${JSON.stringify(id)}.`, { idType, network });
431
+ }
432
+ try {
433
+ GenesisDocument.fromJSON(document);
434
+ } catch (error: unknown) {
435
+ return fail('genesisDocument', `Invalid genesis document: ${error instanceof Error ? error.message : String(error)}`, { idType, network });
436
+ }
437
+ const documentHash = canonicalHashBytes(document);
438
+ if (!equalBytes(documentHash, genesisBytes)) {
439
+ return fail(
440
+ 'genesisDocument',
441
+ `The genesis document hash ${hex.encode(documentHash)} does not equal the genesis bytes ${hex.encode(genesisBytes)}.`,
442
+ { idType, network }
443
+ );
444
+ }
445
+ pass('genesisDocument', 'The genesis document hashes to the genesis bytes.');
446
+ }
447
+
448
+ return { did: identifier, valid: true, idType, network, checks };
449
+ }
450
+
206
451
  /**
207
452
  * Generates a new did:btcr2 identifier based on a newly generated key pair.
208
453
  * @returns {string} The new did:btcr2 identifier.
@@ -249,4 +494,4 @@ export class Identifier {
249
494
  return false;
250
495
  }
251
496
  }
252
- }
497
+ }
@@ -20,6 +20,7 @@ import type {
20
20
  SignedBTCR2Update,
21
21
  UnsignedBTCR2Update
22
22
  } from './btcr2-update.js';
23
+ import { BTCR2_UPDATE_CONTEXT, isBtcr2UpdateContext } from './btcr2-update.js';
23
24
  import {
24
25
  BIP340Cryptosuite,
25
26
  BIP340DataIntegrityProof,
@@ -608,7 +609,8 @@ export class Resolver {
608
609
  }
609
610
 
610
611
  /**
611
- * Implements subsection {@link https://dcdpr.github.io/did-btcr2/operations/resolve.html#apply-update | 7.2.f.3 Apply Update}.
612
+ * Implements subsection {@link https://dcdpr.github.io/did-btcr2/operations/resolve.html#apply-update | 7.2.f.3 Apply Update}
613
+ * and its step {@link https://dcdpr.github.io/did-btcr2/operations/resolve.html#check-update-proof | Check update.proof}.
612
614
  * @param {DidDocument} currentDocument The current DID Document to apply the update to.
613
615
  * @param {SignedBTCR2Update} update The BTCR2 Signed Update to apply.
614
616
  * @returns {DidDocument} The updated DID Document after applying the update.
@@ -618,6 +620,24 @@ export class Resolver {
618
620
  currentDocument: DidDocument,
619
621
  update: SignedBTCR2Update
620
622
  ): DidDocument {
623
+ // Spec "Check update.proof": the update @context must be the array that the BTCR2
624
+ // Unsigned Update data structure pins, and the proof @context must equal it, member
625
+ // for member and in order. The array is inside the hashed and signed bytes, so an
626
+ // update with another array is a different update. The check runs before signature
627
+ // verification so that the failure names the array and not the signature.
628
+ if(!isBtcr2UpdateContext(update['@context'])) {
629
+ throw new ResolveError(
630
+ 'Invalid update: @context is not the array the specification pins for a BTCR2 Update',
631
+ INVALID_DID_UPDATE, { context: update['@context'], expected: [ ...BTCR2_UPDATE_CONTEXT ] }
632
+ );
633
+ }
634
+ if(!isBtcr2UpdateContext(update.proof?.['@context'], update['@context'])) {
635
+ throw new ResolveError(
636
+ 'Invalid update: proof @context does not equal the update @context',
637
+ INVALID_DID_UPDATE, { proofContext: update.proof?.['@context'], context: update['@context'] }
638
+ );
639
+ }
640
+
621
641
  // Get the capability id from the to update proof.
622
642
  const capabilityId = update.proof?.capability;
623
643
  // Since this field is optional, check that it exists