@did-btcr2/common 1.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.
Files changed (75) hide show
  1. package/LICENSE +373 -0
  2. package/README.md +3 -0
  3. package/dist/cjs/canonicalization.js +163 -0
  4. package/dist/cjs/canonicalization.js.map +1 -0
  5. package/dist/cjs/constants.js +116 -0
  6. package/dist/cjs/constants.js.map +1 -0
  7. package/dist/cjs/errors.js +151 -0
  8. package/dist/cjs/errors.js.map +1 -0
  9. package/dist/cjs/exts.js +182 -0
  10. package/dist/cjs/exts.js.map +1 -0
  11. package/dist/cjs/index.js +10 -0
  12. package/dist/cjs/index.js.map +1 -0
  13. package/dist/cjs/interfaces.js +2 -0
  14. package/dist/cjs/interfaces.js.map +1 -0
  15. package/dist/cjs/logger.browser.js +77 -0
  16. package/dist/cjs/logger.browser.js.map +1 -0
  17. package/dist/cjs/logger.js +139 -0
  18. package/dist/cjs/logger.js.map +1 -0
  19. package/dist/cjs/package.json +1 -0
  20. package/dist/cjs/patch.js +163 -0
  21. package/dist/cjs/patch.js.map +1 -0
  22. package/dist/cjs/types.js +20 -0
  23. package/dist/cjs/types.js.map +1 -0
  24. package/dist/esm/canonicalization.js +163 -0
  25. package/dist/esm/canonicalization.js.map +1 -0
  26. package/dist/esm/constants.js +116 -0
  27. package/dist/esm/constants.js.map +1 -0
  28. package/dist/esm/errors.js +151 -0
  29. package/dist/esm/errors.js.map +1 -0
  30. package/dist/esm/exts.js +182 -0
  31. package/dist/esm/exts.js.map +1 -0
  32. package/dist/esm/index.js +10 -0
  33. package/dist/esm/index.js.map +1 -0
  34. package/dist/esm/interfaces.js +2 -0
  35. package/dist/esm/interfaces.js.map +1 -0
  36. package/dist/esm/logger.browser.js +77 -0
  37. package/dist/esm/logger.browser.js.map +1 -0
  38. package/dist/esm/logger.js +139 -0
  39. package/dist/esm/logger.js.map +1 -0
  40. package/dist/esm/patch.js +163 -0
  41. package/dist/esm/patch.js.map +1 -0
  42. package/dist/esm/types.js +20 -0
  43. package/dist/esm/types.js.map +1 -0
  44. package/dist/types/canonicalization.d.ts +106 -0
  45. package/dist/types/canonicalization.d.ts.map +1 -0
  46. package/dist/types/constants.d.ts +103 -0
  47. package/dist/types/constants.d.ts.map +1 -0
  48. package/dist/types/errors.d.ts +113 -0
  49. package/dist/types/errors.d.ts.map +1 -0
  50. package/dist/types/exts.d.ts +82 -0
  51. package/dist/types/exts.d.ts.map +1 -0
  52. package/dist/types/index.d.ts +9 -0
  53. package/dist/types/index.d.ts.map +1 -0
  54. package/dist/types/interfaces.d.ts +282 -0
  55. package/dist/types/interfaces.d.ts.map +1 -0
  56. package/dist/types/logger.browser.d.ts +28 -0
  57. package/dist/types/logger.browser.d.ts.map +1 -0
  58. package/dist/types/logger.d.ts +45 -0
  59. package/dist/types/logger.d.ts.map +1 -0
  60. package/dist/types/patch.d.ts +63 -0
  61. package/dist/types/patch.d.ts.map +1 -0
  62. package/dist/types/types.d.ts +104 -0
  63. package/dist/types/types.d.ts.map +1 -0
  64. package/package.json +109 -0
  65. package/src/canonicalization.ts +180 -0
  66. package/src/constants.ts +123 -0
  67. package/src/errors.ts +224 -0
  68. package/src/exts.ts +293 -0
  69. package/src/index.ts +11 -0
  70. package/src/interfaces.ts +311 -0
  71. package/src/logger.browser.ts +92 -0
  72. package/src/logger.ts +162 -0
  73. package/src/patch.ts +181 -0
  74. package/src/rdf-canonize.d.ts +6 -0
  75. package/src/types.ts +113 -0
