@did-btcr2/common 3.0.0 → 3.1.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,5 +1,4 @@
1
1
  import { Bytes, HashHex } from './types.js';
2
- export declare const ID_PLACEHOLDER_VALUE = "did:btcr2:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
3
2
  export declare const OP_RETURN = 106;
4
3
  export declare const OP_PUSH32 = 32;
5
4
  export declare const VALID_HRP: string[];
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAE5C,eAAO,MAAM,oBAAoB,2EAA2E,CAAC;AAC7G,eAAO,MAAM,SAAS,MAAO,CAAC;AAC9B,eAAO,MAAM,SAAS,KAAO,CAAC;AAC9B,eAAO,MAAM,SAAS,UAAa,CAAC;AACpC,eAAO,MAAM,oBAAoB,YAAY,CAAC;AAC9C,eAAO,MAAM,oBAAoB,KAAK,CAAC;AACvC,eAAO,MAAM,gBAAgB,MAAM,CAAC;AACpC,eAAO,MAAM,uBAAuB,MAAM,CAAC;AAC3C,eAAO,MAAM,oBAAoB;;;;;;CAMhC,CAAC;AACF,eAAO,MAAM,mBAAmB;;CAAoC,CAAC;AACrE,eAAO,MAAM,kBAAkB;;;;;;CAAuB,CAAC;AACvD,eAAO,MAAM,2BAA2B,IAAI,CAAC;AAE7C;;;GAGG;AACH,wBAAgB,mBAAmB,IAAI,OAAO,oBAAoB,CAOjE;AAGD,eAAO,MAAM,kCAAkC,EAAE,KAAoC,CAAC;AAEtF,eAAO,MAAM,uCAAuC,EAAE,OAAgE,CAAC;AAEvH,eAAO,MAAM,kCAAkC,EAAE,KAAoC,CAAC;AAEtF,eAAO,MAAM,uCAAuC,EAAE,OAAgE,CAAC;AAEvH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,MAAM,mBAAmB,sCAAsC,CAAC;AACvE,eAAO,MAAM,eAAe,0CAA0C,CAAC;AACvE,eAAO,MAAM,qBAAqB,uCAAuC,CAAC;AAC1E,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgC3B,CAAC;AAEF,eAAO,MAAM,0BAA0B,UAGtC,CAAC;AAEF,eAAO,MAAM,sBAAsB,UAGlC,CAAC;AAEF,eAAO,MAAM,gCAAgC,UAK5C,CAAC"}
@@ -52,12 +52,14 @@ export declare enum MethodErrorCode {
52
52
  LATE_PUBLISHING_ERROR = "LATE_PUBLISHING_ERROR",
53
53
  /** The sidecar data in the DID Update Payload was invalid. */
54
54
  INVALID_SIDECAR_DATA = "INVALID_SIDECAR_DATA",
55
- /** The proof is missing or has a malformed challenge field. */
56
- INVALID_CHALLENGE_ERROR = "INVALID_CHALLENGE_ERROR",
55
+ /** The update data required for resolution is missing. */
56
+ MISSING_UPDATE_DATA = "MISSING_UPDATE_DATA",
57
+ /** The update is missing or has a malformed field(s). */
58
+ INVALID_UPDATE = "INVALID_UPDATE",
57
59
  /** The proof is missing or has a malformed domain field. */
58
60
  INVALID_DOMAIN_ERROR = "INVALID_DOMAIN_ERROR"
59
61
  }
