@enbox/dids 0.0.2 → 0.0.4
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/README.md +41 -1
- package/dist/browser.mjs +6 -10
- package/dist/browser.mjs.map +4 -4
- package/dist/esm/bearer-did.js +5 -5
- package/dist/esm/bearer-did.js.map +1 -1
- package/dist/esm/did.js +13 -6
- package/dist/esm/did.js.map +1 -1
- package/dist/esm/index.js +2 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/methods/did-dht.js +34 -25
- package/dist/esm/methods/did-dht.js.map +1 -1
- package/dist/esm/methods/did-ion.js +9 -7
- package/dist/esm/methods/did-ion.js.map +1 -1
- package/dist/esm/methods/did-jwk.js +3 -3
- package/dist/esm/methods/did-jwk.js.map +1 -1
- package/dist/esm/methods/did-key.js +12 -240
- package/dist/esm/methods/did-key.js.map +1 -1
- package/dist/esm/methods/did-web.js +3 -2
- package/dist/esm/methods/did-web.js.map +1 -1
- package/dist/esm/resolver/resolver-cache-level.js +1 -1
- package/dist/esm/resolver/resolver-cache-level.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/resolver/resolver-cache-noop.js +10 -10
- package/dist/esm/resolver/resolver-cache-noop.js.map +1 -1
- package/dist/esm/resolver/universal-resolver.js +3 -3
- package/dist/esm/resolver/universal-resolver.js.map +1 -1
- package/dist/esm/utils.js +62 -21
- package/dist/esm/utils.js.map +1 -1
- package/dist/types/bearer-did.d.ts +6 -5
- package/dist/types/bearer-did.d.ts.map +1 -1
- package/dist/types/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.d.ts +6 -6
- package/dist/types/methods/did-dht.d.ts.map +1 -1
- package/dist/types/methods/did-ion.d.ts +6 -5
- package/dist/types/methods/did-ion.d.ts.map +1 -1
- package/dist/types/methods/did-jwk.d.ts +5 -5
- package/dist/types/methods/did-jwk.d.ts.map +1 -1
- package/dist/types/methods/did-key.d.ts +6 -55
- package/dist/types/methods/did-key.d.ts.map +1 -1
- package/dist/types/methods/did-method.d.ts +5 -5
- package/dist/types/methods/did-method.d.ts.map +1 -1
- package/dist/types/resolver/resolver-cache-level.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/resolver/universal-resolver.d.ts +2 -2
- package/dist/types/resolver/universal-resolver.d.ts.map +1 -1
- package/dist/types/types/did-core.d.ts +1 -1
- package/dist/types/types/did-core.d.ts.map +1 -1
- package/dist/types/utils.d.ts +27 -5
- package/dist/types/utils.d.ts.map +1 -1
- package/dist/utils.js +1 -5
- package/dist/utils.js.map +4 -4
- package/package.json +35 -47
- package/src/bearer-did.ts +15 -14
- package/src/did.ts +8 -6
- package/src/index.ts +2 -0
- package/src/methods/did-dht.ts +37 -37
- package/src/methods/did-ion.ts +23 -15
- package/src/methods/did-jwk.ts +9 -9
- package/src/methods/did-key.ts +29 -310
- package/src/methods/did-method.ts +6 -6
- package/src/methods/did-web.ts +2 -2
- package/src/resolver/resolver-cache-level.ts +4 -4
- package/src/resolver/resolver-cache-memory.ts +84 -0
- package/src/resolver/resolver-cache-noop.ts +10 -10
- package/src/resolver/universal-resolver.ts +5 -5
- package/src/types/did-core.ts +3 -3
- package/src/utils.ts +55 -26
- package/dist/browser.js +0 -77
- package/dist/browser.js.map +0 -7
- package/dist/cjs/index.js +0 -6303
- package/dist/cjs/index.js.map +0 -7
- package/dist/cjs/package.json +0 -1
- package/dist/cjs/utils.js +0 -245
- package/dist/cjs/utils.js.map +0 -7
|
@@ -1,11 +1,11 @@
|
|
|
1
|
+
import type { AsymmetricKeyConverter, InferKeyGeneratorAlgorithm, Jwk, KeyCompressor, KeyIdentifier, KeyImporterExporter, KeyManager, KmsExportKeyParams, KmsImportKeyParams } from '@enbox/crypto';
|
|
1
2
|
import type { MulticodecCode, MulticodecDefinition } from '@enbox/common';
|
|
2
|
-
import type { Jwk, CryptoApi, KeyCompressor, KeyIdentifier, KmsExportKeyParams, KmsImportKeyParams, KeyImporterExporter, AsymmetricKeyConverter, InferKeyGeneratorAlgorithm } from '@enbox/crypto';
|
|
3
3
|
import { LocalKeyManager } from '@enbox/crypto';
|
|
4
4
|
import type { PortableDid } from '../types/portable-did.js';
|
|
5
5
|
import type { DidCreateOptions, DidCreateVerificationMethod } from './did-method.js';
|
|
6
6
|
import type { DidDocument, DidResolutionOptions, DidResolutionResult, DidVerificationMethod } from '../types/did-core.js';
|
|
7
|
-
import { DidMethod } from './did-method.js';
|
|
8
7
|
import { BearerDid } from '../bearer-did.js';
|
|
8
|
+
import { DidMethod } from './did-method.js';
|
|
9
9
|
/**
|
|
10
10
|
* Defines the set of options available when creating a new Decentralized Identifier (DID) with the
|
|
11
11
|
* 'did:key' method.
|
|
@@ -59,7 +59,7 @@ export interface DidKeyCreateOptions<TKms> extends DidCreateOptions<TKms> {
|
|
|
59
59
|
/**
|
|
60
60
|
* Optionally specify the algorithm to be used for key generation.
|
|
61
61
|
*/
|
|
62
|
-
algorithm?: TKms extends
|
|
62
|
+
algorithm?: TKms extends KeyManager ? InferKeyGeneratorAlgorithm<TKms> : InferKeyGeneratorAlgorithm<LocalKeyManager>;
|
|
63
63
|
/**
|
|
64
64
|
* Optionally specify an array of JSON-LD context links for the @context property of the DID
|
|
65
65
|
* document.
|
|
@@ -68,22 +68,6 @@ export interface DidKeyCreateOptions<TKms> extends DidCreateOptions<TKms> {
|
|
|
68
68
|
* the DID document JSON. The default context URL is 'https://www.w3.org/ns/did/v1'.
|
|
69
69
|
*/
|
|
70
70
|
defaultContext?: string;
|
|
71
|
-
/**
|
|
72
|
-
* Optionally enable encryption key derivation during DID creation.
|
|
73
|
-
*
|
|
74
|
-
* By default, this option is set to `false`, which means encryption key derivation is not
|
|
75
|
-
* performed unless explicitly enabled.
|
|
76
|
-
*
|
|
77
|
-
* When set to `true`, an `X25519` key will be derived from the `Ed25519` public key used to
|
|
78
|
-
* create the DID. This feature enables the same DID to be used for encrypted communication, in
|
|
79
|
-
* addition to signature verification.
|
|
80
|
-
*
|
|
81
|
-
* Notes:
|
|
82
|
-
* - This option is ONLY applicable when the `algorithm` of the DID's public key is `Ed25519`.
|
|
83
|
-
* - Enabling this introduces specific cryptographic considerations that should be understood
|
|
84
|
-
* before using the same key pair for digital signatures and encrypted communication. See the following for more information:
|
|
85
|
-
*/
|
|
86
|
-
enableEncryptionKeyDerivation?: boolean;
|
|
87
71
|
/**
|
|
88
72
|
* Optionally enable experimental public key types during DID creation.
|
|
89
73
|
* By default, this option is set to `false`, which means experimental public key types are not
|
|
@@ -125,11 +109,7 @@ export declare enum DidKeyRegisteredKeyType {
|
|
|
125
109
|
* secp256r1: Also known as P-256 or prime256v1, this curve is used for cryptographic operations
|
|
126
110
|
* and is widely supported in various cryptographic libraries and standards.
|
|
127
111
|
*/
|
|
128
|
-
secp256r1 = "secp256r1"
|
|
129
|
-
/**
|
|
130
|
-
* X25519: A Diffie-Hellman key exchange algorithm using Curve25519.
|
|
131
|
-
*/
|
|
132
|
-
X25519 = "X25519"
|
|
112
|
+
secp256r1 = "secp256r1"
|
|
133
113
|
}
|
|
134
114
|
/**
|
|
135
115
|
* Enumerates the verification method types supported by the DID Key method.
|
|
@@ -143,8 +123,6 @@ export declare const DidKeyVerificationMethodType: {
|
|
|
143
123
|
readonly Ed25519VerificationKey2020: "https://w3id.org/security/suites/ed25519-2020/v1";
|
|
144
124
|
/** Represents a JSON Web Key (JWK) used for digital signatures and key agreement protocols. */
|
|
145
125
|
readonly JsonWebKey2020: "https://w3id.org/security/suites/jws-2020/v1";
|
|
146
|
-
/** Represents an X25519 public key used for key agreement protocols. */
|
|
147
|
-
readonly X25519KeyAgreementKey2020: "https://w3id.org/security/suites/x25519-2020/v1";
|
|
148
126
|
};
|
|
149
127
|
/**
|
|
150
128
|
* The `DidKey` class provides an implementation of the 'did:key' DID method.
|
|
@@ -170,13 +148,6 @@ export declare const DidKeyVerificationMethodType: {
|
|
|
170
148
|
* for the public key type and the raw public key bytes. To form the DID URI, the method-specific
|
|
171
149
|
* identifier is prefixed with the string 'did:key:'.
|
|
172
150
|
*
|
|
173
|
-
* This method can optionally derive an encryption key from the public key used to create the DID
|
|
174
|
-
* if and only if the public key algorithm is `Ed25519`. This feature enables the same DID to be
|
|
175
|
-
* used for encrypted communication, in addition to signature verification. To enable this
|
|
176
|
-
* feature when calling {@link DidKey.create | `DidKey.create()`}, first specify an `algorithm` of
|
|
177
|
-
* `Ed25519` or provide a `keySet` referencing an `Ed25519` key and then set the
|
|
178
|
-
* `enableEncryptionKeyDerivation` option to `true`.
|
|
179
|
-
*
|
|
180
151
|
* Note:
|
|
181
152
|
* - The authors of the DID Key specification have indicated that use of this method for long-lived
|
|
182
153
|
* use cases is only recommended when accompanied with high confidence that private keys are
|
|
@@ -248,12 +219,6 @@ export declare class DidKey extends DidMethod {
|
|
|
248
219
|
* {@link https://github.com/multiformats/multicodec/blob/master/README.md | Multicodec}-encoded
|
|
249
220
|
* public key and prefixing with `did:key:`.
|
|
250
221
|
*
|
|
251
|
-
* This method can optionally derive an encryption key from the public key used to create the DID
|
|
252
|
-
* if and only if the public key algorithm is `Ed25519`. This feature enables the same DID to be
|
|
253
|
-
* used for encrypted communication, in addition to signature verification. To enable this
|
|
254
|
-
* feature, specify an `algorithm` of `Ed25519` as either a top-level option or in a
|
|
255
|
-
* `verificationMethod` and set the `enableEncryptionKeyDerivation` option to `true`.
|
|
256
|
-
*
|
|
257
222
|
* Notes:
|
|
258
223
|
* - If no `options` are given, by default a new Ed25519 key will be generated.
|
|
259
224
|
* - The `algorithm` and `verificationMethods` options are mutually exclusive. If both are given,
|
|
@@ -274,7 +239,7 @@ export declare class DidKey extends DidMethod {
|
|
|
274
239
|
* @param params.options - Optional parameters that can be specified when creating a new DID.
|
|
275
240
|
* @returns A Promise resolving to a {@link BearerDid} object representing the new DID.
|
|
276
241
|
*/
|
|
277
|
-
static create<TKms extends
|
|
242
|
+
static create<TKms extends KeyManager | undefined = undefined>({ keyManager, options }?: {
|
|
278
243
|
keyManager?: TKms;
|
|
279
244
|
options?: DidKeyCreateOptions<TKms>;
|
|
280
245
|
}): Promise<BearerDid>;
|
|
@@ -324,7 +289,7 @@ export declare class DidKey extends DidMethod {
|
|
|
324
289
|
* @throws An error if the DID document does not contain exactly one verification method.
|
|
325
290
|
*/
|
|
326
291
|
static import({ portableDid, keyManager }: {
|
|
327
|
-
keyManager?:
|
|
292
|
+
keyManager?: KeyManager & KeyImporterExporter<KmsImportKeyParams, KeyIdentifier, KmsExportKeyParams>;
|
|
328
293
|
portableDid: PortableDid;
|
|
329
294
|
}): Promise<BearerDid>;
|
|
330
295
|
/**
|
|
@@ -344,12 +309,6 @@ export declare class DidKey extends DidMethod {
|
|
|
344
309
|
* @returns - A DID dodcument.
|
|
345
310
|
*/
|
|
346
311
|
private static createDocument;
|
|
347
|
-
/**
|
|
348
|
-
* Decoding a multibase-encoded multicodec value into a verification method
|
|
349
|
-
* that is suitable for verifying that encrypted information will be
|
|
350
|
-
* received by the intended recipient.
|
|
351
|
-
*/
|
|
352
|
-
private static createEncryptionMethod;
|
|
353
312
|
/**
|
|
354
313
|
* Decodes a multibase-encoded multicodec value into a verification method
|
|
355
314
|
* that is suitable for verifying digital signatures.
|
|
@@ -357,14 +316,6 @@ export declare class DidKey extends DidMethod {
|
|
|
357
316
|
* @returns - A verification method.
|
|
358
317
|
*/
|
|
359
318
|
private static createSignatureMethod;
|
|
360
|
-
/**
|
|
361
|
-
* Transform a multibase-encoded multicodec value to public encryption key
|
|
362
|
-
* components that are suitable for encrypting messages to a receiver. A
|
|
363
|
-
* mathematical proof elaborating on the safety of performing this operation
|
|
364
|
-
* is available in:
|
|
365
|
-
* {@link https://eprint.iacr.org/2021/509.pdf | On using the same key pair for Ed25519 and an X25519 based KEM}
|
|
366
|
-
*/
|
|
367
|
-
private static deriveEncryptionKey;
|
|
368
319
|
/**
|
|
369
320
|
* Validates the structure and components of a DID URI against the `did:key` method specification.
|
|
370
321
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"did-key.d.ts","sourceRoot":"","sources":["../../../src/methods/did-key.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"did-key.d.ts","sourceRoot":"","sources":["../../../src/methods/did-key.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,sBAAsB,EACtB,0BAA0B,EAC1B,GAAG,EACH,aAAa,EACb,aAAa,EACb,mBAAmB,EACnB,UAAU,EACV,kBAAkB,EAClB,kBAAkB,EACnB,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAE1E,OAAO,EAEL,eAAe,EAGhB,MAAM,eAAe,CAAC;AAGvB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,KAAK,EAAE,gBAAgB,EAAE,2BAA2B,EAAE,MAAM,iBAAiB,CAAC;AACrF,OAAO,KAAK,EACV,WAAW,EACX,oBAAoB,EACpB,mBAAmB,EACnB,qBAAqB,EACtB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE7C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAK5C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;AACH,MAAM,WAAW,mBAAmB,CAAC,IAAI,CAAE,SAAQ,gBAAgB,CAAC,IAAI,CAAC;IACvE;;OAEG;IACH,SAAS,CAAC,EAAE,IAAI,SAAS,UAAU,GAC/B,0BAA0B,CAAC,IAAI,CAAC,GAChC,0BAA0B,CAAC,eAAe,CAAC,CAAC;IAEhD;;;;;;OAMG;IACH,cAAc,CAAC,EA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AS,EAAE,GAAG,CAAA;KACf,GAAG,OAAO,CAAC,MAAM,CAAC;CAwBpB"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { InferKeyGeneratorAlgorithm, KeyManager, LocalKeyManager } from '@enbox/crypto';
|
|
2
2
|
import type { BearerDid } from '../bearer-did.js';
|
|
3
3
|
import type { DidMetadata } from '../types/portable-did.js';
|
|
4
|
-
import type { DidDocument,
|
|
5
|
-
import { DidVerificationRelationship } from '../types/did-core.js';
|
|
4
|
+
import type { DidDocument, DidResolutionOptions, DidResolutionResult, DidVerificationMethod } from '../types/did-core.js';
|
|
5
|
+
import type { DidVerificationRelationship } from '../types/did-core.js';
|
|
6
6
|
/**
|
|
7
7
|
* Represents options during the creation of a Decentralized Identifier (DID).
|
|
8
8
|
*
|
|
@@ -34,7 +34,7 @@ export interface DidCreateVerificationMethod<TKms> extends Pick<Partial<DidVerif
|
|
|
34
34
|
* };
|
|
35
35
|
* ```
|
|
36
36
|
*/
|
|
37
|
-
algorithm: TKms extends
|
|
37
|
+
algorithm: TKms extends KeyManager ? InferKeyGeneratorAlgorithm<TKms> : InferKeyGeneratorAlgorithm<LocalKeyManager>;
|
|
38
38
|
/**
|
|
39
39
|
* Optionally specify the purposes for which a verification method is intended to be used in a DID
|
|
40
40
|
* document.
|
|
@@ -64,7 +64,7 @@ export interface DidCreateVerificationMethod<TKms> extends Pick<Partial<DidVerif
|
|
|
64
64
|
* @typeparam T - The type of the DID instance associated with this method.
|
|
65
65
|
* @typeparam O - The type of the options used for creating the DID.
|
|
66
66
|
*/
|
|
67
|
-
export interface DidMethodApi<TKms extends
|
|
67
|
+
export interface DidMethodApi<TKms extends KeyManager | undefined = KeyManager, TDid extends BearerDid = BearerDid, TOptions extends DidCreateOptions<TKms> = DidCreateOptions<TKms>> extends DidMethodResolver {
|
|
68
68
|
/**
|
|
69
69
|
* The name of the DID method.
|
|
70
70
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"did-method.d.ts","sourceRoot":"","sources":["../../../src/methods/did-method.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,
|
|
1
|
+
{"version":3,"file":"did-method.d.ts","sourceRoot":"","sources":["../../../src/methods/did-method.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,0BAA0B,EAC1B,UAAU,EACV,eAAe,EAChB,MAAM,eAAe,CAAC;AAEvB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,KAAK,EACV,WAAW,EACX,oBAAoB,EACpB,mBAAmB,EACnB,qBAAqB,EACtB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,sBAAsB,CAAC;AAExE;;;;;;GAMG;AACH,MAAM,WAAW,gBAAgB,CAAC,IAAI;IACpC;;OAEG;IACH,mBAAmB,CAAC,EAAE,2BAA2B,CAAC,IAAI,CAAC,EAAE,CAAC;CAC3D;AAED;;;GAGG;AACH,MAAM,WAAW,2BAA2B,CAAC,IAAI,CAAE,SAAQ,IAAI,CAAC,OAAO,CAAC,qBAAqB,CAAC,EAAE,YAAY,GAAG,IAAI,GAAG,MAAM,CAAC;IAC3H;;;;;;;;;;;;OAYG;IACH,SAAS,EAAE,IAAI,SAAS,UAAU,GAC9B,0BAA0B,CAAC,IAAI,CAAC,GAChC,0BAA0B,CAAC,eAAe,CAAC,CAAC;IAEhD;;;;;;;;;;;;;;;;;;;OAmBG;IACH,QAAQ,CAAC,EAAE,CAAC,2BAA2B,GAAG,MAAM,OAAO,2BAA2B,CAAC,EAAE,CAAC;CACvF;AAED;;;;;;GAMG;AACH,MAAM,WAAW,YAAY,CACzB,IAAI,SAAS,UAAU,GAAG,SAAS,GAAG,UAAU,EAChD,IAAI,SAAS,SAAS,GAAG,SAAS,EAClC,QAAQ,SAAS,gBAAgB,CAAC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AAW,CAAC;QACzB,QAAQ,CAAC,EAAE,MAAM,CAAC;KACnB,GAAG,OAAO,CAAC,qBAAqB,GAAG,SAAS,CAAC;IAI9C;;;;;;;;OAQG;WACiB,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,oBAAoB,GAAG,OAAO,CAAC,mBAAmB,CAAC;CAG5G"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolver-cache-level.d.ts","sourceRoot":"","sources":["../../../src/resolver/resolver-cache-level.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAKpD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAChE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAEnE;;;;;GAKG;AACH,MAAM,MAAM,2BAA2B,GAAG;IACxC;;;OAGG;IACH,EAAE,CAAC,EAAE,aAAa,CAAC,MAAM,GAAG,MAAM,GAAG,UAAU,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IAEjE;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;;;OAIG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;CACd,
|
|
1
|
+
{"version":3,"file":"resolver-cache-level.d.ts","sourceRoot":"","sources":["../../../src/resolver/resolver-cache-level.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAKpD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAChE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAEnE;;;;;GAKG;AACH,MAAM,MAAM,2BAA2B,GAAG;IACxC;;;OAGG;IACH,EAAE,CAAC,EAAE,aAAa,CAAC,MAAM,GAAG,MAAM,GAAG,UAAU,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IAEjE;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;;;OAIG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;CACd,CAAC;AAyBF;;;;;;;;;;;;;;GAcG;AACH,qBAAa,qBAAsB,YAAW,gBAAgB;IAC5D,qDAAqD;IACrD,SAAS,CAAC,KAAK,8DAAC;IAEhB,0DAA0D;IAC1D,SAAS,CAAC,GAAG,EAAE,MAAM,CAAC;gBAEV,EACV,EAAE,EACF,QAAmC,EACnC,GAAW,EACZ,GAAE,2BAAgC;IAKnC;;;;;;;OAOG;IACG,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,GAAG,IAAI,CAAC;IAwB3D;;;;;;OAMG;IACH,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC;IAO3D;;;;;OAKG;IACH,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIlC;;;;OAIG;IACH,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAItB;;;;OAIG;IACH,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAGvB"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type { DidResolutionResult } from '../types/did-core.js';
|
|
2
|
+
import type { DidResolverCache } from '../types/did-resolution.js';
|
|
3
|
+
/**
|
|
4
|
+
* Configuration parameters for creating an in-memory cache for DID resolution results.
|
|
5
|
+
*
|
|
6
|
+
* Allows customization of the cache time-to-live (TTL) setting.
|
|
7
|
+
*/
|
|
8
|
+
export type DidResolverCacheMemoryParams = {
|
|
9
|
+
/**
|
|
10
|
+
* Optional. The time-to-live for cache entries, expressed as a string (e.g., '1h', '15m').
|
|
11
|
+
* Determines how long a cache entry should remain valid before being considered expired.
|
|
12
|
+
*
|
|
13
|
+
* Defaults to '15m' if not specified.
|
|
14
|
+
*/
|
|
15
|
+
ttl?: string;
|
|
16
|
+
};
|
|
17
|
+
export declare class DidResolverCacheMemory implements DidResolverCache {
|
|
18
|
+
private cache;
|
|
19
|
+
constructor({ ttl }?: DidResolverCacheMemoryParams);
|
|
20
|
+
/**
|
|
21
|
+
* Retrieves a DID resolution result from the cache.
|
|
22
|
+
*
|
|
23
|
+
* If the cached item has exceeded its TTL, it's scheduled for deletion and undefined is returned.
|
|
24
|
+
*
|
|
25
|
+
* @param didUri - The DID string used as the key for retrieving the cached result.
|
|
26
|
+
* @returns The cached DID resolution result or undefined if not found or expired.
|
|
27
|
+
*/
|
|
28
|
+
get(didUri: string): Promise<DidResolutionResult | void>;
|
|
29
|
+
/**
|
|
30
|
+
* Stores a DID resolution result in the cache with a TTL.
|
|
31
|
+
*
|
|
32
|
+
* @param didUri - The DID string used as the key for storing the result.
|
|
33
|
+
* @param resolutionResult - The DID resolution result to be cached.
|
|
34
|
+
* @returns A promise that resolves when the operation is complete.
|
|
35
|
+
*/
|
|
36
|
+
set(didUri: string, resolutionResult: DidResolutionResult): Promise<void>;
|
|
37
|
+
/**
|
|
38
|
+
* Deletes a DID resolution result from the cache.
|
|
39
|
+
*
|
|
40
|
+
* @param didUri - The DID string used as the key for deletion.
|
|
41
|
+
* @returns A promise that resolves when the operation is complete.
|
|
42
|
+
*/
|
|
43
|
+
delete(didUri: string): Promise<void>;
|
|
44
|
+
/**
|
|
45
|
+
* Clears all entries from the cache.
|
|
46
|
+
*
|
|
47
|
+
* @returns A promise that resolves when the operation is complete.
|
|
48
|
+
*/
|
|
49
|
+
clear(): Promise<void>;
|
|
50
|
+
/**
|
|
51
|
+
* This method is a no-op but exists to be consistent with other DID Resolver Cache
|
|
52
|
+
* implementations.
|
|
53
|
+
*
|
|
54
|
+
* @returns A promise that resolves immediately.
|
|
55
|
+
*/
|
|
56
|
+
close(): Promise<void>;
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=resolver-cache-memory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolver-cache-memory.d.ts","sourceRoot":"","sources":["../../../src/resolver/resolver-cache-memory.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAChE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAEnE;;;;GAIG;AACH,MAAM,MAAM,4BAA4B,GAAG;IACzC;;;;;OAKG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,qBAAa,sBAAuB,YAAW,gBAAgB;IAC7D,OAAO,CAAC,KAAK,CAAwC;gBAEzC,EAAE,GAAW,EAAE,GAAE,4BAAiC;IAI9D;;;;;;;OAOG;IACU,GAAG,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,GAAG,IAAI,CAAC;IAQrE;;;;;;OAMG;IACU,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,gBAAgB,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC;IAItF;;;;;OAKG;IACU,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIlD;;;;OAIG;IACU,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAInC;;;;;OAKG;IACU,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAGpC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { DidMethodResolver } from '../methods/did-method.js';
|
|
2
|
-
import type { DidResolver, DidResolverCache, DidUrlDereferencer } from '../types/did-resolution.js';
|
|
3
2
|
import type { DidDereferencingOptions, DidDereferencingResult, DidResolutionOptions, DidResolutionResult } from '../types/did-core.js';
|
|
3
|
+
import type { DidResolver, DidResolverCache, DidUrlDereferencer } from '../types/did-resolution.js';
|
|
4
4
|
/**
|
|
5
5
|
* Parameters for configuring the `UniversalResolver` class, which is responsible for resolving
|
|
6
6
|
* decentralized identifiers (DIDs) to their corresponding DID documents.
|
|
@@ -98,7 +98,7 @@ export declare class UniversalResolver implements DidResolver, DidUrlDereference
|
|
|
98
98
|
* More information on DID URL dereferencing can be found in the
|
|
99
99
|
* {@link https://www.w3.org/TR/did-core/#did-url-dereferencing | DID Core specification}.
|
|
100
100
|
*
|
|
101
|
-
* TODO: This is a partial implementation and does not fully implement DID URL dereferencing. (https://github.com/
|
|
101
|
+
* TODO: This is a partial implementation and does not fully implement DID URL dereferencing. (https://github.com/enboxorg/enbox/issues/387)
|
|
102
102
|
*
|
|
103
103
|
* @param didUrl - The DID URL string to dereference.
|
|
104
104
|
* @param [_options] - Input options to the dereference function. Optional.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"universal-resolver.d.ts","sourceRoot":"","sources":["../../../src/resolver/universal-resolver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"universal-resolver.d.ts","sourceRoot":"","sources":["../../../src/resolver/universal-resolver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,KAAK,EAAE,uBAAuB,EAAE,sBAAsB,EAAE,oBAAoB,EAAE,mBAAmB,EAAe,MAAM,sBAAsB,CAAC;AACpJ,OAAO,KAAK,EAAE,WAAW,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAOpG;;;;;;;;GAQG;AACH,MAAM,MAAM,uBAAuB,GAAG;IACpC;;;;;OAKG;IACH,YAAY,EAAE,iBAAiB,EAAE,CAAC;IAElC;;;;;;OAMG;IACH,KAAK,CAAC,EAAE,gBAAgB,CAAC;CAC1B,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,qBAAa,iBAAkB,YAAW,WAAW,EAAE,kBAAkB;IACvE;;OAEG;IACH,SAAS,CAAC,KAAK,EAAE,gBAAgB,CAAC;IAElC;;OAEG;IACH,OAAO,CAAC,YAAY,CAA6C;IAEjE;;;;OAIG;gBACS,EAAE,KAAK,EAAE,YAAY,EAAE,EAAE,uBAAuB;IAQ5D;;;;;;;;;OASG;IACU,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,oBAAoB,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAuClG;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACG,WAAW,CACf,MAAM,EAAE,MAAM,EACd,QAAQ,CAAC,EAAE,uBAAuB,GACjC,OAAO,CAAC,sBAAsB,CAAC;CAyEnC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"did-core.d.ts","sourceRoot":"","sources":["../../../src/types/did-core.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"did-core.d.ts","sourceRoot":"","sources":["../../../src/types/did-core.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAEzC;;;;;;;GAOG;AACH,MAAM,MAAM,wBAAwB,GAAG;IACrC;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;;;;;;;;;;;;OAaG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAGf,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,WAAW,uBAAuB;IACtC,gEAAgE;IAChE,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB,2DAA2D;IAC3D,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB;AAED;;;;;;;;GAQG;AACH,MAAM,MAAM,sBAAsB,GAAG;IACnC;;;;;;OAMG;IACH,qBAAqB,EAAE,wBAAwB,CAAC;IAEhD;;;;;;;;;;OAUG;IACH,aAAa,EAAE,WAAW,G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;IACH,EAAE,EAAE,MAAM,CAAC;IAEX;;;;;;;;OAQG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;;;;;OAMG;IACH,eAAe,EAAE,kBAAkB,GAAG,kBAAkB,EAAE,CAAC;IAG3D,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB,CAAC;AAEF;;;;;;;;;GASG;AACH,MAAM,MAAM,kBAAkB,GAAG,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AAE9D;;;;;;;;GAQG;AACH,MAAM,WAAW,qBAAqB;IACpC;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IAEX;;;;;OAKG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;;;OAIG;IACH,YAAY,CAAC,EAAE,GAAG,CAAC;IAEnB;;;;;OAKG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED;;;;;;;;;;GAUG;AACH,oBAAY,2BAA2B;IACrC;;;;;OAKG;IACH,cAAc,mBAAmB;IAEjC;;;;;;OAMG;IACH,eAAe,oBAAoB;IAEnC;;;;;OAKG;IACH,YAAY,iBAAiB;IAE7B;;;;;OAKG;IACH,oBAAoB,yBAAyB;IAE7C;;;;;OAKG;IACH,oBAAoB,yBAAyB;CAC9C"}
|
package/dist/types/utils.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import type { Jwk } from '@enbox/crypto';
|
|
2
2
|
import type { RequireOnly } from '@enbox/common';
|
|
3
3
|
import type { KeyWithMulticodec } from './types/multibase.js';
|
|
4
|
-
import {
|
|
4
|
+
import type { PortableDid } from './types/portable-did.js';
|
|
5
|
+
import type { DidDocument, DidService, DidVerificationMethod } from './types/did-core.js';
|
|
6
|
+
import { DidVerificationRelationship } from './types/did-core.js';
|
|
5
7
|
/**
|
|
6
8
|
* Represents a Decentralized Web Node (DWN) service in a DID Document.
|
|
7
9
|
*
|
|
@@ -18,7 +20,7 @@ import { DidService, DidDocument, DidVerificationMethod, DidVerificationRelation
|
|
|
18
20
|
* const service: DwnDidService = {
|
|
19
21
|
* id: 'did:example:123#dwn',
|
|
20
22
|
* type: 'DecentralizedWebNode',
|
|
21
|
-
* serviceEndpoint: 'https://enbox-
|
|
23
|
+
* serviceEndpoint: 'https://enbox-dwn.fly.dev',
|
|
22
24
|
* enc: 'did:example:123#key-1',
|
|
23
25
|
* sig: 'did:example:123#key-2'
|
|
24
26
|
* }
|
|
@@ -78,8 +80,10 @@ export declare function extractDidFragment(input: unknown): string | undefined;
|
|
|
78
80
|
*
|
|
79
81
|
* @param params - An object containing input parameters for retrieving services.
|
|
80
82
|
* @param params.didDocument - The DID document from which services are retrieved.
|
|
81
|
-
* @param params.id - Optional. A string representing the specific service ID to match. If provided,
|
|
82
|
-
*
|
|
83
|
+
* @param params.id - Optional. A string representing the specific service ID to match. If provided,
|
|
84
|
+
* only the service with this ID will be returned.
|
|
85
|
+
* @param params.type - Optional. A string representing the specific service type to match.
|
|
86
|
+
* If provided, only the service(s) of this type will be returned.
|
|
83
87
|
* @returns An array of services. If no matching service is found, an empty array is returned.
|
|
84
88
|
*/
|
|
85
89
|
export declare function getServices({ didDocument, id, type }: {
|
|
@@ -287,7 +291,7 @@ export declare function isDidService(obj: unknown): obj is DidService;
|
|
|
287
291
|
* {
|
|
288
292
|
* id: 'did:example:123#dwn',
|
|
289
293
|
* type: 'DecentralizedWebNode',
|
|
290
|
-
* serviceEndpoint: 'https://enbox-
|
|
294
|
+
* serviceEndpoint: 'https://enbox-dwn.fly.dev',
|
|
291
295
|
* enc: 'did:example:123#key-1',
|
|
292
296
|
* sig: 'did:example:123#key-2'
|
|
293
297
|
* }
|
|
@@ -333,6 +337,24 @@ export declare function isDwnDidService(obj: unknown): obj is DwnDidService;
|
|
|
333
337
|
* @returns `true` if `obj` is a `DidVerificationMethod`; otherwise, `false`.
|
|
334
338
|
*/
|
|
335
339
|
export declare function isDidVerificationMethod(obj: unknown): obj is DidVerificationMethod;
|
|
340
|
+
/**
|
|
341
|
+
* Checks if a given object conforms to the {@link PortableDid} interface.
|
|
342
|
+
*
|
|
343
|
+
* A `PortableDid` is an object with `uri`, `document`, and `metadata` properties that does not
|
|
344
|
+
* have a `keyManager` property (or has it set to `undefined`). This distinguishes it from a
|
|
345
|
+
* {@link BearerDid}, which includes a `keyManager`.
|
|
346
|
+
*
|
|
347
|
+
* @example
|
|
348
|
+
* ```ts
|
|
349
|
+
* if (isPortableDid(obj)) {
|
|
350
|
+
* console.log('The object is a PortableDid');
|
|
351
|
+
* }
|
|
352
|
+
* ```
|
|
353
|
+
*
|
|
354
|
+
* @param obj - The object to be checked.
|
|
355
|
+
* @returns `true` if `obj` is a `PortableDid`; otherwise, `false`.
|
|
356
|
+
*/
|
|
357
|
+
export declare function isPortableDid(obj: unknown): obj is PortableDid;
|
|
336
358
|
/**
|
|
337
359
|
* Converts a cryptographic key to a multibase identifier.
|
|
338
360
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAKjD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAKjD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,KAAK,EACV,WAAW,EACX,UAA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