@@ -0,0 +1,282 @@
1
+ export type JsonPatch = Array<PatchOperation>;
2
+ export type PatchOpCode = 'add' | 'remove' | 'replace' | 'move' | 'copy' | 'test' | string;
3
+ /**
4
+ * A JSON Patch operation, as defined in {@link https://datatracker.ietf.org/doc/html/rfc6902 | RFC 6902}.
5
+ */
6
+ export interface PatchOperation {
7
+ op: PatchOpCode;
8
+ path: string;
9
+ value?: any;
10
+ from?: string;
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%3Abtc1%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-didbtc1-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
+ [didBtc1Identifier: 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-didbtc1-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%3Abtc1%3Ak1qq...",
272
+ * "controller": "did:btcr2:k1qq...",
273
+ * "invocationTarget": "did:btcr2:k1qq..."
274
+ * }
275
+ * ```
276
+ */
277
+ export interface DidBtc1RootCapability {
278
+ '@context': string | string[];
279
+ id: string;
280
+ controller: string;
281
+ invocationTarget: string;
282
+ }
@@ -0,0 +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,MAAM,CAAC;AAC3F;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,WAAW,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,GAAG,CAAC;IACZ,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,MAAM,WAAW,gBAAgB;IAC7B;;;OAGG;IACH,UAAU,EAAE,MAAM,EAAE,CAAC;IAErB;;;;OAIG;IACH,KAAK,EAAE,SAAS,CAAC;IAEjB;;;;OAIG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;;;OAIG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;;OAGG;IACH,eAAe,EAAE,MAAM,CAAC;IAExB;;;;;OAKG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC;CACjB;AAED;;;;;;;;;GASG;AACH,MAAM,WAAW,mBAAoB,SAAQ,gBAAgB;IAC3D,KAAK,EAAE,KAAK,CAAC;CACd;AAED;;;;;;;;;GASG;AACH,MAAM,WAAW,KAAM,SAAQ,YAAY;IACzC;;;;OAIG;IACH,UAAU,EAAE,MAAM,CAAC;CACpB;AAED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AAE,MAAM,CAAC;IAEjB;;OAEG;IACH,UAAU,EAAE,UAAU,CAAC;IAEvB;;;OAGG;IACH,EAAE,EAAE,GAAG,CAAC;CACT;AAED;;;;;;;;;;;;;;;GAeG;AACH,MAAM,WAAW,qBAAqB;IACpC,UAAU,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,MAAM,CAAC;IACnB,gBAAgB,EAAE,MAAM,CAAC;CAC1B"}
@@ -0,0 +1,28 @@
1
+ export declare enum Env {
2
+ Development = "development",
3
+ Production = "production",
4
+ Test = "test"
5
+ }
6
+ export type Level = 'debug' | 'error' | 'info' | 'log' | 'warn' | 'security';
7
+ export declare const NODE_ENV: Env;
8
+ export declare class Logger {
9
+ private levels;
10
+ private namespace?;
11
+ constructor(namespace?: string);
12
+ private _log;
13
+ debug(m?: unknown, ...a: unknown[]): this;
14
+ error(m?: unknown, ...a: unknown[]): this;
15
+ info(m?: unknown, ...a: unknown[]): this;
16
+ warn(m?: unknown, ...a: unknown[]): this;
17
+ security(m?: unknown, ...a: unknown[]): this;
18
+ log(m?: unknown, ...a: unknown[]): this;
19
+ newline(): this;
20
+ static debug(m?: unknown, ...a: unknown[]): void;
21
+ static error(m?: unknown, ...a: unknown[]): void;
22
+ static info(m?: unknown, ...a: unknown[]): void;
23
+ static warn(m?: unknown, ...a: unknown[]): void;
24
+ static security(m?: unknown, ...a: unknown[]): void;
25
+ static log(m?: unknown, ...a: unknown[]): void;
26
+ static newline(): void;
27
+ private static getCallerLocation;
28
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.browser.d.ts","sourceRoot":"","sources":["../../src/logger.browser.ts"],"names":[],"mappings":"AAAA,oBAAY,GAAG;IACX,WAAW,gBAAgB;IAC3B,UAAU,eAAe;IACzB,IAAI,SAAS;CAChB;AAED,MAAM,MAAM,KAAK,GAAG,OAAO,GAAG,OAAO,GAAG,MAAM,GAAG,KAAK,GAAG,MA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0,0 +1,45 @@
1
+ export declare enum Env {
2
+ Development = "development",
3
+ Production = "production",
4
+ Test = "test"
5
+ }
6
+ export type Level = 'debug' | 'error' | 'info' | 'log' | 'warn' | 'security';
7
+ export declare const NODE_ENV: Env;
8
+ /**
9
+ * A flexible, feature-rich logger with:
10
+ * - Environment-based filtering
11
+ * - Namespacing
12
+ * - File/line tracing
13
+ * - Timestamps
14
+ * - Colorized output
15
+ */
16
+ export declare class Logger {
17
+ private levels;
18
+ private namespace?;
19
+ constructor(namespace?: string);
20
+ /**
21
+ * Logs a message with the specified level.
22
+ */
23
+ private _log;
24
+ debug(message?: unknown, ...args: unknown[]): this;
25
+ error(message?: unknown, ...args: unknown[]): this;
26
+ info(message?: unknown, ...args: unknown[]): this;
27
+ warn(message?: unknown, ...args: unknown[]): this;
28
+ security(message?: unknown, ...args: unknown[]): this;
29
+ log(message?: unknown, ...args: unknown[]): this;
30
+ newline(): this;
31
+ /**
32
+ * Static methods for convenience (auto-instantiate).
33
+ */
34
+ static debug(message?: unknown, ...args: unknown[]): void;
35
+ static error(message?: unknown, ...args: unknown[]): void;
36
+ static info(message?: unknown, ...args: unknown[]): void;
37
+ static warn(message?: unknown, ...args: unknown[]): void;
38
+ static security(message?: unknown, ...args: unknown[]): void;
39
+ static log(message?: unknown, ...args: unknown[]): void;
40
+ static newline(): void;
41
+ /**
42
+ * Returns the caller's file and line number.
43
+ */
44
+ private static getCallerLocation;
45
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/logger.ts"],"names":[],"mappings":"AAGA,oBAAY,GAAG;IACb,WAAW,gBAAgB;IAC3B,UAAU,eAAe;IACzB,IAAI,SAAS;CACd;AAED,MAAM,MAAM,KAAK,GAAG,OAAO,GAAG,OAAO,GAAG,MAAM,GAAG,KAAK,GAAG,MAAM,GAAG,UAAU,CAAC;AAE7E,eAAO,MAAM,QAAQ,KAAmD,CAAC;AAoCzE;;;;;;;GAOG;AACH,qBAA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from './interfaces.js';
2
+ import { JSONObject } from './types.js';
3
+ /**
4
+ * Implementation of {@link https://datatracker.ietf.org/doc/html/rfc6902 | IETF RFC 6902 JSON Patch}.
5
+ *
6
+ * JavaScript Object Notation (JSON) Patch defines a JSON document structure for expressing a sequence of operations to
7
+ * apply to a JavaScript Object Notation (JSON) document; it is suitable for use with the HTTP PATCH method. The
8
+ * "application/json-patch+json" media type is used to identify such patch documents.
9
+ *
10
+ * @class Patch
11
+ * @type {Patch}
12
+ */
13
+ export declare class Patch {
14
+ /**
15
+ * Applies a JSON Patch to a source document and returns the patched document.
16
+ * @param {JSONObject} sourceDocument The source document to patch.
17
+ * @param {PatchOperation[]} operations The JSON Patch operations to apply.
18
+ * @returns {JSONObject} The patched document.
19
+ * @throws {Error} If an unsupported operation is provided.
20
+ */
21
+ apply(sourceDocument: JSONObject, operations: PatchOperation[]): JSONObject;
22
+ /**
23
+ * Constructs a JSON Patch with a single operation (e.g. add service).
24
+ * @param {PatchOperation} patches - The patch operation to create.
25
+ * @param {string} patch.op - The patch operation type (e.g. 'add').
26
+ * @param {string} patch.path - The JSON Pointer path to apply the operation.
27
+ * @param {*} patch.value - The value to apply (if applicable).
28
+ * @returns {PatchOperation[]} A single-entry JSON Patch array.
29
+ */
30
+ create(patches: PatchOperation[]): PatchOperation[];
31
+ /**
32
+ * Find the diff between a source and target document constructing the patch operations from source => target.
33
+ * @param {JSONObject} sourceDocument The original JSON object.
34
+ * @param {JSONObject} targetDocument The target JSON object to transform into.
35
+ * @returns {PatchOperation[]} An array of JSON Patch operations.
36
+ */
37
+ diff(sourceDocument: JSONObject, targetDocument: JSONObject, path: string): PatchOperation[];
38
+ /**
39
+ * Gets the value at a given path in an object.
40
+ * @private
41
+ * @param {*} obj The object to get the value from.
42
+ * @param {string[]} path The path to the value.
43
+ * @returns {*} The value at the given path.
44
+ */
45
+ private getValue;
46
+ /**
47
+ * Sets the value at a given path in an object.
48
+ * @private
49
+ * @param {*} obj The object to set the value in.
50
+ * @param {string[]} path The path to the value.
51
+ * @param {*} value The value to set.
52
+ * @returns {*} The object with the value set.
53
+ */
54
+ private setValue;
55
+ /**
56
+ * Removes the value at a given path in an object.
57
+ * @private
58
+ * @param {*} obj The object to remove the value from.
59
+ * @param {string[]} path The path to the value.
60
+ * @returns {*} The object with the value removed.
61
+ */
62
+ private removeValue;
63
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"patch.d.ts","sourceRoot":"","sources":["../../src/patch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAGxC;;;;;;;;;GASG;AACH,qBAAa,KAAK;IAChB;;;;;;OAMG;IACI,KAAK,CAAC,cAAc,EAAE,UAAU,EAAE,UAAU,EAAE,cAAc,EAAE,GAAG,UAAU;IAmDlF;;;;;;;KAOC;IACM,MAAM,CAAC,OAAO,EAAE,cAAc,EAAE,GAAG,cAAc,EAAE;IAgB1D;;;;;OAKG;IACI,IAAI,CAAC,cAAc,EAAE,UAAU,EAAE,cAAc,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,GAAG,cAAc,EAAE;IA8BnG;;;;;;OAMG;IACH,OAAO,CAAC,QAAQ;IAKhB;;;;;;;OAOG;IACH,OAAO,CAAC,QAAQ;IAWhB;;;;;;OAMG;IACH,OAAO,CAAC,WAAW;CASpB"}
@@ -0,0 +1,104 @@
1
+ import { HDKey } from '@scure/bip32';
2
+ export type Hex = Uint8Array | string;
3
+ export type SignatureHex = Hex;
4
+ export type HashHex = Hex;
5
+ export type Bytes = Uint8Array;
6
+ export type DocumentBytes = Bytes;
7
+ export type SignatureBytes = Bytes;
8
+ export type ProofBytes = Bytes;
9
+ export type HashBytes = Bytes;
10
+ export type MessageBytes = Bytes;
11
+ export type Entropy = Bytes | bigint;
12
+ export type CompressedPublicKeyParityByte = 0x02 | 0x03;
13
+ export type Bip340Encoding = string;
14
+ export type Base58BtcPrefix = 'z';
15
+ export type KeyBytes = Bytes;
16
+ export type Point = {
17
+ x: Array<number>;
18
+ y: Array<number>;
19
+ parity: number;
20
+ };
21
+ export type PublicKeyObject = {
22
+ point: Point;
23
+ hex: Hex;
24
+ multibase: MultibaseObject;
25
+ };
26
+ export type SecretKeyObject = {
27
+ bytes: Array<number>;
28
+ seed?: string;
29
+ hex?: Hex;
30
+ };
31
+ export type SchnorrKeyPair = {
32
+ secretKey: KeyBytes;
33
+ publicKey: KeyBytes;
34
+ };
35
+ export type SchnorrKeyPairObject = {
36
+ secretKey: SecretKeyObject;
37
+ publicKey: PublicKeyObject;
38
+ };
39
+ export type MultibaseObject = {
40
+ address: string;
41
+ prefix: Bytes;
42
+ key: Array<number>;
43
+ };
44
+ export type HdWallet = {
45
+ mnemonic: string;
46
+ hdkey: HDKey;
47
+ };
48
+ export type DID = 'did';
49
+ export type MethodName = string;
50
+ export type MethodSpecificId = string;
51
+ export type DecentralizedIdentifierExplicit = `${DID}:${MethodName}:${MethodSpecificId}`;
52
+ export type DecentralizedIdentifier = string;
53
+ export type Btc1MethodName = 'btcr2';
54
+ export type Btc1DeterministicPrefix = 'k';
55
+ export type Btc1ExternalPrefix = 'x';
56
+ export type Btc1Prefix = `${Btc1DeterministicPrefix | Btc1ExternalPrefix}1`;
57
+ export type Bech32Id = string;
58
+ export type Btc1Id = `${Btc1Prefix}${Bech32Id}`;
59
+ export type Btc1IdentifierExplicit = `${DID}:${Btc1MethodName}:${Btc1Id}`;
60
+ export type Btc1Identifier = string;
61
+ export type Controller = Btc1Identifier;
62
+ export type Id = 'initialKey';
63
+ export type FullId = `${Controller}#${Id}`;
64
+ export declare enum Btc1IdentifierTypes {
65
+ KEY = "KEY",
66
+ EXTERNAL = "EXTERNAL"
67
+ }
68
+ export declare enum Btc1IdentifierHrp {
69
+ k = "k",
70
+ x = "x"
71
+ }
72
+ export declare enum BitcoinNetworkNames {
73
+ bitcoin = 0,
74
+ signet = 1,
75
+ regtest = 2,
76
+ testnet3 = 3,
77
+ testnet4 = 4,
78
+ mutinynet = 5
79
+ }
80
+ export type KeyIdentifier = string;
81
+ export type BeaconUri = string;
82
+ export type DidPlaceholder = 'did:btcr2:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';
83
+ export type CanonicalizedProofConfig = string;
84
+ export type CryptosuiteName = 'bip340-jcs-2025' | 'bip340-rdfc-2025';
85
+ export type ContextObject = Record<string | number | symbol, any>;
86
+ export type Context = string | string[] | ContextObject | ContextObject[];
87
+ export type Maybe<T> = T | any;
88
+ export type JSONObject = Record<string | number | symbol, any>;
89
+ export type Prototyped = JSONObject;
90
+ export type Unprototyped = JSONObject;
91
+ export type TwoDigits = `${number}${number}`;
92
+ export type ThreeDigits = `${number}${number}${number}`;
93
+ export type Year = `${1 | 2}${ThreeDigits}`;
94
+ export type Month = TwoDigits;
95
+ export type Day = TwoDigits;
96
+ export type Hours = TwoDigits;
97
+ export type Minutes = TwoDigits;
98
+ export type Seconds = TwoDigits;
99
+ export type UtcTimestamp = `${Year}-${Month}-${Day}T${Hours}:${Minutes}:${Seconds}`;
100
+ export type TzOffset = `${Hours}:${Minutes}`;
101
+ export type DateTimestamp = `${UtcTimestamp}Z` | `${UtcTimestamp}-${TzOffset}`;
102
+ export type CanonicalizableObject = Record<string, any>;
103
+ export type CanonicalizationAlgorithm = 'jcs' | 'rdfc';
104
+ export type UnixTimestamp = number;
@@ -0,0 +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,GAAG,GAAG,UAAU,GAAG,MAAM,CAAC;AACtC,MAAM,MAAM,YAAY,GAAG,GAAG,CAAC;AAC/B,MAAM,MAAM,OAAO,GAAG,GAAG,CAAC;AAE1B,MAAM,MAAM,KAAK,GAAG,UAAU,CAAC;AAC/B,MAAM,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C;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,aAAa,GAAG,MAAM,CAAC"}
package/package.json ADDED
@@ -0,0 +1,109 @@
1
+ {
2
+ "name": "@did-btcr2/common",
3
+ "version": "1.1.0",
4
+ "type": "module",
5
+ "description": "Common utilities, types, interfaces, etc. shared across the did-btcr2-js monorepo packages.",
6
+ "main": "./dist/cjs/index.js",
7
+ "module": "./dist/esm/index.js",
8
+ "types": "./dist/types/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/types/index.d.ts",
12
+ "import": "./dist/esm/index.js",
13
+ "require": "./dist/cjs/index.js"
14
+ },
15
+ "./logger": {
16
+ "browser": "./dist/esm/logger.browser.js",
17
+ "default": "./dist/esm/logger.js"
18
+ }
19
+ },
20
+ "files": [
21
+ "dist",
22
+ "src"
23
+ ],
24
+ "license": "MPL-2.0",
25
+ "contributors": [
26
+ {
27
+ "name": "dcdpr",
28
+ "url": "https://github.com/dcdpr"
29
+ },
30
+ {
31
+ "name": "jintekc",
32
+ "url": "https://github.com/jintekc",
33
+ "email": "github@jintek.consulting"
34
+ }
35
+ ],
36
+ "homepage": "https://github.com/dcdpr/did-btcr2-js/tree/main/packages/common",
37
+ "repository": {
38
+ "type": "git",
39
+ "url": "git+ssh://git@github.com:dcdpr/did-btcr2-js.git",
40
+ "directory": "packages/common"
41
+ },
42
+ "bugs": "https://github.com/dcdpr/did-btcr2-js/issues",
43
+ "publishConfig": {
44
+ "access": "public"
45
+ },
46
+ "engines": {
47
+ "node": ">=22.0.0"
48
+ },
49
+ "keywords": [],
50
+ "dependencies": {
51
+ "@noble/hashes": "^1.7.1",
52
+ "@scure/bip32": "^1.5.0",
53
+ "canonicalize": "^2.1.0",
54
+ "chalk": "^5.4.1",
55
+ "json-canonicalize": "^1.0.6",
56
+ "multiformats": "^13.3.2",
57
+ "rdf-canonize": "^4.0.1"
58
+ },
59
+ "devDependencies": {
60
+ "@eslint/js": "^9.21.0",
61
+ "@types/chai": "^5.0.1",
62
+ "@types/chai-as-promised": "^8.0.1",
63
+ "@types/eslint": "^9.6.1",
64
+ "@types/mocha": "^10.0.10",
65
+ "@types/node": "^22.13.8",
66
+ "@typescript-eslint/eslint-plugin": "^8.25.0",
67
+ "@typescript-eslint/parser": "^8.25.0",
68
+ "c8": "^10.1.3",
69
+ "chai": "^5.2.0",
70
+ "chai-as-promised": "^8.0.1",
71
+ "esbuild": "^0.25.0",
72
+ "eslint": "^9.21.0",
73
+ "eslint-plugin-mocha": "^10.5.0",
74
+ "globals": "^16.0.0",
75
+ "mocha": "^11.1.0",
76
+ "mocha-junit-reporter": "^2.2.1",
77
+ "node-stdlib-browser": "^1.3.1",
78
+ "rimraf": "^6.0.1",
79
+ "typedoc-plugin-markdown": "^4.7.0",
80
+ "typescript": "~5.7.3",
81
+ "typescript-eslint": "^8.25.0"
82
+ },
83
+ "scripts": {
84
+ "clean": "rimraf dist coverage tests/compiled",
85
+ "clean:build": "rimraf dist",
86
+ "clean:coverage": "rimraf coverage",
87
+ "clean:tests": "rimraf tests/compiled",
88
+ "clean:test-coverage": "pnpm clean:tests && pnpm clean:coverage",
89
+ "wipe": "rimraf node_modules pnpm-lock.json",
90
+ "wipe:clean": "pnpm wipe && pnpm clean",
91
+ "wipe:install": "pnpm wipe && pnpm install",
92
+ "clean:install": "pnpm clean && pnpm install",
93
+ "wipe:clean:install": "pnpm wipe:clean && pnpm install",
94
+ "reinstall": "pnpm install --force",
95
+ "build": "pnpm clean && pnpm build:esm && pnpm build:cjs",
96
+ "build:esm": "rimraf dist/esm dist/types && pnpm tsc -p tsconfig.json",
97
+ "build:cjs": "rimraf dist/cjs && tsc -p tsconfig.cjs.json && echo '{\"type\": \"commonjs\"}' > ./dist/cjs/package.json",
98
+ "build:tests": "pnpm tsc -p tests/tsconfig.json",
99
+ "build:docs": "typedoc --options typedoc.json",
100
+ "build:all": "pnpm build && pnpm build:tests && pnpm build:docs",
101
+ "release": "pnpm build && pnpm pack && mv *.tgz ../../release/common",
102
+ "lint": "eslint . --max-warnings 0",
103
+ "lint:fix": "eslint . --fix",
104
+ "test": "pnpm c8 mocha",
105
+ "build:test": "pnpm build && pnpm build:tests && pnpm c8 mocha",
106
+ "build:lint:test": "pnpm build && pnpm build:tests && pnpm lint:fix",
107
+ "prepublish": "pnpm build"
108
+ }
109
+ }