@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.
Files changed (77) hide show
  1. package/dist/browser.mjs +1 -1
  2. package/dist/browser.mjs.map +4 -4
  3. package/dist/esm/index.js +2 -0
  4. package/dist/esm/index.js.map +1 -1
  5. package/dist/esm/methods/did-dht-dns.js +455 -0
  6. package/dist/esm/methods/did-dht-dns.js.map +1 -0
  7. package/dist/esm/methods/did-dht-pkarr.js +168 -0
  8. package/dist/esm/methods/did-dht-pkarr.js.map +1 -0
  9. package/dist/esm/methods/did-dht-types.js +116 -0
  10. package/dist/esm/methods/did-dht-types.js.map +1 -0
  11. package/dist/esm/methods/did-dht-utils.js +143 -0
  12. package/dist/esm/methods/did-dht-utils.js.map +1 -0
  13. package/dist/esm/methods/did-dht.js +65 -842
  14. package/dist/esm/methods/did-dht.js.map +1 -1
  15. package/dist/esm/methods/did-ion-utils.js +161 -0
  16. package/dist/esm/methods/did-ion-utils.js.map +1 -0
  17. package/dist/esm/methods/did-ion.js +4 -151
  18. package/dist/esm/methods/did-ion.js.map +1 -1
  19. package/dist/esm/methods/did-jwk.js.map +1 -1
  20. package/dist/esm/methods/did-key-utils.js +235 -0
  21. package/dist/esm/methods/did-key-utils.js.map +1 -0
  22. package/dist/esm/methods/did-key.js +6 -222
  23. package/dist/esm/methods/did-key.js.map +1 -1
  24. package/dist/esm/resolver/resolver-cache-memory.js +77 -0
  25. package/dist/esm/resolver/resolver-cache-memory.js.map +1 -0
  26. package/dist/esm/utils.js +25 -0
  27. package/dist/esm/utils.js.map +1 -1
  28. package/dist/types/bearer-did.d.ts +4 -4
  29. package/dist/types/bearer-did.d.ts.map +1 -1
  30. package/dist/types/index.d.ts +2 -0
  31. package/dist/types/index.d.ts.map +1 -1
  32. package/dist/types/methods/did-dht-dns.d.ts +114 -0
  33. package/dist/types/methods/did-dht-dns.d.ts.map +1 -0
  34. package/dist/types/methods/did-dht-pkarr.d.ts +56 -0
  35. package/dist/types/methods/did-dht-pkarr.d.ts.map +1 -0
  36. package/dist/types/methods/did-dht-types.d.ts +286 -0
  37. package/dist/types/methods/did-dht-types.d.ts.map +1 -0
  38. package/dist/types/methods/did-dht-utils.d.ts +54 -0
  39. package/dist/types/methods/did-dht-utils.d.ts.map +1 -0
  40. package/dist/types/methods/did-dht.d.ts +45 -460
  41. package/dist/types/methods/did-dht.d.ts.map +1 -1
  42. package/dist/types/methods/did-ion-utils.d.ts +86 -0
  43. package/dist/types/methods/did-ion-utils.d.ts.map +1 -0
  44. package/dist/types/methods/did-ion.d.ts +4 -84
  45. package/dist/types/methods/did-ion.d.ts.map +1 -1
  46. package/dist/types/methods/did-jwk.d.ts +4 -4
  47. package/dist/types/methods/did-jwk.d.ts.map +1 -1
  48. package/dist/types/methods/did-key-utils.d.ts +138 -0
  49. package/dist/types/methods/did-key-utils.d.ts.map +1 -0
  50. package/dist/types/methods/did-key.d.ts +6 -127
  51. package/dist/types/methods/did-key.d.ts.map +1 -1
  52. package/dist/types/methods/did-method.d.ts +3 -3
  53. package/dist/types/methods/did-method.d.ts.map +1 -1
  54. package/dist/types/resolver/resolver-cache-memory.d.ts +58 -0
  55. package/dist/types/resolver/resolver-cache-memory.d.ts.map +1 -0
  56. package/dist/types/utils.d.ts +19 -0
  57. package/dist/types/utils.d.ts.map +1 -1
  58. package/dist/utils.js +1 -1
  59. package/dist/utils.js.map +4 -4
  60. package/package.json +11 -13
  61. package/src/bearer-did.ts +4 -4
  62. package/src/index.ts +2 -0
  63. package/src/methods/did-dht-dns.ts +516 -0
  64. package/src/methods/did-dht-pkarr.ts +192 -0
  65. package/src/methods/did-dht-types.ts +316 -0
  66. package/src/methods/did-dht-utils.ts +157 -0
  67. package/src/methods/did-dht.ts +125 -1131
  68. package/src/methods/did-ion-utils.ts +186 -0
  69. package/src/methods/did-ion.ts +16 -185
  70. package/src/methods/did-jwk.ts +4 -4
  71. package/src/methods/did-key-utils.ts +258 -0
  72. package/src/methods/did-key.ts +20 -272
  73. package/src/methods/did-method.ts +3 -3
  74. package/src/resolver/resolver-cache-memory.ts +84 -0
  75. package/src/utils.ts +27 -0
  76. package/dist/browser.js +0 -73
  77. package/dist/browser.js.map +0 -7
