@enbox/dids 0.0.4 → 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/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-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/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 +42 -457
- 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 +2 -82
- package/dist/types/methods/did-ion.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 +3 -124
- package/dist/types/methods/did-key.d.ts.map +1 -1
- package/package.json +1 -1
- 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 +122 -1128
- package/src/methods/did-ion-utils.ts +186 -0
- package/src/methods/did-ion.ts +14 -190
- package/src/methods/did-key-utils.ts +258 -0
- package/src/methods/did-key.ts +14 -266
|
@@ -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;IA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AAE,SAAS,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,EAAE;IACxD,cAAc,EAAK,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE;IAC/D,eAAe,EAAI,EAAE,GAAG,EAAE,WAAW,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE;IAChE,gBAAgB,EAAG,EAAE,GAAG,EAAE,WAAW,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,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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MAAM,WAAW,CAAC,eAAe,CAAC,EAAE,IAAI,EAAE,eAAe,EAAE,CAAC,CAAC;gBAC7E,kBAAkB,CAAC,YAAY,GAAG,MAAM,WAAW,CAAC,YAAY,CAAC,GAAI,CAAC,CAAC,gBAAgB,CAAC,EAAE,cAAc,EAAE,CAAC,CAAC;YAC9G,CAAC;YAED;;eAEG;YACH,OAAO,kBAAkB,CAAC;QAC5B,CAAC;KAAA;IAGD;;;;;;;OAOG;IACK,MAAM,CAAC,kBAAkB,CAAC,SAAc;QAC9C,MAAM,EAAE,MAAM,EAAE,EAAE,EAAE,cAAc,EAAE,GAAG,SAAS,CAAC;QACjD,MAAM,CAAE,MAAM,CAAE,GAAG,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,114 @@
|
|
|
1
|
+
import type { DidMetadata } from '../types/portable-did.js';
|
|
2
|
+
import type { PreviousDidProof } from './did-dht-types.js';
|
|
3
|
+
import type { DidDocument } from '../types/did-core.js';
|
|
4
|
+
import type { Packet, TxtAnswer, TxtData } from '@dnsquery/dns-packet';
|
|
5
|
+
import { DidDhtRegisteredKeyType } from './did-dht-types.js';
|
|
6
|
+
/**
|
|
7
|
+
* The version of the DID DHT specification that is implemented by this library.
|
|
8
|
+
*/
|
|
9
|
+
export declare const DID_DHT_SPECIFICATION_VERSION = 0;
|
|
10
|
+
/**
|
|
11
|
+
* The default TTL for DNS records published to the DHT network.
|
|
12
|
+
*
|
|
13
|
+
* The recommended TTL value is 7200 seconds (2 hours) since it matches the default TTL for
|
|
14
|
+
* Mainline DHT records.
|
|
15
|
+
*/
|
|
16
|
+
export declare const DNS_RECORD_TTL = 7200;
|
|
17
|
+
/**
|
|
18
|
+
* Character used to separate distinct elements or entries in the DNS packet representation
|
|
19
|
+
* of a DID Document.
|
|
20
|
+
*/
|
|
21
|
+
export declare const PROPERTY_SEPARATOR = ";";
|
|
22
|
+
/**
|
|
23
|
+
* Character used to separate distinct values within a single element or entry in the DNS packet
|
|
24
|
+
* representation of a DID Document.
|
|
25
|
+
*/
|
|
26
|
+
export declare const VALUE_SEPARATOR = ",";
|
|
27
|
+
/**
|
|
28
|
+
* Private helper that maps algorithm identifiers to their corresponding DID DHT
|
|
29
|
+
* {@link DidDhtRegisteredKeyType | registered key type}.
|
|
30
|
+
*/
|
|
31
|
+
export declare const AlgorithmToKeyTypeMap: {
|
|
32
|
+
readonly Ed25519: DidDhtRegisteredKeyType.Ed25519;
|
|
33
|
+
readonly ES256K: DidDhtRegisteredKeyType.secp256k1;
|
|
34
|
+
readonly ES256: DidDhtRegisteredKeyType.secp256r1;
|
|
35
|
+
readonly 'P-256': DidDhtRegisteredKeyType.secp256r1;
|
|
36
|
+
readonly secp256k1: DidDhtRegisteredKeyType.secp256k1;
|
|
37
|
+
readonly secp256r1: DidDhtRegisteredKeyType.secp256r1;
|
|
38
|
+
readonly X25519: DidDhtRegisteredKeyType.X25519;
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* Private helper that maps DID DHT registered key types to their corresponding default algorithm identifiers.
|
|
42
|
+
*/
|
|
43
|
+
export declare const KeyTypeToDefaultAlgorithmMap: {
|
|
44
|
+
0: string;
|
|
45
|
+
1: string;
|
|
46
|
+
2: string;
|
|
47
|
+
3: string;
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
* Creates a TXT DNS answer record with the given name and data, using the standard DNS_RECORD_TTL.
|
|
51
|
+
*
|
|
52
|
+
* @param name - The DNS record name.
|
|
53
|
+
* @param data - The TXT record data (string or string array).
|
|
54
|
+
* @returns A TxtAnswer record.
|
|
55
|
+
*/
|
|
56
|
+
export declare function createTxtRecord(name: string, data: string | string[]): TxtAnswer;
|
|
57
|
+
/**
|
|
58
|
+
* Decodes and parses the data value of a DNS TXT record into a string.
|
|
59
|
+
*
|
|
60
|
+
* @param txtData - The data value of a DNS TXT record.
|
|
61
|
+
* @returns A string representation of the TXT record data.
|
|
62
|
+
*/
|
|
63
|
+
export declare function parseTxtDataToString(txtData: TxtData): string;
|
|
64
|
+
/**
|
|
65
|
+
* Decodes and parses the data value of a DNS TXT record into a key-value object.
|
|
66
|
+
*
|
|
67
|
+
* @param txtData - The data value of a DNS TXT record.
|
|
68
|
+
* @returns An object containing the key/value pairs of the TXT record data.
|
|
69
|
+
*/
|
|
70
|
+
export declare function parseTxtDataToObject(txtData: TxtData): Record<string, string>;
|
|
71
|
+
/**
|
|
72
|
+
* Splits a string into chunks of length 255 if the string exceeds length 255.
|
|
73
|
+
*
|
|
74
|
+
* @param data - The string to split into chunks.
|
|
75
|
+
* @returns The original string if its length is less than or equal to 255, otherwise an array of chunked strings.
|
|
76
|
+
*/
|
|
77
|
+
export declare function chunkDataIfNeeded(data: string): string | string[];
|
|
78
|
+
/**
|
|
79
|
+
* Converts a DNS packet to a DID document according to the DID DHT specification.
|
|
80
|
+
*
|
|
81
|
+
* @see {@link https://did-dht.com/#dids-as-dns-records | DID DHT Specification, § DIDs as DNS Records}
|
|
82
|
+
*
|
|
83
|
+
* @param params - The parameters to use when converting a DNS packet to a DID document.
|
|
84
|
+
* @param params.didUri - The DID URI of the DID document.
|
|
85
|
+
* @param params.dnsPacket - The DNS packet to convert to a DID document.
|
|
86
|
+
* @returns A Promise resolving to an object containing the DID document and its metadata.
|
|
87
|
+
*/
|
|
88
|
+
export declare function fromDnsPacket({ didUri, dnsPacket }: {
|
|
89
|
+
didUri: string;
|
|
90
|
+
dnsPacket: Packet;
|
|
91
|
+
}): Promise<{
|
|
92
|
+
didDocument: DidDocument;
|
|
93
|
+
didDocumentMetadata: DidMetadata;
|
|
94
|
+
didResolutionMetadata: Record<string, never>;
|
|
95
|
+
}>;
|
|
96
|
+
/**
|
|
97
|
+
* Converts a DID document to a DNS packet according to the DID DHT specification.
|
|
98
|
+
*
|
|
99
|
+
* @see {@link https://did-dht.com/#dids-as-dns-records | DID DHT Specification, § DIDs as DNS Records}
|
|
100
|
+
*
|
|
101
|
+
* @param params - The parameters to use when converting a DID document to a DNS packet.
|
|
102
|
+
* @param params.didDocument - The DID document to convert to a DNS packet.
|
|
103
|
+
* @param params.didMetadata - The DID metadata to include in the DNS packet.
|
|
104
|
+
* @param params.authoritativeGatewayUris - The URIs of the Authoritative Gateways to generate NS records from.
|
|
105
|
+
* @param params.previousDidProof - The signature proof that this DID is linked to the given previous DID.
|
|
106
|
+
* @returns A promise that resolves to a DNS packet.
|
|
107
|
+
*/
|
|
108
|
+
export declare function toDnsPacket({ didDocument, didMetadata, authoritativeGatewayUris, previousDidProof }: {
|
|
109
|
+
didDocument: DidDocument;
|
|
110
|
+
didMetadata: DidMetadata;
|
|
111
|
+
authoritativeGatewayUris?: string[];
|
|
112
|
+
previousDidProof?: PreviousDidProof;
|
|
113
|
+
}): Promise<Packet>;
|
|
114
|
+
//# sourceMappingURL=did-dht-dns.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"did-dht-dns.d.ts","sourceRoot":"","sources":["../../../src/methods/did-dht-dns.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,KAAK,EAAE,WAAW,EAAc,MAAM,sBAAsB,CAAC;AACpE,OAAO,KAAK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