60
- export declare const INVALID_DID: MethodErrorCode, METHOD_NOT_SUPPORTED: MethodErrorCode, INTERNAL_ERROR: MethodErrorCode, INVALID_DID_DOCUMENT: MethodErrorCode, INVALID_DID_UPDATE: MethodErrorCode, INVALID_DID_DOCUMENT_LENGTH: MethodErrorCode, INVALID_DID_URL: MethodErrorCode, INVALID_PREVIOUS_DID_PROOF: MethodErrorCode, INVALID_PUBLIC_KEY: MethodErrorCode, INVALID_PUBLIC_KEY_MULTIBASE: MethodErrorCode, INVALID_PUBLIC_KEY_LENGTH: MethodErrorCode, INVALID_PUBLIC_KEY_TYPE: MethodErrorCode, INVALID_SIGNATURE: MethodErrorCode, NOT_FOUND: MethodErrorCode, REPRESENTATION_NOT_SUPPORTED: MethodErrorCode, UNSUPPORTED_PUBLIC_KEY_TYPE: MethodErrorCode, PROOF_VERIFICATION_ERROR: MethodErrorCode, PROOF_GENERATION_ERROR: MethodErrorCode, PROOF_SERIALIZATION_ERROR: MethodErrorCode, PROOF_PARSING_ERROR: MethodErrorCode, VERIFICATION_METHOD_ERROR: MethodErrorCode, LATE_PUBLISHING_ERROR: MethodErrorCode, INVALID_SIDECAR_DATA: MethodErrorCode, INVALID_CHALLENGE_ERROR: MethodErrorCode, INVALID_DOMAIN_ERROR: MethodErrorCode;
62
+ export declare const INVALID_DID: MethodErrorCode, METHOD_NOT_SUPPORTED: MethodErrorCode, INTERNAL_ERROR: MethodErrorCode, INVALID_DID_DOCUMENT: MethodErrorCode, INVALID_DID_UPDATE: MethodErrorCode, INVALID_DID_DOCUMENT_LENGTH: MethodErrorCode, INVALID_DID_URL: MethodErrorCode, INVALID_PREVIOUS_DID_PROOF: MethodErrorCode, INVALID_PUBLIC_KEY: MethodErrorCode, INVALID_PUBLIC_KEY_MULTIBASE: MethodErrorCode, INVALID_PUBLIC_KEY_LENGTH: MethodErrorCode, INVALID_PUBLIC_KEY_TYPE: MethodErrorCode, INVALID_SIGNATURE: MethodErrorCode, NOT_FOUND: MethodErrorCode, REPRESENTATION_NOT_SUPPORTED: MethodErrorCode, UNSUPPORTED_PUBLIC_KEY_TYPE: MethodErrorCode, PROOF_VERIFICATION_ERROR: MethodErrorCode, PROOF_GENERATION_ERROR: MethodErrorCode, PROOF_SERIALIZATION_ERROR: MethodErrorCode, PROOF_PARSING_ERROR: MethodErrorCode, VERIFICATION_METHOD_ERROR: MethodErrorCode, LATE_PUBLISHING_ERROR: MethodErrorCode, INVALID_SIDECAR_DATA: MethodErrorCode, MISSING_UPDATE_DATA: MethodErrorCode, INVALID_UPDATE: MethodErrorCode, INVALID_DOMAIN_ERROR: MethodErrorCode;
61
63
  export type ErrorOptions = {
62
64
  type?: string;
63
65
  name?: string;
@@ -77,6 +79,12 @@ export declare class DidMethodError extends Error {
77
79
  export declare class MethodError extends DidMethodError {
78
80
  constructor(message: string, type: string, data?: Record<string, any>);
79
81
  }
82
+ export declare class IdentifierError extends DidMethodError {
83
+ constructor(message: string, type?: string, data?: Record<string, any>);
84
+ }
85
+ export declare class UpdateError extends DidMethodError {
86
+ constructor(message: string, type?: string, data?: Record<string, any>);
87
+ }
80
88
  export declare class ResolveError extends DidMethodError {
81
89
  constructor(message: string, type?: string, data?: Record<string, any>);
82
90
  }
@@ -89,6 +97,9 @@ export declare class DidDocumentError extends DidMethodError {
89
97
  export declare class CryptosuiteError extends DidMethodError {
90
98
  constructor(message: string, type?: string, data?: Record<string, any>);
91
99
  }
100
+ export declare class DataIntegrityProofError extends DidMethodError {
101
+ constructor(message: string, type?: string, data?: Record<string, any>);
102
+ }
92
103
  export declare class KeyPairError extends DidMethodError {
93
104
  constructor(message: string, type?: string, data?: Record<string, any>);
94
105
  }
@@ -1 +1 @@
1
- {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/errors.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,oBAAY,eAAe;IACzB,yDAAyD;IACzD,WAAW,gBAAgB;IAE3B,sGAAsG;IACtG,oBAAoB,yBAAyB;IAE7C,uEAAuE;IACvE,cAAc,mBAAmB;IAEjC,kEAAkE;IAClE,oBAAoB,yBAAyB;IAE7C,gEAAgE;IAChE,kBAAkB,uBAAuB;IAEzC,2EAA2E;IAC3E,2BAA2B,gCAAgC;IAE3D,2FAA2F;IAC3F,eAAe,oBAAoB;IAEnC,mDAAmD;IACnD,0BAA0B,+BAA+B;IAEzD,gEAAgE;IAChE,kBAAkB,uBAAuB;IAEzC,wFAAwF;IACxF,4BAA4B,iCAAiC;IAE7D,yEAAyE;IACzE,yBAAyB,8BAA8B;IAEvD,sEAAsE;IACtE,uBAAuB,4BAA4B;IAEnD,iEAAiE;IACjE,iBAAiB,sBAAsB;IAEvC,qDAAqD;IACrD,mHAAmH;IACnH,SAAS,cAAc;IAEvB;;;OAGG;IAC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IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;CAGrF;AAED,qBAAa,oBAAqB,SAAQ,cAAc;gBAC1C,OAAO,EAAE,MAAM,EAAE,IAAI,GAAE,MAA+B,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;CAG/F;AAED,qBAAa,uBAAwB,SAAQ,cAAc;gBAC7C,OAAO,EAAE,MAAM,EAAE,IAAI,GAAE,MAAkC,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;CAGlG;AAED,qBAAa,uBAAwB,SAAQ,cAAc;gBAC7C,OAAO,EAAE,MAAM,EAAE,IAAI,GAAE,MAAkC,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;CAGlG;AAED,qBAAa,qBAAsB,SAAQ,cAAc;gBAC3C,OAAO,EAAE,MAAM,EAAE,IAAI,GAAE,MAAgC,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;CAGhG"}
@@ -9,274 +9,3 @@ export interface PatchOperation {
9
9
  value?: unknown;
10
10
  from?: string;
11
11
  }
12
- /**
13
- * The unsigned payload object containing instructions for how to update a
14
- * did:btcr2 DID Document. Once signed, it becomes a
15
- * {@link DidUpdateInvocation | DID Update Invocation}
16
- *
17
- * DID BTCR2
18
- * {@link https://dcdpr.github.io/did-btcr2/#construct-did-update-payload | 4.3.1 Construct DID Update Payload}.
19
- *
20
- * Found in DID BTCR2 Specification {@link https://dcdpr.github.io/did-btcr2/#dereference-root-capability-identifier | Section 9.4.2}
21
- * @example
22
- * ```
23
- * {
24
- * "@context": [
25
- * "https://w3id.org/zcap/v1",
26
- * "https://w3id.org/security/data-integrity/v2",
27
- * "https://w3id.org/json-ld-patch/v1"
28
- * ],
29
- * "patch": [
30
- * {
31
- * "op": "add",
32
- * "path": "/service/4",
33
- * "value": {
34
- * "id": "#linked-domain",
35
- * "type": "LinkedDomains",
36
- * "serviceEndpoint": "https://contact-me.com"
37
- * }
38
- * }
39
- * ],
40
- * "proof":{
41
- * "type": "DataIntegrityProof,
42
- * "cryptosuite": "schnorr-secp256k1-jcs-2025,
43
- * "verificationMethod": "did:btcr2:k1qqpuwwde82nennsavvf0lqfnlvx7frrgzs57lchr02q8mz49qzaaxmqphnvcx#initialKey,
44
- * "invocationTarget": "did:btcr2:k1qqpuwwde82nennsavvf0lqfnlvx7frrgzs57lchr02q8mz49qzaaxmqphnvcx,
45
- * "capability": "urn:zcap:root:did%3Abtcr2%3Ak1qqpuwwde82nennsavvf0lqfnlvx7frrgzs57lchr02q8mz49qzaaxmqphnvcx,
46
- * "capabilityAction": "Write,
47
- * "proofPurpose": "assertionMethod,
48
- * "proofValue": "z381yXYmxU8NudZ4HXY56DfMN6zfD8syvWcRXzT9xD9uYoQToo8QsXD7ahM3gXTzuay5WJbqTswt2BKaGWYn2hHhVFKJLXaD
49
- * }
50
- * }
51
- * ```
52
- */
53
- export interface DidUpdatePayload {
54
- /**
55
- * JSON-LD context URIs for interpreting this payload, including contexts
56
- * for ZCAP (capabilities), Data Integrity proofs, and JSON-LD patch ops.
57
- */
58
- '@context': string[];
59
- /**
60
- * A JSON Patch (or JSON-LD Patch) object defining the mutations to apply to
61
- * the DID Document. Applying this patch to the current DID Document yields
62
- * the new DID Document (which must remain valid per DID Core spec).
63
- */
64
- patch: JsonPatch;
65
- /**
66
- * The multihash of the current (source) DID Document, encoded as a multibase
67
- * base58-btc string. This is a SHA-256 hash of the canonicalized source DID
68
- * Document, used to ensure the patch is applied to the correct document state.
69
- */
70
- sourceHash: string;
71
- /**
72
- * The multihash of the updated (target) DID Document, encoded as multibase
73
- * base58-btc. This is the SHA-256 hash of the canonicalized
74
- * DID Document after applying the patch, used to verify the update result.
75
- */
76
- targetHash: string;
77
- /**
78
- * The version number of the DID Document after this update.
79
- * It is equal to the previous document version + 1.
80
- */
81
- targetVersionId: number;
82
- /**
83
- * A proof object (Data Integrity proof) that authorizes this update.
84
- * It is a JSON-LD proof indicating a capability invocation on the DID's
85
- * root capability, typically signed with the DID's verification key (using
86
- * Schnorr secp256k1 in did:btcr2).
87
- */
88
- proof?: Proof;
89
- }
90
- /**
91
- * An extension of {@link DidUpdatePayload | DID Update Payload} containing a
92
- * Data Integrity proof that authorizes the update. Once signed, the spec calls
93
- * this an 'invoked DID Update Payload' or 'didUpdateInvocation'.
94
- *
95
- * DID BTCR2
96
- * {@link https://dcdpr.github.io/did-btcr2/#invoke-did-update-payload | 4.3.2 Invoke DID Update Payload}
97
- * and
98
- * {@link https://dcdpr.github.io/did-btcr2/#root-didbtcr2-update-capabilities | 9.4 Root did:btcr2 Update Capabilities}.
99
- */
100
- export interface DidUpdateInvocation extends DidUpdatePayload {
101
- proof: Proof;
102
- }
103
- /**
104
- * Proof is the Data Integrity proof (ZCAP-LD style) added to a did:btcr2 DID
105
- * Update Payload.
106
- *
107
- * Verifiable Credential Data Integrity
108
- * {@link https://w3c.github.io/vc-data-integrity/#proofs | 2.1 Proofs}.
109
- *
110
- * DID BTCR2
111
- * {@link https://dcdpr.github.io/did-btcr2/#invoke-did-update-payload | 4.3.2 Invoke DID Update Payload}.
112
- */
113
- export interface Proof extends ProofOptions {
114
- /**
115
- * The cryptographic signature value. The exact property name may be defined
116
- * by the cryptosuite (for instance, `proofValue` for a raw signature) and
117
- * contains the actual signature bytes in an encoded form.
118
- */
119
- proofValue: string;
120
- }
121
- /**
122
- * Proof Options used when adding a Data Integrity proof (ZCAP-LD style)
123
- * to a did:btcr2 DID Update Payload.
124
- *
125
- * Verifiable Credential Data Integrity
126
- * {@link https://w3c.github.io/vc-data-integrity/#proofs | 2.1 Proofs}.
127
- *
128
- * DID BTCR2
129
- * {@link https://dcdpr.github.io/did-btcr2/#invoke-did-update-payload | 4.3.2 Invoke DID Update Payload}.
130
- */
131
- export interface ProofOptions {
132
- /**
133
- * The proof type—per the spec’s example, "DataIntegrityProof".
134
- */
135
- type: string;
136
- /**
137
- * The cryptographic suite used, e.g. "schnorr-secp256k1-jcs-2025".
138
- */
139
- cryptosuite: string;
140
- /**
141
- * DID URL of the key invoking the capability, i.e. the DID
142
- * Document's verificationMethod.id used to sign this update.
143
- */
144
- verificationMethod: string;
145
- /**
146
- * The purpose of the proof, which the spec sets to "capabilityInvocation".
147
- */
148
- proofPurpose: string;
149
- /**
150
- * The root capability being invoked. In did:btcr2, this is typically
151
- * `urn:zcap:root:<urlencoded-did>` (see Section 9.4.1).
152
- */
153
- capability?: string;
154
- /**
155
- * The action performed under the capability—set to "Write" in the spec
156
- * for DID document updates.
157
- */
158
- capabilityAction?: string;
159
- /**
160
- * (Optional) Some cryptosuites or proofs may include a timestamp, domain,
161
- * or challenge. Although not explicitly required in the doc's steps, they
162
- * often appear in Data Integrity proofs and may be included as needed.
163
- */
164
- created?: string;
165
- domain?: string;
166
- challenge?: string;
167
- }
168
- /**
169
- * A JSON object that maps did:btcr2 identifiers to the CID of the corresponding
170
- * DID Update Payload.
171
- *
172
- * DID BTCR2
173
- * {@link https://dcdpr.github.io/did-btcr2/#cidaggregate-beacon | 5.2 CIDAggregate Beacons}.
174
- */
175
- export interface DidUpdateBundle {
176
- /**
177
- * The keys are did:btcr2 identifiers as strings. The values are
178
- * IPFS CIDs (or other CAS IDs) referencing the actual DID Update Payload.
179
- */
180
- [didbtcr2Identifier: string]: string;
181
- }
182
- /**
183
- * A container for out-of-band data the resolver may need. This includes the
184
- * initial DID document if it isn't stored in IPFS, plus references for each
185
- * on-chain Beacon signal.
186
- *
187
- * DID BTCR2
188
- * {@link https://dcdpr.github.io/did-btcr2/#sidecar-initial-document-validation | 4.2.1.2.1 Sidecar Initial Document Validation},
189
- * {@link https://dcdpr.github.io/did-btcr2/#resolve-target-document | 4.2.2 Resolve Target Document},
190
- * {@link https://dcdpr.github.io/did-btcr2/#traverse-blockchain-history | 4.2.2.2 Traverse Blockchain History},
191
- * {@link https://dcdpr.github.io/did-btcr2/#find-next-signals | 4.2.2.3 Find Next Signals}.
192
- */
193
- export interface SidecarData {
194
- /**
195
- * The initial DID Document for an externally created did:btcr2,
196
- * if not fetched from IPFS or another CAS.
197
- */
198
- initialDocument?: Record<string, any>;
199
- /**
200
- * A map from Bitcoin transaction IDs to the sidecar info about that signal.
201
- * Each signal might provide a single DID Update Payload, or (for aggregator beacons)
202
- * a bundle or proofs.
203
- */
204
- signalsMetadata: {
205
- [txid: string]: SignalSidecarData;
206
- };
207
- }
208
- /**
209
- * Sidecar data for a specific Beacon Signal. Different Beacon types store different fields.
210
- * - SingletonBeacon might just store one `updatePayload`.
211
- * - CIDAggregateBeacon might store `updateBundle` + an `updatePayload`.
212
- * - SMTAggregateBeacon might store `updatePayload` + a `smtProof`.
213
- */
214
- export interface SignalSidecarData {
215
- updatePayload?: DidUpdateInvocation;
216
- updateBundle?: DidUpdateBundle;
217
- /**
218
- * For SMTAggregateBeacon, a Merkle proof that the `updatePayload`
219
- * is included (or not included) in the aggregator's Sparse Merkle Tree.
220
- */
221
- smtProof?: SmtProof;
222
- }
223
- /**
224
- * A placeholder for the actual Sparse Merkle Tree inclusion/non-inclusion proof.
225
- *
226
- * DID BTCR2
227
- * {@link https://dcdpr.github.io/did-btcr2/#smtaggregate-beacon | 5.3 SMTAggregate Beacon}.
228
- */
229
- export interface SmtProof {
230
- siblingHashes: string[];
231
- leafIndex?: string;
232
- }
233
- /**
234
- * The known Beacon types from the spec.
235
- */
236
- export type BeaconType = 'SingletonBeacon' | 'CIDAggregateBeacon' | 'SMTAggregateBeacon';
237
- /**
238
- * Represents a transaction discovered on the Bitcoin blockchain that
239
- * spends from a Beacon address, thus announcing DID updates.
240
- *
241
- * DID BTCR2
242
- * {@link https://dcdpr.github.io/did-btcr2/#find-next-signals | 4.2.2.3 Find Next Signals}
243
- * and
244
- * {@link https://dcdpr.github.io/did-btcr2/#process-beacon-signals | 4.2.2.4 Process Beacon Signals}.
245
- */
246
- export interface BeaconSignal {
247
- /**
248
- * The DID Document's `service` ID of the Beacon that produced this signal, e.g. "#cidAggregateBeacon".
249
- */
250
- beaconId: string;
251
- /**
252
- * The type of Beacon, e.g. "SingletonBeacon".
253
- */
254
- beaconType: BeaconType;
255
- /**
256
- * The Bitcoin transaction that is the actual on-chain Beacon Signal.
257
- * Typically you'd store a minimal subset or a reference/ID for real usage.
258
- */
259
- tx: any;
260
- }
261
- /**
262
- * A ZCAP-LD root capability object that authorizes updates for a particular did:btcr2.
263
- *
264
- * DID BTCR2
265
- * {@link https://dcdpr.github.io/did-btcr2/#derive-root-capability-from-didbtcr2-identifier | 9.4.1 Derive Root Capability from did:btcr2 Identifier}.
266
- *
267
- * @example Found in DID BTCR2 Specification Section 9.4.1
268
- * ```
269
- * {
270
- * "@context": "https://w3id.org/zcap/v1",
271
- * "id": "urn:zcap:root:did%3Abtcr2%3Ak1qq...",
272
- * "controller": "did:btcr2:k1qq...",
273
- * "invocationTarget": "did:btcr2:k1qq..."
274
- * }
275
- * ```
276
- */
277
- export interface DidBtcr2RootCapability {
278
- '@context': string | string[];
279
- id: string;
280
- controller: string;
281
- invocationTarget: string;
282
- }
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../src/interfaces.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,SAAS,GAAG,KAAK,CAAC,cAAc,CAAC,CAAC;AAC9C,MAAM,MAAM,WAAW,GAAG,KAAK,GAAG,QAAQ,GAAG,SAAS,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;AAClG;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,WAAW,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,MAAM,WAAW,gBAAgB;IAC7B;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AAM,CAAC;CACf"}
@@ -1,6 +1,7 @@
1
1
  import { HDKey } from '@scure/bip32';
2
2
  export type Bytes = Uint8Array;
3
3
  export type Hex = Bytes | string;
4
+ export type HexString = string;
4
5
  export type SignatureHex = Hex;
5
6
  export type HashHex = Hex;
6
7
  export type DocumentBytes = Bytes;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAGrC,MAAM,MAAM,KAAK,GAAG,UAAU,CAAC;AAC/B,MAAM,MAAM,GAAG,GAAG,KAAK,GAAG,MAAM,CAAC;AACjC,MAAM,MAAM,YAAY,GAAG,GAAG,CAAC;AAC/B,MAAM,MAAM,OAAO,GAAG,GAAG,CAAC;AAE1B,MAAM,MAAM,aAAa,GAAG,KAAK,CAAC;AAClC,MAAM,MAAM,cAAc,GAAG,KAAK,CAAC;AACnC,MAAM,MAAM,UAAU,GAAG,KAAK,CAAC;AAC/B,MAAM,MAAM,SAAS,GAAG,KAAK,CAAC;AAC9B,MAAM,MAAM,YAAY,GAAG,KAAK,CAAC;AACjC,MAAM,MAAM,OAAO,GAAG,KAAK,GAAG,MAAM,CAAC;AAErC,MAAM,MAAM,6BAA6B,GAAG,IAAI,GAAG,IAAI,CAAC;AACxD,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC;AACpC,MAAM,MAAM,eAAe,GAAG,GAAG,CAAC;AAElC,MAAM,MAAM,QAAQ,GAAG,KAAK,CAAC;AAC7B,MAAM,MAAM,KAAK,GAAG;IAClB,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACjB,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;CAChB,CAAA;AACD,MAAM,MAAM,eAAe,GAAG;IAC5B,KAAK,EAAE,KAAK,CAAC;IACb,GAAG,EAAE,GAAG,CAAC;IACT,SAAS,EA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AAK,IAAI,GAAG,IAAI,KAAK,IAAI,OAAO,IAAI,OAAO,EAAE,CAAC;AACpF,MAAM,MAAM,QAAQ,GAAG,GAAG,KAAK,IAAI,OAAO,EAAE,CAAC;AAC7C,MAAM,MAAM,aAAa,GAAG,GAAG,YAAY,GAAG,GAAG,GAAG,YAAY,IAAI,QAAQ,EAAE,CAAC;AAC/E,MAAM,MAAM,qBAAqB,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AACxD,MAAM,MAAM,yBAAyB,GAAG,KAAK,GAAG,MAAM,CAAC;AACvD,MAAM,MAAM,wBAAwB,GAAG,KAAK,GAAG,QAAQ,CAAC;AACxD,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC"}
@@ -9,11 +9,31 @@ export declare class DateUtils {
9
9
  * @param {Date} [date=new Date()] - The date to format.
10
10
  * @returns {string} The formatted date string.
11
11
  */
12
- static getUTCDateTime(date?: Date): string;
12
+ static toISOStringNonFractional(date?: Date): string;
13
13
  /**
14
14
  * Unix timestamp in seconds (integer).
15
15
  * @param {Date} [date=new Date()] - The date to convert.
16
16
  * @returns {number} The Unix timestamp in seconds.
17
17
  */
18
18
  static toUnixSeconds(date?: Date): number;
19
+ /**
20
+ * Validate if a string is a valid UTC date string.
21
+ * @param {string} dateString - The date string to validate.
22
+ * @returns {boolean} True if valid, otherwise false.
23
+ * @throws {Error} If the date string is invalid.
24
+ */
25
+ static dateStringToTimestamp(dateString: string): Date;
26
+ /**
27
+ * Convert a blocktime (Unix timestamp in seconds) to a Date object.
28
+ * @param {number} blocktime - The blocktime in seconds.
29
+ * @returns {Date} The corresponding Date object.
30
+ */
31
+ static blocktimeToTimestamp(blocktime: number): Date;
32
+ /**
33
+ * Validates an XMLSCHEMA11-2 dateTime string.
34
+ * Format: [-]YYYY-MM-DDThh:mm:ss[.fractional][Z|(+|-)hh:mm]
35
+ *
36
+ * @see https://www.w3.org/TR/xmlschema11-2/#dateTime
37
+ */
38
+ static isValidXsdDateTime(value?: string): boolean;
19
39
  }
@@ -1 +1 @@
1
- {"version":3,"file":"date.d.ts","sourceRoot":"","sources":["../../../src/utils/date.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,qBAAa,SAAS;IACpB;;;;OAIG;IACH,MAAM,CAAC,cAAc,CAAC,IAAI,GAAE,IAAiB,GAAG,MAAM;IAQtD;;;;OAIG;IACH,MAAM,CAAC,aAAa,CAAC,IAAI,GAAE,IAAiB,GAAG,MAAM;CAOtD"}
1
+ {"version":3,"file":"date.d.ts","sourceRoot":"","sources":["../../../src/utils/date.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,qBAAa,SAAS;IACpB;;;;OAIG;IACH,MAAM,CAAC,wBAAwB,CAAC,IAAI,GAAE,IAAiB,GAAG,MAAM;IAQhE;;;;OAIG;IACH,MAAM,CAAC,aAAa,CAAC,IAAI,GAAE,IAAiB,GAAG,MAAM;IAQrD;;;;;OAKG;IACH,MAAM,CAAC,qBAAqB,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI;IAQtD;;;;OAIG;IACH,MAAM,CAAC,oBAAoB,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI;IAIpD;;;;;OAKG;IACH,MAAM,CAAC,kBAAkB,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO;CAoEnD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@did-btcr2/common",
3
- "version": "3.0.0",
3
+ "version": "3.1.0",
4
4
  "type": "module",
5
5
  "description": "Common utilities, types, interfaces, etc. shared across the did-btcr2-js monorepo packages.",
6
6
  "main": "./dist/cjs/index.js",
@@ -72,18 +72,18 @@ export class Canonicalization {
72
72
  * @param {Object} [options] Options for processing.
73
73
  * @param {CanonicalizationEncoding} [options.encoding='hex'] The encoding format ('hex' or 'base58').
74
74
  * @param {CanonicalizationAlgorithm} [options.algorithm] The canonicalization algorithm to use.
75
- * @returns {Promise<string>} The final SHA-256 hash bytes as a hex string.
75
+ * @returns {string} The final SHA-256 hash bytes as a hex string.
76
76
  */
77
- async process(object: Record<any, any>, options: {
77
+ process(object: Record<any, any>, options: {
78
78
  encoding?: CanonicalizationEncoding;
79
79
  algorithm?: CanonicalizationAlgorithm;
80
80
  multibase?: boolean;
81
- } = {}): Promise<string> {
81
+ } = {}): string {
82
82
  const algorithm = Canonicalization.normalizeAlgorithm(options.algorithm ?? this._defaultAlgorithm);
83
83
  const encoding = Canonicalization.normalizeEncoding(options.encoding ?? 'hex');
84
84
 
85
85
  // Step 1: Canonicalize
86
- const canonicalized = await this.canonicalize(object, algorithm);
86
+ const canonicalized = this.canonicalize(object, algorithm);
87
87
  // Step 2: Hash
88
88
  const hashed = this.hash(canonicalized);
89
89
  // Step 3: Encode
@@ -96,9 +96,9 @@ export class Canonicalization {
96
96
  * Step 1: Uses this.algorithm to determine the method (JCS).
97
97
  * @param {Record<any, any>} object The object to canonicalize.
98
98
  * @param {CanonicalizationAlgorithm} [algorithm] The algorithm to use.
99
- * @returns {Promise<string>} The canonicalized object.
99
+ * @returns {string} The canonicalized object.
100
100
  */
101
- async canonicalize(object: Record<any, any>, algorithm: CanonicalizationAlgorithm = this._defaultAlgorithm): Promise<string> {
101
+ canonicalize(object: Record<any, any>, algorithm: CanonicalizationAlgorithm = this._defaultAlgorithm): string {
102
102
  switch (Canonicalization.normalizeAlgorithm(algorithm)) {
103
103
  case 'jcs':
104
104
  return this.jcs(object);
@@ -121,7 +121,7 @@ export class Canonicalization {
121
121
  * @param {string} canonicalized The canonicalized object.
122
122
  * @returns {HashBytes} The SHA-256 HashBytes (Uint8Array).
123
123
  */
124
- public hash(canonicalized: string): HashBytes {
124
+ hash(canonicalized: string): HashBytes {
125
125
  return sha256(canonicalized);
126
126
  }
127
127
 
@@ -132,7 +132,7 @@ export class Canonicalization {
132
132
  * @throws {CanonicalizationError} If the encoding format is not supported.
133
133
  * @returns {string} The encoded string.
134
134
  */
135
- public encode(canonicalizedhash: HashBytes, encoding: CanonicalizationEncoding = 'hex', multibase: boolean = false): string {
135
+ encode(canonicalizedhash: HashBytes, encoding: CanonicalizationEncoding = 'hex', multibase: boolean = false): string {
136
136
  const normalized = Canonicalization.normalizeEncoding(encoding);
137
137
  if (normalized === 'hex') return this.hex(canonicalizedhash);
138
138
  if (normalized === 'base58') {
@@ -147,7 +147,7 @@ export class Canonicalization {
147
147
  * @param {HashBytes} hashBytes The hash as a Uint8Array.
148
148
  * @returns {string} The hash as a hex string.
149
149
  */
150
- public hex(hashBytes: HashBytes): string {
150
+ hex(hashBytes: HashBytes): string {
151
151
  return bytesToHex(hashBytes);
152
152
  }
153
153
 
@@ -156,7 +156,7 @@ export class Canonicalization {
156
156
  * @param {HashBytes} hashBytes The hash as a Uint8Array.
157
157
  * @returns {string} The hash as a hex string.
158
158
  */
159
- public base58(hashBytes: HashBytes): string {
159
+ base58(hashBytes: HashBytes): string {
160
160
  const encoded = base58btc.encode(hashBytes);
161
161
  return encoded.startsWith('z') ? encoded.slice(1) : encoded;
162
162
  }
@@ -167,11 +167,11 @@ export class Canonicalization {
167
167
  * @param {Record<any, any>} object The object to process.
168
168
  * @returns {Promise<HashBytes>} The final SHA-256 hash bytes.
169
169
  */
170
- public async canonicalhash(
170
+ canonicalhash(
171
171
  object: Record<any, any>,
172
172
  algorithm: CanonicalizationAlgorithm = this._defaultAlgorithm
173
- ): Promise<HashBytes> {
174
- const canonicalized = await this.canonicalize(object, algorithm);
173
+ ): HashBytes {
174
+ const canonicalized = this.canonicalize(object, algorithm);
175
175
  return this.hash(canonicalized);
176
176
  }
177
177
 
@@ -181,7 +181,7 @@ export class Canonicalization {
181
181
  * @param {string} canonicalized The canonicalized object to hash.
182
182
  * @returns {string} The SHA-256 hash as a hex string.
183
183
  */
184
- public hashhex(canonicalized: string): string {
184
+ hashhex(canonicalized: string): string {
185
185
  return this.encode(this.hash(canonicalized), 'hex');
186
186
  }
187
187
 
@@ -191,7 +191,7 @@ export class Canonicalization {
191
191
  * @param {string} canonicalized The canonicalized object to hash.
192
192
  * @returns {string} The SHA-256 hash as a base58 string.
193
193
  */
194
- public hashbase58(canonicalized: string): string {
194
+ hashbase58(canonicalized: string): string {
195
195
  return this.encode(this.hash(canonicalized), 'base58', false);
196
196
  }
197
197
  }
package/src/constants.ts CHANGED
@@ -2,7 +2,6 @@ import { sha256 } from '@noble/hashes/sha2';
2
2
  import { bytesToHex } from '@noble/hashes/utils';
3
3
  import { Bytes, HashHex } from './types.js';
4
4
 
5
- export const ID_PLACEHOLDER_VALUE = 'did:btcr2:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';
6
5
  export const OP_RETURN = 0x6a;
7
6
  export const OP_PUSH32 = 0x20;
8
7
  export const VALID_HRP = ['k', 'x'];
package/src/errors.ts CHANGED
@@ -75,8 +75,11 @@ export enum MethodErrorCode {
75
75
  /** The sidecar data in the DID Update Payload was invalid. */
76
76
  INVALID_SIDECAR_DATA = 'INVALID_SIDECAR_DATA',
77
77
 
78
- /** The proof is missing or has a malformed challenge field. */
79
- INVALID_CHALLENGE_ERROR = 'INVALID_CHALLENGE_ERROR',
78
+ /** The update data required for resolution is missing. */
79
+ MISSING_UPDATE_DATA = 'MISSING_UPDATE_DATA',
80
+
81
+ /** The update is missing or has a malformed field(s). */
82
+ INVALID_UPDATE = 'INVALID_UPDATE',
80
83
 
81
84
  /** The proof is missing or has a malformed domain field. */
82
85
  INVALID_DOMAIN_ERROR = 'INVALID_DOMAIN_ERROR'
@@ -106,7 +109,8 @@ export const {
106
109
  VERIFICATION_METHOD_ERROR,
107
110
  LATE_PUBLISHING_ERROR,
108
111
  INVALID_SIDECAR_DATA,
109
- INVALID_CHALLENGE_ERROR,
112
+ MISSING_UPDATE_DATA,
113
+ INVALID_UPDATE,
110
114
  INVALID_DOMAIN_ERROR
111
115
  } = MethodErrorCode;
112
116
 
@@ -166,6 +170,18 @@ export class MethodError extends DidMethodError {
166
170
  }
167
171
  }
168
172
 
173
+ export class IdentifierError extends DidMethodError {
174
+ constructor(message: string, type: string = 'IdentifierError', data?: Record<string, any>) {
175
+ super(message, { type, name: type, data });
176
+ }
177
+ }
178
+
179
+ export class UpdateError extends DidMethodError {
180
+ constructor(message: string, type: string = 'UpdateError', data?: Record<string, any>) {
181
+ super(message, { type, name: type, data });
182
+ }
183
+ }
184
+
169
185
  export class ResolveError extends DidMethodError {
170
186
  constructor(message: string, type: string = 'ResolveError', data?: Record<string, any>) {
171
187
  super(message, { type, name: 'ResolveError', data });
@@ -190,6 +206,12 @@ export class CryptosuiteError extends DidMethodError {
190
206
  }
191
207
  }
192
208
 
209
+ export class DataIntegrityProofError extends DidMethodError {
210
+ constructor(message: string, type: string = 'DataIntegrityProofError', data?: Record<string, any>) {
211
+ super(message, { type, name: type, data });
212
+ }
213
+ }
214
+
193
215
  export class KeyPairError extends DidMethodError {
194
216
  constructor(message: string, type: string = 'KeyPairError', data?: Record<string, any>) {
195
217
  super(message, { type, name: type, data });