@@ -0,0 +1,86 @@
1
+ import type { Jwk } from '@enbox/crypto';
2
+ import type { IonDocumentModel } from '@decentralized-identity/ion-sdk';
3
+ import type { DidService } from '../types/did-core.js';
4
+ import type { DidIonCreateRequest, DidIonVerificationMethod } from './did-ion.js';
5
+ /**
6
+ * The `DidIonUtils` class provides utility functions to support operations in the DID ION method.
7
+ */
8
+ export declare class DidIonUtils {
9
+ /**
10
+ * Appends a specified path to a base URL, ensuring proper formatting of the resulting URL.
11
+ *
12
+ * This method is useful for constructing URLs for accessing various endpoints, such as Sidetree
13
+ * nodes in the ION network. It handles the nuances of URL path concatenation, including the
14
+ * addition or removal of leading/trailing slashes, to create a well-formed URL.
15
+ *
16
+ * @param params - The parameters for URL construction.
17
+ * @param params.baseUrl - The base URL to which the path will be appended.
18
+ * @param params.path - The path to append to the base URL.
19
+ * @returns The fully constructed URL string with the path appended to the base URL.
20
+ */
21
+ static appendPathToUrl({ baseUrl, path }: {
22
+ baseUrl: string;
23
+ path: string;
24
+ }): string;
25
+ /**
26
+ * Computes the Long Form DID URI given an ION DID's recovery key, update key, services, and
27
+ * verification methods.
28
+ *
29
+ * @param params - The parameters for computing the Long Form DID URI.
30
+ * @param params.recoveryKey - The ION Recovery Key.
31
+ * @param params.updateKey - The ION Update Key.
32
+ * @param params.services - An array of services associated with the DID.
33
+ * @param params.verificationMethods - An array of verification methods associated with the DID.
34
+ * @returns A Promise resolving to the Long Form DID URI.
35
+ */
36
+ static computeLongFormDidUri({ recoveryKey, updateKey, services, verificationMethods }: {
37
+ recoveryKey: Jwk;
38
+ updateKey: Jwk;
39
+ services: DidService[];
40
+ verificationMethods: DidIonVerificationMethod[];
41
+ }): Promise<string>;
42
+ /**
43
+ * Constructs a Sidetree Create Operation request for a DID document within the ION network.
44
+ *
45
+ * This method prepares the necessary payload for submitting a Create Operation to a Sidetree
46
+ * node, encapsulating the details of the DID document, recovery key, and update key.
47
+ *
48
+ * @param params - Parameters required to construct the Create Operation request.
49
+ * @param params.ionDocument - The DID document model containing public keys and service endpoints.
50
+ * @param params.recoveryKey - The recovery public key in JWK format.
51
+ * @param params.updateKey - The update public key in JWK format.
52
+ * @returns A promise resolving to the ION Create Operation request model, ready for submission to a Sidetree node.
53
+ */
54
+ static constructCreateRequest({ ionDocument, recoveryKey, updateKey }: {
55
+ ionDocument: IonDocumentModel;
56
+ recoveryKey: Jwk;
57
+ updateKey: Jwk;
58
+ }): Promise<DidIonCreateRequest>;
59
+ /**
60
+ * Assembles an ION document model from provided services and verification methods
61
+ *
62
+ * This model serves as the foundation for a DID document in the ION network, facilitating the
63
+ * creation and management of decentralized identities. It translates service endpoints and
64
+ * public keys into a format compatible with the Sidetree protocol, ensuring the resulting DID
65
+ * document adheres to the required specifications for ION DIDs. This method is essential for
66
+ * constructing the payload needed to register or update DIDs within the ION network.
67
+ *
68
+ * @param params - The parameters containing the services and verification methods to include in the ION document.
69
+ * @param params.services - A list of service endpoints to be included in the DID document, specifying ways to interact with the DID subject.
70
+ * @param params.verificationMethods - A list of verification methods to be included, detailing the
71
+ * cryptographic keys and their intended uses within the DID document.
72
+ * @returns A Promise resolving to an `IonDocumentModel`, ready for use in Sidetree operations like DID creation and updates.
73
+ */
74
+ static createIonDocument({ services, verificationMethods }: {
75
+ services: DidService[];
76
+ verificationMethods: DidIonVerificationMethod[];
77
+ }): Promise<IonDocumentModel>;
78
+ /**
79
+ * Normalize the given JWK to include only specific members and in lexicographic order.
80
+ *
81
+ * @param jwk - The JWK to normalize.
82
+ * @returns The normalized JWK.
83
+ */
84
+ private static normalizeJwk;
85
+ }
86
+ //# sourceMappingURL=did-ion-utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"did-ion-utils.d.ts","sourceRoot":"","sources":["../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CAkB5B"}
@@ -1,8 +1,8 @@
1
- import type { CryptoApi, Jwk, KeyIdentifier, KeyImporterExporter, KmsExportKeyParams, KmsImportKeyParams } from '@enbox/crypto';
2
1
  import type { IonDocumentModel } from '@decentralized-identity/ion-sdk';
3
2
  import type { PortableDid } from '../types/portable-did.js';
