@did-btcr2/common 2.0.2 → 2.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/errors.js +50 -50
- package/dist/cjs/errors.js.map +1 -1
- package/dist/cjs/patch.js +3 -3
- package/dist/cjs/patch.js.map +1 -1
- package/dist/cjs/types.js +10 -10
- package/dist/cjs/types.js.map +1 -1
- package/dist/esm/errors.js +50 -50
- package/dist/esm/errors.js.map +1 -1
- package/dist/esm/patch.js +3 -3
- package/dist/esm/patch.js.map +1 -1
- package/dist/esm/types.js +10 -10
- package/dist/esm/types.js.map +1 -1
- package/dist/types/errors.d.ts +17 -17
- package/dist/types/errors.d.ts.map +1 -1
- package/dist/types/types.d.ts +2 -18
- package/dist/types/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/errors.ts +23 -23
- package/src/patch.ts +3 -3
- package/src/types.ts +2 -20
package/dist/cjs/errors.js
CHANGED
|
@@ -1,67 +1,67 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* An enumeration of possible DID error codes.
|
|
3
3
|
*/
|
|
4
|
-
export var
|
|
5
|
-
(function (
|
|
4
|
+
export var MethodErrorCode;
|
|
5
|
+
(function (MethodErrorCode) {
|
|
6
6
|
/** The DID supplied does not conform to valid syntax. */
|
|
7
|
-
|
|
7
|
+
MethodErrorCode["INVALID_DID"] = "INVALID_DID";
|
|
8
8
|
/** The supplied method name is not supported by the DID method and/or DID resolver implementation. */
|
|
9
|
-
|
|
9
|
+
MethodErrorCode["METHOD_NOT_SUPPORTED"] = "METHOD_NOT_SUPPORTED";
|
|
10
10
|
/** An unexpected error occurred during the requested DID operation. */
|
|
11
|
-
|
|
11
|
+
MethodErrorCode["INTERNAL_ERROR"] = "INTERNAL_ERROR";
|
|
12
12
|
/** The DID document supplied does not conform to valid syntax. */
|
|
13
|
-
|
|
13
|
+
MethodErrorCode["INVALID_DID_DOCUMENT"] = "INVALID_DID_DOCUMENT";
|
|
14
14
|
/** The DID Update supplied does not conform to valid syntax. */
|
|
15
|
-
|
|
15
|
+
MethodErrorCode["INVALID_DID_UPDATE"] = "INVALID_DID_UPDATE";
|
|
16
16
|
/** The byte length of a DID document does not match the expected value. */
|
|
17
|
-
|
|
17
|
+
MethodErrorCode["INVALID_DID_DOCUMENT_LENGTH"] = "INVALID_DID_DOCUMENT_LENGTH";
|
|
18
18
|
/** The DID URL supplied to the dereferencing function does not conform to valid syntax. */
|
|
19
|
-
|
|
19
|
+
MethodErrorCode["INVALID_DID_URL"] = "INVALID_DID_URL";
|
|
20
20
|
/** The given proof of a previous DID is invalid */
|
|
21
|
-
|
|
21
|
+
MethodErrorCode["INVALID_PREVIOUS_DID_PROOF"] = "INVALID_PREVIOUS_DID_PROOF";
|
|
22
22
|
/** An invalid public key is detected during a DID operation. */
|
|
23
|
-
|
|
23
|
+
MethodErrorCode["INVALID_PUBLIC_KEY"] = "INVALID_PUBLIC_KEY";
|
|
24
24
|
/** An invalid multibase format is detected on the public key during a DID operation. */
|
|
25
|
-
|
|
25
|
+
MethodErrorCode["INVALID_PUBLIC_KEY_MULTIBASE"] = "INVALID_PUBLIC_KEY_MULTIBASE";
|
|
26
26
|
/** The byte length of a public key does not match the expected value. */
|
|
27
|
-
|
|
27
|
+
MethodErrorCode["INVALID_PUBLIC_KEY_LENGTH"] = "INVALID_PUBLIC_KEY_LENGTH";
|
|
28
28
|
/** An invalid public key type was detected during a DID operation. */
|
|
29
|
-
|
|
29
|
+
MethodErrorCode["INVALID_PUBLIC_KEY_TYPE"] = "INVALID_PUBLIC_KEY_TYPE";
|
|
30
30
|
/** Verification of a signature failed during a DID operation. */
|
|
31
|
-
|
|
31
|
+
MethodErrorCode["INVALID_SIGNATURE"] = "INVALID_SIGNATURE";
|
|
32
32
|
/** General: The resource requested was not found. */
|
|
33
33
|
/** DID Resolution: The DID resolver was unable to find the DID document resulting from the resolution request. */
|
|
34
|
-
|
|
34
|
+
MethodErrorCode["NOT_FOUND"] = "NOT_FOUND";
|
|
35
35
|
/**
|
|
36
36
|
* The representation requested via the `accept` input metadata property is not supported by the
|
|
37
37
|
* DID method and/or DID resolver implementation.
|
|
38
38
|
*/
|
|
39
|
-
|
|
39
|
+
MethodErrorCode["REPRESENTATION_NOT_SUPPORTED"] = "REPRESENTATION_NOT_SUPPORTED";
|
|
40
40
|
/** The type of a public key is not supported by the DID method and/or DID resolver implementation. */
|
|
41
|
-
|
|
41
|
+
MethodErrorCode["UNSUPPORTED_PUBLIC_KEY_TYPE"] = "UNSUPPORTED_PUBLIC_KEY_TYPE";
|
|
42
42
|
/** The proof verification operation failed. */
|
|
43
|
-
|
|
43
|
+
MethodErrorCode["PROOF_VERIFICATION_ERROR"] = "PROOF_VERIFICATION_ERROR";
|
|
44
44
|
/** The proof generation operation failed. */
|
|
45
|
-
|
|
45
|
+
MethodErrorCode["PROOF_GENERATION_ERROR"] = "PROOF_GENERATION_ERROR";
|
|
46
46
|
/** The proof serialization operation failed. */
|
|
47
|
-
|
|
47
|
+
MethodErrorCode["PROOF_SERIALIZATION_ERROR"] = "PROOF_SERIALIZATION_ERROR";
|
|
48
48
|
/** The proof could not be parsed properly. */
|
|
49
|
-
|
|
49
|
+
MethodErrorCode["PROOF_PARSING_ERROR"] = "PROOF_PARSING_ERROR";
|
|
50
50
|
/** The verification method was formed improperly. */
|
|
51
|
-
|
|
51
|
+
MethodErrorCode["VERIFICATION_METHOD_ERROR"] = "VERIFICATION_METHOD_ERROR";
|
|
52
52
|
/** Something about the DID Update Payload indicates the potential for late publishing. */
|
|
53
|
-
|
|
53
|
+
MethodErrorCode["LATE_PUBLISHING_ERROR"] = "LATE_PUBLISHING_ERROR";
|
|
54
54
|
/** The sidecar data in the DID Update Payload was invalid. */
|
|
55
|
-
|
|
55
|
+
MethodErrorCode["INVALID_SIDECAR_DATA"] = "INVALID_SIDECAR_DATA";
|
|
56
56
|
/** The proof is missing or has a malformed challenge field. */
|
|
57
|
-
|
|
57
|
+
MethodErrorCode["INVALID_CHALLENGE_ERROR"] = "INVALID_CHALLENGE_ERROR";
|
|
58
58
|
/** The proof is missing or has a malformed domain field. */
|
|
59
|
-
|
|
60
|
-
})(
|
|
61
|
-
export const { INVALID_DID, METHOD_NOT_SUPPORTED, INTERNAL_ERROR, INVALID_DID_DOCUMENT, INVALID_DID_UPDATE, INVALID_DID_DOCUMENT_LENGTH, INVALID_DID_URL, INVALID_PREVIOUS_DID_PROOF, INVALID_PUBLIC_KEY, INVALID_PUBLIC_KEY_MULTIBASE, INVALID_PUBLIC_KEY_LENGTH, INVALID_PUBLIC_KEY_TYPE, INVALID_SIGNATURE, NOT_FOUND, REPRESENTATION_NOT_SUPPORTED, UNSUPPORTED_PUBLIC_KEY_TYPE, PROOF_VERIFICATION_ERROR, PROOF_GENERATION_ERROR, PROOF_SERIALIZATION_ERROR, PROOF_PARSING_ERROR, VERIFICATION_METHOD_ERROR, LATE_PUBLISHING_ERROR, INVALID_SIDECAR_DATA, INVALID_CHALLENGE_ERROR, INVALID_DOMAIN_ERROR } =
|
|
62
|
-
export class
|
|
63
|
-
name = '
|
|
64
|
-
type = '
|
|
59
|
+
MethodErrorCode["INVALID_DOMAIN_ERROR"] = "INVALID_DOMAIN_ERROR";
|
|
60
|
+
})(MethodErrorCode || (MethodErrorCode = {}));
|
|
61
|
+
export const { INVALID_DID, METHOD_NOT_SUPPORTED, INTERNAL_ERROR, INVALID_DID_DOCUMENT, INVALID_DID_UPDATE, INVALID_DID_DOCUMENT_LENGTH, INVALID_DID_URL, INVALID_PREVIOUS_DID_PROOF, INVALID_PUBLIC_KEY, INVALID_PUBLIC_KEY_MULTIBASE, INVALID_PUBLIC_KEY_LENGTH, INVALID_PUBLIC_KEY_TYPE, INVALID_SIGNATURE, NOT_FOUND, REPRESENTATION_NOT_SUPPORTED, UNSUPPORTED_PUBLIC_KEY_TYPE, PROOF_VERIFICATION_ERROR, PROOF_GENERATION_ERROR, PROOF_SERIALIZATION_ERROR, PROOF_PARSING_ERROR, VERIFICATION_METHOD_ERROR, LATE_PUBLISHING_ERROR, INVALID_SIDECAR_DATA, INVALID_CHALLENGE_ERROR, INVALID_DOMAIN_ERROR } = MethodErrorCode;
|
|
62
|
+
export class DidMethodError extends Error {
|
|
63
|
+
name = 'DidMethodError';
|
|
64
|
+
type = 'DidMethodError';
|
|
65
65
|
data;
|
|
66
66
|
constructor(message, options = {}) {
|
|
67
67
|
super(message);
|
|
@@ -74,76 +74,76 @@ export class DidBtcr2Error extends Error {
|
|
|
74
74
|
// Captures the stack trace in V8 engines (like Chrome, Edge, and Node.js).
|
|
75
75
|
// In non-V8 environments, the stack trace will still be captured.
|
|
76
76
|
if (Error.captureStackTrace) {
|
|
77
|
-
Error.captureStackTrace(this,
|
|
77
|
+
Error.captureStackTrace(this, DidMethodError);
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
|
-
export class
|
|
81
|
+
export class MethodError extends DidMethodError {
|
|
82
82
|
constructor(message, type, data) {
|
|
83
83
|
super(message, { type, name: type, data });
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
|
-
export class
|
|
87
|
-
constructor(message, type = '
|
|
88
|
-
super(message, { type, name: '
|
|
86
|
+
export class ResolveError extends DidMethodError {
|
|
87
|
+
constructor(message, type = 'ResolveError', data) {
|
|
88
|
+
super(message, { type, name: 'ResolveError', data });
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
|
-
export class
|
|
92
|
-
constructor(message, type = '
|
|
91
|
+
export class KeyManagerError extends DidMethodError {
|
|
92
|
+
constructor(message, type = 'KeyManagerError', data) {
|
|
93
93
|
super(message, { type, name: type, data });
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
|
-
export class DidDocumentError extends
|
|
96
|
+
export class DidDocumentError extends DidMethodError {
|
|
97
97
|
constructor(message, type = 'DidDocumentError', data) {
|
|
98
98
|
super(message, { type, name: type, data });
|
|
99
99
|
}
|
|
100
100
|
}
|
|
101
|
-
export class CryptosuiteError extends
|
|
101
|
+
export class CryptosuiteError extends DidMethodError {
|
|
102
102
|
constructor(message, type = 'CryptosuiteError', data) {
|
|
103
103
|
super(message, { type, name: type, data });
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
|
-
export class KeyPairError extends
|
|
106
|
+
export class KeyPairError extends DidMethodError {
|
|
107
107
|
constructor(message, type = 'KeyPairError', data) {
|
|
108
108
|
super(message, { type, name: type, data });
|
|
109
109
|
}
|
|
110
110
|
}
|
|
111
|
-
export class SecretKeyError extends
|
|
111
|
+
export class SecretKeyError extends DidMethodError {
|
|
112
112
|
constructor(message, type = 'SecretKeyError', data) {
|
|
113
113
|
super(message, { type, name: type, data });
|
|
114
114
|
}
|
|
115
115
|
}
|
|
116
|
-
export class PublicKeyError extends
|
|
116
|
+
export class PublicKeyError extends DidMethodError {
|
|
117
117
|
constructor(message, type = 'PublicKeyError', data) {
|
|
118
118
|
super(message, { type, name: type, data });
|
|
119
119
|
}
|
|
120
120
|
}
|
|
121
|
-
export class MultikeyError extends
|
|
121
|
+
export class MultikeyError extends DidMethodError {
|
|
122
122
|
constructor(message, type = 'MultikeyError', data) {
|
|
123
123
|
super(message, { type, name: type, data });
|
|
124
124
|
}
|
|
125
125
|
}
|
|
126
|
-
export class ProofError extends
|
|
126
|
+
export class ProofError extends DidMethodError {
|
|
127
127
|
constructor(message, type = 'ProofError', data) {
|
|
128
128
|
super(message, { type, name: type, data });
|
|
129
129
|
}
|
|
130
130
|
}
|
|
131
|
-
export class SingletonBeaconError extends
|
|
131
|
+
export class SingletonBeaconError extends DidMethodError {
|
|
132
132
|
constructor(message, type = 'SingletonBeaconError', data) {
|
|
133
133
|
super(message, { type, name: type, data });
|
|
134
134
|
}
|
|
135
135
|
}
|
|
136
|
-
export class CIDAggregateBeaconError extends
|
|
136
|
+
export class CIDAggregateBeaconError extends DidMethodError {
|
|
137
137
|
constructor(message, type = 'CIDAggregateBeaconError', data) {
|
|
138
138
|
super(message, { type, name: type, data });
|
|
139
139
|
}
|
|
140
140
|
}
|
|
141
|
-
export class SMTAggregateBeaconError extends
|
|
141
|
+
export class SMTAggregateBeaconError extends DidMethodError {
|
|
142
142
|
constructor(message, type = 'SMTAggregateBeaconError', data) {
|
|
143
143
|
super(message, { type, name: type, data });
|
|
144
144
|
}
|
|
145
145
|
}
|
|
146
|
-
export class CanonicalizationError extends
|
|
146
|
+
export class CanonicalizationError extends DidMethodError {
|
|
147
147
|
constructor(message, type = 'CanonicalizationError', data) {
|
|
148
148
|
super(message, { type, name: type, data });
|
|
149
149
|
}
|
package/dist/cjs/errors.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/errors.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAN,IAAY,
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/errors.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAN,IAAY,eA+EX;AA/ED,WAAY,eAAe;IACzB,yDAAyD;IACzD,8CAA2B,CAAA;IAE3B,sGAAsG;IACtG,gEAA6C,CAAA;IAE7C,uEAAuE;IACvE,oDAAiC,CAAA;IAEjC,kEAAkE;IAClE,gEAA6C,CAAA;IAE7C,gEAAgE;IAChE,4DAAyC,CAAA;IAEzC,2EAA2E;IAC3E,8EAA2D,CAAA;IAE3D,2FAA2F;IAC3F,sDAAmC,CAAA;IAEnC,mDAAmD;IACnD,4EAAyD,CAAA;IAEzD,gEAAgE;IAChE,4DAAyC,CAAA;IAEzC,wFAAwF;IACxF,gFAA6D,CAAA;IAE7D,yEAAyE;IACzE,0EAAuD,CAAA;IAEvD,sEAAsE;IACtE,sEAAmD,CAAA;IAEnD,iEAAiE;IACjE,0DAAuC,CAAA;IAEvC,qDAAqD;IACrD,mHAAmH;IACnH,0CAAuB,CAAA;IAEvB;;;OAGG;IACH,gFAA6D,CAAA;IAE7D,sGAAsG;IACtG,8EAA2D,CAAA;IAE3D,+CAA+C;IAC/C,wEAAqD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D,YAAY,OAAe,EAAE,OAAe,yBAAyB,EAAE,IAA0B;QAC/F,KAAK,CAAC,OAAO,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;IAC7C,CAAC;CACF;AAED,MAAM,OAAO,uBAAwB,SAAQ,cAAc;IACzD,YAAY,OAAe,EAAE,OAAe,yBAAyB,EAAE,IAA0B;QAC/F,KAAK,CAAC,OAAO,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;IAC7C,CAAC;CACF;AAED,MAAM,OAAO,qBAAsB,SAAQ,cAAc;IACvD,YAAY,OAAe,EAAE,OAAe,uBAAuB,EAAE,IAA0B;QAC7F,KAAK,CAAC,OAAO,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;IAC7C,CAAC;CACF"}
|
package/dist/cjs/patch.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { MethodError } from './errors.js';
|
|
2
2
|
/**
|
|
3
3
|
* Implementation of {@link https://datatracker.ietf.org/doc/html/rfc6902 | IETF RFC 6902 JSON Patch}.
|
|
4
4
|
*
|
|
@@ -51,12 +51,12 @@ export class Patch {
|
|
|
51
51
|
case 'test': {
|
|
52
52
|
const existingValue = this.getValue(patchedDocument, segments);
|
|
53
53
|
if (JSON.stringify(existingValue) !== JSON.stringify(value)) {
|
|
54
|
-
throw new
|
|
54
|
+
throw new MethodError(`Test operation failed at path`, 'JSON_PATCH_APPLY_ERROR', { path });
|
|
55
55
|
}
|
|
56
56
|
break;
|
|
57
57
|
}
|
|
58
58
|
default:
|
|
59
|
-
throw new
|
|
59
|
+
throw new MethodError(`Unsupported JSON Patch operation`, 'JSON_PATCH_APPLY_ERROR', { op });
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
62
|
return patchedDocument;
|
package/dist/cjs/patch.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"patch.js","sourceRoot":"","sources":["../../src/patch.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"patch.js","sourceRoot":"","sources":["../../src/patch.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C;;;;;;;;;GASG;AACH,MAAM,OAAO,KAAK;IAChB;;;;;;OAMG;IACI,KAAK,CAAC,cAA0B,EAAE,UAA4B;QACnE,MAAM,eAAe,GAAG,IAAI,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;QAEvD,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE,CAAC;YACnC,MAAM,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,SAAS,CAAC;YAE5C,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;YAE1C,QAAQ,EAAE,EAAE,CAAC;gBACX,KAAK,KAAK;oBACR,IAAI,CAAC,QAAQ,CAAC,eAAe,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC;oBAChD,MAAM;gBAER,KAAK,QAAQ;oBACX,IAAI,CAAC,WAAW,CAAC,eAAe,EAAE,QAAQ,CAAC,CAAC;oBAC5C,MAAM;gBAER,KAAK,SAAS;oBACZ,IAAI,CAAC,QAAQ,CAAC,eAAe,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC;oBAChD,MAAM;gBAER,KAAK,MAAM,CAAC,CAAA,CAAC;oBACX,IAAI,CAAC,IAAI;wBAAE,MAAM,IAAI,KAAK,CAAC,oCAAoC,CAAC,CAAC;oBACjE,MAAM,YAAY,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;oBAC9C,MAAM,UAAU,GAAG,IAAI,CAAC,QAAQ,CAAC,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GAAG,IAAI,OAAO,CAAC;gBAAE,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC;YACzC,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;QACzB,CAAC;QACD,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC;IACzC,CAAC;IAGD;;;;;;OAMG;IACK,WAAW,CAAC,GAAQ,EAAE,IAAc;QAC1C,IAAI,OAAO,GAAG,GAAG,CAAC;QAClB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;YACzC,MAAM,GAAG,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;YACpB,IAAI,CAAC,CAAC,GAAG,IAAI,OAAO,CAAC;gBAAE,OAAO;YAC9B,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;QACzB,CAAC;QACD,OAAO,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC;IACxC,CAAC;CACF"}
|
package/dist/cjs/types.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
export var
|
|
2
|
-
(function (
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
})(
|
|
6
|
-
export var
|
|
7
|
-
(function (
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
})(
|
|
1
|
+
export var IdentifierTypes;
|
|
2
|
+
(function (IdentifierTypes) {
|
|
3
|
+
IdentifierTypes["KEY"] = "KEY";
|
|
4
|
+
IdentifierTypes["EXTERNAL"] = "EXTERNAL";
|
|
5
|
+
})(IdentifierTypes || (IdentifierTypes = {}));
|
|
6
|
+
export var IdentifierHrp;
|
|
7
|
+
(function (IdentifierHrp) {
|
|
8
|
+
IdentifierHrp["k"] = "k";
|
|
9
|
+
IdentifierHrp["x"] = "x";
|
|
10
|
+
})(IdentifierHrp || (IdentifierHrp = {}));
|
|
11
11
|
export var BitcoinNetworkNames;
|
|
12
12
|
(function (BitcoinNetworkNames) {
|
|
13
13
|
BitcoinNetworkNames[BitcoinNetworkNames["bitcoin"] = 0] = "bitcoin";
|
package/dist/cjs/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAoDA,MAAM,CAAN,IAAY,eAGX;AAHD,WAAY,eAAe;IACvB,8BAAW,CAAA;IACX,wCAAqB,CAAA;AACzB,CAAC,EAHW,eAAe,KAAf,eAAe,QAG1B;AACD,MAAM,CAAN,IAAY,aAGX;AAHD,WAAY,aAAa;IACrB,wBAAO,CAAA;IACP,wBAAO,CAAA;AACX,CAAC,EAHW,aAAa,KAAb,aAAa,QAGxB;AACD,MAAM,CAAN,IAAY,mBAOX;AAPD,WAAY,mBAAmB;IAC3B,mEAAW,CAAA;IACX,iEAAU,CAAA;IACV,mEAAW,CAAA;IACX,qEAAY,CAAA;IACZ,qEAAY,CAAA;IACZ,uEAAa,CAAA;AACjB,CAAC,EAPW,mBAAmB,KAAnB,mBAAmB,QAO9B"}
|
package/dist/esm/errors.js
CHANGED
|
@@ -1,67 +1,67 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* An enumeration of possible DID error codes.
|
|
3
3
|
*/
|
|
4
|
-
export var
|
|
5
|
-
(function (
|
|
4
|
+
export var MethodErrorCode;
|
|
5
|
+
(function (MethodErrorCode) {
|
|
6
6
|
/** The DID supplied does not conform to valid syntax. */
|
|
7
|
-
|
|
7
|
+
MethodErrorCode["INVALID_DID"] = "INVALID_DID";
|
|
8
8
|
/** The supplied method name is not supported by the DID method and/or DID resolver implementation. */
|
|
9
|
-
|
|
9
|
+
MethodErrorCode["METHOD_NOT_SUPPORTED"] = "METHOD_NOT_SUPPORTED";
|
|
10
10
|
/** An unexpected error occurred during the requested DID operation. */
|
|
11
|
-
|
|
11
|
+
MethodErrorCode["INTERNAL_ERROR"] = "INTERNAL_ERROR";
|
|
12
12
|
/** The DID document supplied does not conform to valid syntax. */
|
|
13
|
-
|
|
13
|
+
MethodErrorCode["INVALID_DID_DOCUMENT"] = "INVALID_DID_DOCUMENT";
|
|
14
14
|
/** The DID Update supplied does not conform to valid syntax. */
|
|
15
|
-
|
|
15
|
+
MethodErrorCode["INVALID_DID_UPDATE"] = "INVALID_DID_UPDATE";
|
|
16
16
|
/** The byte length of a DID document does not match the expected value. */
|
|
17
|
-
|
|
17
|
+
MethodErrorCode["INVALID_DID_DOCUMENT_LENGTH"] = "INVALID_DID_DOCUMENT_LENGTH";
|
|
18
18
|
/** The DID URL supplied to the dereferencing function does not conform to valid syntax. */
|
|
19
|
-
|
|
19
|
+
MethodErrorCode["INVALID_DID_URL"] = "INVALID_DID_URL";
|
|
20
20
|
/** The given proof of a previous DID is invalid */
|
|
21
|
-
|
|
21
|
+
MethodErrorCode["INVALID_PREVIOUS_DID_PROOF"] = "INVALID_PREVIOUS_DID_PROOF";
|
|
22
22
|
/** An invalid public key is detected during a DID operation. */
|
|
23
|
-
|
|
23
|
+
MethodErrorCode["INVALID_PUBLIC_KEY"] = "INVALID_PUBLIC_KEY";
|
|
24
24
|
/** An invalid multibase format is detected on the public key during a DID operation. */
|
|
25
|
-
|
|
25
|
+
MethodErrorCode["INVALID_PUBLIC_KEY_MULTIBASE"] = "INVALID_PUBLIC_KEY_MULTIBASE";
|
|
26
26
|
/** The byte length of a public key does not match the expected value. */
|
|
27
|
-
|
|
27
|
+
MethodErrorCode["INVALID_PUBLIC_KEY_LENGTH"] = "INVALID_PUBLIC_KEY_LENGTH";
|
|
28
28
|
/** An invalid public key type was detected during a DID operation. */
|
|
29
|
-
|
|
29
|
+
MethodErrorCode["INVALID_PUBLIC_KEY_TYPE"] = "INVALID_PUBLIC_KEY_TYPE";
|
|
30
30
|
/** Verification of a signature failed during a DID operation. */
|
|
31
|
-
|
|
31
|
+
MethodErrorCode["INVALID_SIGNATURE"] = "INVALID_SIGNATURE";
|
|
32
32
|
/** General: The resource requested was not found. */
|
|
33
33
|
/** DID Resolution: The DID resolver was unable to find the DID document resulting from the resolution request. */
|
|
34
|
-
|
|
34
|
+
MethodErrorCode["NOT_FOUND"] = "NOT_FOUND";
|
|
35
35
|
/**
|
|
36
36
|
* The representation requested via the `accept` input metadata property is not supported by the
|
|
37
37
|
* DID method and/or DID resolver implementation.
|
|
38
38
|
*/
|
|
39
|
-
|
|
39
|
+
MethodErrorCode["REPRESENTATION_NOT_SUPPORTED"] = "REPRESENTATION_NOT_SUPPORTED";
|
|
40
40
|
/** The type of a public key is not supported by the DID method and/or DID resolver implementation. */
|
|
41
|
-
|
|
41
|
+
MethodErrorCode["UNSUPPORTED_PUBLIC_KEY_TYPE"] = "UNSUPPORTED_PUBLIC_KEY_TYPE";
|
|
42
42
|
/** The proof verification operation failed. */
|
|
43
|
-
|
|
43
|
+
MethodErrorCode["PROOF_VERIFICATION_ERROR"] = "PROOF_VERIFICATION_ERROR";
|
|
44
44
|
/** The proof generation operation failed. */
|
|
45
|
-
|
|
45
|
+
MethodErrorCode["PROOF_GENERATION_ERROR"] = "PROOF_GENERATION_ERROR";
|
|
46
46
|
/** The proof serialization operation failed. */
|
|
47
|
-
|
|
47
|
+
MethodErrorCode["PROOF_SERIALIZATION_ERROR"] = "PROOF_SERIALIZATION_ERROR";
|
|
48
48
|
/** The proof could not be parsed properly. */
|
|
49
|
-
|
|
49
|
+
MethodErrorCode["PROOF_PARSING_ERROR"] = "PROOF_PARSING_ERROR";
|
|
50
50
|
/** The verification method was formed improperly. */
|
|
51
|
-
|
|
51
|
+
MethodErrorCode["VERIFICATION_METHOD_ERROR"] = "VERIFICATION_METHOD_ERROR";
|
|
52
52
|
/** Something about the DID Update Payload indicates the potential for late publishing. */
|
|
53
|
-
|
|
53
|
+
MethodErrorCode["LATE_PUBLISHING_ERROR"] = "LATE_PUBLISHING_ERROR";
|
|
54
54
|
/** The sidecar data in the DID Update Payload was invalid. */
|
|
55
|
-
|
|
55
|
+
MethodErrorCode["INVALID_SIDECAR_DATA"] = "INVALID_SIDECAR_DATA";
|
|
56
56
|
/** The proof is missing or has a malformed challenge field. */
|
|
57
|
-
|
|
57
|
+
MethodErrorCode["INVALID_CHALLENGE_ERROR"] = "INVALID_CHALLENGE_ERROR";
|
|
58
58
|
/** The proof is missing or has a malformed domain field. */
|
|
59
|
-
|
|
60
|
-
})(
|
|
61
|
-
export const { INVALID_DID, METHOD_NOT_SUPPORTED, INTERNAL_ERROR, INVALID_DID_DOCUMENT, INVALID_DID_UPDATE, INVALID_DID_DOCUMENT_LENGTH, INVALID_DID_URL, INVALID_PREVIOUS_DID_PROOF, INVALID_PUBLIC_KEY, INVALID_PUBLIC_KEY_MULTIBASE, INVALID_PUBLIC_KEY_LENGTH, INVALID_PUBLIC_KEY_TYPE, INVALID_SIGNATURE, NOT_FOUND, REPRESENTATION_NOT_SUPPORTED, UNSUPPORTED_PUBLIC_KEY_TYPE, PROOF_VERIFICATION_ERROR, PROOF_GENERATION_ERROR, PROOF_SERIALIZATION_ERROR, PROOF_PARSING_ERROR, VERIFICATION_METHOD_ERROR, LATE_PUBLISHING_ERROR, INVALID_SIDECAR_DATA, INVALID_CHALLENGE_ERROR, INVALID_DOMAIN_ERROR } =
|
|
62
|
-
export class
|
|
63
|
-
name = '
|
|
64
|
-
type = '
|
|
59
|
+
MethodErrorCode["INVALID_DOMAIN_ERROR"] = "INVALID_DOMAIN_ERROR";
|
|
60
|
+
})(MethodErrorCode || (MethodErrorCode = {}));
|
|
61
|
+
export const { INVALID_DID, METHOD_NOT_SUPPORTED, INTERNAL_ERROR, INVALID_DID_DOCUMENT, INVALID_DID_UPDATE, INVALID_DID_DOCUMENT_LENGTH, INVALID_DID_URL, INVALID_PREVIOUS_DID_PROOF, INVALID_PUBLIC_KEY, INVALID_PUBLIC_KEY_MULTIBASE, INVALID_PUBLIC_KEY_LENGTH, INVALID_PUBLIC_KEY_TYPE, INVALID_SIGNATURE, NOT_FOUND, REPRESENTATION_NOT_SUPPORTED, UNSUPPORTED_PUBLIC_KEY_TYPE, PROOF_VERIFICATION_ERROR, PROOF_GENERATION_ERROR, PROOF_SERIALIZATION_ERROR, PROOF_PARSING_ERROR, VERIFICATION_METHOD_ERROR, LATE_PUBLISHING_ERROR, INVALID_SIDECAR_DATA, INVALID_CHALLENGE_ERROR, INVALID_DOMAIN_ERROR } = MethodErrorCode;
|
|
62
|
+
export class DidMethodError extends Error {
|
|
63
|
+
name = 'DidMethodError';
|
|
64
|
+
type = 'DidMethodError';
|
|
65
65
|
data;
|
|
66
66
|
constructor(message, options = {}) {
|
|
67
67
|
super(message);
|
|
@@ -74,76 +74,76 @@ export class DidBtcr2Error extends Error {
|
|
|
74
74
|
// Captures the stack trace in V8 engines (like Chrome, Edge, and Node.js).
|
|
75
75
|
// In non-V8 environments, the stack trace will still be captured.
|
|
76
76
|
if (Error.captureStackTrace) {
|
|
77
|
-
Error.captureStackTrace(this,
|
|
77
|
+
Error.captureStackTrace(this, DidMethodError);
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
|
-
export class
|
|
81
|
+
export class MethodError extends DidMethodError {
|
|
82
82
|
constructor(message, type, data) {
|
|
83
83
|
super(message, { type, name: type, data });
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
|
-
export class
|
|
87
|
-
constructor(message, type = '
|
|
88
|
-
super(message, { type, name: '
|
|
86
|
+
export class ResolveError extends DidMethodError {
|
|
87
|
+
constructor(message, type = 'ResolveError', data) {
|
|
88
|
+
super(message, { type, name: 'ResolveError', data });
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
|
-
export class
|
|
92
|
-
constructor(message, type = '
|
|
91
|
+
export class KeyManagerError extends DidMethodError {
|
|
92
|
+
constructor(message, type = 'KeyManagerError', data) {
|
|
93
93
|
super(message, { type, name: type, data });
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
|
-
export class DidDocumentError extends
|
|
96
|
+
export class DidDocumentError extends DidMethodError {
|
|
97
97
|
constructor(message, type = 'DidDocumentError', data) {
|
|
98
98
|
super(message, { type, name: type, data });
|
|
99
99
|
}
|
|
100
100
|
}
|
|
101
|
-
export class CryptosuiteError extends
|
|
101
|
+
export class CryptosuiteError extends DidMethodError {
|
|
102
102
|
constructor(message, type = 'CryptosuiteError', data) {
|
|
103
103
|
super(message, { type, name: type, data });
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
|
-
export class KeyPairError extends
|
|
106
|
+
export class KeyPairError extends DidMethodError {
|
|
107
107
|
constructor(message, type = 'KeyPairError', data) {
|
|
108
108
|
super(message, { type, name: type, data });
|
|
109
109
|
}
|
|
110
110
|
}
|
|
111
|
-
export class SecretKeyError extends
|
|
111
|
+
export class SecretKeyError extends DidMethodError {
|
|
112
112
|
constructor(message, type = 'SecretKeyError', data) {
|
|
113
113
|
super(message, { type, name: type, data });
|
|
114
114
|
}
|
|
115
115
|
}
|
|
116
|
-
export class PublicKeyError extends
|
|
116
|
+
export class PublicKeyError extends DidMethodError {
|
|
117
117
|
constructor(message, type = 'PublicKeyError', data) {
|
|
118
118
|
super(message, { type, name: type, data });
|
|
119
119
|
}
|
|
120
120
|
}
|
|
121
|
-
export class MultikeyError extends
|
|
121
|
+
export class MultikeyError extends DidMethodError {
|
|
122
122
|
constructor(message, type = 'MultikeyError', data) {
|
|
123
123
|
super(message, { type, name: type, data });
|
|
124
124
|
}
|
|
125
125
|
}
|
|
126
|
-
export class ProofError extends
|
|
126
|
+
export class ProofError extends DidMethodError {
|
|
127
127
|
constructor(message, type = 'ProofError', data) {
|
|
128
128
|
super(message, { type, name: type, data });
|
|
129
129
|
}
|
|
130
130
|
}
|
|
131
|
-
export class SingletonBeaconError extends
|
|
131
|
+
export class SingletonBeaconError extends DidMethodError {
|
|
132
132
|
constructor(message, type = 'SingletonBeaconError', data) {
|
|
133
133
|
super(message, { type, name: type, data });
|
|
134
134
|
}
|
|
135
135
|
}
|
|
136
|
-
export class CIDAggregateBeaconError extends
|
|
136
|
+
export class CIDAggregateBeaconError extends DidMethodError {
|
|
137
137
|
constructor(message, type = 'CIDAggregateBeaconError', data) {
|
|
138
138
|
super(message, { type, name: type, data });
|
|
139
139
|
}
|
|
140
140
|
}
|
|
141
|
-
export class SMTAggregateBeaconError extends
|
|
141
|
+
export class SMTAggregateBeaconError extends DidMethodError {
|
|
142
142
|
constructor(message, type = 'SMTAggregateBeaconError', data) {
|
|
143
143
|
super(message, { type, name: type, data });
|
|
144
144
|
}
|
|
145
145
|
}
|
|
146
|
-
export class CanonicalizationError extends
|
|
146
|
+
export class CanonicalizationError extends DidMethodError {
|
|
147
147
|
constructor(message, type = 'CanonicalizationError', data) {
|
|
148
148
|
super(message, { type, name: type, data });
|
|
149
149
|
}
|
package/dist/esm/errors.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/errors.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAN,IAAY,
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/errors.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAN,IAAY,eA+EX;AA/ED,WAAY,eAAe;IACzB,yDAAyD;IACzD,8CAA2B,CAAA;IAE3B,sGAAsG;IACtG,gEAA6C,CAAA;IAE7C,uEAAuE;IACvE,oDAAiC,CAAA;IAEjC,kEAAkE;IAClE,gEAA6C,CAAA;IAE7C,gEAAgE;IAChE,4DAAyC,CAAA;IAEzC,2EAA2E;IAC3E,8EAA2D,CAAA;IAE3D,2FAA2F;IAC3F,sDAAmC,CAAA;IAEnC,mDAAmD;IACnD,4EAAyD,CAAA;IAEzD,gEAAgE;IAChE,4DAAyC,CAAA;IAEzC,wFAAwF;IACxF,gFAA6D,CAAA;IAE7D,yEAAyE;IACzE,0E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AAO,oBAAqB,SAAQ,cAAc;IACtD,YAAY,OAAe,EAAE,OAAe,sBAAsB,EAAE,IAA0B;QAC5F,KAAK,CAAC,OAAO,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;IAC7C,CAAC;CACF;AAED,MAAM,OAAO,uBAAwB,SAAQ,cAAc;IACzD,YAAY,OAAe,EAAE,OAAe,yBAAyB,EAAE,IAA0B;QAC/F,KAAK,CAAC,OAAO,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;IAC7C,CAAC;CACF;AAED,MAAM,OAAO,uBAAwB,SAAQ,cAAc;IACzD,YAAY,OAAe,EAAE,OAAe,yBAAyB,EAAE,IAA0B;QAC/F,KAAK,CAAC,OAAO,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;IAC7C,CAAC;CACF;AAED,MAAM,OAAO,qBAAsB,SAAQ,cAAc;IACvD,YAAY,OAAe,EAAE,OAAe,uBAAuB,EAAE,IAA0B;QAC7F,KAAK,CAAC,OAAO,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;IAC7C,CAAC;CACF"}
|
package/dist/esm/patch.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { MethodError } from './errors.js';
|
|
2
2
|
/**
|
|
3
3
|
* Implementation of {@link https://datatracker.ietf.org/doc/html/rfc6902 | IETF RFC 6902 JSON Patch}.
|
|
4
4
|
*
|
|
@@ -51,12 +51,12 @@ export class Patch {
|
|
|
51
51
|
case 'test': {
|
|
52
52
|
const existingValue = this.getValue(patchedDocument, segments);
|
|
53
53
|
if (JSON.stringify(existingValue) !== JSON.stringify(value)) {
|
|
54
|
-
throw new
|
|
54
|
+
throw new MethodError(`Test operation failed at path`, 'JSON_PATCH_APPLY_ERROR', { path });
|
|
55
55
|
}
|
|
56
56
|
break;
|
|
57
57
|
}
|
|
58
58
|
default:
|
|
59
|
-
throw new
|
|
59
|
+
throw new MethodError(`Unsupported JSON Patch operation`, 'JSON_PATCH_APPLY_ERROR', { op });
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
62
|
return patchedDocument;
|
package/dist/esm/patch.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"patch.js","sourceRoot":"","sources":["../../src/patch.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"patch.js","sourceRoot":"","sources":["../../src/patch.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C;;;;;;;;;GASG;AACH,MAAM,OAAO,KAAK;IAChB;;;;;;OAMG;IACI,KAAK,CAAC,cAA0B,EAAE,UAA4B;QACnE,MAAM,eAAe,GAAG,IAAI,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;QAEvD,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE,CAAC;YACnC,MAAM,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,SAAS,CAAC;YAE5C,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;YAE1C,QAAQ,EAAE,EAAE,CAAC;gBACX,KAAK,KAAK;oBACR,IAAI,CAAC,QAAQ,CAAC,eAAe,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC;oBAChD,MAAM;gBAER,KAAK,QAAQ;oBACX,IAAI,CAAC,WAAW,CAAC,eAAe,EAAE,QAAQ,CAAC,CAAC;oBAC5C,MAAM;gBAER,KAAK,SAAS;oBACZ,IAAI,CAAC,QAAQ,CAAC,eAAe,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC;oBAChD,MAAM;gBAER,KAAK,MAAM,CAAC,CAA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AAU;QACnD,IAAI,OAAO,GAAG,GAAG,CAAC;QAClB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;YACzC,MAAM,GAAG,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;YACpB,IAAI,CAAC,CAAC,GAAG,IAAI,OAAO,CAAC;gBAAE,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC;YACzC,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;QACzB,CAAC;QACD,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC;IACzC,CAAC;IAGD;;;;;;OAMG;IACK,WAAW,CAAC,GAAQ,EAAE,IAAc;QAC1C,IAAI,OAAO,GAAG,GAAG,CAAC;QAClB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;YACzC,MAAM,GAAG,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;YACpB,IAAI,CAAC,CAAC,GAAG,IAAI,OAAO,CAAC;gBAAE,OAAO;YAC9B,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;QACzB,CAAC;QACD,OAAO,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC;IACxC,CAAC;CACF"}
|
package/dist/esm/types.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
export var
|
|
2
|
-
(function (
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
})(
|
|
6
|
-
export var
|
|
7
|
-
(function (
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
})(
|
|
1
|
+
export var IdentifierTypes;
|
|
2
|
+
(function (IdentifierTypes) {
|
|
3
|
+
IdentifierTypes["KEY"] = "KEY";
|
|
4
|
+
IdentifierTypes["EXTERNAL"] = "EXTERNAL";
|
|
5
|
+
})(IdentifierTypes || (IdentifierTypes = {}));
|
|
6
|
+
export var IdentifierHrp;
|
|
7
|
+
(function (IdentifierHrp) {
|
|
8
|
+
IdentifierHrp["k"] = "k";
|
|
9
|
+
IdentifierHrp["x"] = "x";
|
|
10
|
+
})(IdentifierHrp || (IdentifierHrp = {}));
|
|
11
11
|
export var BitcoinNetworkNames;
|
|
12
12
|
(function (BitcoinNetworkNames) {
|
|
13
13
|
BitcoinNetworkNames[BitcoinNetworkNames["bitcoin"] = 0] = "bitcoin";
|
package/dist/esm/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAoDA,MAAM,CAAN,IAAY,eAGX;AAHD,WAAY,eAAe;IACvB,8BAAW,CAAA;IACX,wCAAqB,CAAA;AACzB,CAAC,EAHW,eAAe,KAAf,eAAe,QAG1B;AACD,MAAM,CAAN,IAAY,aAGX;AAHD,WAAY,aAAa;IACrB,wBAAO,CAAA;IACP,wBAAO,CAAA;AACX,CAAC,EAHW,aAAa,KAAb,aAAa,QAGxB;AACD,MAAM,CAAN,IAAY,mBAOX;AAPD,WAAY,mBAAmB;IAC3B,mEAAW,CAAA;IACX,iEAAU,CAAA;IACV,mEAAW,CAAA;IACX,qEAAY,CAAA;IACZ,qEAAY,CAAA;IACZ,uEAAa,CAAA;AACjB,CAAC,EAPW,mBAAmB,KAAnB,mBAAmB,QAO9B"}
|
package/dist/types/errors.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* An enumeration of possible DID error codes.
|
|
3
3
|
*/
|
|
4
|
-
export declare enum
|
|
4
|
+
export declare enum MethodErrorCode {
|
|
5
5
|
/** The DID supplied does not conform to valid syntax. */
|
|
6
6
|
INVALID_DID = "INVALID_DID",
|
|
7
7
|
/** The supplied method name is not supported by the DID method and/or DID resolver implementation. */
|
|
@@ -57,57 +57,57 @@ export declare enum Btcr2ErrorCode {
|
|
|
57
57
|
/** The proof is missing or has a malformed domain field. */
|
|
58
58
|
INVALID_DOMAIN_ERROR = "INVALID_DOMAIN_ERROR"
|
|
59
59
|
}
|
|
60
|
-
export declare const INVALID_DID:
|
|
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;
|
|
61
61
|
export type ErrorOptions = {
|
|
62
62
|
type?: string;
|
|
63
63
|
name?: string;
|
|
64
64
|
data?: any;
|
|
65
65
|
};
|
|
66
|
-
export declare class
|
|
66
|
+
export declare class DidMethodError extends Error {
|
|
67
67
|
name: string;
|
|
68
68
|
type: string;
|
|
69
69
|
data?: Record<string, any>;
|
|
70
70
|
constructor(message: string, options?: ErrorOptions);
|
|
71
71
|
}
|
|
72
|
-
export declare class
|
|
72
|
+
export declare class MethodError extends DidMethodError {
|
|
73
73
|
constructor(message: string, type: string, data?: Record<string, any>);
|
|
74
74
|
}
|
|
75
|
-
export declare class
|
|
75
|
+
export declare class ResolveError extends DidMethodError {
|
|
76
76
|
constructor(message: string, type?: string, data?: Record<string, any>);
|
|
77
77
|
}
|
|
78
|
-
export declare class
|
|
78
|
+
export declare class KeyManagerError extends DidMethodError {
|
|
79
79
|
constructor(message: string, type?: string, data?: Record<string, any>);
|
|
80
80
|
}
|
|
81
|
-
export declare class DidDocumentError extends
|
|
81
|
+
export declare class DidDocumentError extends DidMethodError {
|
|
82
82
|
constructor(message: string, type?: string, data?: Record<string, any>);
|
|
83
83
|
}
|
|
84
|
-
export declare class CryptosuiteError extends
|
|
84
|
+
export declare class CryptosuiteError extends DidMethodError {
|
|
85
85
|
constructor(message: string, type?: string, data?: Record<string, any>);
|
|
86
86
|
}
|
|
87
|
-
export declare class KeyPairError extends
|
|
87
|
+
export declare class KeyPairError extends DidMethodError {
|
|
88
88
|
constructor(message: string, type?: string, data?: Record<string, any>);
|
|
89
89
|
}
|
|
90
|
-
export declare class SecretKeyError extends
|
|
90
|
+
export declare class SecretKeyError extends DidMethodError {
|
|
91
91
|
constructor(message: string, type?: string, data?: Record<string, any>);
|
|
92
92
|
}
|
|
93
|
-
export declare class PublicKeyError extends
|
|
93
|
+
export declare class PublicKeyError extends DidMethodError {
|
|
94
94
|
constructor(message: string, type?: string, data?: Record<string, any>);
|
|
95
95
|
}
|
|
96
|
-
export declare class MultikeyError extends
|
|
96
|
+
export declare class MultikeyError extends DidMethodError {
|
|
97
97
|
constructor(message: string, type?: string, data?: Record<string, any>);
|
|
98
98
|
}
|
|
99
|
-
export declare class ProofError extends
|
|
99
|
+
export declare class ProofError extends DidMethodError {
|
|
100
100
|
constructor(message: string, type?: string, data?: Record<string, any>);
|
|
101
101
|
}
|
|
102
|
-
export declare class SingletonBeaconError extends
|
|
102
|
+
export declare class SingletonBeaconError extends DidMethodError {
|
|
103
103
|
constructor(message: string, type?: string, data?: Record<string, any>);
|
|
104
104
|
}
|
|
105
|
-
export declare class CIDAggregateBeaconError extends
|
|
105
|
+
export declare class CIDAggregateBeaconError extends DidMethodError {
|
|
106
106
|
constructor(message: string, type?: string, data?: Record<string, any>);
|
|
107
107
|
}
|
|
108
|
-
export declare class SMTAggregateBeaconError extends
|
|
108
|
+
export declare class SMTAggregateBeaconError extends DidMethodError {
|
|
109
109
|
constructor(message: string, type?: string, data?: Record<string, any>);
|
|
110
110
|
}
|
|
111
|
-
export declare class CanonicalizationError extends
|
|
111
|
+
export declare class CanonicalizationError extends DidMethodError {
|
|
112
112
|
constructor(message: string, type?: string, data?: Record<string, any>);
|
|
113
113
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/errors.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,oBAAY,
|
|
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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AI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;CAGzF;AAED,qBAAa,aAAc,SAAQ,cAAc;gBACnC,OAAO,EAAE,MAAM,EAAE,IAAI,GAAE,MAAwB,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;CAGxF;AAED,qBAAa,UAAW,SAAQ,cAAc;gBAChC,OAAO,EAAE,MAAM,EAAE,IAAI,GAAE,MAAqB,EAAE,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"}
|
package/dist/types/types.d.ts
CHANGED
|
@@ -45,27 +45,11 @@ export type HdWallet = {
|
|
|
45
45
|
mnemonic: string;
|
|
46
46
|
hdkey: HDKey;
|
|
47
47
|
};
|
|
48
|
-
export
|
|
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 Btcr2MethodName = 'btcr2';
|
|
54
|
-
export type Btcr2DeterministicPrefix = 'k';
|
|
55
|
-
export type Btcr2ExternalPrefix = 'x';
|
|
56
|
-
export type Btcr2Prefix = `${Btcr2DeterministicPrefix | Btcr2ExternalPrefix}1`;
|
|
57
|
-
export type Bech32Id = string;
|
|
58
|
-
export type Btcr2Id = `${Btcr2Prefix}${Bech32Id}`;
|
|
59
|
-
export type Btcr2IdentifierExplicit = `${DID}:${Btcr2MethodName}:${Btcr2Id}`;
|
|
60
|
-
export type Btcr2Identifier = string;
|
|
61
|
-
export type Controller = Btcr2Identifier;
|
|
62
|
-
export type Id = 'initialKey';
|
|
63
|
-
export type FullId = `${Controller}#${Id}`;
|
|
64
|
-
export declare enum Btcr2IdentifierTypes {
|
|
48
|
+
export declare enum IdentifierTypes {
|
|
65
49
|
KEY = "KEY",
|
|
66
50
|
EXTERNAL = "EXTERNAL"
|
|
67
51
|
}
|
|
68
|
-
export declare enum
|
|
52
|
+
export declare enum IdentifierHrp {
|
|
69
53
|
k = "k",
|
|
70
54
|
x = "x"
|
|
71
55
|
}
|
|
@@ -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,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,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,MAA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GAAG,CAAC,CAAC;AAC/D,MAAM,MAAM,UAAU,GAAG,UAAU,CAAC;AACpC,MAAM,MAAM,YAAY,GAAG,UAAU,CAAC;AACtC,MAAM,MAAM,SAAS,GAAG,GAAG,MAAM,GAAG,MAAM,EAAE,CAAC;AAC7C,MAAM,MAAM,WAAW,GAAG,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,CAAC;AACxD,MAAM,MAAM,IAAI,GAAG,GAAG,CAAC,GAAG,CAAC,GAAG,WAAW,EAAE,CAAC;AAC5C,MAAM,MAAM,KAAK,GAAG,SAAS,CAAC;AAC9B,MAAM,MAAM,GAAG,GAAG,SAAS,CAAC;AAC5B,MAAM,MAAM,KAAK,GAAG,SAAS,CAAC;AAC9B,MAAM,MAAM,OAAO,GAAG,SAAS,CAAC;AAChC,MAAM,MAAM,OAAO,GAAG,SAAS,CAAC;AAChC,MAAM,MAAM,YAAY,GAAG,GAAG,IAAI,IAAI,KAAK,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,aAAa,GAAG,MAAM,CAAC"}
|
package/package.json
CHANGED
package/src/errors.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* An enumeration of possible DID error codes.
|
|
3
3
|
*/
|
|
4
|
-
export enum
|
|
4
|
+
export enum MethodErrorCode {
|
|
5
5
|
/** The DID supplied does not conform to valid syntax. */
|
|
6
6
|
INVALID_DID = 'INVALID_DID',
|
|
7
7
|
|
|
@@ -108,7 +108,7 @@ export const {
|
|
|
108
108
|
INVALID_SIDECAR_DATA,
|
|
109
109
|
INVALID_CHALLENGE_ERROR,
|
|
110
110
|
INVALID_DOMAIN_ERROR
|
|
111
|
-
} =
|
|
111
|
+
} = MethodErrorCode;
|
|
112
112
|
|
|
113
113
|
export type ErrorOptions = {
|
|
114
114
|
type?: string;
|
|
@@ -116,9 +116,9 @@ export type ErrorOptions = {
|
|
|
116
116
|
data?: any;
|
|
117
117
|
}
|
|
118
118
|
|
|
119
|
-
export class
|
|
120
|
-
name: string = '
|
|
121
|
-
type: string = '
|
|
119
|
+
export class DidMethodError extends Error {
|
|
120
|
+
name: string = 'DidMethodError';
|
|
121
|
+
type: string = 'DidMethodError';
|
|
122
122
|
data?: Record<string, any>;
|
|
123
123
|
|
|
124
124
|
constructor(message: string, options: ErrorOptions = {}) {
|
|
@@ -134,90 +134,90 @@ export class DidBtcr2Error extends Error {
|
|
|
134
134
|
// Captures the stack trace in V8 engines (like Chrome, Edge, and Node.js).
|
|
135
135
|
// In non-V8 environments, the stack trace will still be captured.
|
|
136
136
|
if (Error.captureStackTrace) {
|
|
137
|
-
Error.captureStackTrace(this,
|
|
137
|
+
Error.captureStackTrace(this, DidMethodError);
|
|
138
138
|
}
|
|
139
139
|
}
|
|
140
140
|
}
|
|
141
141
|
|
|
142
|
-
export class
|
|
142
|
+
export class MethodError extends DidMethodError {
|
|
143
143
|
constructor(message: string, type: string, data?: Record<string, any>) {
|
|
144
144
|
super(message, { type, name: type, data });
|
|
145
145
|
}
|
|
146
146
|
}
|
|
147
147
|
|
|
148
|
-
export class
|
|
149
|
-
constructor(message: string, type: string = '
|
|
150
|
-
super(message, { type, name: '
|
|
148
|
+
export class ResolveError extends DidMethodError {
|
|
149
|
+
constructor(message: string, type: string = 'ResolveError', data?: Record<string, any>) {
|
|
150
|
+
super(message, { type, name: 'ResolveError', data });
|
|
151
151
|
}
|
|
152
152
|
}
|
|
153
153
|
|
|
154
|
-
export class
|
|
155
|
-
constructor(message: string, type: string = '
|
|
154
|
+
export class KeyManagerError extends DidMethodError {
|
|
155
|
+
constructor(message: string, type: string = 'KeyManagerError', data?: Record<string, any>) {
|
|
156
156
|
super(message, { type, name: type, data });
|
|
157
157
|
}
|
|
158
158
|
}
|
|
159
159
|
|
|
160
|
-
export class DidDocumentError extends
|
|
160
|
+
export class DidDocumentError extends DidMethodError {
|
|
161
161
|
constructor(message: string, type: string = 'DidDocumentError', data?: Record<string, any>) {
|
|
162
162
|
super(message, { type, name: type, data });
|
|
163
163
|
}
|
|
164
164
|
}
|
|
165
165
|
|
|
166
|
-
export class CryptosuiteError extends
|
|
166
|
+
export class CryptosuiteError extends DidMethodError {
|
|
167
167
|
constructor(message: string, type: string = 'CryptosuiteError', data?: Record<string, any>) {
|
|
168
168
|
super(message, { type, name: type, data });
|
|
169
169
|
}
|
|
170
170
|
}
|
|
171
171
|
|
|
172
|
-
export class KeyPairError extends
|
|
172
|
+
export class KeyPairError extends DidMethodError {
|
|
173
173
|
constructor(message: string, type: string = 'KeyPairError', data?: Record<string, any>) {
|
|
174
174
|
super(message, { type, name: type, data });
|
|
175
175
|
}
|
|
176
176
|
}
|
|
177
177
|
|
|
178
|
-
export class SecretKeyError extends
|
|
178
|
+
export class SecretKeyError extends DidMethodError {
|
|
179
179
|
constructor(message: string, type: string = 'SecretKeyError', data?: Record<string, any>) {
|
|
180
180
|
super(message, { type, name: type, data });
|
|
181
181
|
}
|
|
182
182
|
}
|
|
183
183
|
|
|
184
|
-
export class PublicKeyError extends
|
|
184
|
+
export class PublicKeyError extends DidMethodError {
|
|
185
185
|
constructor(message: string, type: string = 'PublicKeyError', data?: Record<string, any>) {
|
|
186
186
|
super(message, { type, name: type, data });
|
|
187
187
|
}
|
|
188
188
|
}
|
|
189
189
|
|
|
190
|
-
export class MultikeyError extends
|
|
190
|
+
export class MultikeyError extends DidMethodError {
|
|
191
191
|
constructor(message: string, type: string = 'MultikeyError', data?: Record<string, any>) {
|
|
192
192
|
super(message, { type, name: type, data });
|
|
193
193
|
}
|
|
194
194
|
}
|
|
195
195
|
|
|
196
|
-
export class ProofError extends
|
|
196
|
+
export class ProofError extends DidMethodError {
|
|
197
197
|
constructor(message: string, type: string = 'ProofError', data?: Record<string, any>) {
|
|
198
198
|
super(message, { type, name: type, data });
|
|
199
199
|
}
|
|
200
200
|
}
|
|
201
201
|
|
|
202
|
-
export class SingletonBeaconError extends
|
|
202
|
+
export class SingletonBeaconError extends DidMethodError {
|
|
203
203
|
constructor(message: string, type: string = 'SingletonBeaconError', data?: Record<string, any>) {
|
|
204
204
|
super(message, { type, name: type, data });
|
|
205
205
|
}
|
|
206
206
|
}
|
|
207
207
|
|
|
208
|
-
export class CIDAggregateBeaconError extends
|
|
208
|
+
export class CIDAggregateBeaconError extends DidMethodError {
|
|
209
209
|
constructor(message: string, type: string = 'CIDAggregateBeaconError', data?: Record<string, any>) {
|
|
210
210
|
super(message, { type, name: type, data });
|
|
211
211
|
}
|
|
212
212
|
}
|
|
213
213
|
|
|
214
|
-
export class SMTAggregateBeaconError extends
|
|
214
|
+
export class SMTAggregateBeaconError extends DidMethodError {
|
|
215
215
|
constructor(message: string, type: string = 'SMTAggregateBeaconError', data?: Record<string, any>) {
|
|
216
216
|
super(message, { type, name: type, data });
|
|
217
217
|
}
|
|
218
218
|
}
|
|
219
219
|
|
|
220
|
-
export class CanonicalizationError extends
|
|
220
|
+
export class CanonicalizationError extends DidMethodError {
|
|
221
221
|
constructor(message: string, type: string = 'CanonicalizationError', data?: Record<string, any>) {
|
|
222
222
|
super(message, { type, name: type, data });
|
|
223
223
|
}
|
package/src/patch.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { PatchOperation } from './interfaces.js';
|
|
2
2
|
import { JSONObject } from './types.js';
|
|
3
|
-
import {
|
|
3
|
+
import { MethodError } from './errors.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Implementation of {@link https://datatracker.ietf.org/doc/html/rfc6902 | IETF RFC 6902 JSON Patch}.
|
|
@@ -59,12 +59,12 @@ export class Patch {
|
|
|
59
59
|
case 'test':{
|
|
60
60
|
const existingValue = this.getValue(patchedDocument, segments);
|
|
61
61
|
if (JSON.stringify(existingValue) !== JSON.stringify(value)) {
|
|
62
|
-
throw new
|
|
62
|
+
throw new MethodError(`Test operation failed at path`, 'JSON_PATCH_APPLY_ERROR', { path });
|
|
63
63
|
}
|
|
64
64
|
break;
|
|
65
65
|
}
|
|
66
66
|
default:
|
|
67
|
-
throw new
|
|
67
|
+
throw new MethodError(`Unsupported JSON Patch operation`, 'JSON_PATCH_APPLY_ERROR', { op });
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
70
|
|
package/src/types.ts
CHANGED
|
@@ -50,29 +50,11 @@ export type HdWallet = {
|
|
|
50
50
|
mnemonic: string;
|
|
51
51
|
hdkey: HDKey
|
|
52
52
|
};
|
|
53
|
-
|
|
54
|
-
/* DID Types */
|
|
55
|
-
export type DID = 'did';
|
|
56
|
-
export type MethodName = string;
|
|
57
|
-
export type MethodSpecificId = string;
|
|
58
|
-
export type DecentralizedIdentifierExplicit = `${DID}:${MethodName}:${MethodSpecificId}`;
|
|
59
|
-
export type DecentralizedIdentifier = string;
|
|
60
|
-
export type Btcr2MethodName = 'btcr2';
|
|
61
|
-
export type Btcr2DeterministicPrefix = 'k';
|
|
62
|
-
export type Btcr2ExternalPrefix = 'x';
|
|
63
|
-
export type Btcr2Prefix = `${Btcr2DeterministicPrefix | Btcr2ExternalPrefix}1`;
|
|
64
|
-
export type Bech32Id = string;
|
|
65
|
-
export type Btcr2Id = `${Btcr2Prefix}${Bech32Id}`
|
|
66
|
-
export type Btcr2IdentifierExplicit = `${DID}:${Btcr2MethodName}:${Btcr2Id}`;
|
|
67
|
-
export type Btcr2Identifier = string;
|
|
68
|
-
export type Controller = Btcr2Identifier;
|
|
69
|
-
export type Id = 'initialKey';
|
|
70
|
-
export type FullId = `${Controller}#${Id}`;
|
|
71
|
-
export enum Btcr2IdentifierTypes {
|
|
53
|
+
export enum IdentifierTypes {
|
|
72
54
|
KEY = 'KEY',
|
|
73
55
|
EXTERNAL = 'EXTERNAL'
|
|
74
56
|
}
|
|
75
|
-
export enum
|
|
57
|
+
export enum IdentifierHrp {
|
|
76
58
|
k = 'k',
|
|
77
59
|
x = 'x'
|
|
78
60
|
}
|