@enbox/dids 0.0.3 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser.mjs +1 -1
- package/dist/browser.mjs.map +4 -4
- package/dist/esm/index.js +2 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/methods/did-dht-dns.js +455 -0
- package/dist/esm/methods/did-dht-dns.js.map +1 -0
- package/dist/esm/methods/did-dht-pkarr.js +168 -0
- package/dist/esm/methods/did-dht-pkarr.js.map +1 -0
- package/dist/esm/methods/did-dht-types.js +116 -0
- package/dist/esm/methods/did-dht-types.js.map +1 -0
- package/dist/esm/methods/did-dht-utils.js +143 -0
- package/dist/esm/methods/did-dht-utils.js.map +1 -0
- package/dist/esm/methods/did-dht.js +65 -842
- package/dist/esm/methods/did-dht.js.map +1 -1
- package/dist/esm/methods/did-ion-utils.js +161 -0
- package/dist/esm/methods/did-ion-utils.js.map +1 -0
- package/dist/esm/methods/did-ion.js +4 -151
- package/dist/esm/methods/did-ion.js.map +1 -1
- package/dist/esm/methods/did-jwk.js.map +1 -1
- package/dist/esm/methods/did-key-utils.js +235 -0
- package/dist/esm/methods/did-key-utils.js.map +1 -0
- package/dist/esm/methods/did-key.js +6 -222
- package/dist/esm/methods/did-key.js.map +1 -1
- package/dist/esm/resolver/resolver-cache-memory.js +77 -0
- package/dist/esm/resolver/resolver-cache-memory.js.map +1 -0
- package/dist/esm/utils.js +25 -0
- package/dist/esm/utils.js.map +1 -1
- package/dist/types/bearer-did.d.ts +4 -4
- package/dist/types/bearer-did.d.ts.map +1 -1
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/methods/did-dht-dns.d.ts +114 -0
- package/dist/types/methods/did-dht-dns.d.ts.map +1 -0
- package/dist/types/methods/did-dht-pkarr.d.ts +56 -0
- package/dist/types/methods/did-dht-pkarr.d.ts.map +1 -0
- package/dist/types/methods/did-dht-types.d.ts +286 -0
- package/dist/types/methods/did-dht-types.d.ts.map +1 -0
- package/dist/types/methods/did-dht-utils.d.ts +54 -0
- package/dist/types/methods/did-dht-utils.d.ts.map +1 -0
- package/dist/types/methods/did-dht.d.ts +45 -460
- package/dist/types/methods/did-dht.d.ts.map +1 -1
- package/dist/types/methods/did-ion-utils.d.ts +86 -0
- package/dist/types/methods/did-ion-utils.d.ts.map +1 -0
- package/dist/types/methods/did-ion.d.ts +4 -84
- package/dist/types/methods/did-ion.d.ts.map +1 -1
- package/dist/types/methods/did-jwk.d.ts +4 -4
- package/dist/types/methods/did-jwk.d.ts.map +1 -1
- package/dist/types/methods/did-key-utils.d.ts +138 -0
- package/dist/types/methods/did-key-utils.d.ts.map +1 -0
- package/dist/types/methods/did-key.d.ts +6 -127
- package/dist/types/methods/did-key.d.ts.map +1 -1
- package/dist/types/methods/did-method.d.ts +3 -3
- package/dist/types/methods/did-method.d.ts.map +1 -1
- package/dist/types/resolver/resolver-cache-memory.d.ts +58 -0
- package/dist/types/resolver/resolver-cache-memory.d.ts.map +1 -0
- package/dist/types/utils.d.ts +19 -0
- package/dist/types/utils.d.ts.map +1 -1
- package/dist/utils.js +1 -1
- package/dist/utils.js.map +4 -4
- package/package.json +11 -13
- package/src/bearer-did.ts +4 -4
- package/src/index.ts +2 -0
- package/src/methods/did-dht-dns.ts +516 -0
- package/src/methods/did-dht-pkarr.ts +192 -0
- package/src/methods/did-dht-types.ts +316 -0
- package/src/methods/did-dht-utils.ts +157 -0
- package/src/methods/did-dht.ts +125 -1131
- package/src/methods/did-ion-utils.ts +186 -0
- package/src/methods/did-ion.ts +16 -185
- package/src/methods/did-jwk.ts +4 -4
- package/src/methods/did-key-utils.ts +258 -0
- package/src/methods/did-key.ts +20 -272
- package/src/methods/did-method.ts +3 -3
- package/src/resolver/resolver-cache-memory.ts +84 -0
- package/src/utils.ts +27 -0
- package/dist/browser.js +0 -73
- package/dist/browser.js.map +0 -7
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { Multicodec } from '@enbox/common';
|
|
11
|
+
import { Ed25519, Secp256k1, Secp256r1 } from '@enbox/crypto';
|
|
12
|
+
import { keyBytesToMultibaseId } from '../utils.js';
|
|
13
|
+
import { DidError, DidErrorCode } from '../did-error.js';
|
|
14
|
+
/**
|
|
15
|
+
* Private helper that maps algorithm identifiers to their corresponding DID Key
|
|
16
|
+
* {@link DidKeyRegisteredKeyType | registered key type}.
|
|
17
|
+
*
|
|
18
|
+
* Note: This is also used by `DidKeyUtils.publicKeyToMultibaseId()` to validate key types.
|
|
19
|
+
*/
|
|
20
|
+
export const AlgorithmToKeyTypeMap = {
|
|
21
|
+
Ed25519: 'Ed25519',
|
|
22
|
+
ES256K: 'secp256k1',
|
|
23
|
+
ES256: 'secp256r1',
|
|
24
|
+
'P-256': 'secp256r1',
|
|
25
|
+
secp256k1: 'secp256k1',
|
|
26
|
+
secp256r1: 'secp256r1',
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* The `DidKeyUtils` class provides utility functions to support operations in the DID Key method.
|
|
30
|
+
*/
|
|
31
|
+
export class DidKeyUtils {
|
|
32
|
+
/**
|
|
33
|
+
* Converts a JWK (JSON Web Key) to a Multicodec code and name.
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```ts
|
|
37
|
+
* const jwk: Jwk = { crv: 'Ed25519', kty: 'OKP', x: '...' };
|
|
38
|
+
* const { code, name } = await DidKeyUtils.jwkToMulticodec({ jwk });
|
|
39
|
+
* ```
|
|
40
|
+
*
|
|
41
|
+
* @param params - The parameters for the conversion.
|
|
42
|
+
* @param params.jwk - The JSON Web Key to be converted.
|
|
43
|
+
* @returns A promise that resolves to a Multicodec definition.
|
|
44
|
+
*/
|
|
45
|
+
static jwkToMulticodec(_a) {
|
|
46
|
+
return __awaiter(this, arguments, void 0, function* ({ jwk }) {
|
|
47
|
+
const params = [];
|
|
48
|
+
if (jwk.crv) {
|
|
49
|
+
params.push(jwk.crv);
|
|
50
|
+
if (jwk.d) {
|
|
51
|
+
params.push('private');
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
params.push('public');
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
const lookupKey = params.join(':');
|
|
58
|
+
const name = DidKeyUtils.JWK_TO_MULTICODEC[lookupKey];
|
|
59
|
+
if (name === undefined) {
|
|
60
|
+
throw new Error(`Unsupported JWK to Multicodec conversion: '${lookupKey}'`);
|
|
61
|
+
}
|
|
62
|
+
const code = Multicodec.getCodeFromName({ name });
|
|
63
|
+
return { code, name };
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Returns the appropriate public key compressor for the specified cryptographic curve.
|
|
68
|
+
*
|
|
69
|
+
* @param curve - The cryptographic curve to use for the key conversion.
|
|
70
|
+
* @returns A public key compressor for the specified curve.
|
|
71
|
+
*/
|
|
72
|
+
static keyCompressor(curve) {
|
|
73
|
+
// ): ({ publicKeyBytes }: { publicKeyBytes: Uint8Array }) => Promise<Uint8Array> {
|
|
74
|
+
const compressors = {
|
|
75
|
+
'P-256': Secp256r1.compressPublicKey,
|
|
76
|
+
'secp256k1': Secp256k1.compressPublicKey
|
|
77
|
+
};
|
|
78
|
+
const compressor = compressors[curve];
|
|
79
|
+
if (!compressor) {
|
|
80
|
+
throw new DidError(DidErrorCode.InvalidPublicKeyType, `Unsupported curve: ${curve}`);
|
|
81
|
+
}
|
|
82
|
+
return compressor;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Returns the appropriate key converter for the specified cryptographic curve.
|
|
86
|
+
*
|
|
87
|
+
* @param curve - The cryptographic curve to use for the key conversion.
|
|
88
|
+
* @returns An `AsymmetricKeyConverter` for the specified curve.
|
|
89
|
+
*/
|
|
90
|
+
static keyConverter(curve) {
|
|
91
|
+
const converters = {
|
|
92
|
+
'Ed25519': Ed25519,
|
|
93
|
+
'P-256': Secp256r1,
|
|
94
|
+
'secp256k1': Secp256k1,
|
|
95
|
+
};
|
|
96
|
+
const converter = converters[curve];
|
|
97
|
+
if (!converter) {
|
|
98
|
+
throw new DidError(DidErrorCode.InvalidPublicKeyType, `Unsupported curve: ${curve}`);
|
|
99
|
+
}
|
|
100
|
+
return converter;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Converts a Multicodec code or name to parial JWK (JSON Web Key).
|
|
104
|
+
*
|
|
105
|
+
* @example
|
|
106
|
+
* ```ts
|
|
107
|
+
* const partialJwk = await DidKeyUtils.multicodecToJwk({ name: 'ed25519-pub' });
|
|
108
|
+
* ```
|
|
109
|
+
*
|
|
110
|
+
* @param params - The parameters for the conversion.
|
|
111
|
+
* @param params.code - Optional Multicodec code to convert.
|
|
112
|
+
* @param params.name - Optional Multicodec name to convert.
|
|
113
|
+
* @returns A promise that resolves to a JOSE format key.
|
|
114
|
+
*/
|
|
115
|
+
static multicodecToJwk(_a) {
|
|
116
|
+
return __awaiter(this, arguments, void 0, function* ({ code, name }) {
|
|
117
|
+
// Either code or name must be specified, but not both.
|
|
118
|
+
if (!(name ? !code : code)) {
|
|
119
|
+
throw new Error(`Either 'name' or 'code' must be defined, but not both.`);
|
|
120
|
+
}
|
|
121
|
+
// If name is undefined, lookup by code.
|
|
122
|
+
name = (name === undefined) ? Multicodec.getNameFromCode({ code: code }) : name;
|
|
123
|
+
const lookupKey = name;
|
|
124
|
+
const jose = DidKeyUtils.MULTICODEC_TO_JWK[lookupKey];
|
|
125
|
+
if (jose === undefined) {
|
|
126
|
+
throw new Error(`Unsupported Multicodec to JWK conversion`);
|
|
127
|
+
}
|
|
128
|
+
return Object.assign({}, jose);
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Converts a public key in JWK (JSON Web Key) format to a multibase identifier.
|
|
133
|
+
*
|
|
134
|
+
* @remarks
|
|
135
|
+
* Note: All secp public keys are converted to compressed point encoding
|
|
136
|
+
* before the multibase identifier is computed.
|
|
137
|
+
*
|
|
138
|
+
* Per {@link https://github.com/multiformats/multicodec/blob/master/table.csv | Multicodec table}:
|
|
139
|
+
* Public keys for Elliptic Curve cryptography algorithms (e.g., secp256k1,
|
|
140
|
+
* secp256k1r1, secp384r1, etc.) are always represented with compressed point
|
|
141
|
+
* encoding (e.g., secp256k1-pub, p256-pub, p384-pub, etc.).
|
|
142
|
+
*
|
|
143
|
+
* Per {@link https://datatracker.ietf.org/doc/html/rfc8812#name-jose-and-cose-secp256k1-cur | RFC 8812}:
|
|
144
|
+
* "As a compressed point encoding representation is not defined for JWK
|
|
145
|
+
* elliptic curve points, the uncompressed point encoding defined there
|
|
146
|
+
* MUST be used. The x and y values represented MUST both be exactly
|
|
147
|
+
* 256 bits, with any leading zeros preserved."
|
|
148
|
+
*
|
|
149
|
+
* @example
|
|
150
|
+
* ```ts
|
|
151
|
+
* const publicKey = { crv: 'Ed25519', kty: 'OKP', x: '...' };
|
|
152
|
+
* const multibaseId = await DidKeyUtils.publicKeyToMultibaseId({ publicKey });
|
|
153
|
+
* ```
|
|
154
|
+
*
|
|
155
|
+
* @param params - The parameters for the conversion.
|
|
156
|
+
* @param params.publicKey - The public key in JWK format.
|
|
157
|
+
* @returns A promise that resolves to the multibase identifier.
|
|
158
|
+
*/
|
|
159
|
+
static publicKeyToMultibaseId(_a) {
|
|
160
|
+
return __awaiter(this, arguments, void 0, function* ({ publicKey }) {
|
|
161
|
+
var _b;
|
|
162
|
+
if (!((publicKey === null || publicKey === void 0 ? void 0 : publicKey.crv) && publicKey.crv in AlgorithmToKeyTypeMap)) {
|
|
163
|
+
throw new DidError(DidErrorCode.InvalidPublicKeyType, `Public key contains an unsupported key type: ${(_b = publicKey === null || publicKey === void 0 ? void 0 : publicKey.crv) !== null && _b !== void 0 ? _b : 'undefined'}`);
|
|
164
|
+
}
|
|
165
|
+
// Convert the public key from JWK format to a byte array.
|
|
166
|
+
let publicKeyBytes = yield DidKeyUtils.keyConverter(publicKey.crv).publicKeyToBytes({ publicKey });
|
|
167
|
+
// Compress the public key if it is an elliptic curve key.
|
|
168
|
+
if (/^(secp256k1|P-256|P-384|P-521)$/.test(publicKey.crv)) {
|
|
169
|
+
publicKeyBytes = yield DidKeyUtils.keyCompressor(publicKey.crv)({ publicKeyBytes });
|
|
170
|
+
}
|
|
171
|
+
// Convert the JSON Web Key (JWK) parameters to a Multicodec name.
|
|
172
|
+
const { name: multicodecName } = yield DidKeyUtils.jwkToMulticodec({ jwk: publicKey });
|
|
173
|
+
// Compute the multibase identifier based on the provided key.
|
|
174
|
+
const multibaseId = keyBytesToMultibaseId({
|
|
175
|
+
keyBytes: publicKeyBytes,
|
|
176
|
+
multicodecName
|
|
177
|
+
});
|
|
178
|
+
return multibaseId;
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* A mapping from JSON Web Key (JWK) property descriptors to multicodec names.
|
|
184
|
+
*
|
|
185
|
+
* This mapping is used to convert keys in JWK (JSON Web Key) format to multicodec format.
|
|
186
|
+
*
|
|
187
|
+
* @remarks
|
|
188
|
+
* The keys of this object are strings that describe the JOSE key type and usage,
|
|
189
|
+
* such as 'Ed25519:public', 'Ed25519:private', etc. The values are the corresponding multicodec
|
|
190
|
+
* names used to represent these key types.
|
|
191
|
+
*
|
|
192
|
+
* @example
|
|
193
|
+
* ```ts
|
|
194
|
+
* const multicodecName = JWK_TO_MULTICODEC['Ed25519:public'];
|
|
195
|
+
* // Returns 'ed25519-pub', the multicodec name for an Ed25519 public key
|
|
196
|
+
* ```
|
|
197
|
+
*/
|
|
198
|
+
DidKeyUtils.JWK_TO_MULTICODEC = {
|
|
199
|
+
'Ed25519:public': 'ed25519-pub',
|
|
200
|
+
'Ed25519:private': 'ed25519-priv',
|
|
201
|
+
'secp256k1:public': 'secp256k1-pub',
|
|
202
|
+
'secp256k1:private': 'secp256k1-priv',
|
|
203
|
+
};
|
|
204
|
+
/**
|
|
205
|
+
* Defines the expected byte lengths for public keys associated with different cryptographic
|
|
206
|
+
* algorithms, indexed by their multicodec code values.
|
|
207
|
+
*/
|
|
208
|
+
DidKeyUtils.MULTICODEC_PUBLIC_KEY_LENGTH = {
|
|
209
|
+
// secp256k1-pub - Secp256k1 public key (compressed) - 33 bytes
|
|
210
|
+
0xe7: 33,
|
|
211
|
+
// ed25519-pub - Ed25519 public key - 32 bytes
|
|
212
|
+
0xed: 32
|
|
213
|
+
};
|
|
214
|
+
/**
|
|
215
|
+
* A mapping from multicodec names to their corresponding JOSE (JSON Object Signing and Encryption)
|
|
216
|
+
* representations. This mapping facilitates the conversion of multicodec key formats to
|
|
217
|
+
* JWK (JSON Web Key) formats.
|
|
218
|
+
*
|
|
219
|
+
* @remarks
|
|
220
|
+
* The keys of this object are multicodec names, such as 'ed25519-pub', 'ed25519-priv', etc.
|
|
221
|
+
* The values are objects representing the corresponding JWK properties for that key type.
|
|
222
|
+
*
|
|
223
|
+
* @example
|
|
224
|
+
* ```ts
|
|
225
|
+
* const joseKey = MULTICODEC_TO_JWK['ed25519-pub'];
|
|
226
|
+
* // Returns a partial JWK for an Ed25519 public key
|
|
227
|
+
* ```
|
|
228
|
+
*/
|
|
229
|
+
DidKeyUtils.MULTICODEC_TO_JWK = {
|
|
230
|
+
'ed25519-pub': { crv: 'Ed25519', kty: 'OKP', x: '' },
|
|
231
|
+
'ed25519-priv': { crv: 'Ed25519', kty: 'OKP', x: '', d: '' },
|
|
232
|
+
'secp256k1-pub': { crv: 'secp256k1', kty: 'EC', x: '', y: '' },
|
|
233
|
+
'secp256k1-priv': { crv: 'secp256k1', kty: 'EC', x: '', y: '', d: '' },
|
|
234
|
+
};
|
|
235
|
+
//# sourceMappingURL=did-key-utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"did-key-utils.js","sourceRoot":"","sources":["../../../src/methods/did-key-utils.ts"],"names":[],"mappings":";;;;;;;;;AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE9D,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAEzD;;;;;GAKG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,OAAO,EAAK,SAAS;IACrB,MAAM,EAAM,WAAW;IACvB,KAAK,EAAO,WAAW;IACvB,OAAO,EAAK,WAAW;IACvB,SAAS,EAAG,WAAW;IACvB,SAAS,EAAG,WAAW;CACf,CAAC;AAEX;;GAEG;AACH,MAAM,OAAO,WAAW;IA0DtB;;;;;;;;;;;;OAYG;IACI,MAAM,CAAO,eAAe;6DAAC,EAAE,GAAG,EAExC;YACC,MAAM,MAAM,GAAa,EAAE,CAAC;YAE5B,IAAI,GAAG,CAAC,GAAG,EAAE,CAAC;gBACZ,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;gBACrB,IAAI,GAAG,CAAC,CAAC,EAAE,CAAC;oBACV,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;gBACzB,CAAC;qBAAM,CAAC;oBACN,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;gBACxB,CAAC;YACH,CAAC;YAED,MAAM,SAAS,GAAG,MAAM,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C,EAAE,EAAE,EAAE;CACxE,CAAC"}
|
|
@@ -7,14 +7,15 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
10
|
+
import { universalTypeOf } from '@enbox/common';
|
|
11
|
+
import { Ed25519, LocalKeyManager, Secp256k1 } from '@enbox/crypto';
|
|
12
12
|
import { BearerDid } from '../bearer-did.js';
|
|
13
13
|
import { Did } from '../did.js';
|
|
14
|
+
import { DidKeyUtils } from './did-key-utils.js';
|
|
14
15
|
import { DidMethod } from './did-method.js';
|
|
15
16
|
import { EMPTY_DID_RESOLUTION_RESULT } from '../types/did-resolution.js';
|
|
16
17
|
import { DidError, DidErrorCode } from '../did-error.js';
|
|
17
|
-
import { getVerificationMethodTypes,
|
|
18
|
+
import { getVerificationMethodTypes, multibaseIdToKeyBytes } from '../utils.js';
|
|
18
19
|
/**
|
|
19
20
|
* Enumerates the types of keys that can be used in a DID Key document.
|
|
20
21
|
*
|
|
@@ -53,18 +54,6 @@ export const DidKeyVerificationMethodType = {
|
|
|
53
54
|
/** Represents a JSON Web Key (JWK) used for digital signatures and key agreement protocols. */
|
|
54
55
|
JsonWebKey2020: 'https://w3id.org/security/suites/jws-2020/v1',
|
|
55
56
|
};
|
|
56
|
-
/**
|
|
57
|
-
* Private helper that maps algorithm identifiers to their corresponding DID Key
|
|
58
|
-
* {@link DidKeyRegisteredKeyType | registered key type}.
|
|
59
|
-
*/
|
|
60
|
-
const AlgorithmToKeyTypeMap = {
|
|
61
|
-
Ed25519: DidKeyRegisteredKeyType.Ed25519,
|
|
62
|
-
ES256K: DidKeyRegisteredKeyType.secp256k1,
|
|
63
|
-
ES256: DidKeyRegisteredKeyType.secp256r1,
|
|
64
|
-
'P-256': DidKeyRegisteredKeyType.secp256r1,
|
|
65
|
-
secp256k1: DidKeyRegisteredKeyType.secp256k1,
|
|
66
|
-
secp256r1: DidKeyRegisteredKeyType.secp256r1,
|
|
67
|
-
};
|
|
68
57
|
/**
|
|
69
58
|
* The `DidKey` class provides an implementation of the 'did:key' DID method.
|
|
70
59
|
*
|
|
@@ -545,211 +534,6 @@ export class DidKey extends DidMethod {
|
|
|
545
534
|
* Name of the DID method, as defined in the DID Key specification.
|
|
546
535
|
*/
|
|
547
536
|
DidKey.methodName = 'key';
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
*/
|
|
551
|
-
export class DidKeyUtils {
|
|
552
|
-
/**
|
|
553
|
-
* Converts a JWK (JSON Web Key) to a Multicodec code and name.
|
|
554
|
-
*
|
|
555
|
-
* @example
|
|
556
|
-
* ```ts
|
|
557
|
-
* const jwk: Jwk = { crv: 'Ed25519', kty: 'OKP', x: '...' };
|
|
558
|
-
* const { code, name } = await DidKeyUtils.jwkToMulticodec({ jwk });
|
|
559
|
-
* ```
|
|
560
|
-
*
|
|
561
|
-
* @param params - The parameters for the conversion.
|
|
562
|
-
* @param params.jwk - The JSON Web Key to be converted.
|
|
563
|
-
* @returns A promise that resolves to a Multicodec definition.
|
|
564
|
-
*/
|
|
565
|
-
static jwkToMulticodec(_a) {
|
|
566
|
-
return __awaiter(this, arguments, void 0, function* ({ jwk }) {
|
|
567
|
-
const params = [];
|
|
568
|
-
if (jwk.crv) {
|
|
569
|
-
params.push(jwk.crv);
|
|
570
|
-
if (jwk.d) {
|
|
571
|
-
params.push('private');
|
|
572
|
-
}
|
|
573
|
-
else {
|
|
574
|
-
params.push('public');
|
|
575
|
-
}
|
|
576
|
-
}
|
|
577
|
-
const lookupKey = params.join(':');
|
|
578
|
-
const name = DidKeyUtils.JWK_TO_MULTICODEC[lookupKey];
|
|
579
|
-
if (name === undefined) {
|
|
580
|
-
throw new Error(`Unsupported JWK to Multicodec conversion: '${lookupKey}'`);
|
|
581
|
-
}
|
|
582
|
-
const code = Multicodec.getCodeFromName({ name });
|
|
583
|
-
return { code, name };
|
|
584
|
-
});
|
|
585
|
-
}
|
|
586
|
-
/**
|
|
587
|
-
* Returns the appropriate public key compressor for the specified cryptographic curve.
|
|
588
|
-
*
|
|
589
|
-
* @param curve - The cryptographic curve to use for the key conversion.
|
|
590
|
-
* @returns A public key compressor for the specified curve.
|
|
591
|
-
*/
|
|
592
|
-
static keyCompressor(curve) {
|
|
593
|
-
// ): ({ publicKeyBytes }: { publicKeyBytes: Uint8Array }) => Promise<Uint8Array> {
|
|
594
|
-
const compressors = {
|
|
595
|
-
'P-256': Secp256r1.compressPublicKey,
|
|
596
|
-
'secp256k1': Secp256k1.compressPublicKey
|
|
597
|
-
};
|
|
598
|
-
const compressor = compressors[curve];
|
|
599
|
-
if (!compressor) {
|
|
600
|
-
throw new DidError(DidErrorCode.InvalidPublicKeyType, `Unsupported curve: ${curve}`);
|
|
601
|
-
}
|
|
602
|
-
return compressor;
|
|
603
|
-
}
|
|
604
|
-
/**
|
|
605
|
-
* Returns the appropriate key converter for the specified cryptographic curve.
|
|
606
|
-
*
|
|
607
|
-
* @param curve - The cryptographic curve to use for the key conversion.
|
|
608
|
-
* @returns An `AsymmetricKeyConverter` for the specified curve.
|
|
609
|
-
*/
|
|
610
|
-
static keyConverter(curve) {
|
|
611
|
-
const converters = {
|
|
612
|
-
'Ed25519': Ed25519,
|
|
613
|
-
'P-256': Secp256r1,
|
|
614
|
-
'secp256k1': Secp256k1,
|
|
615
|
-
};
|
|
616
|
-
const converter = converters[curve];
|
|
617
|
-
if (!converter) {
|
|
618
|
-
throw new DidError(DidErrorCode.InvalidPublicKeyType, `Unsupported curve: ${curve}`);
|
|
619
|
-
}
|
|
620
|
-
return converter;
|
|
621
|
-
}
|
|
622
|
-
/**
|
|
623
|
-
* Converts a Multicodec code or name to parial JWK (JSON Web Key).
|
|
624
|
-
*
|
|
625
|
-
* @example
|
|
626
|
-
* ```ts
|
|
627
|
-
* const partialJwk = await DidKeyUtils.multicodecToJwk({ name: 'ed25519-pub' });
|
|
628
|
-
* ```
|
|
629
|
-
*
|
|
630
|
-
* @param params - The parameters for the conversion.
|
|
631
|
-
* @param params.code - Optional Multicodec code to convert.
|
|
632
|
-
* @param params.name - Optional Multicodec name to convert.
|
|
633
|
-
* @returns A promise that resolves to a JOSE format key.
|
|
634
|
-
*/
|
|
635
|
-
static multicodecToJwk(_a) {
|
|
636
|
-
return __awaiter(this, arguments, void 0, function* ({ code, name }) {
|
|
637
|
-
// Either code or name must be specified, but not both.
|
|
638
|
-
if (!(name ? !code : code)) {
|
|
639
|
-
throw new Error(`Either 'name' or 'code' must be defined, but not both.`);
|
|
640
|
-
}
|
|
641
|
-
// If name is undefined, lookup by code.
|
|
642
|
-
name = (name === undefined) ? Multicodec.getNameFromCode({ code: code }) : name;
|
|
643
|
-
const lookupKey = name;
|
|
644
|
-
const jose = DidKeyUtils.MULTICODEC_TO_JWK[lookupKey];
|
|
645
|
-
if (jose === undefined) {
|
|
646
|
-
throw new Error(`Unsupported Multicodec to JWK conversion`);
|
|
647
|
-
}
|
|
648
|
-
return Object.assign({}, jose);
|
|
649
|
-
});
|
|
650
|
-
}
|
|
651
|
-
/**
|
|
652
|
-
* Converts a public key in JWK (JSON Web Key) format to a multibase identifier.
|
|
653
|
-
*
|
|
654
|
-
* @remarks
|
|
655
|
-
* Note: All secp public keys are converted to compressed point encoding
|
|
656
|
-
* before the multibase identifier is computed.
|
|
657
|
-
*
|
|
658
|
-
* Per {@link https://github.com/multiformats/multicodec/blob/master/table.csv | Multicodec table}:
|
|
659
|
-
* Public keys for Elliptic Curve cryptography algorithms (e.g., secp256k1,
|
|
660
|
-
* secp256k1r1, secp384r1, etc.) are always represented with compressed point
|
|
661
|
-
* encoding (e.g., secp256k1-pub, p256-pub, p384-pub, etc.).
|
|
662
|
-
*
|
|
663
|
-
* Per {@link https://datatracker.ietf.org/doc/html/rfc8812#name-jose-and-cose-secp256k1-cur | RFC 8812}:
|
|
664
|
-
* "As a compressed point encoding representation is not defined for JWK
|
|
665
|
-
* elliptic curve points, the uncompressed point encoding defined there
|
|
666
|
-
* MUST be used. The x and y values represented MUST both be exactly
|
|
667
|
-
* 256 bits, with any leading zeros preserved."
|
|
668
|
-
*
|
|
669
|
-
* @example
|
|
670
|
-
* ```ts
|
|
671
|
-
* const publicKey = { crv: 'Ed25519', kty: 'OKP', x: '...' };
|
|
672
|
-
* const multibaseId = await DidKeyUtils.publicKeyToMultibaseId({ publicKey });
|
|
673
|
-
* ```
|
|
674
|
-
*
|
|
675
|
-
* @param params - The parameters for the conversion.
|
|
676
|
-
* @param params.publicKey - The public key in JWK format.
|
|
677
|
-
* @returns A promise that resolves to the multibase identifier.
|
|
678
|
-
*/
|
|
679
|
-
static publicKeyToMultibaseId(_a) {
|
|
680
|
-
return __awaiter(this, arguments, void 0, function* ({ publicKey }) {
|
|
681
|
-
var _b;
|
|
682
|
-
if (!((publicKey === null || publicKey === void 0 ? void 0 : publicKey.crv) && publicKey.crv in AlgorithmToKeyTypeMap)) {
|
|
683
|
-
throw new DidError(DidErrorCode.InvalidPublicKeyType, `Public key contains an unsupported key type: ${(_b = publicKey === null || publicKey === void 0 ? void 0 : publicKey.crv) !== null && _b !== void 0 ? _b : 'undefined'}`);
|
|
684
|
-
}
|
|
685
|
-
// Convert the public key from JWK format to a byte array.
|
|
686
|
-
let publicKeyBytes = yield DidKeyUtils.keyConverter(publicKey.crv).publicKeyToBytes({ publicKey });
|
|
687
|
-
// Compress the public key if it is an elliptic curve key.
|
|
688
|
-
if (/^(secp256k1|P-256|P-384|P-521)$/.test(publicKey.crv)) {
|
|
689
|
-
publicKeyBytes = yield DidKeyUtils.keyCompressor(publicKey.crv)({ publicKeyBytes });
|
|
690
|
-
}
|
|
691
|
-
// Convert the JSON Web Key (JWK) parameters to a Multicodec name.
|
|
692
|
-
const { name: multicodecName } = yield DidKeyUtils.jwkToMulticodec({ jwk: publicKey });
|
|
693
|
-
// Compute the multibase identifier based on the provided key.
|
|
694
|
-
const multibaseId = keyBytesToMultibaseId({
|
|
695
|
-
keyBytes: publicKeyBytes,
|
|
696
|
-
multicodecName
|
|
697
|
-
});
|
|
698
|
-
return multibaseId;
|
|
699
|
-
});
|
|
700
|
-
}
|
|
701
|
-
}
|
|
702
|
-
/**
|
|
703
|
-
* A mapping from JSON Web Key (JWK) property descriptors to multicodec names.
|
|
704
|
-
*
|
|
705
|
-
* This mapping is used to convert keys in JWK (JSON Web Key) format to multicodec format.
|
|
706
|
-
*
|
|
707
|
-
* @remarks
|
|
708
|
-
* The keys of this object are strings that describe the JOSE key type and usage,
|
|
709
|
-
* such as 'Ed25519:public', 'Ed25519:private', etc. The values are the corresponding multicodec
|
|
710
|
-
* names used to represent these key types.
|
|
711
|
-
*
|
|
712
|
-
* @example
|
|
713
|
-
* ```ts
|
|
714
|
-
* const multicodecName = JWK_TO_MULTICODEC['Ed25519:public'];
|
|
715
|
-
* // Returns 'ed25519-pub', the multicodec name for an Ed25519 public key
|
|
716
|
-
* ```
|
|
717
|
-
*/
|
|
718
|
-
DidKeyUtils.JWK_TO_MULTICODEC = {
|
|
719
|
-
'Ed25519:public': 'ed25519-pub',
|
|
720
|
-
'Ed25519:private': 'ed25519-priv',
|
|
721
|
-
'secp256k1:public': 'secp256k1-pub',
|
|
722
|
-
'secp256k1:private': 'secp256k1-priv',
|
|
723
|
-
};
|
|
724
|
-
/**
|
|
725
|
-
* Defines the expected byte lengths for public keys associated with different cryptographic
|
|
726
|
-
* algorithms, indexed by their multicodec code values.
|
|
727
|
-
*/
|
|
728
|
-
DidKeyUtils.MULTICODEC_PUBLIC_KEY_LENGTH = {
|
|
729
|
-
// secp256k1-pub - Secp256k1 public key (compressed) - 33 bytes
|
|
730
|
-
0xe7: 33,
|
|
731
|
-
// ed25519-pub - Ed25519 public key - 32 bytes
|
|
732
|
-
0xed: 32
|
|
733
|
-
};
|
|
734
|
-
/**
|
|
735
|
-
* A mapping from multicodec names to their corresponding JOSE (JSON Object Signing and Encryption)
|
|
736
|
-
* representations. This mapping facilitates the conversion of multicodec key formats to
|
|
737
|
-
* JWK (JSON Web Key) formats.
|
|
738
|
-
*
|
|
739
|
-
* @remarks
|
|
740
|
-
* The keys of this object are multicodec names, such as 'ed25519-pub', 'ed25519-priv', etc.
|
|
741
|
-
* The values are objects representing the corresponding JWK properties for that key type.
|
|
742
|
-
*
|
|
743
|
-
* @example
|
|
744
|
-
* ```ts
|
|
745
|
-
* const joseKey = MULTICODEC_TO_JWK['ed25519-pub'];
|
|
746
|
-
* // Returns a partial JWK for an Ed25519 public key
|
|
747
|
-
* ```
|
|
748
|
-
*/
|
|
749
|
-
DidKeyUtils.MULTICODEC_TO_JWK = {
|
|
750
|
-
'ed25519-pub': { crv: 'Ed25519', kty: 'OKP', x: '' },
|
|
751
|
-
'ed25519-priv': { crv: 'Ed25519', kty: 'OKP', x: '', d: '' },
|
|
752
|
-
'secp256k1-pub': { crv: 'secp256k1', kty: 'EC', x: '', y: '' },
|
|
753
|
-
'secp256k1-priv': { crv: 'secp256k1', kty: 'EC', x: '', y: '', d: '' },
|
|
754
|
-
};
|
|
537
|
+
// Re-export DidKeyUtils from its dedicated module for backward compatibility.
|
|
538
|
+
export { DidKeyUtils } from './did-key-utils.js';
|
|
755
539
|
//# sourceMappingURL=did-key.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"did-key.js","sourceRoot":"","sources":["../../../src/methods/did-key.ts"],"names":[],"mappings":";;;;;;;;;AAaA,OAAO,EACL,OAAO,EACP,eAAe,EACf,SAAS,EACT,SAAS,GACV,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAW5D,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAChC,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,2BAA2B,EAAE,MAAM,4BAA4B,CAAC;AACzE,OAAO,EAAE,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,SAAS,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;QAE/C;;;;;WAKG;QACH,MAAM,OAAO,GAAG,GAAG,CAAC;QAEpB,OAAO,CACL,MAAM,KAAK,KAAK;YAChB,MAAM,KAAK,KAAK;YAChB,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC;YACnB,eAAe,CAAC,cAAc,CAAC,KAAK,QAAQ;YAC5C,cAAc,CAAC,UAAU,CAAC,GAAG,CAAC,CAC/B,CAAC;IACJ,CAAC;;AAtdD;;GAEG;AACW,iBAAU,GAAG,KAAK,CAAC;AAsdnC,8EAA8E;AAC9E,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import ms from 'ms';
|
|
11
|
+
import { TtlCache } from '@enbox/common';
|
|
12
|
+
export class DidResolverCacheMemory {
|
|
13
|
+
constructor({ ttl = '15m' } = {}) {
|
|
14
|
+
this.cache = new TtlCache({ ttl: ms(ttl) });
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Retrieves a DID resolution result from the cache.
|
|
18
|
+
*
|
|
19
|
+
* If the cached item has exceeded its TTL, it's scheduled for deletion and undefined is returned.
|
|
20
|
+
*
|
|
21
|
+
* @param didUri - The DID string used as the key for retrieving the cached result.
|
|
22
|
+
* @returns The cached DID resolution result or undefined if not found or expired.
|
|
23
|
+
*/
|
|
24
|
+
get(didUri) {
|
|
25
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
26
|
+
if (!didUri) {
|
|
27
|
+
throw new Error('Key cannot be null or undefined');
|
|
28
|
+
}
|
|
29
|
+
return this.cache.get(didUri);
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Stores a DID resolution result in the cache with a TTL.
|
|
34
|
+
*
|
|
35
|
+
* @param didUri - The DID string used as the key for storing the result.
|
|
36
|
+
* @param resolutionResult - The DID resolution result to be cached.
|
|
37
|
+
* @returns A promise that resolves when the operation is complete.
|
|
38
|
+
*/
|
|
39
|
+
set(didUri, resolutionResult) {
|
|
40
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
41
|
+
this.cache.set(didUri, resolutionResult);
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Deletes a DID resolution result from the cache.
|
|
46
|
+
*
|
|
47
|
+
* @param didUri - The DID string used as the key for deletion.
|
|
48
|
+
* @returns A promise that resolves when the operation is complete.
|
|
49
|
+
*/
|
|
50
|
+
delete(didUri) {
|
|
51
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
52
|
+
this.cache.delete(didUri);
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Clears all entries from the cache.
|
|
57
|
+
*
|
|
58
|
+
* @returns A promise that resolves when the operation is complete.
|
|
59
|
+
*/
|
|
60
|
+
clear() {
|
|
61
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
62
|
+
this.cache.clear();
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* This method is a no-op but exists to be consistent with other DID Resolver Cache
|
|
67
|
+
* implementations.
|
|
68
|
+
*
|
|
69
|
+
* @returns A promise that resolves immediately.
|
|
70
|
+
*/
|
|
71
|
+
close() {
|
|
72
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
73
|
+
// No-op since there is no underlying store to close.
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=resolver-cache-memory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolver-cache-memory.js","sourceRoot":"","sources":["../../../src/resolver/resolver-cache-memory.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAoBzC,MAAM,OAAO,sBAAsB;IAGjC,YAAY,EAAE,GAAG,GAAG,KAAK,KAAmC,EAAE;QAC5D,IAAI,CAAC,KAAK,GAAG,IAAI,QAAQ,CAAC,EAAE,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAC9C,CAAC;IAED;;;;;;;OAOG;IACU,GAAG,CAAC,MAAc;;YAC7B,IAAI,CAAC,MAAM,EAAE,CAAC;gBACZ,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAC;YACrD,CAAC;YAED,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QAChC,CAAC;KAAA;IAED;;;;;;OAMG;IACU,GAAG,CAAC,MAAc,EAAE,gBAAqC;;YACpE,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;QAC3C,CAAC;KAAA;IAED;;;;;OAKG;IACU,MAAM,CAAC,MAAc;;YAChC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QAC5B,CAAC;KAAA;IAED;;;;OAIG;IACU,KAAK;;YAChB,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;QACrB,CAAC;KAAA;IAED;;;;;OAKG;IACU,KAAK;;YAChB,qDAAqD;QACvD,CAAC;KAAA;CACF"}
|
package/dist/esm/utils.js
CHANGED
|
@@ -412,6 +412,31 @@ export function isDidVerificationMethod(obj) {
|
|
|
412
412
|
}
|
|
413
413
|
return true;
|
|
414
414
|
}
|
|
415
|
+
/**
|
|
416
|
+
* Checks if a given object conforms to the {@link PortableDid} interface.
|
|
417
|
+
*
|
|
418
|
+
* A `PortableDid` is an object with `uri`, `document`, and `metadata` properties that does not
|
|
419
|
+
* have a `keyManager` property (or has it set to `undefined`). This distinguishes it from a
|
|
420
|
+
* {@link BearerDid}, which includes a `keyManager`.
|
|
421
|
+
*
|
|
422
|
+
* @example
|
|
423
|
+
* ```ts
|
|
424
|
+
* if (isPortableDid(obj)) {
|
|
425
|
+
* console.log('The object is a PortableDid');
|
|
426
|
+
* }
|
|
427
|
+
* ```
|
|
428
|
+
*
|
|
429
|
+
* @param obj - The object to be checked.
|
|
430
|
+
* @returns `true` if `obj` is a `PortableDid`; otherwise, `false`.
|
|
431
|
+
*/
|
|
432
|
+
export function isPortableDid(obj) {
|
|
433
|
+
// Validate that the given value is an object that has the necessary properties of PortableDid.
|
|
434
|
+
return !(!obj || typeof obj !== 'object' || obj === null)
|
|
435
|
+
&& 'uri' in obj
|
|
436
|
+
&& 'document' in obj
|
|
437
|
+
&& 'metadata' in obj
|
|
438
|
+
&& (!('keyManager' in obj) || obj.keyManager === undefined);
|
|
439
|
+
}
|
|
415
440
|
/**
|
|
416
441
|
* Converts a cryptographic key to a multibase identifier.
|
|
417
442
|
*
|