4
3
  import type { DidCreateOptions, DidCreateVerificationMethod, DidRegistrationResult } from '../methods/did-method.js';
5
4
  import type { DidDocument, DidResolutionOptions, DidResolutionResult, DidService, DidVerificationMethod, DidVerificationRelationship } from '../types/did-core.js';
5
+ import type { Jwk, KeyIdentifier, KeyImporterExporter, KeyManager, KmsExportKeyParams, KmsImportKeyParams } from '@enbox/crypto';
6
6
  import { BearerDid } from '../bearer-did.js';
7
7
  import { DidMethod } from '../methods/did-method.js';
8
8
  /**
@@ -304,7 +304,7 @@ export declare class DidIon extends DidMethod {
304
304
  * @param params.options - Optional parameters that can be specified when creating a new DID.
305
305
  * @returns A Promise resolving to a {@link BearerDid} object representing the new DID.
306
306
  */
307
- static create<TKms extends CryptoApi | undefined = undefined>({ keyManager, options }?: {
307
+ static create<TKms extends KeyManager | undefined = undefined>({ keyManager, options }?: {
308
308
  keyManager?: TKms;
309
309
  options?: DidIonCreateOptions<TKms>;
310
310
  }): Promise<BearerDid>;
@@ -349,7 +349,7 @@ export declare class DidIon extends DidMethod {
349
349
  * any verification method are missing in the key manager.
350
350
  */
351
351
  static import({ portableDid, keyManager }: {
352
- keyManager?: CryptoApi & KeyImporterExporter<KmsImportKeyParams, KeyIdentifier, KmsExportKeyParams>;
352
+ keyManager?: KeyManager & KeyImporterExporter<KmsImportKeyParams, KeyIdentifier, KmsExportKeyParams>;
353
353
  portableDid: PortableDid;
354
354
  }): Promise<BearerDid>;
355
355
  /**
@@ -409,85 +409,5 @@ export declare class DidIon extends DidMethod {
409
409
  */
410
410
  static resolve(didUri: string, options?: DidResolutionOptions): Promise<DidResolutionResult>;
411
411
  }
412
- /**
413
- * The `DidIonUtils` class provides utility functions to support operations in the DID ION method.
414
- */
415
- export declare class DidIonUtils {
416
- /**
417
- * Appends a specified path to a base URL, ensuring proper formatting of the resulting URL.
418
- *
419
- * This method is useful for constructing URLs for accessing various endpoints, such as Sidetree
420
- * nodes in the ION network. It handles the nuances of URL path concatenation, including the
421
- * addition or removal of leading/trailing slashes, to create a well-formed URL.
422
- *
423
- * @param params - The parameters for URL construction.
424
- * @param params.baseUrl - The base URL to which the path will be appended.
425
- * @param params.path - The path to append to the base URL.
426
- * @returns The fully constructed URL string with the path appended to the base URL.
427
- */
428
- static appendPathToUrl({ baseUrl, path }: {
429
- baseUrl: string;
430
- path: string;
431
- }): string;
432
- /**
433
- * Computes the Long Form DID URI given an ION DID's recovery key, update key, services, and
434
- * verification methods.
435
- *
436
- * @param params - The parameters for computing the Long Form DID URI.
437
- * @param params.recoveryKey - The ION Recovery Key.
438
- * @param params.updateKey - The ION Update Key.
439
- * @param params.services - An array of services associated with the DID.
440
- * @param params.verificationMethods - An array of verification methods associated with the DID.
441
- * @returns A Promise resolving to the Long Form DID URI.
442
- */
443
- static computeLongFormDidUri({ recoveryKey, updateKey, services, verificationMethods }: {
444
- recoveryKey: Jwk;
445
- updateKey: Jwk;
446
- services: DidService[];
447
- verificationMethods: DidIonVerificationMethod[];
448
- }): Promise<string>;
449
- /**
450
- * Constructs a Sidetree Create Operation request for a DID document within the ION network.
451
- *
452
- * This method prepares the necessary payload for submitting a Create Operation to a Sidetree
453
- * node, encapsulating the details of the DID document, recovery key, and update key.
454
- *
455
- * @param params - Parameters required to construct the Create Operation request.
456
- * @param params.ionDocument - The DID document model containing public keys and service endpoints.
457
- * @param params.recoveryKey - The recovery public key in JWK format.
458
- * @param params.updateKey - The update public key in JWK format.
459
- * @returns A promise resolving to the ION Create Operation request model, ready for submission to a Sidetree node.
460
- */
461
- static constructCreateRequest({ ionDocument, recoveryKey, updateKey }: {
462
- ionDocument: IonDocumentModel;
463
- recoveryKey: Jwk;
464
- updateKey: Jwk;
465
- }): Promise<DidIonCreateRequest>;
466
- /**
467
- * Assembles an ION document model from provided services and verification methods
468
- *
469
- * This model serves as the foundation for a DID document in the ION network, facilitating the
470
- * creation and management of decentralized identities. It translates service endpoints and
471
- * public keys into a format compatible with the Sidetree protocol, ensuring the resulting DID
472
- * document adheres to the required specifications for ION DIDs. This method is essential for
473
- * constructing the payload needed to register or update DIDs within the ION network.
474
- *
475
- * @param params - The parameters containing the services and verification methods to include in the ION document.
476
- * @param params.services - A list of service endpoints to be included in the DID document, specifying ways to interact with the DID subject.
477
- * @param params.verificationMethods - A list of verification methods to be included, detailing the
478
- * cryptographic keys and their intended uses within the DID document.
479
- * @returns A Promise resolving to an `IonDocumentModel`, ready for use in Sidetree operations like DID creation and updates.
480
- */
481
- static createIonDocument({ services, verificationMethods }: {
482
- services: DidService[];
483
- verificationMethods: DidIonVerificationMethod[];
484
- }): Promise<IonDocumentModel>;
485
- /**
486
- * Normalize the given JWK to include only specific members and in lexicographic order.
487
- *
488
- * @param jwk - The JWK to normalize.
489
- * @returns The normalized JWK.
490
- */
491
- private static normalizeJwk;
492
- }
412
+ export { DidIonUtils } from './did-ion-utils.js';
493
413
  //# sourceMappingURL=did-ion.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"did-ion.d.ts","sourceRoot":"","sources":["../../../src/methods/did-ion.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,GAAG,EAAE,aAAa,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAChI,OAAO,KAAK,EACV,gBAAgB,EAIjB,MAAM,iCAAiC,CAAC;AAKzC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,KAAK,EAAE,gBAAgB,EAAE,2BAA2B,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AACrH,OAAO,KAAK,EACV,WAAW,EACX,oBAAoB,EACpB,mBAAmB,EACnB,UAAU,EACV,qBAA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,UAAkC,EAClC,OAAY,EACb,GAAE;QACD,UAAU,CAAC,EAAE,IAAI,CAAC;QAClB,OAAO,CAAC,EAAE,mBAAmB,CAAC,IAAI,CAAC,CAAC;KAChC,GAAG,OAAO,CAAC,SAAS,CAAC;IAwF3B;;;;;;;;;;OAUG;WACiB,gBAAgB,CAAC,EAAE,WAAW,EAAE,QAAQ,EAAE,EAAE;QAC9D,WAAW,EAAE,WAAW,CAAC;QACzB,QAAQ,CAAC,EAAE,MAAM,CAAC;KACnB,GAAG,OAAO,CAAC,qBAAqB,CAAC;IAmBlC;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;WACiB,MAAM,CAAC,EAAE,WAAW,EAAE,UAAkC,EAAE,EAAE;QAC9E,UAAU,CAAC,EAAE,UAAU,GAAG,mBAAmB,CAAC,kBAAkB,EAAE,aAAa,EAAE,kBAAkB,CAAC,CAAC;QACrG,WAAW,EAAE,WAAW,CAAC;KAC1B,GAAG,OAAO,CAAC,SAAS,CAAC;IAYtB;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4BG;WACiB,OAAO,CAAC,EAAE,GAAG,EAAE,UAAgC,EAAE,EAAE;QACrE,GAAG,EAAE,SAAS,CAAC;QACf,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB,GAAG,OAAO,CAAC,qBAAqB,CAAC;IAgElC;;;;;;;;;;;;;;;;;;;;;OAqBG;WACiB,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,GAAE,oBAAyB,GAAG,OAAO,CAAC,mBAAmB,CAAC;CA+D9G;AAGD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC"}
@@ -1,4 +1,4 @@
1
- import type { CryptoApi, InferKeyGeneratorAlgorithm, KeyIdentifier, KeyImporterExporter, KmsExportKeyParams, KmsImportKeyParams } from '@enbox/crypto';
1
+ import type { InferKeyGeneratorAlgorithm, KeyIdentifier, KeyImporterExporter, KeyManager, KmsExportKeyParams, KmsImportKeyParams } from '@enbox/crypto';
2
2
  import { LocalKeyManager } from '@enbox/crypto';
3
3
  import type { PortableDid } from '../types/portable-did.js';
4
4
  import type { DidCreateOptions, DidCreateVerificationMethod } from './did-method.js';
@@ -60,7 +60,7 @@ export interface DidJwkCreateOptions<TKms> extends DidCreateOptions<TKms> {
60
60
  /**
61
61
  * Optionally specify the algorithm to be used for key generation.
62
62
  */
63
- algorithm?: TKms extends CryptoApi ? InferKeyGeneratorAlgorithm<TKms> : InferKeyGeneratorAlgorithm<LocalKeyManager>;
63
+ algorithm?: TKms extends KeyManager ? InferKeyGeneratorAlgorithm<TKms> : InferKeyGeneratorAlgorithm<LocalKeyManager>;
64
64
  /**
65
65
  * Alternatively, specify the algorithm to be used for key generation of the single verification
66
66
  * method in the DID Document.
@@ -171,7 +171,7 @@ export declare class DidJwk extends DidMethod {
171
171
  * @param params.options - Optional parameters that can be specified when creating a new DID.
172
172
  * @returns A Promise resolving to a {@link BearerDid} object representing the new DID.
173
173
  */
174
- static create<TKms extends CryptoApi | undefined = undefined>({ keyManager, options }?: {
174
+ static create<TKms extends KeyManager | undefined = undefined>({ keyManager, options }?: {
175
175
  keyManager?: TKms;
176
176
  options?: DidJwkCreateOptions<TKms>;
177
177
  }): Promise<BearerDid>;
@@ -221,7 +221,7 @@ export declare class DidJwk extends DidMethod {
221
221
  * @throws An error if the DID document does not contain exactly one verification method.
222
222
  */
223
223
  static import({ portableDid, keyManager }: {
224
- keyManager?: CryptoApi & KeyImporterExporter<KmsImportKeyParams, KeyIdentifier, KmsExportKeyParams>;
224
+ keyManager?: KeyManager & KeyImporterExporter<KmsImportKeyParams, KeyIdentifier, KmsExportKeyParams>;
225
225
  portableDid: PortableDid;
226
226
  }): Promise<BearerDid>;
227
227
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"did-jwk.d.ts","sourceRoot":"","sources":["../../../src/methods/did-jwk.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,SAAS,EACT,0BAA0B,EAE1B,aAAa,EACb,mBAAmB,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MAAM,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,oBAAoB,GAAG,OAAO,CAAC,mBAAmB,CAAC;CAyE3G"}
@@ -0,0 +1,138 @@
1
+ import type { AsymmetricKeyConverter, Jwk, KeyCompressor } from '@enbox/crypto';
2
+ import type { MulticodecCode, MulticodecDefinition } from '@enbox/common';
3
+ /**
4
+ * Private helper that maps algorithm identifiers to their corresponding DID Key
5
+ * {@link DidKeyRegisteredKeyType | registered key type}.
6
+ *
7
+ * Note: This is also used by `DidKeyUtils.publicKeyToMultibaseId()` to validate key types.
8
+ */
9
+ export declare const AlgorithmToKeyTypeMap: {
10
+ readonly Ed25519: "Ed25519";
11
+ readonly ES256K: "secp256k1";
12
+ readonly ES256: "secp256r1";
13
+ readonly 'P-256': "secp256r1";
14
+ readonly secp256k1: "secp256k1";
15
+ readonly secp256r1: "secp256r1";
16
+ };
17
+ /**
18
+ * The `DidKeyUtils` class provides utility functions to support operations in the DID Key method.
19
+ */
20
+ export declare class DidKeyUtils {
21
+ /**
22
+ * A mapping from JSON Web Key (JWK) property descriptors to multicodec names.
23
+ *
24
+ * This mapping is used to convert keys in JWK (JSON Web Key) format to multicodec format.
25
+ *
26
+ * @remarks
27
+ * The keys of this object are strings that describe the JOSE key type and usage,
28
+ * such as 'Ed25519:public', 'Ed25519:private', etc. The values are the corresponding multicodec
29
+ * names used to represent these key types.
30
+ *
31
+ * @example
32
+ * ```ts
33
+ * const multicodecName = JWK_TO_MULTICODEC['Ed25519:public'];
34
+ * // Returns 'ed25519-pub', the multicodec name for an Ed25519 public key
35
+ * ```
36
+ */
37
+ private static JWK_TO_MULTICODEC;
38
+ /**
39
+ * Defines the expected byte lengths for public keys associated with different cryptographic
40
+ * algorithms, indexed by their multicodec code values.
41
+ */
42
+ static MULTICODEC_PUBLIC_KEY_LENGTH: Record<number, number>;
43
+ /**
44
+ * A mapping from multicodec names to their corresponding JOSE (JSON Object Signing and Encryption)
45
+ * representations. This mapping facilitates the conversion of multicodec key formats to
46
+ * JWK (JSON Web Key) formats.
47
+ *
48
+ * @remarks
49
+ * The keys of this object are multicodec names, such as 'ed25519-pub', 'ed25519-priv', etc.
50
+ * The values are objects representing the corresponding JWK properties for that key type.
51
+ *
52
+ * @example
53
+ * ```ts
54
+ * const joseKey = MULTICODEC_TO_JWK['ed25519-pub'];
55
+ * // Returns a partial JWK for an Ed25519 public key
56
+ * ```
57
+ */
58
+ private static MULTICODEC_TO_JWK;
59
+ /**
60
+ * Converts a JWK (JSON Web Key) to a Multicodec code and name.
61
+ *
62
+ * @example
63
+ * ```ts
64
+ * const jwk: Jwk = { crv: 'Ed25519', kty: 'OKP', x: '...' };
65
+ * const { code, name } = await DidKeyUtils.jwkToMulticodec({ jwk });
66
+ * ```
67
+ *
68
+ * @param params - The parameters for the conversion.
69
+ * @param params.jwk - The JSON Web Key to be converted.
70
+ * @returns A promise that resolves to a Multicodec definition.
71
+ */
72
+ static jwkToMulticodec({ jwk }: {
73
+ jwk: Jwk;
74
+ }): Promise<MulticodecDefinition<MulticodecCode>>;
75
+ /**
76
+ * Returns the appropriate public key compressor for the specified cryptographic curve.
77
+ *
78
+ * @param curve - The cryptographic curve to use for the key conversion.
79
+ * @returns A public key compressor for the specified curve.
80
+ */
81
+ static keyCompressor(curve: string): KeyCompressor['compressPublicKey'];
82
+ /**
83
+ * Returns the appropriate key converter for the specified cryptographic curve.
84
+ *
85
+ * @param curve - The cryptographic curve to use for the key conversion.
86
+ * @returns An `AsymmetricKeyConverter` for the specified curve.
87
+ */
88
+ static keyConverter(curve: string): AsymmetricKeyConverter;
89
+ /**
90
+ * Converts a Multicodec code or name to parial JWK (JSON Web Key).
91
+ *
92
+ * @example
93
+ * ```ts
94
+ * const partialJwk = await DidKeyUtils.multicodecToJwk({ name: 'ed25519-pub' });
95
+ * ```
96
+ *
97
+ * @param params - The parameters for the conversion.
98
+ * @param params.code - Optional Multicodec code to convert.
99
+ * @param params.name - Optional Multicodec name to convert.
100
+ * @returns A promise that resolves to a JOSE format key.
101
+ */
102
+ static multicodecToJwk({ code, name }: {
103
+ code?: MulticodecCode;
104
+ name?: string;
105
+ }): Promise<Jwk>;
106
+ /**
107
+ * Converts a public key in JWK (JSON Web Key) format to a multibase identifier.
108
+ *
109
+ * @remarks
110
+ * Note: All secp public keys are converted to compressed point encoding
111
+ * before the multibase identifier is computed.
112
+ *
113
+ * Per {@link https://github.com/multiformats/multicodec/blob/master/table.csv | Multicodec table}:
114
+ * Public keys for Elliptic Curve cryptography algorithms (e.g., secp256k1,
115
+ * secp256k1r1, secp384r1, etc.) are always represented with compressed point
116
+ * encoding (e.g., secp256k1-pub, p256-pub, p384-pub, etc.).
117
+ *
118
+ * Per {@link https://datatracker.ietf.org/doc/html/rfc8812#name-jose-and-cose-secp256k1-cur | RFC 8812}:
119
+ * "As a compressed point encoding representation is not defined for JWK
120
+ * elliptic curve points, the uncompressed point encoding defined there
121
+ * MUST be used. The x and y values represented MUST both be exactly
122
+ * 256 bits, with any leading zeros preserved."
123
+ *
124
+ * @example
125
+ * ```ts
126
+ * const publicKey = { crv: 'Ed25519', kty: 'OKP', x: '...' };
127
+ * const multibaseId = await DidKeyUtils.publicKeyToMultibaseId({ publicKey });
128
+ * ```
129
+ *
130
+ * @param params - The parameters for the conversion.
131
+ * @param params.publicKey - The public key in JWK format.
132
+ * @returns A promise that resolves to the multibase identifier.
133
+ */
134
+ static publicKeyToMultibaseId({ publicKey }: {
135
+ publicKey: Jwk;
136
+ }): Promise<string>;
137
+ }
138
+ //# sourceMappingURL=did-key-utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"did-key-utils.d.ts","sourceRoot":"","sources":["../../../src/methods/did-key-utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,GAAG,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAChF,OAAO,KAAK,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAQ1E;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB;;;;;;;CAOxB,CAAC;AAEX;;GAEG;AACH,qBAAa,WAAW;IACtB;;;;;;;;;;;;;;;OAeG;IACH,OAAO,CAAC,MAAM,CAAC,iBAAiB,CAK9B;IAEF;;;OAGG;IACH,OAAc,4BAA4B,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAMhE;IAEF;;;;;;;;;;;;;;OAcG;IACH,OAAO,CAAC,MAAM,CAAC,iBAAiB,CAK9B;IAEF;;;;;;;;;;;;OAYG;WACiB,eAAe,CAAC,EAAE,GAAG,EAAE,EAAE;QAC3C,GAAG,EAAE,GAAG,CAAA;KACT,GAAG,OAAO,CAAC,oBAAoB,CAAC,cAAc,CAAC,CAAC;IAwBjD;;;;;OAKG;WACW,aAAa,CACzB,KAAK,EAAE,MAAM,GACZ,aAAa,CAAC,mBAAmB,CAAC;IAcrC;;;;;OAKG;WACW,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,sBAAsB;IAcjE;;;;;;;;;;;;OAYG;WACiB,eAAe,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE;QAClD,IAAI,CAAC,EAAE,cAAc,CAAC;QACtB,IAAI,CAAC,EAAE,MAAM,CAAA;KACd,GAAG,OAAO,CAAC,GAAG,CAAC;IAmBhB;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2BG;WACiB,sBAAsB,CAAC,EAAE,SAAS,EAAE,EAAE;QACxD,SAAS,EAAE,GAAG,CAAA;KACf,GAAG,OAAO,CAAC,MAAM,CAAC;CAwBpB"}
@@ -1,9 +1,8 @@
1
- import type { AsymmetricKeyConverter, CryptoApi, InferKeyGeneratorAlgorithm, Jwk, KeyCompressor, KeyIdentifier, KeyImporterExporter, KmsExportKeyParams, KmsImportKeyParams } from '@enbox/crypto';
2
- import type { MulticodecCode, MulticodecDefinition } from '@enbox/common';
3
- import { LocalKeyManager } from '@enbox/crypto';
4
1
  import type { PortableDid } from '../types/portable-did.js';
5
2
  import type { DidCreateOptions, DidCreateVerificationMethod } from './did-method.js';
6
3
  import type { DidDocument, DidResolutionOptions, DidResolutionResult, DidVerificationMethod } from '../types/did-core.js';
4
+ import type { InferKeyGeneratorAlgorithm, KeyIdentifier, KeyImporterExporter, KeyManager, KmsExportKeyParams, KmsImportKeyParams } from '@enbox/crypto';
5
+ import { LocalKeyManager } from '@enbox/crypto';
7
6
  import { BearerDid } from '../bearer-did.js';
8
7
  import { DidMethod } from './did-method.js';
9
8
  /**
@@ -59,7 +58,7 @@ export interface DidKeyCreateOptions<TKms> extends DidCreateOptions<TKms> {
59
58
  /**
60
59
  * Optionally specify the algorithm to be used for key generation.
61
60
  */
62
- algorithm?: TKms extends CryptoApi ? InferKeyGeneratorAlgorithm<TKms> : InferKeyGeneratorAlgorithm<LocalKeyManager>;
61
+ algorithm?: TKms extends KeyManager ? InferKeyGeneratorAlgorithm<TKms> : InferKeyGeneratorAlgorithm<LocalKeyManager>;
63
62
  /**
64
63
  * Optionally specify an array of JSON-LD context links for the @context property of the DID
65
64
  * document.
@@ -239,7 +238,7 @@ export declare class DidKey extends DidMethod {
239
238
  * @param params.options - Optional parameters that can be specified when creating a new DID.
240
239
  * @returns A Promise resolving to a {@link BearerDid} object representing the new DID.
241
240
  */
242
- static create<TKms extends CryptoApi | undefined = undefined>({ keyManager, options }?: {
241
+ static create<TKms extends KeyManager | undefined = undefined>({ keyManager, options }?: {
243
242
  keyManager?: TKms;
244
243
  options?: DidKeyCreateOptions<TKms>;
245
244
  }): Promise<BearerDid>;
@@ -289,7 +288,7 @@ export declare class DidKey extends DidMethod {
289
288
  * @throws An error if the DID document does not contain exactly one verification method.
290
289
  */
291
290
  static import({ portableDid, keyManager }: {
292
- keyManager?: CryptoApi & KeyImporterExporter<KmsImportKeyParams, KeyIdentifier, KmsExportKeyParams>;
291
+ keyManager?: KeyManager & KeyImporterExporter<KmsImportKeyParams, KeyIdentifier, KmsExportKeyParams>;
293
292
  portableDid: PortableDid;
294
293
  }): Promise<BearerDid>;
295
294
  /**
@@ -326,125 +325,5 @@ export declare class DidKey extends DidMethod {
326
325
  */
327
326
  private static validateIdentifier;
328
327
  }
329
- /**
330
- * The `DidKeyUtils` class provides utility functions to support operations in the DID Key method.
331
- */
332
- export declare class DidKeyUtils {
333
- /**
334
- * A mapping from JSON Web Key (JWK) property descriptors to multicodec names.
335
- *
336
- * This mapping is used to convert keys in JWK (JSON Web Key) format to multicodec format.
337
- *
338
- * @remarks
339
- * The keys of this object are strings that describe the JOSE key type and usage,
340
- * such as 'Ed25519:public', 'Ed25519:private', etc. The values are the corresponding multicodec
341
- * names used to represent these key types.
342
- *
343
- * @example
344
- * ```ts
345
- * const multicodecName = JWK_TO_MULTICODEC['Ed25519:public'];
346
- * // Returns 'ed25519-pub', the multicodec name for an Ed25519 public key
347
- * ```
348
- */
349
- private static JWK_TO_MULTICODEC;
350
- /**
351
- * Defines the expected byte lengths for public keys associated with different cryptographic
352
- * algorithms, indexed by their multicodec code values.
353
- */
354
- static MULTICODEC_PUBLIC_KEY_LENGTH: Record<number, number>;
355
- /**
356
- * A mapping from multicodec names to their corresponding JOSE (JSON Object Signing and Encryption)
357
- * representations. This mapping facilitates the conversion of multicodec key formats to
358
- * JWK (JSON Web Key) formats.
359
- *
360
- * @remarks
361
- * The keys of this object are multicodec names, such as 'ed25519-pub', 'ed25519-priv', etc.
362
- * The values are objects representing the corresponding JWK properties for that key type.
363
- *
364
- * @example
365
- * ```ts
366
- * const joseKey = MULTICODEC_TO_JWK['ed25519-pub'];
367
- * // Returns a partial JWK for an Ed25519 public key
368
- * ```
369
- */
370
- private static MULTICODEC_TO_JWK;
371
- /**
372
- * Converts a JWK (JSON Web Key) to a Multicodec code and name.
373
- *
374
- * @example
375
- * ```ts
376
- * const jwk: Jwk = { crv: 'Ed25519', kty: 'OKP', x: '...' };
377
- * const { code, name } = await DidKeyUtils.jwkToMulticodec({ jwk });
378
- * ```
379
- *
380
- * @param params - The parameters for the conversion.
381
- * @param params.jwk - The JSON Web Key to be converted.
382
- * @returns A promise that resolves to a Multicodec definition.
383
- */
384
- static jwkToMulticodec({ jwk }: {
385
- jwk: Jwk;
386
- }): Promise<MulticodecDefinition<MulticodecCode>>;
387
- /**
388
- * Returns the appropriate public key compressor for the specified cryptographic curve.
389
- *
390
- * @param curve - The cryptographic curve to use for the key conversion.
391
- * @returns A public key compressor for the specified curve.
392
- */
393
- static keyCompressor(curve: string): KeyCompressor['compressPublicKey'];
394
- /**
395
- * Returns the appropriate key converter for the specified cryptographic curve.
396
- *
397
- * @param curve - The cryptographic curve to use for the key conversion.
398
- * @returns An `AsymmetricKeyConverter` for the specified curve.
399
- */
400
- static keyConverter(curve: string): AsymmetricKeyConverter;
401
- /**
402
- * Converts a Multicodec code or name to parial JWK (JSON Web Key).
403
- *
404
- * @example
405
- * ```ts
406
- * const partialJwk = await DidKeyUtils.multicodecToJwk({ name: 'ed25519-pub' });
407
- * ```
408
- *
409
- * @param params - The parameters for the conversion.
410
- * @param params.code - Optional Multicodec code to convert.
411
- * @param params.name - Optional Multicodec name to convert.
412
- * @returns A promise that resolves to a JOSE format key.
413
- */
414
- static multicodecToJwk({ code, name }: {
415
- code?: MulticodecCode;
416
- name?: string;
417
- }): Promise<Jwk>;
418
- /**
419
- * Converts a public key in JWK (JSON Web Key) format to a multibase identifier.
420
- *
421
- * @remarks
422
- * Note: All secp public keys are converted to compressed point encoding
423
- * before the multibase identifier is computed.
424
- *
425
- * Per {@link https://github.com/multiformats/multicodec/blob/master/table.csv | Multicodec table}:
426
- * Public keys for Elliptic Curve cryptography algorithms (e.g., secp256k1,
427
- * secp256k1r1, secp384r1, etc.) are always represented with compressed point
428
- * encoding (e.g., secp256k1-pub, p256-pub, p384-pub, etc.).
429
- *
430
- * Per {@link https://datatracker.ietf.org/doc/html/rfc8812#name-jose-and-cose-secp256k1-cur | RFC 8812}:
431
- * "As a compressed point encoding representation is not defined for JWK
432
- * elliptic curve points, the uncompressed point encoding defined there
433
- * MUST be used. The x and y values represented MUST both be exactly
434
- * 256 bits, with any leading zeros preserved."
435
- *
436
- * @example
437
- * ```ts
438
- * const publicKey = { crv: 'Ed25519', kty: 'OKP', x: '...' };
439
- * const multibaseId = await DidKeyUtils.publicKeyToMultibaseId({ publicKey });
440
- * ```
441
- *
442
- * @param params - The parameters for the conversion.
443
- * @param params.publicKey - The public key in JWK format.
444
- * @returns A promise that resolves to the multibase identifier.
445
- */
446
- static publicKeyToMultibaseId({ publicKey }: {
447
- publicKey: Jwk;
448
- }): Promise<string>;
449
- }
328
+ export { DidKeyUtils } from './did-key-utils.js';
450
329
  //# sourceMappingURL=did-key.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"did-key.d.ts","sourceRoot":"","sources":["../../../src/methods/did-key.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,sBAAsB,EACtB,SAAS,EACT,0BAA0B,EAC1B,GAAG,EACH,aAAa,EACb,aAAa,EACb,mBAAmB,EACnB,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;I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AS,CAAC;IAoBtB;;;;;;OAMG;WACiB,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,oBAAoB,GAAG,OAAO,CAAC,mBAAmB,CAAC;IA0BzG;;;;;;;OAOG;mBACkB,cAAc;IAsGnC;;;;;OAKG;mBACkB,qBAAqB;IA4H1C;;;;;;;OAOG;IACH,OAAO,CAAC,MAAM,CAAC,kBAAkB;CAoBlC;AAGD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC"}
@@ -1,4 +1,4 @@
1
- import type { CryptoApi, InferKeyGeneratorAlgorithm, LocalKeyManager } from '@enbox/crypto';
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
4
  import type { DidDocument, DidResolutionOptions, DidResolutionResult, DidVerificationMethod } from '../types/did-core.js';
@@ -34,7 +34,7 @@ export interface DidCreateVerificationMethod<TKms> extends Pick<Partial<DidVerif
34
34
  * };
35
35
  * ```
36
36
  */
37
- algorithm: TKms extends CryptoApi ? InferKeyGeneratorAlgorithm<TKms> : InferKeyGeneratorAlgorithm<LocalKeyManager>;
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 CryptoApi | undefined = CryptoApi, TDid extends BearerDid = BearerDid, TOptions extends DidCreateOptions<TKms> = DidCreateOptions<TKms>> extends DidMethodResolver {
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,SAAS,EACT,0BAA0B,EAC1B,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,SAAS,GAC7B,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,SAAS,GAAG,SAAS,GAAG,SAAS,EAC9C,IAAI,SAAS,SAAS,GAAG,SAAS,EAClC,QAAQ,SAAS,gBAAg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