cdk-common 2.0.1351 → 2.0.1353

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 (168) hide show
  1. package/.jsii +38 -2
  2. package/API.md +36 -0
  3. package/lib/main.js +1 -1
  4. package/lib/managed-policies.d.ts +7 -1
  5. package/lib/managed-policies.js +7 -1
  6. package/node_modules/@types/concat-stream/node_modules/@types/node/README.md +1 -1
  7. package/node_modules/@types/concat-stream/node_modules/@types/node/assert/strict.d.ts +5 -11
  8. package/node_modules/@types/concat-stream/node_modules/@types/node/assert.d.ts +9 -169
  9. package/node_modules/@types/concat-stream/node_modules/@types/node/async_hooks.d.ts +8 -8
  10. package/node_modules/@types/concat-stream/node_modules/@types/node/buffer.buffer.d.ts +1 -7
  11. package/node_modules/@types/concat-stream/node_modules/@types/node/buffer.d.ts +44 -168
  12. package/node_modules/@types/concat-stream/node_modules/@types/node/child_process.d.ts +16 -64
  13. package/node_modules/@types/concat-stream/node_modules/@types/node/cluster.d.ts +240 -332
  14. package/node_modules/@types/concat-stream/node_modules/@types/node/console.d.ts +49 -351
  15. package/node_modules/@types/concat-stream/node_modules/@types/node/constants.d.ts +3 -4
  16. package/node_modules/@types/concat-stream/node_modules/@types/node/crypto.d.ts +279 -1631
  17. package/node_modules/@types/concat-stream/node_modules/@types/node/dgram.d.ts +15 -51
  18. package/node_modules/@types/concat-stream/node_modules/@types/node/diagnostics_channel.d.ts +4 -4
  19. package/node_modules/@types/concat-stream/node_modules/@types/node/dns/promises.d.ts +3 -3
  20. package/node_modules/@types/concat-stream/node_modules/@types/node/dns.d.ts +131 -132
  21. package/node_modules/@types/concat-stream/node_modules/@types/node/domain.d.ts +13 -17
  22. package/node_modules/@types/concat-stream/node_modules/@types/node/events.d.ts +869 -791
  23. package/node_modules/@types/concat-stream/node_modules/@types/node/fs/promises.d.ts +7 -8
  24. package/node_modules/@types/concat-stream/node_modules/@types/node/fs.d.ts +417 -455
  25. package/node_modules/@types/concat-stream/node_modules/@types/node/globals.d.ts +6 -26
  26. package/node_modules/@types/concat-stream/node_modules/@types/node/globals.typedarray.d.ts +60 -0
  27. package/node_modules/@types/concat-stream/node_modules/@types/node/http.d.ts +263 -254
  28. package/node_modules/@types/concat-stream/node_modules/@types/node/http2.d.ts +528 -804
  29. package/node_modules/@types/concat-stream/node_modules/@types/node/https.d.ts +59 -239
  30. package/node_modules/@types/concat-stream/node_modules/@types/node/index.d.ts +15 -1
  31. package/node_modules/@types/concat-stream/node_modules/@types/node/inspector/promises.d.ts +41 -0
  32. package/node_modules/@types/concat-stream/node_modules/@types/node/inspector.d.ts +6 -59
  33. package/node_modules/@types/concat-stream/node_modules/@types/node/inspector.generated.d.ts +3 -10
  34. package/node_modules/@types/concat-stream/node_modules/@types/node/module.d.ts +47 -122
  35. package/node_modules/@types/concat-stream/node_modules/@types/node/net.d.ts +63 -184
  36. package/node_modules/@types/concat-stream/node_modules/@types/node/os.d.ts +6 -6
  37. package/node_modules/@types/concat-stream/node_modules/@types/node/package.json +2 -2
  38. package/node_modules/@types/concat-stream/node_modules/@types/node/path/posix.d.ts +8 -0
  39. package/node_modules/@types/concat-stream/node_modules/@types/node/path/win32.d.ts +8 -0
  40. package/node_modules/@types/concat-stream/node_modules/@types/node/path.d.ts +120 -133
  41. package/node_modules/@types/concat-stream/node_modules/@types/node/perf_hooks.d.ts +282 -643
  42. package/node_modules/@types/concat-stream/node_modules/@types/node/process.d.ts +156 -128
  43. package/node_modules/@types/concat-stream/node_modules/@types/node/punycode.d.ts +5 -5
  44. package/node_modules/@types/concat-stream/node_modules/@types/node/querystring.d.ts +4 -4
  45. package/node_modules/@types/concat-stream/node_modules/@types/node/quic.d.ts +910 -0
  46. package/node_modules/@types/concat-stream/node_modules/@types/node/readline/promises.d.ts +3 -3
  47. package/node_modules/@types/concat-stream/node_modules/@types/node/readline.d.ts +67 -120
  48. package/node_modules/@types/concat-stream/node_modules/@types/node/repl.d.ts +75 -98
  49. package/node_modules/@types/concat-stream/node_modules/@types/node/sea.d.ts +1 -1
  50. package/node_modules/@types/concat-stream/node_modules/@types/node/sqlite.d.ts +2 -2
  51. package/node_modules/@types/concat-stream/node_modules/@types/node/stream/consumers.d.ts +10 -10
  52. package/node_modules/@types/concat-stream/node_modules/@types/node/stream/promises.d.ts +136 -15
  53. package/node_modules/@types/concat-stream/node_modules/@types/node/stream/web.d.ts +176 -453
  54. package/node_modules/@types/concat-stream/node_modules/@types/node/stream.d.ts +555 -478
  55. package/node_modules/@types/concat-stream/node_modules/@types/node/string_decoder.d.ts +4 -4
  56. package/node_modules/@types/concat-stream/node_modules/@types/node/test/reporters.d.ts +96 -0
  57. package/node_modules/@types/concat-stream/node_modules/@types/node/test.d.ts +80 -180
  58. package/node_modules/@types/concat-stream/node_modules/@types/node/timers/promises.d.ts +4 -4
  59. package/node_modules/@types/concat-stream/node_modules/@types/node/timers.d.ts +4 -130
  60. package/node_modules/@types/concat-stream/node_modules/@types/node/tls.d.ts +102 -177
  61. package/node_modules/@types/concat-stream/node_modules/@types/node/trace_events.d.ts +9 -9
  62. package/node_modules/@types/concat-stream/node_modules/@types/node/ts5.6/buffer.buffer.d.ts +1 -7
  63. package/node_modules/@types/concat-stream/node_modules/@types/node/ts5.6/index.d.ts +15 -1
  64. package/node_modules/@types/concat-stream/node_modules/@types/node/ts5.7/index.d.ts +15 -1
  65. package/node_modules/@types/concat-stream/node_modules/@types/node/tty.d.ts +58 -16
  66. package/node_modules/@types/concat-stream/node_modules/@types/node/url.d.ts +54 -592
  67. package/node_modules/@types/concat-stream/node_modules/@types/node/util/types.d.ts +558 -0
  68. package/node_modules/@types/concat-stream/node_modules/@types/node/util.d.ts +120 -792
  69. package/node_modules/@types/concat-stream/node_modules/@types/node/v8.d.ts +32 -5
  70. package/node_modules/@types/concat-stream/node_modules/@types/node/vm.d.ts +13 -13
  71. package/node_modules/@types/concat-stream/node_modules/@types/node/wasi.d.ts +4 -4
  72. package/node_modules/@types/concat-stream/node_modules/@types/node/web-globals/abortcontroller.d.ts +27 -2
  73. package/node_modules/@types/concat-stream/node_modules/@types/node/web-globals/blob.d.ts +23 -0
  74. package/node_modules/@types/concat-stream/node_modules/@types/node/web-globals/console.d.ts +9 -0
  75. package/node_modules/@types/concat-stream/node_modules/@types/node/web-globals/crypto.d.ts +7 -0
  76. package/node_modules/@types/concat-stream/node_modules/@types/node/web-globals/encoding.d.ts +11 -0
  77. package/node_modules/@types/concat-stream/node_modules/@types/node/web-globals/events.d.ts +9 -0
  78. package/node_modules/@types/concat-stream/node_modules/@types/node/web-globals/fetch.d.ts +4 -0
  79. package/node_modules/@types/concat-stream/node_modules/@types/node/web-globals/importmeta.d.ts +13 -0
  80. package/node_modules/@types/concat-stream/node_modules/@types/node/web-globals/messaging.d.ts +23 -0
  81. package/node_modules/@types/concat-stream/node_modules/@types/node/web-globals/performance.d.ts +45 -0
  82. package/node_modules/@types/concat-stream/node_modules/@types/node/web-globals/streams.d.ts +93 -0
  83. package/node_modules/@types/concat-stream/node_modules/@types/node/web-globals/timers.d.ts +44 -0
  84. package/node_modules/@types/concat-stream/node_modules/@types/node/web-globals/url.d.ts +24 -0
  85. package/node_modules/@types/concat-stream/node_modules/@types/node/worker_threads.d.ts +176 -358
  86. package/node_modules/@types/concat-stream/node_modules/@types/node/zlib.d.ts +8 -71
  87. package/node_modules/@types/form-data/node_modules/@types/node/README.md +1 -1
  88. package/node_modules/@types/form-data/node_modules/@types/node/assert/strict.d.ts +5 -11
  89. package/node_modules/@types/form-data/node_modules/@types/node/assert.d.ts +9 -169
  90. package/node_modules/@types/form-data/node_modules/@types/node/async_hooks.d.ts +8 -8
  91. package/node_modules/@types/form-data/node_modules/@types/node/buffer.buffer.d.ts +1 -7
  92. package/node_modules/@types/form-data/node_modules/@types/node/buffer.d.ts +44 -168
  93. package/node_modules/@types/form-data/node_modules/@types/node/child_process.d.ts +16 -64
  94. package/node_modules/@types/form-data/node_modules/@types/node/cluster.d.ts +240 -332
  95. package/node_modules/@types/form-data/node_modules/@types/node/console.d.ts +49 -351
  96. package/node_modules/@types/form-data/node_modules/@types/node/constants.d.ts +3 -4
  97. package/node_modules/@types/form-data/node_modules/@types/node/crypto.d.ts +279 -1631
  98. package/node_modules/@types/form-data/node_modules/@types/node/dgram.d.ts +15 -51
  99. package/node_modules/@types/form-data/node_modules/@types/node/diagnostics_channel.d.ts +4 -4
  100. package/node_modules/@types/form-data/node_modules/@types/node/dns/promises.d.ts +3 -3
  101. package/node_modules/@types/form-data/node_modules/@types/node/dns.d.ts +131 -132
  102. package/node_modules/@types/form-data/node_modules/@types/node/domain.d.ts +13 -17
  103. package/node_modules/@types/form-data/node_modules/@types/node/events.d.ts +869 -791
  104. package/node_modules/@types/form-data/node_modules/@types/node/fs/promises.d.ts +7 -8
  105. package/node_modules/@types/form-data/node_modules/@types/node/fs.d.ts +417 -455
  106. package/node_modules/@types/form-data/node_modules/@types/node/globals.d.ts +6 -26
  107. package/node_modules/@types/form-data/node_modules/@types/node/globals.typedarray.d.ts +60 -0
  108. package/node_modules/@types/form-data/node_modules/@types/node/http.d.ts +263 -254
  109. package/node_modules/@types/form-data/node_modules/@types/node/http2.d.ts +528 -804
  110. package/node_modules/@types/form-data/node_modules/@types/node/https.d.ts +59 -239
  111. package/node_modules/@types/form-data/node_modules/@types/node/index.d.ts +15 -1
  112. package/node_modules/@types/form-data/node_modules/@types/node/inspector/promises.d.ts +41 -0
  113. package/node_modules/@types/form-data/node_modules/@types/node/inspector.d.ts +6 -59
  114. package/node_modules/@types/form-data/node_modules/@types/node/inspector.generated.d.ts +3 -10
  115. package/node_modules/@types/form-data/node_modules/@types/node/module.d.ts +47 -122
  116. package/node_modules/@types/form-data/node_modules/@types/node/net.d.ts +63 -184
  117. package/node_modules/@types/form-data/node_modules/@types/node/os.d.ts +6 -6
  118. package/node_modules/@types/form-data/node_modules/@types/node/package.json +2 -2
  119. package/node_modules/@types/form-data/node_modules/@types/node/path/posix.d.ts +8 -0
  120. package/node_modules/@types/form-data/node_modules/@types/node/path/win32.d.ts +8 -0
  121. package/node_modules/@types/form-data/node_modules/@types/node/path.d.ts +120 -133
  122. package/node_modules/@types/form-data/node_modules/@types/node/perf_hooks.d.ts +282 -643
  123. package/node_modules/@types/form-data/node_modules/@types/node/process.d.ts +156 -128
  124. package/node_modules/@types/form-data/node_modules/@types/node/punycode.d.ts +5 -5
  125. package/node_modules/@types/form-data/node_modules/@types/node/querystring.d.ts +4 -4
  126. package/node_modules/@types/form-data/node_modules/@types/node/quic.d.ts +910 -0
  127. package/node_modules/@types/form-data/node_modules/@types/node/readline/promises.d.ts +3 -3
  128. package/node_modules/@types/form-data/node_modules/@types/node/readline.d.ts +67 -120
  129. package/node_modules/@types/form-data/node_modules/@types/node/repl.d.ts +75 -98
  130. package/node_modules/@types/form-data/node_modules/@types/node/sea.d.ts +1 -1
  131. package/node_modules/@types/form-data/node_modules/@types/node/sqlite.d.ts +2 -2
  132. package/node_modules/@types/form-data/node_modules/@types/node/stream/consumers.d.ts +10 -10
  133. package/node_modules/@types/form-data/node_modules/@types/node/stream/promises.d.ts +136 -15
  134. package/node_modules/@types/form-data/node_modules/@types/node/stream/web.d.ts +176 -453
  135. package/node_modules/@types/form-data/node_modules/@types/node/stream.d.ts +555 -478
  136. package/node_modules/@types/form-data/node_modules/@types/node/string_decoder.d.ts +4 -4
  137. package/node_modules/@types/form-data/node_modules/@types/node/test/reporters.d.ts +96 -0
  138. package/node_modules/@types/form-data/node_modules/@types/node/test.d.ts +80 -180
  139. package/node_modules/@types/form-data/node_modules/@types/node/timers/promises.d.ts +4 -4
  140. package/node_modules/@types/form-data/node_modules/@types/node/timers.d.ts +4 -130
  141. package/node_modules/@types/form-data/node_modules/@types/node/tls.d.ts +102 -177
  142. package/node_modules/@types/form-data/node_modules/@types/node/trace_events.d.ts +9 -9
  143. package/node_modules/@types/form-data/node_modules/@types/node/ts5.6/buffer.buffer.d.ts +1 -7
  144. package/node_modules/@types/form-data/node_modules/@types/node/ts5.6/index.d.ts +15 -1
  145. package/node_modules/@types/form-data/node_modules/@types/node/ts5.7/index.d.ts +15 -1
  146. package/node_modules/@types/form-data/node_modules/@types/node/tty.d.ts +58 -16
  147. package/node_modules/@types/form-data/node_modules/@types/node/url.d.ts +54 -592
  148. package/node_modules/@types/form-data/node_modules/@types/node/util/types.d.ts +558 -0
  149. package/node_modules/@types/form-data/node_modules/@types/node/util.d.ts +120 -792
  150. package/node_modules/@types/form-data/node_modules/@types/node/v8.d.ts +32 -5
  151. package/node_modules/@types/form-data/node_modules/@types/node/vm.d.ts +13 -13
  152. package/node_modules/@types/form-data/node_modules/@types/node/wasi.d.ts +4 -4
  153. package/node_modules/@types/form-data/node_modules/@types/node/web-globals/abortcontroller.d.ts +27 -2
  154. package/node_modules/@types/form-data/node_modules/@types/node/web-globals/blob.d.ts +23 -0
  155. package/node_modules/@types/form-data/node_modules/@types/node/web-globals/console.d.ts +9 -0
  156. package/node_modules/@types/form-data/node_modules/@types/node/web-globals/crypto.d.ts +7 -0
  157. package/node_modules/@types/form-data/node_modules/@types/node/web-globals/encoding.d.ts +11 -0
  158. package/node_modules/@types/form-data/node_modules/@types/node/web-globals/events.d.ts +9 -0
  159. package/node_modules/@types/form-data/node_modules/@types/node/web-globals/fetch.d.ts +4 -0
  160. package/node_modules/@types/form-data/node_modules/@types/node/web-globals/importmeta.d.ts +13 -0
  161. package/node_modules/@types/form-data/node_modules/@types/node/web-globals/messaging.d.ts +23 -0
  162. package/node_modules/@types/form-data/node_modules/@types/node/web-globals/performance.d.ts +45 -0
  163. package/node_modules/@types/form-data/node_modules/@types/node/web-globals/streams.d.ts +93 -0
  164. package/node_modules/@types/form-data/node_modules/@types/node/web-globals/timers.d.ts +44 -0
  165. package/node_modules/@types/form-data/node_modules/@types/node/web-globals/url.d.ts +24 -0
  166. package/node_modules/@types/form-data/node_modules/@types/node/worker_threads.d.ts +176 -358
  167. package/node_modules/@types/form-data/node_modules/@types/node/zlib.d.ts +8 -71
  168. package/package.json +4 -4
@@ -14,9 +14,9 @@
14
14
  * // Prints:
15
15
  * // c0fa1bc00531bd78ef38c628449c5102aeabd49b5dc3a2a516ea6ea959d6658e
16
16
  * ```
17
- * @see [source](https://github.com/nodejs/node/blob/v24.x/lib/crypto.js)
17
+ * @see [source](https://github.com/nodejs/node/blob/v25.x/lib/crypto.js)
18
18
  */
19
- declare module "crypto" {
19
+ declare module "node:crypto" {
20
20
  import { NonSharedBuffer } from "node:buffer";
21
21
  import * as stream from "node:stream";
22
22
  import { PeerCertificate } from "node:tls";
@@ -97,7 +97,7 @@ declare module "crypto" {
97
97
  verifySpkac(spkac: NodeJS.ArrayBufferView): boolean;
98
98
  }
99
99
  namespace constants {
100
- // https://nodejs.org/dist/latest-v24.x/docs/api/crypto.html#crypto-constants
100
+ // https://nodejs.org/dist/latest-v25.x/docs/api/crypto.html#crypto-constants
101
101
  const OPENSSL_VERSION_NUMBER: number;
102
102
  /** Applies multiple bug workarounds within OpenSSL. See https://www.openssl.org/docs/man1.0.2/ssl/SSL_CTX_set_options.html for detail. */
103
103
  const SSL_OP_ALL: number;
@@ -471,7 +471,6 @@ declare module "crypto" {
471
471
  * // 7fd04df92f636fd450bc841c9418e5825c17f33ad9c87c518115a45971f7f77e
472
472
  * ```
473
473
  * @since v0.1.94
474
- * @deprecated Since v20.13.0 Calling `Hmac` class directly with `Hmac()` or `new Hmac()` is deprecated due to being internals, not intended for public use. Please use the {@link createHmac} method to create Hmac instances.
475
474
  */
476
475
  class Hmac extends stream.Transform {
477
476
  private constructor();
@@ -500,32 +499,66 @@ declare module "crypto" {
500
499
  digest(): NonSharedBuffer;
501
500
  digest(encoding: BinaryToTextEncoding): string;
502
501
  }
502
+ type KeyFormat = "pem" | "der" | "jwk";
503
503
  type KeyObjectType = "secret" | "public" | "private";
504
- interface KeyExportOptions<T extends KeyFormat> {
505
- type: "pkcs1" | "spki" | "pkcs8" | "sec1";
506
- format: T;
504
+ type PublicKeyExportType = "pkcs1" | "spki";
505
+ type PrivateKeyExportType = "pkcs1" | "pkcs8" | "sec1";
506
+ type KeyExportOptions =
507
+ | SymmetricKeyExportOptions
508
+ | PublicKeyExportOptions
509
+ | PrivateKeyExportOptions
510
+ | JwkKeyExportOptions;
511
+ interface SymmetricKeyExportOptions {
512
+ format?: "buffer" | undefined;
513
+ }
514
+ interface PublicKeyExportOptions<T extends PublicKeyExportType = PublicKeyExportType> {
515
+ type: T;
516
+ format: Exclude<KeyFormat, "jwk">;
517
+ }
518
+ interface PrivateKeyExportOptions<T extends PrivateKeyExportType = PrivateKeyExportType> {
519
+ type: T;
520
+ format: Exclude<KeyFormat, "jwk">;
507
521
  cipher?: string | undefined;
508
522
  passphrase?: string | Buffer | undefined;
509
523
  }
510
524
  interface JwkKeyExportOptions {
511
525
  format: "jwk";
512
526
  }
513
- interface JsonWebKey {
514
- crv?: string;
515
- d?: string;
516
- dp?: string;
517
- dq?: string;
518
- e?: string;
519
- k?: string;
520
- kty?: string;
521
- n?: string;
522
- p?: string;
523
- q?: string;
524
- qi?: string;
525
- x?: string;
526
- y?: string;
527
- [key: string]: unknown;
528
- }
527
+ interface KeyPairExportOptions<
528
+ TPublic extends PublicKeyExportType = PublicKeyExportType,
529
+ TPrivate extends PrivateKeyExportType = PrivateKeyExportType,
530
+ > {
531
+ publicKeyEncoding?: PublicKeyExportOptions<TPublic> | JwkKeyExportOptions | undefined;
532
+ privateKeyEncoding?: PrivateKeyExportOptions<TPrivate> | JwkKeyExportOptions | undefined;
533
+ }
534
+ type KeyExportResult<T, Default> = T extends { format: infer F extends KeyFormat }
535
+ ? { der: NonSharedBuffer; jwk: webcrypto.JsonWebKey; pem: string }[F]
536
+ : Default;
537
+ interface KeyPairExportResult<T extends KeyPairExportOptions> {
538
+ publicKey: KeyExportResult<T["publicKeyEncoding"], KeyObject>;
539
+ privateKey: KeyExportResult<T["privateKeyEncoding"], KeyObject>;
540
+ }
541
+ type KeyPairExportCallback<T extends KeyPairExportOptions> = (
542
+ err: Error | null,
543
+ publicKey: KeyExportResult<T["publicKeyEncoding"], KeyObject>,
544
+ privateKey: KeyExportResult<T["privateKeyEncoding"], KeyObject>,
545
+ ) => void;
546
+ type MLDSAKeyType = `ml-dsa-${44 | 65 | 87}`;
547
+ type MLKEMKeyType = `ml-kem-${1024 | 512 | 768}`;
548
+ type SLHDSAKeyType = `slh-dsa-${"sha2" | "shake"}-${128 | 192 | 256}${"f" | "s"}`;
549
+ type AsymmetricKeyType =
550
+ | "dh"
551
+ | "dsa"
552
+ | "ec"
553
+ | "ed25519"
554
+ | "ed448"
555
+ | MLDSAKeyType
556
+ | MLKEMKeyType
557
+ | "rsa-pss"
558
+ | "rsa"
559
+ | SLHDSAKeyType
560
+ | "x25519"
561
+ | "x448";
529
562
  interface AsymmetricKeyDetails {
530
563
  /**
531
564
  * Key size in bits (RSA, DSA).
@@ -593,13 +626,13 @@ declare module "crypto" {
593
626
  static from(key: webcrypto.CryptoKey): KeyObject;
594
627
  /**
595
628
  * For asymmetric keys, this property represents the type of the key. See the
596
- * supported [asymmetric key types](https://nodejs.org/docs/latest-v24.x/api/crypto.html#asymmetric-key-types).
629
+ * supported [asymmetric key types](https://nodejs.org/docs/latest-v25.x/api/crypto.html#asymmetric-key-types).
597
630
  *
598
631
  * This property is `undefined` for unrecognized `KeyObject` types and symmetric
599
632
  * keys.
600
633
  * @since v11.6.0
601
634
  */
602
- asymmetricKeyType?: KeyType;
635
+ asymmetricKeyType?: AsymmetricKeyType;
603
636
  /**
604
637
  * This property exists only on asymmetric keys. Depending on the type of the key,
605
638
  * this object contains information about the key. None of the information obtained
@@ -637,9 +670,7 @@ declare module "crypto" {
637
670
  * PKCS#1 and SEC1 encryption.
638
671
  * @since v11.6.0
639
672
  */
640
- export(options: KeyExportOptions<"pem">): string | NonSharedBuffer;
641
- export(options?: KeyExportOptions<"der">): NonSharedBuffer;
642
- export(options?: JwkKeyExportOptions): JsonWebKey;
673
+ export<T extends KeyExportOptions = {}>(options?: T): KeyExportResult<T, NonSharedBuffer>;
643
674
  /**
644
675
  * Returns `true` or `false` depending on whether the keys have exactly the same
645
676
  * type, value, and parameters. This method is not [constant time](https://en.wikipedia.org/wiki/Timing_attack).
@@ -1204,14 +1235,14 @@ declare module "crypto" {
1204
1235
  interface PrivateKeyInput {
1205
1236
  key: string | Buffer;
1206
1237
  format?: KeyFormat | undefined;
1207
- type?: "pkcs1" | "pkcs8" | "sec1" | undefined;
1238
+ type?: PrivateKeyExportType | undefined;
1208
1239
  passphrase?: string | Buffer | undefined;
1209
1240
  encoding?: string | undefined;
1210
1241
  }
1211
1242
  interface PublicKeyInput {
1212
1243
  key: string | Buffer;
1213
1244
  format?: KeyFormat | undefined;
1214
- type?: "pkcs1" | "spki" | undefined;
1245
+ type?: PublicKeyExportType | undefined;
1215
1246
  encoding?: string | undefined;
1216
1247
  }
1217
1248
  /**
@@ -1264,7 +1295,7 @@ declare module "crypto" {
1264
1295
  },
1265
1296
  ): KeyObject;
1266
1297
  interface JsonWebKeyInput {
1267
- key: JsonWebKey;
1298
+ key: webcrypto.JsonWebKey;
1268
1299
  format: "jwk";
1269
1300
  }
1270
1301
  /**
@@ -2468,96 +2499,27 @@ declare module "crypto" {
2468
2499
  * @since v6.6.0
2469
2500
  */
2470
2501
  function timingSafeEqual(a: NodeJS.ArrayBufferView, b: NodeJS.ArrayBufferView): boolean;
2471
- type KeyType =
2472
- | "dh"
2473
- | "dsa"
2474
- | "ec"
2475
- | "ed25519"
2476
- | "ed448"
2477
- | "ml-dsa-44"
2478
- | "ml-dsa-65"
2479
- | "ml-dsa-87"
2480
- | "ml-kem-1024"
2481
- | "ml-kem-512"
2482
- | "ml-kem-768"
2483
- | "rsa-pss"
2484
- | "rsa"
2485
- | "slh-dsa-sha2-128f"
2486
- | "slh-dsa-sha2-128s"
2487
- | "slh-dsa-sha2-192f"
2488
- | "slh-dsa-sha2-192s"
2489
- | "slh-dsa-sha2-256f"
2490
- | "slh-dsa-sha2-256s"
2491
- | "slh-dsa-shake-128f"
2492
- | "slh-dsa-shake-128s"
2493
- | "slh-dsa-shake-192f"
2494
- | "slh-dsa-shake-192s"
2495
- | "slh-dsa-shake-256f"
2496
- | "slh-dsa-shake-256s"
2497
- | "x25519"
2498
- | "x448";
2499
- type KeyFormat = "pem" | "der" | "jwk";
2500
- interface BasePrivateKeyEncodingOptions<T extends KeyFormat> {
2501
- format: T;
2502
- cipher?: string | undefined;
2503
- passphrase?: string | undefined;
2504
- }
2505
- interface KeyPairKeyObjectResult {
2506
- publicKey: KeyObject;
2507
- privateKey: KeyObject;
2508
- }
2509
- interface ED25519KeyPairKeyObjectOptions {}
2510
- interface ED448KeyPairKeyObjectOptions {}
2511
- interface X25519KeyPairKeyObjectOptions {}
2512
- interface X448KeyPairKeyObjectOptions {}
2513
- interface MLDSAKeyPairKeyObjectOptions {}
2514
- interface MLKEMKeyPairKeyObjectOptions {}
2515
- interface SLHDSAKeyPairKeyObjectOptions {}
2516
- interface ECKeyPairKeyObjectOptions {
2502
+ interface DHKeyPairOptions extends KeyPairExportOptions<"spki", "pkcs8"> {
2517
2503
  /**
2518
- * Name of the curve to use
2504
+ * The prime parameter
2519
2505
  */
2520
- namedCurve: string;
2506
+ prime?: Buffer | undefined;
2521
2507
  /**
2522
- * Must be `'named'` or `'explicit'`. Default: `'named'`.
2508
+ * Prime length in bits
2523
2509
  */
2524
- paramEncoding?: "explicit" | "named" | undefined;
2525
- }
2526
- interface RSAKeyPairKeyObjectOptions {
2510
+ primeLength?: number | undefined;
2527
2511
  /**
2528
- * Key size in bits
2512
+ * Custom generator
2513
+ * @default 2
2529
2514
  */
2530
- modulusLength: number;
2515
+ generator?: number | undefined;
2531
2516
  /**
2532
- * Public exponent
2533
- * @default 0x10001
2534
- */
2535
- publicExponent?: number | undefined;
2536
- }
2537
- interface RSAPSSKeyPairKeyObjectOptions {
2538
- /**
2539
- * Key size in bits
2540
- */
2541
- modulusLength: number;
2542
- /**
2543
- * Public exponent
2544
- * @default 0x10001
2545
- */
2546
- publicExponent?: number | undefined;
2547
- /**
2548
- * Name of the message digest
2517
+ * Diffie-Hellman group name
2518
+ * @see {@link getDiffieHellman}
2549
2519
  */
2550
- hashAlgorithm?: string | undefined;
2551
- /**
2552
- * Name of the message digest used by MGF1
2553
- */
2554
- mgf1HashAlgorithm?: string | undefined;
2555
- /**
2556
- * Minimal salt length in bytes
2557
- */
2558
- saltLength?: string | undefined;
2520
+ groupName?: string | undefined;
2559
2521
  }
2560
- interface DSAKeyPairKeyObjectOptions {
2522
+ interface DSAKeyPairOptions extends KeyPairExportOptions<"spki", "pkcs8"> {
2561
2523
  /**
2562
2524
  * Key size in bits
2563
2525
  */
@@ -2567,25 +2529,22 @@ declare module "crypto" {
2567
2529
  */
2568
2530
  divisorLength: number;
2569
2531
  }
2570
- interface RSAKeyPairOptions<PubF extends KeyFormat, PrivF extends KeyFormat> {
2532
+ interface ECKeyPairOptions extends KeyPairExportOptions<"spki", "pkcs8" | "sec1"> {
2571
2533
  /**
2572
- * Key size in bits
2534
+ * Name of the curve to use
2573
2535
  */
2574
- modulusLength: number;
2536
+ namedCurve: string;
2575
2537
  /**
2576
- * Public exponent
2577
- * @default 0x10001
2538
+ * Must be `'named'` or `'explicit'`
2539
+ * @default 'named'
2578
2540
  */
2579
- publicExponent?: number | undefined;
2580
- publicKeyEncoding: {
2581
- type: "pkcs1" | "spki";
2582
- format: PubF;
2583
- };
2584
- privateKeyEncoding: BasePrivateKeyEncodingOptions<PrivF> & {
2585
- type: "pkcs1" | "pkcs8";
2586
- };
2541
+ paramEncoding?: "explicit" | "named" | undefined;
2587
2542
  }
2588
- interface RSAPSSKeyPairOptions<PubF extends KeyFormat, PrivF extends KeyFormat> {
2543
+ interface ED25519KeyPairOptions extends KeyPairExportOptions<"spki", "pkcs8"> {}
2544
+ interface ED448KeyPairOptions extends KeyPairExportOptions<"spki", "pkcs8"> {}
2545
+ interface MLDSAKeyPairOptions extends KeyPairExportOptions<"spki", "pkcs8"> {}
2546
+ interface MLKEMKeyPairOptions extends KeyPairExportOptions<"spki", "pkcs8"> {}
2547
+ interface RSAPSSKeyPairOptions extends KeyPairExportOptions<"spki", "pkcs8"> {
2589
2548
  /**
2590
2549
  * Key size in bits
2591
2550
  */
@@ -2607,107 +2566,21 @@ declare module "crypto" {
2607
2566
  * Minimal salt length in bytes
2608
2567
  */
2609
2568
  saltLength?: string | undefined;
2610
- publicKeyEncoding: {
2611
- type: "spki";
2612
- format: PubF;
2613
- };
2614
- privateKeyEncoding: BasePrivateKeyEncodingOptions<PrivF> & {
2615
- type: "pkcs8";
2616
- };
2617
2569
  }
2618
- interface DSAKeyPairOptions<PubF extends KeyFormat, PrivF extends KeyFormat> {
2570
+ interface RSAKeyPairOptions extends KeyPairExportOptions<"pkcs1" | "spki", "pkcs1" | "pkcs8"> {
2619
2571
  /**
2620
2572
  * Key size in bits
2621
2573
  */
2622
2574
  modulusLength: number;
2623
2575
  /**
2624
- * Size of q in bits
2576
+ * Public exponent
2577
+ * @default 0x10001
2625
2578
  */
2626
- divisorLength: number;
2627
- publicKeyEncoding: {
2628
- type: "spki";
2629
- format: PubF;
2630
- };
2631
- privateKeyEncoding: BasePrivateKeyEncodingOptions<PrivF> & {
2632
- type: "pkcs8";
2633
- };
2634
- }
2635
- interface ECKeyPairOptions<PubF extends KeyFormat, PrivF extends KeyFormat> extends ECKeyPairKeyObjectOptions {
2636
- publicKeyEncoding: {
2637
- type: "pkcs1" | "spki";
2638
- format: PubF;
2639
- };
2640
- privateKeyEncoding: BasePrivateKeyEncodingOptions<PrivF> & {
2641
- type: "sec1" | "pkcs8";
2642
- };
2643
- }
2644
- interface ED25519KeyPairOptions<PubF extends KeyFormat, PrivF extends KeyFormat> {
2645
- publicKeyEncoding: {
2646
- type: "spki";
2647
- format: PubF;
2648
- };
2649
- privateKeyEncoding: BasePrivateKeyEncodingOptions<PrivF> & {
2650
- type: "pkcs8";
2651
- };
2652
- }
2653
- interface ED448KeyPairOptions<PubF extends KeyFormat, PrivF extends KeyFormat> {
2654
- publicKeyEncoding: {
2655
- type: "spki";
2656
- format: PubF;
2657
- };
2658
- privateKeyEncoding: BasePrivateKeyEncodingOptions<PrivF> & {
2659
- type: "pkcs8";
2660
- };
2661
- }
2662
- interface X25519KeyPairOptions<PubF extends KeyFormat, PrivF extends KeyFormat> {
2663
- publicKeyEncoding: {
2664
- type: "spki";
2665
- format: PubF;
2666
- };
2667
- privateKeyEncoding: BasePrivateKeyEncodingOptions<PrivF> & {
2668
- type: "pkcs8";
2669
- };
2670
- }
2671
- interface X448KeyPairOptions<PubF extends KeyFormat, PrivF extends KeyFormat> {
2672
- publicKeyEncoding: {
2673
- type: "spki";
2674
- format: PubF;
2675
- };
2676
- privateKeyEncoding: BasePrivateKeyEncodingOptions<PrivF> & {
2677
- type: "pkcs8";
2678
- };
2679
- }
2680
- interface MLDSAKeyPairOptions<PubF extends KeyFormat, PrivF extends KeyFormat> {
2681
- publicKeyEncoding: {
2682
- type: "spki";
2683
- format: PubF;
2684
- };
2685
- privateKeyEncoding: BasePrivateKeyEncodingOptions<PrivF> & {
2686
- type: "pkcs8";
2687
- };
2688
- }
2689
- interface MLKEMKeyPairOptions<PubF extends KeyFormat, PrivF extends KeyFormat> {
2690
- publicKeyEncoding: {
2691
- type: "spki";
2692
- format: PubF;
2693
- };
2694
- privateKeyEncoding: BasePrivateKeyEncodingOptions<PrivF> & {
2695
- type: "pkcs8";
2696
- };
2697
- }
2698
- interface SLHDSAKeyPairOptions<PubF extends KeyFormat, PrivF extends KeyFormat> {
2699
- publicKeyEncoding: {
2700
- type: "spki";
2701
- format: PubF;
2702
- };
2703
- privateKeyEncoding: BasePrivateKeyEncodingOptions<PrivF> & {
2704
- type: "pkcs8";
2705
- };
2706
- }
2707
- interface KeyPairSyncResult<T1 extends string | Buffer, T2 extends string | Buffer> {
2708
- publicKey: T1;
2709
- privateKey: T2;
2579
+ publicExponent?: number | undefined;
2710
2580
  }
2581
+ interface SLHDSAKeyPairOptions extends KeyPairExportOptions<"spki", "pkcs8"> {}
2582
+ interface X25519KeyPairOptions extends KeyPairExportOptions<"spki", "pkcs8"> {}
2583
+ interface X448KeyPairOptions extends KeyPairExportOptions<"spki", "pkcs8"> {}
2711
2584
  /**
2712
2585
  * Generates a new asymmetric key pair of the given `type`. RSA, RSA-PSS, DSA, EC,
2713
2586
  * Ed25519, Ed448, X25519, X448, DH, and ML-DSA are currently supported.
@@ -2748,264 +2621,56 @@ declare module "crypto" {
2748
2621
  * it will be a buffer containing the data encoded as DER.
2749
2622
  * @since v10.12.0
2750
2623
  * @param type The asymmetric key type to generate. See the
2751
- * supported [asymmetric key types](https://nodejs.org/docs/latest-v24.x/api/crypto.html#asymmetric-key-types).
2624
+ * supported [asymmetric key types](https://nodejs.org/docs/latest-v25.x/api/crypto.html#asymmetric-key-types).
2752
2625
  */
2753
- function generateKeyPairSync(
2754
- type: "rsa",
2755
- options: RSAKeyPairOptions<"pem", "pem">,
2756
- ): KeyPairSyncResult<string, string>;
2757
- function generateKeyPairSync(
2758
- type: "rsa",
2759
- options: RSAKeyPairOptions<"pem", "der">,
2760
- ): KeyPairSyncResult<string, NonSharedBuffer>;
2761
- function generateKeyPairSync(
2762
- type: "rsa",
2763
- options: RSAKeyPairOptions<"der", "pem">,
2764
- ): KeyPairSyncResult<NonSharedBuffer, string>;
2765
- function generateKeyPairSync(
2766
- type: "rsa",
2767
- options: RSAKeyPairOptions<"der", "der">,
2768
- ): KeyPairSyncResult<NonSharedBuffer, NonSharedBuffer>;
2769
- function generateKeyPairSync(type: "rsa", options: RSAKeyPairKeyObjectOptions): KeyPairKeyObjectResult;
2770
- function generateKeyPairSync(
2771
- type: "rsa-pss",
2772
- options: RSAPSSKeyPairOptions<"pem", "pem">,
2773
- ): KeyPairSyncResult<string, string>;
2774
- function generateKeyPairSync(
2775
- type: "rsa-pss",
2776
- options: RSAPSSKeyPairOptions<"pem", "der">,
2777
- ): KeyPairSyncResult<string, NonSharedBuffer>;
2778
- function generateKeyPairSync(
2779
- type: "rsa-pss",
2780
- options: RSAPSSKeyPairOptions<"der", "pem">,
2781
- ): KeyPairSyncResult<NonSharedBuffer, string>;
2782
- function generateKeyPairSync(
2783
- type: "rsa-pss",
2784
- options: RSAPSSKeyPairOptions<"der", "der">,
2785
- ): KeyPairSyncResult<NonSharedBuffer, NonSharedBuffer>;
2786
- function generateKeyPairSync(type: "rsa-pss", options: RSAPSSKeyPairKeyObjectOptions): KeyPairKeyObjectResult;
2787
- function generateKeyPairSync(
2788
- type: "dsa",
2789
- options: DSAKeyPairOptions<"pem", "pem">,
2790
- ): KeyPairSyncResult<string, string>;
2791
- function generateKeyPairSync(
2626
+ function generateKeyPairSync<T extends DHKeyPairOptions>(
2627
+ type: "dh",
2628
+ options: T,
2629
+ ): KeyPairExportResult<T>;
2630
+ function generateKeyPairSync<T extends DSAKeyPairOptions>(
2792
2631
  type: "dsa",
2793
- options: DSAKeyPairOptions<"pem", "der">,
2794
- ): KeyPairSyncResult<string, NonSharedBuffer>;
2795
- function generateKeyPairSync(
2796
- type: "dsa",
2797
- options: DSAKeyPairOptions<"der", "pem">,
2798
- ): KeyPairSyncResult<NonSharedBuffer, string>;
2799
- function generateKeyPairSync(
2800
- type: "dsa",
2801
- options: DSAKeyPairOptions<"der", "der">,
2802
- ): KeyPairSyncResult<NonSharedBuffer, NonSharedBuffer>;
2803
- function generateKeyPairSync(type: "dsa", options: DSAKeyPairKeyObjectOptions): KeyPairKeyObjectResult;
2804
- function generateKeyPairSync(
2805
- type: "ec",
2806
- options: ECKeyPairOptions<"pem", "pem">,
2807
- ): KeyPairSyncResult<string, string>;
2808
- function generateKeyPairSync(
2809
- type: "ec",
2810
- options: ECKeyPairOptions<"pem", "der">,
2811
- ): KeyPairSyncResult<string, NonSharedBuffer>;
2812
- function generateKeyPairSync(
2632
+ options: T,
2633
+ ): KeyPairExportResult<T>;
2634
+ function generateKeyPairSync<T extends ECKeyPairOptions>(
2813
2635
  type: "ec",
2814
- options: ECKeyPairOptions<"der", "pem">,
2815
- ): KeyPairSyncResult<NonSharedBuffer, string>;
2816
- function generateKeyPairSync(
2817
- type: "ec",
2818
- options: ECKeyPairOptions<"der", "der">,
2819
- ): KeyPairSyncResult<NonSharedBuffer, NonSharedBuffer>;
2820
- function generateKeyPairSync(type: "ec", options: ECKeyPairKeyObjectOptions): KeyPairKeyObjectResult;
2821
- function generateKeyPairSync(
2822
- type: "ed25519",
2823
- options: ED25519KeyPairOptions<"pem", "pem">,
2824
- ): KeyPairSyncResult<string, string>;
2825
- function generateKeyPairSync(
2826
- type: "ed25519",
2827
- options: ED25519KeyPairOptions<"pem", "der">,
2828
- ): KeyPairSyncResult<string, NonSharedBuffer>;
2829
- function generateKeyPairSync(
2830
- type: "ed25519",
2831
- options: ED25519KeyPairOptions<"der", "pem">,
2832
- ): KeyPairSyncResult<NonSharedBuffer, string>;
2833
- function generateKeyPairSync(
2636
+ options: T,
2637
+ ): KeyPairExportResult<T>;
2638
+ function generateKeyPairSync<T extends ED25519KeyPairOptions = {}>(
2834
2639
  type: "ed25519",
2835
- options: ED25519KeyPairOptions<"der", "der">,
2836
- ): KeyPairSyncResult<NonSharedBuffer, NonSharedBuffer>;
2837
- function generateKeyPairSync(type: "ed25519", options?: ED25519KeyPairKeyObjectOptions): KeyPairKeyObjectResult;
2838
- function generateKeyPairSync(
2640
+ options?: T,
2641
+ ): KeyPairExportResult<T>;
2642
+ function generateKeyPairSync<T extends ED448KeyPairOptions = {}>(
2839
2643
  type: "ed448",
2840
- options: ED448KeyPairOptions<"pem", "pem">,
2841
- ): KeyPairSyncResult<string, string>;
2842
- function generateKeyPairSync(
2843
- type: "ed448",
2844
- options: ED448KeyPairOptions<"pem", "der">,
2845
- ): KeyPairSyncResult<string, NonSharedBuffer>;
2846
- function generateKeyPairSync(
2847
- type: "ed448",
2848
- options: ED448KeyPairOptions<"der", "pem">,
2849
- ): KeyPairSyncResult<NonSharedBuffer, string>;
2850
- function generateKeyPairSync(
2851
- type: "ed448",
2852
- options: ED448KeyPairOptions<"der", "der">,
2853
- ): KeyPairSyncResult<NonSharedBuffer, NonSharedBuffer>;
2854
- function generateKeyPairSync(type: "ed448", options?: ED448KeyPairKeyObjectOptions): KeyPairKeyObjectResult;
2855
- function generateKeyPairSync(
2856
- type: "x25519",
2857
- options: X25519KeyPairOptions<"pem", "pem">,
2858
- ): KeyPairSyncResult<string, string>;
2859
- function generateKeyPairSync(
2860
- type: "x25519",
2861
- options: X25519KeyPairOptions<"pem", "der">,
2862
- ): KeyPairSyncResult<string, NonSharedBuffer>;
2863
- function generateKeyPairSync(
2864
- type: "x25519",
2865
- options: X25519KeyPairOptions<"der", "pem">,
2866
- ): KeyPairSyncResult<NonSharedBuffer, string>;
2867
- function generateKeyPairSync(
2644
+ options?: T,
2645
+ ): KeyPairExportResult<T>;
2646
+ function generateKeyPairSync<T extends MLDSAKeyPairOptions = {}>(
2647
+ type: MLDSAKeyType,
2648
+ options?: T,
2649
+ ): KeyPairExportResult<T>;
2650
+ function generateKeyPairSync<T extends MLKEMKeyPairOptions = {}>(
2651
+ type: MLKEMKeyType,
2652
+ options?: T,
2653
+ ): KeyPairExportResult<T>;
2654
+ function generateKeyPairSync<T extends RSAPSSKeyPairOptions>(
2655
+ type: "rsa-pss",
2656
+ options: T,
2657
+ ): KeyPairExportResult<T>;
2658
+ function generateKeyPairSync<T extends RSAKeyPairOptions>(
2659
+ type: "rsa",
2660
+ options: T,
2661
+ ): KeyPairExportResult<T>;
2662
+ function generateKeyPairSync<T extends SLHDSAKeyPairOptions = {}>(
2663
+ type: SLHDSAKeyType,
2664
+ options?: T,
2665
+ ): KeyPairExportResult<T>;
2666
+ function generateKeyPairSync<T extends X25519KeyPairOptions = {}>(
2868
2667
  type: "x25519",
2869
- options: X25519KeyPairOptions<"der", "der">,
2870
- ): KeyPairSyncResult<NonSharedBuffer, NonSharedBuffer>;
2871
- function generateKeyPairSync(type: "x25519", options?: X25519KeyPairKeyObjectOptions): KeyPairKeyObjectResult;
2872
- function generateKeyPairSync(
2668
+ options?: T,
2669
+ ): KeyPairExportResult<T>;
2670
+ function generateKeyPairSync<T extends X448KeyPairOptions = {}>(
2873
2671
  type: "x448",
2874
- options: X448KeyPairOptions<"pem", "pem">,
2875
- ): KeyPairSyncResult<string, string>;
2876
- function generateKeyPairSync(
2877
- type: "x448",
2878
- options: X448KeyPairOptions<"pem", "der">,
2879
- ): KeyPairSyncResult<string, NonSharedBuffer>;
2880
- function generateKeyPairSync(
2881
- type: "x448",
2882
- options: X448KeyPairOptions<"der", "pem">,
2883
- ): KeyPairSyncResult<NonSharedBuffer, string>;
2884
- function generateKeyPairSync(
2885
- type: "x448",
2886
- options: X448KeyPairOptions<"der", "der">,
2887
- ): KeyPairSyncResult<NonSharedBuffer, NonSharedBuffer>;
2888
- function generateKeyPairSync(type: "x448", options?: X448KeyPairKeyObjectOptions): KeyPairKeyObjectResult;
2889
- function generateKeyPairSync(
2890
- type: "ml-dsa-44" | "ml-dsa-65" | "ml-dsa-87",
2891
- options: MLDSAKeyPairOptions<"pem", "pem">,
2892
- ): KeyPairSyncResult<string, string>;
2893
- function generateKeyPairSync(
2894
- type: "ml-dsa-44" | "ml-dsa-65" | "ml-dsa-87",
2895
- options: MLDSAKeyPairOptions<"pem", "der">,
2896
- ): KeyPairSyncResult<string, NonSharedBuffer>;
2897
- function generateKeyPairSync(
2898
- type: "ml-dsa-44" | "ml-dsa-65" | "ml-dsa-87",
2899
- options: MLDSAKeyPairOptions<"der", "pem">,
2900
- ): KeyPairSyncResult<NonSharedBuffer, string>;
2901
- function generateKeyPairSync(
2902
- type: "ml-dsa-44" | "ml-dsa-65" | "ml-dsa-87",
2903
- options: MLDSAKeyPairOptions<"der", "der">,
2904
- ): KeyPairSyncResult<NonSharedBuffer, NonSharedBuffer>;
2905
- function generateKeyPairSync(
2906
- type: "ml-dsa-44" | "ml-dsa-65" | "ml-dsa-87",
2907
- options?: MLDSAKeyPairKeyObjectOptions,
2908
- ): KeyPairKeyObjectResult;
2909
- function generateKeyPairSync(
2910
- type: "ml-kem-1024" | "ml-kem-512" | "ml-kem-768",
2911
- options: MLKEMKeyPairOptions<"pem", "pem">,
2912
- ): KeyPairSyncResult<string, string>;
2913
- function generateKeyPairSync(
2914
- type: "ml-kem-1024" | "ml-kem-512" | "ml-kem-768",
2915
- options: MLKEMKeyPairOptions<"pem", "der">,
2916
- ): KeyPairSyncResult<string, NonSharedBuffer>;
2917
- function generateKeyPairSync(
2918
- type: "ml-kem-1024" | "ml-kem-512" | "ml-kem-768",
2919
- options: MLKEMKeyPairOptions<"der", "pem">,
2920
- ): KeyPairSyncResult<NonSharedBuffer, string>;
2921
- function generateKeyPairSync(
2922
- type: "ml-kem-1024" | "ml-kem-512" | "ml-kem-768",
2923
- options: MLKEMKeyPairOptions<"der", "der">,
2924
- ): KeyPairSyncResult<NonSharedBuffer, NonSharedBuffer>;
2925
- function generateKeyPairSync(
2926
- type: "ml-kem-1024" | "ml-kem-512" | "ml-kem-768",
2927
- options?: MLKEMKeyPairKeyObjectOptions,
2928
- ): KeyPairKeyObjectResult;
2929
- function generateKeyPairSync(
2930
- type:
2931
- | "slh-dsa-sha2-128f"
2932
- | "slh-dsa-sha2-128s"
2933
- | "slh-dsa-sha2-192f"
2934
- | "slh-dsa-sha2-192s"
2935
- | "slh-dsa-sha2-256f"
2936
- | "slh-dsa-sha2-256s"
2937
- | "slh-dsa-shake-128f"
2938
- | "slh-dsa-shake-128s"
2939
- | "slh-dsa-shake-192f"
2940
- | "slh-dsa-shake-192s"
2941
- | "slh-dsa-shake-256f"
2942
- | "slh-dsa-shake-256s",
2943
- options: SLHDSAKeyPairOptions<"pem", "pem">,
2944
- ): KeyPairSyncResult<string, string>;
2945
- function generateKeyPairSync(
2946
- type:
2947
- | "slh-dsa-sha2-128f"
2948
- | "slh-dsa-sha2-128s"
2949
- | "slh-dsa-sha2-192f"
2950
- | "slh-dsa-sha2-192s"
2951
- | "slh-dsa-sha2-256f"
2952
- | "slh-dsa-sha2-256s"
2953
- | "slh-dsa-shake-128f"
2954
- | "slh-dsa-shake-128s"
2955
- | "slh-dsa-shake-192f"
2956
- | "slh-dsa-shake-192s"
2957
- | "slh-dsa-shake-256f"
2958
- | "slh-dsa-shake-256s",
2959
- options: SLHDSAKeyPairOptions<"pem", "der">,
2960
- ): KeyPairSyncResult<string, Buffer>;
2961
- function generateKeyPairSync(
2962
- type:
2963
- | "slh-dsa-sha2-128f"
2964
- | "slh-dsa-sha2-128s"
2965
- | "slh-dsa-sha2-192f"
2966
- | "slh-dsa-sha2-192s"
2967
- | "slh-dsa-sha2-256f"
2968
- | "slh-dsa-sha2-256s"
2969
- | "slh-dsa-shake-128f"
2970
- | "slh-dsa-shake-128s"
2971
- | "slh-dsa-shake-192f"
2972
- | "slh-dsa-shake-192s"
2973
- | "slh-dsa-shake-256f"
2974
- | "slh-dsa-shake-256s",
2975
- options: SLHDSAKeyPairOptions<"der", "pem">,
2976
- ): KeyPairSyncResult<Buffer, string>;
2977
- function generateKeyPairSync(
2978
- type:
2979
- | "slh-dsa-sha2-128f"
2980
- | "slh-dsa-sha2-128s"
2981
- | "slh-dsa-sha2-192f"
2982
- | "slh-dsa-sha2-192s"
2983
- | "slh-dsa-sha2-256f"
2984
- | "slh-dsa-sha2-256s"
2985
- | "slh-dsa-shake-128f"
2986
- | "slh-dsa-shake-128s"
2987
- | "slh-dsa-shake-192f"
2988
- | "slh-dsa-shake-192s"
2989
- | "slh-dsa-shake-256f"
2990
- | "slh-dsa-shake-256s",
2991
- options: SLHDSAKeyPairOptions<"der", "der">,
2992
- ): KeyPairSyncResult<Buffer, Buffer>;
2993
- function generateKeyPairSync(
2994
- type:
2995
- | "slh-dsa-sha2-128f"
2996
- | "slh-dsa-sha2-128s"
2997
- | "slh-dsa-sha2-192f"
2998
- | "slh-dsa-sha2-192s"
2999
- | "slh-dsa-sha2-256f"
3000
- | "slh-dsa-sha2-256s"
3001
- | "slh-dsa-shake-128f"
3002
- | "slh-dsa-shake-128s"
3003
- | "slh-dsa-shake-192f"
3004
- | "slh-dsa-shake-192s"
3005
- | "slh-dsa-shake-256f"
3006
- | "slh-dsa-shake-256s",
3007
- options?: SLHDSAKeyPairKeyObjectOptions,
3008
- ): KeyPairKeyObjectResult;
2672
+ options?: T,
2673
+ ): KeyPairExportResult<T>;
3009
2674
  /**
3010
2675
  * Generates a new asymmetric key pair of the given `type`. RSA, RSA-PSS, DSA, EC,
3011
2676
  * Ed25519, Ed448, X25519, X448, and DH are currently supported.
@@ -3044,741 +2709,117 @@ declare module "crypto" {
3044
2709
  * a `Promise` for an `Object` with `publicKey` and `privateKey` properties.
3045
2710
  * @since v10.12.0
3046
2711
  * @param type The asymmetric key type to generate. See the
3047
- * supported [asymmetric key types](https://nodejs.org/docs/latest-v24.x/api/crypto.html#asymmetric-key-types).
2712
+ * supported [asymmetric key types](https://nodejs.org/docs/latest-v25.x/api/crypto.html#asymmetric-key-types).
3048
2713
  */
3049
- function generateKeyPair(
3050
- type: "rsa",
3051
- options: RSAKeyPairOptions<"pem", "pem">,
3052
- callback: (err: Error | null, publicKey: string, privateKey: string) => void,
3053
- ): void;
3054
- function generateKeyPair(
3055
- type: "rsa",
3056
- options: RSAKeyPairOptions<"pem", "der">,
3057
- callback: (err: Error | null, publicKey: string, privateKey: NonSharedBuffer) => void,
3058
- ): void;
3059
- function generateKeyPair(
3060
- type: "rsa",
3061
- options: RSAKeyPairOptions<"der", "pem">,
3062
- callback: (err: Error | null, publicKey: NonSharedBuffer, privateKey: string) => void,
3063
- ): void;
3064
- function generateKeyPair(
3065
- type: "rsa",
3066
- options: RSAKeyPairOptions<"der", "der">,
3067
- callback: (err: Error | null, publicKey: NonSharedBuffer, privateKey: NonSharedBuffer) => void,
3068
- ): void;
3069
- function generateKeyPair(
3070
- type: "rsa",
3071
- options: RSAKeyPairKeyObjectOptions,
3072
- callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void,
3073
- ): void;
3074
- function generateKeyPair(
3075
- type: "rsa-pss",
3076
- options: RSAPSSKeyPairOptions<"pem", "pem">,
3077
- callback: (err: Error | null, publicKey: string, privateKey: string) => void,
3078
- ): void;
3079
- function generateKeyPair(
3080
- type: "rsa-pss",
3081
- options: RSAPSSKeyPairOptions<"pem", "der">,
3082
- callback: (err: Error | null, publicKey: string, privateKey: NonSharedBuffer) => void,
3083
- ): void;
3084
- function generateKeyPair(
3085
- type: "rsa-pss",
3086
- options: RSAPSSKeyPairOptions<"der", "pem">,
3087
- callback: (err: Error | null, publicKey: NonSharedBuffer, privateKey: string) => void,
3088
- ): void;
3089
- function generateKeyPair(
3090
- type: "rsa-pss",
3091
- options: RSAPSSKeyPairOptions<"der", "der">,
3092
- callback: (err: Error | null, publicKey: NonSharedBuffer, privateKey: NonSharedBuffer) => void,
3093
- ): void;
3094
- function generateKeyPair(
3095
- type: "rsa-pss",
3096
- options: RSAPSSKeyPairKeyObjectOptions,
3097
- callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void,
3098
- ): void;
3099
- function generateKeyPair(
3100
- type: "dsa",
3101
- options: DSAKeyPairOptions<"pem", "pem">,
3102
- callback: (err: Error | null, publicKey: string, privateKey: string) => void,
2714
+ function generateKeyPair<T extends DHKeyPairOptions>(
2715
+ type: "dh",
2716
+ options: T,
2717
+ callback: KeyPairExportCallback<T>,
3103
2718
  ): void;
3104
- function generateKeyPair(
2719
+ function generateKeyPair<T extends DSAKeyPairOptions>(
3105
2720
  type: "dsa",
3106
- options: DSAKeyPairOptions<"pem", "der">,
3107
- callback: (err: Error | null, publicKey: string, privateKey: NonSharedBuffer) => void,
2721
+ options: T,
2722
+ callback: KeyPairExportCallback<T>,
3108
2723
  ): void;
3109
- function generateKeyPair(
3110
- type: "dsa",
3111
- options: DSAKeyPairOptions<"der", "pem">,
3112
- callback: (err: Error | null, publicKey: NonSharedBuffer, privateKey: string) => void,
3113
- ): void;
3114
- function generateKeyPair(
3115
- type: "dsa",
3116
- options: DSAKeyPairOptions<"der", "der">,
3117
- callback: (err: Error | null, publicKey: NonSharedBuffer, privateKey: NonSharedBuffer) => void,
3118
- ): void;
3119
- function generateKeyPair(
3120
- type: "dsa",
3121
- options: DSAKeyPairKeyObjectOptions,
3122
- callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void,
3123
- ): void;
3124
- function generateKeyPair(
3125
- type: "ec",
3126
- options: ECKeyPairOptions<"pem", "pem">,
3127
- callback: (err: Error | null, publicKey: string, privateKey: string) => void,
3128
- ): void;
3129
- function generateKeyPair(
2724
+ function generateKeyPair<T extends ECKeyPairOptions>(
3130
2725
  type: "ec",
3131
- options: ECKeyPairOptions<"pem", "der">,
3132
- callback: (err: Error | null, publicKey: string, privateKey: NonSharedBuffer) => void,
3133
- ): void;
3134
- function generateKeyPair(
3135
- type: "ec",
3136
- options: ECKeyPairOptions<"der", "pem">,
3137
- callback: (err: Error | null, publicKey: NonSharedBuffer, privateKey: string) => void,
3138
- ): void;
3139
- function generateKeyPair(
3140
- type: "ec",
3141
- options: ECKeyPairOptions<"der", "der">,
3142
- callback: (err: Error | null, publicKey: NonSharedBuffer, privateKey: NonSharedBuffer) => void,
3143
- ): void;
3144
- function generateKeyPair(
3145
- type: "ec",
3146
- options: ECKeyPairKeyObjectOptions,
3147
- callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void,
3148
- ): void;
3149
- function generateKeyPair(
3150
- type: "ed25519",
3151
- options: ED25519KeyPairOptions<"pem", "pem">,
3152
- callback: (err: Error | null, publicKey: string, privateKey: string) => void,
2726
+ options: T,
2727
+ callback: KeyPairExportCallback<T>,
3153
2728
  ): void;
3154
- function generateKeyPair(
2729
+ function generateKeyPair<T extends ED25519KeyPairOptions = {}>(
3155
2730
  type: "ed25519",
3156
- options: ED25519KeyPairOptions<"pem", "der">,
3157
- callback: (err: Error | null, publicKey: string, privateKey: NonSharedBuffer) => void,
2731
+ options: T | undefined,
2732
+ callback: KeyPairExportCallback<T>,
3158
2733
  ): void;
3159
- function generateKeyPair(
3160
- type: "ed25519",
3161
- options: ED25519KeyPairOptions<"der", "pem">,
3162
- callback: (err: Error | null, publicKey: NonSharedBuffer, privateKey: string) => void,
3163
- ): void;
3164
- function generateKeyPair(
3165
- type: "ed25519",
3166
- options: ED25519KeyPairOptions<"der", "der">,
3167
- callback: (err: Error | null, publicKey: NonSharedBuffer, privateKey: NonSharedBuffer) => void,
3168
- ): void;
3169
- function generateKeyPair(
3170
- type: "ed25519",
3171
- options: ED25519KeyPairKeyObjectOptions | undefined,
3172
- callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void,
3173
- ): void;
3174
- function generateKeyPair(
3175
- type: "ed448",
3176
- options: ED448KeyPairOptions<"pem", "pem">,
3177
- callback: (err: Error | null, publicKey: string, privateKey: string) => void,
3178
- ): void;
3179
- function generateKeyPair(
2734
+ function generateKeyPair<T extends ED448KeyPairOptions = {}>(
3180
2735
  type: "ed448",
3181
- options: ED448KeyPairOptions<"pem", "der">,
3182
- callback: (err: Error | null, publicKey: string, privateKey: NonSharedBuffer) => void,
2736
+ options: T | undefined,
2737
+ callback: KeyPairExportCallback<T>,
3183
2738
  ): void;
3184
- function generateKeyPair(
3185
- type: "ed448",
3186
- options: ED448KeyPairOptions<"der", "pem">,
3187
- callback: (err: Error | null, publicKey: NonSharedBuffer, privateKey: string) => void,
3188
- ): void;
3189
- function generateKeyPair(
3190
- type: "ed448",
3191
- options: ED448KeyPairOptions<"der", "der">,
3192
- callback: (err: Error | null, publicKey: NonSharedBuffer, privateKey: NonSharedBuffer) => void,
3193
- ): void;
3194
- function generateKeyPair(
3195
- type: "ed448",
3196
- options: ED448KeyPairKeyObjectOptions | undefined,
3197
- callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void,
2739
+ function generateKeyPair<T extends MLDSAKeyPairOptions = {}>(
2740
+ type: MLDSAKeyType,
2741
+ options: T | undefined,
2742
+ callback: KeyPairExportCallback<T>,
3198
2743
  ): void;
3199
- function generateKeyPair(
3200
- type: "x25519",
3201
- options: X25519KeyPairOptions<"pem", "pem">,
3202
- callback: (err: Error | null, publicKey: string, privateKey: string) => void,
2744
+ function generateKeyPair<T extends MLKEMKeyPairOptions = {}>(
2745
+ type: MLKEMKeyType,
2746
+ options: T | undefined,
2747
+ callback: KeyPairExportCallback<T>,
3203
2748
  ): void;
3204
- function generateKeyPair(
3205
- type: "x25519",
3206
- options: X25519KeyPairOptions<"pem", "der">,
3207
- callback: (err: Error | null, publicKey: string, privateKey: NonSharedBuffer) => void,
2749
+ function generateKeyPair<T extends RSAPSSKeyPairOptions>(
2750
+ type: "rsa-pss",
2751
+ options: T,
2752
+ callback: KeyPairExportCallback<T>,
3208
2753
  ): void;
3209
- function generateKeyPair(
3210
- type: "x25519",
3211
- options: X25519KeyPairOptions<"der", "pem">,
3212
- callback: (err: Error | null, publicKey: NonSharedBuffer, privateKey: string) => void,
2754
+ function generateKeyPair<T extends RSAKeyPairOptions>(
2755
+ type: "rsa",
2756
+ options: T,
2757
+ callback: KeyPairExportCallback<T>,
3213
2758
  ): void;
3214
- function generateKeyPair(
3215
- type: "x25519",
3216
- options: X25519KeyPairOptions<"der", "der">,
3217
- callback: (err: Error | null, publicKey: NonSharedBuffer, privateKey: NonSharedBuffer) => void,
2759
+ function generateKeyPair<T extends SLHDSAKeyPairOptions = {}>(
2760
+ type: SLHDSAKeyType,
2761
+ options: T | undefined,
2762
+ callback: KeyPairExportCallback<T>,
3218
2763
  ): void;
3219
- function generateKeyPair(
2764
+ function generateKeyPair<T extends X25519KeyPairOptions = {}>(
3220
2765
  type: "x25519",
3221
- options: X25519KeyPairKeyObjectOptions | undefined,
3222
- callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void,
3223
- ): void;
3224
- function generateKeyPair(
3225
- type: "x448",
3226
- options: X448KeyPairOptions<"pem", "pem">,
3227
- callback: (err: Error | null, publicKey: string, privateKey: string) => void,
3228
- ): void;
3229
- function generateKeyPair(
3230
- type: "x448",
3231
- options: X448KeyPairOptions<"pem", "der">,
3232
- callback: (err: Error | null, publicKey: string, privateKey: NonSharedBuffer) => void,
3233
- ): void;
3234
- function generateKeyPair(
3235
- type: "x448",
3236
- options: X448KeyPairOptions<"der", "pem">,
3237
- callback: (err: Error | null, publicKey: NonSharedBuffer, privateKey: string) => void,
3238
- ): void;
3239
- function generateKeyPair(
3240
- type: "x448",
3241
- options: X448KeyPairOptions<"der", "der">,
3242
- callback: (err: Error | null, publicKey: NonSharedBuffer, privateKey: NonSharedBuffer) => void,
2766
+ options: T | undefined,
2767
+ callback: KeyPairExportCallback<T>,
3243
2768
  ): void;
3244
- function generateKeyPair(
2769
+ function generateKeyPair<T extends X448KeyPairOptions = {}>(
3245
2770
  type: "x448",
3246
- options: X448KeyPairKeyObjectOptions | undefined,
3247
- callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void,
3248
- ): void;
3249
- function generateKeyPair(
3250
- type: "ml-dsa-44" | "ml-dsa-65" | "ml-dsa-87",
3251
- options: MLDSAKeyPairOptions<"pem", "pem">,
3252
- callback: (err: Error | null, publicKey: string, privateKey: string) => void,
3253
- ): void;
3254
- function generateKeyPair(
3255
- type: "ml-dsa-44" | "ml-dsa-65" | "ml-dsa-87",
3256
- options: MLDSAKeyPairOptions<"pem", "der">,
3257
- callback: (err: Error | null, publicKey: string, privateKey: NonSharedBuffer) => void,
3258
- ): void;
3259
- function generateKeyPair(
3260
- type: "ml-dsa-44" | "ml-dsa-65" | "ml-dsa-87",
3261
- options: MLDSAKeyPairOptions<"der", "pem">,
3262
- callback: (err: Error | null, publicKey: NonSharedBuffer, privateKey: string) => void,
3263
- ): void;
3264
- function generateKeyPair(
3265
- type: "ml-dsa-44" | "ml-dsa-65" | "ml-dsa-87",
3266
- options: MLDSAKeyPairOptions<"der", "der">,
3267
- callback: (err: Error | null, publicKey: NonSharedBuffer, privateKey: NonSharedBuffer) => void,
3268
- ): void;
3269
- function generateKeyPair(
3270
- type: "ml-dsa-44" | "ml-dsa-65" | "ml-dsa-87",
3271
- options: MLDSAKeyPairKeyObjectOptions | undefined,
3272
- callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void,
3273
- ): void;
3274
- function generateKeyPair(
3275
- type: "ml-kem-1024" | "ml-kem-512" | "ml-kem-768",
3276
- options: MLKEMKeyPairOptions<"pem", "pem">,
3277
- callback: (err: Error | null, publicKey: string, privateKey: string) => void,
3278
- ): void;
3279
- function generateKeyPair(
3280
- type: "ml-kem-1024" | "ml-kem-512" | "ml-kem-768",
3281
- options: MLKEMKeyPairOptions<"pem", "der">,
3282
- callback: (err: Error | null, publicKey: string, privateKey: NonSharedBuffer) => void,
3283
- ): void;
3284
- function generateKeyPair(
3285
- type: "ml-kem-1024" | "ml-kem-512" | "ml-kem-768",
3286
- options: MLKEMKeyPairOptions<"der", "pem">,
3287
- callback: (err: Error | null, publicKey: NonSharedBuffer, privateKey: string) => void,
3288
- ): void;
3289
- function generateKeyPair(
3290
- type: "ml-kem-1024" | "ml-kem-512" | "ml-kem-768",
3291
- options: MLKEMKeyPairOptions<"der", "der">,
3292
- callback: (err: Error | null, publicKey: NonSharedBuffer, privateKey: NonSharedBuffer) => void,
3293
- ): void;
3294
- function generateKeyPair(
3295
- type: "ml-kem-1024" | "ml-kem-512" | "ml-kem-768",
3296
- options: MLKEMKeyPairKeyObjectOptions | undefined,
3297
- callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void,
3298
- ): void;
3299
- function generateKeyPair(
3300
- type:
3301
- | "slh-dsa-sha2-128f"
3302
- | "slh-dsa-sha2-128s"
3303
- | "slh-dsa-sha2-192f"
3304
- | "slh-dsa-sha2-192s"
3305
- | "slh-dsa-sha2-256f"
3306
- | "slh-dsa-sha2-256s"
3307
- | "slh-dsa-shake-128f"
3308
- | "slh-dsa-shake-128s"
3309
- | "slh-dsa-shake-192f"
3310
- | "slh-dsa-shake-192s"
3311
- | "slh-dsa-shake-256f"
3312
- | "slh-dsa-shake-256s",
3313
- options: SLHDSAKeyPairOptions<"pem", "pem">,
3314
- callback: (err: Error | null, publicKey: string, privateKey: string) => void,
3315
- ): void;
3316
- function generateKeyPair(
3317
- type:
3318
- | "slh-dsa-sha2-128f"
3319
- | "slh-dsa-sha2-128s"
3320
- | "slh-dsa-sha2-192f"
3321
- | "slh-dsa-sha2-192s"
3322
- | "slh-dsa-sha2-256f"
3323
- | "slh-dsa-sha2-256s"
3324
- | "slh-dsa-shake-128f"
3325
- | "slh-dsa-shake-128s"
3326
- | "slh-dsa-shake-192f"
3327
- | "slh-dsa-shake-192s"
3328
- | "slh-dsa-shake-256f"
3329
- | "slh-dsa-shake-256s",
3330
- options: SLHDSAKeyPairOptions<"pem", "der">,
3331
- callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void,
3332
- ): void;
3333
- function generateKeyPair(
3334
- type:
3335
- | "slh-dsa-sha2-128f"
3336
- | "slh-dsa-sha2-128s"
3337
- | "slh-dsa-sha2-192f"
3338
- | "slh-dsa-sha2-192s"
3339
- | "slh-dsa-sha2-256f"
3340
- | "slh-dsa-sha2-256s"
3341
- | "slh-dsa-shake-128f"
3342
- | "slh-dsa-shake-128s"
3343
- | "slh-dsa-shake-192f"
3344
- | "slh-dsa-shake-192s"
3345
- | "slh-dsa-shake-256f"
3346
- | "slh-dsa-shake-256s",
3347
- options: SLHDSAKeyPairOptions<"der", "pem">,
3348
- callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void,
3349
- ): void;
3350
- function generateKeyPair(
3351
- type:
3352
- | "slh-dsa-sha2-128f"
3353
- | "slh-dsa-sha2-128s"
3354
- | "slh-dsa-sha2-192f"
3355
- | "slh-dsa-sha2-192s"
3356
- | "slh-dsa-sha2-256f"
3357
- | "slh-dsa-sha2-256s"
3358
- | "slh-dsa-shake-128f"
3359
- | "slh-dsa-shake-128s"
3360
- | "slh-dsa-shake-192f"
3361
- | "slh-dsa-shake-192s"
3362
- | "slh-dsa-shake-256f"
3363
- | "slh-dsa-shake-256s",
3364
- options: SLHDSAKeyPairOptions<"der", "der">,
3365
- callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void,
3366
- ): void;
3367
- function generateKeyPair(
3368
- type:
3369
- | "slh-dsa-sha2-128f"
3370
- | "slh-dsa-sha2-128s"
3371
- | "slh-dsa-sha2-192f"
3372
- | "slh-dsa-sha2-192s"
3373
- | "slh-dsa-sha2-256f"
3374
- | "slh-dsa-sha2-256s"
3375
- | "slh-dsa-shake-128f"
3376
- | "slh-dsa-shake-128s"
3377
- | "slh-dsa-shake-192f"
3378
- | "slh-dsa-shake-192s"
3379
- | "slh-dsa-shake-256f"
3380
- | "slh-dsa-shake-256s",
3381
- options: SLHDSAKeyPairKeyObjectOptions | undefined,
3382
- callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void,
2771
+ options: T | undefined,
2772
+ callback: KeyPairExportCallback<T>,
3383
2773
  ): void;
3384
2774
  namespace generateKeyPair {
3385
- function __promisify__(
3386
- type: "rsa",
3387
- options: RSAKeyPairOptions<"pem", "pem">,
3388
- ): Promise<{
3389
- publicKey: string;
3390
- privateKey: string;
3391
- }>;
3392
- function __promisify__(
3393
- type: "rsa",
3394
- options: RSAKeyPairOptions<"pem", "der">,
3395
- ): Promise<{
3396
- publicKey: string;
3397
- privateKey: NonSharedBuffer;
3398
- }>;
3399
- function __promisify__(
3400
- type: "rsa",
3401
- options: RSAKeyPairOptions<"der", "pem">,
3402
- ): Promise<{
3403
- publicKey: NonSharedBuffer;
3404
- privateKey: string;
3405
- }>;
3406
- function __promisify__(
3407
- type: "rsa",
3408
- options: RSAKeyPairOptions<"der", "der">,
3409
- ): Promise<{
3410
- publicKey: NonSharedBuffer;
3411
- privateKey: NonSharedBuffer;
3412
- }>;
3413
- function __promisify__(type: "rsa", options: RSAKeyPairKeyObjectOptions): Promise<KeyPairKeyObjectResult>;
3414
- function __promisify__(
3415
- type: "rsa-pss",
3416
- options: RSAPSSKeyPairOptions<"pem", "pem">,
3417
- ): Promise<{
3418
- publicKey: string;
3419
- privateKey: string;
3420
- }>;
3421
- function __promisify__(
3422
- type: "rsa-pss",
3423
- options: RSAPSSKeyPairOptions<"pem", "der">,
3424
- ): Promise<{
3425
- publicKey: string;
3426
- privateKey: NonSharedBuffer;
3427
- }>;
3428
- function __promisify__(
3429
- type: "rsa-pss",
3430
- options: RSAPSSKeyPairOptions<"der", "pem">,
3431
- ): Promise<{
3432
- publicKey: NonSharedBuffer;
3433
- privateKey: string;
3434
- }>;
3435
- function __promisify__(
3436
- type: "rsa-pss",
3437
- options: RSAPSSKeyPairOptions<"der", "der">,
3438
- ): Promise<{
3439
- publicKey: NonSharedBuffer;
3440
- privateKey: NonSharedBuffer;
3441
- }>;
3442
- function __promisify__(
3443
- type: "rsa-pss",
3444
- options: RSAPSSKeyPairKeyObjectOptions,
3445
- ): Promise<KeyPairKeyObjectResult>;
3446
- function __promisify__(
3447
- type: "dsa",
3448
- options: DSAKeyPairOptions<"pem", "pem">,
3449
- ): Promise<{
3450
- publicKey: string;
3451
- privateKey: string;
3452
- }>;
3453
- function __promisify__(
2775
+ function __promisify__<T extends DHKeyPairOptions>(
2776
+ type: "dh",
2777
+ options: T,
2778
+ ): Promise<KeyPairExportResult<T>>;
2779
+ function __promisify__<T extends DSAKeyPairOptions>(
3454
2780
  type: "dsa",
3455
- options: DSAKeyPairOptions<"pem", "der">,
3456
- ): Promise<{
3457
- publicKey: string;
3458
- privateKey: NonSharedBuffer;
3459
- }>;
3460
- function __promisify__(
3461
- type: "dsa",
3462
- options: DSAKeyPairOptions<"der", "pem">,
3463
- ): Promise<{
3464
- publicKey: NonSharedBuffer;
3465
- privateKey: string;
3466
- }>;
3467
- function __promisify__(
3468
- type: "dsa",
3469
- options: DSAKeyPairOptions<"der", "der">,
3470
- ): Promise<{
3471
- publicKey: NonSharedBuffer;
3472
- privateKey: NonSharedBuffer;
3473
- }>;
3474
- function __promisify__(type: "dsa", options: DSAKeyPairKeyObjectOptions): Promise<KeyPairKeyObjectResult>;
3475
- function __promisify__(
3476
- type: "ec",
3477
- options: ECKeyPairOptions<"pem", "pem">,
3478
- ): Promise<{
3479
- publicKey: string;
3480
- privateKey: string;
3481
- }>;
3482
- function __promisify__(
3483
- type: "ec",
3484
- options: ECKeyPairOptions<"pem", "der">,
3485
- ): Promise<{
3486
- publicKey: string;
3487
- privateKey: NonSharedBuffer;
3488
- }>;
3489
- function __promisify__(
2781
+ options: T,
2782
+ ): Promise<KeyPairExportResult<T>>;
2783
+ function __promisify__<T extends ECKeyPairOptions>(
3490
2784
  type: "ec",
3491
- options: ECKeyPairOptions<"der", "pem">,
3492
- ): Promise<{
3493
- publicKey: NonSharedBuffer;
3494
- privateKey: string;
3495
- }>;
3496
- function __promisify__(
3497
- type: "ec",
3498
- options: ECKeyPairOptions<"der", "der">,
3499
- ): Promise<{
3500
- publicKey: NonSharedBuffer;
3501
- privateKey: NonSharedBuffer;
3502
- }>;
3503
- function __promisify__(type: "ec", options: ECKeyPairKeyObjectOptions): Promise<KeyPairKeyObjectResult>;
3504
- function __promisify__(
3505
- type: "ed25519",
3506
- options: ED25519KeyPairOptions<"pem", "pem">,
3507
- ): Promise<{
3508
- publicKey: string;
3509
- privateKey: string;
3510
- }>;
3511
- function __promisify__(
3512
- type: "ed25519",
3513
- options: ED25519KeyPairOptions<"pem", "der">,
3514
- ): Promise<{
3515
- publicKey: string;
3516
- privateKey: NonSharedBuffer;
3517
- }>;
3518
- function __promisify__(
3519
- type: "ed25519",
3520
- options: ED25519KeyPairOptions<"der", "pem">,
3521
- ): Promise<{
3522
- publicKey: NonSharedBuffer;
3523
- privateKey: string;
3524
- }>;
3525
- function __promisify__(
2785
+ options: T,
2786
+ ): Promise<KeyPairExportResult<T>>;
2787
+ function __promisify__<T extends ED25519KeyPairOptions = {}>(
3526
2788
  type: "ed25519",
3527
- options: ED25519KeyPairOptions<"der", "der">,
3528
- ): Promise<{
3529
- publicKey: NonSharedBuffer;
3530
- privateKey: NonSharedBuffer;
3531
- }>;
3532
- function __promisify__(
3533
- type: "ed25519",
3534
- options?: ED25519KeyPairKeyObjectOptions,
3535
- ): Promise<KeyPairKeyObjectResult>;
3536
- function __promisify__(
3537
- type: "ed448",
3538
- options: ED448KeyPairOptions<"pem", "pem">,
3539
- ): Promise<{
3540
- publicKey: string;
3541
- privateKey: string;
3542
- }>;
3543
- function __promisify__(
3544
- type: "ed448",
3545
- options: ED448KeyPairOptions<"pem", "der">,
3546
- ): Promise<{
3547
- publicKey: string;
3548
- privateKey: NonSharedBuffer;
3549
- }>;
3550
- function __promisify__(
3551
- type: "ed448",
3552
- options: ED448KeyPairOptions<"der", "pem">,
3553
- ): Promise<{
3554
- publicKey: NonSharedBuffer;
3555
- privateKey: string;
3556
- }>;
3557
- function __promisify__(
2789
+ options?: T,
2790
+ ): Promise<KeyPairExportResult<T>>;
2791
+ function __promisify__<T extends ED448KeyPairOptions = {}>(
3558
2792
  type: "ed448",
3559
- options: ED448KeyPairOptions<"der", "der">,
3560
- ): Promise<{
3561
- publicKey: NonSharedBuffer;
3562
- privateKey: NonSharedBuffer;
3563
- }>;
3564
- function __promisify__(type: "ed448", options?: ED448KeyPairKeyObjectOptions): Promise<KeyPairKeyObjectResult>;
3565
- function __promisify__(
3566
- type: "x25519",
3567
- options: X25519KeyPairOptions<"pem", "pem">,
3568
- ): Promise<{
3569
- publicKey: string;
3570
- privateKey: string;
3571
- }>;
3572
- function __promisify__(
3573
- type: "x25519",
3574
- options: X25519KeyPairOptions<"pem", "der">,
3575
- ): Promise<{
3576
- publicKey: string;
3577
- privateKey: NonSharedBuffer;
3578
- }>;
3579
- function __promisify__(
3580
- type: "x25519",
3581
- options: X25519KeyPairOptions<"der", "pem">,
3582
- ): Promise<{
3583
- publicKey: NonSharedBuffer;
3584
- privateKey: string;
3585
- }>;
3586
- function __promisify__(
3587
- type: "x25519",
3588
- options: X25519KeyPairOptions<"der", "der">,
3589
- ): Promise<{
3590
- publicKey: NonSharedBuffer;
3591
- privateKey: NonSharedBuffer;
3592
- }>;
3593
- function __promisify__(
2793
+ options?: T,
2794
+ ): Promise<KeyPairExportResult<T>>;
2795
+ function __promisify__<T extends MLDSAKeyPairOptions = {}>(
2796
+ type: MLDSAKeyType,
2797
+ options?: T,
2798
+ ): Promise<KeyPairExportResult<T>>;
2799
+ function __promisify__<T extends MLKEMKeyPairOptions = {}>(
2800
+ type: MLKEMKeyType,
2801
+ options?: T,
2802
+ ): Promise<KeyPairExportResult<T>>;
2803
+ function __promisify__<T extends RSAPSSKeyPairOptions>(
2804
+ type: "rsa-pss",
2805
+ options: T,
2806
+ ): Promise<KeyPairExportResult<T>>;
2807
+ function __promisify__<T extends RSAKeyPairOptions>(
2808
+ type: "rsa",
2809
+ options: T,
2810
+ ): Promise<KeyPairExportResult<T>>;
2811
+ function __promisify__<T extends SLHDSAKeyPairOptions = {}>(
2812
+ type: SLHDSAKeyType,
2813
+ options?: T,
2814
+ ): Promise<KeyPairExportResult<T>>;
2815
+ function __promisify__<T extends X25519KeyPairOptions = {}>(
3594
2816
  type: "x25519",
3595
- options?: X25519KeyPairKeyObjectOptions,
3596
- ): Promise<KeyPairKeyObjectResult>;
3597
- function __promisify__(
3598
- type: "x448",
3599
- options: X448KeyPairOptions<"pem", "pem">,
3600
- ): Promise<{
3601
- publicKey: string;
3602
- privateKey: string;
3603
- }>;
3604
- function __promisify__(
3605
- type: "x448",
3606
- options: X448KeyPairOptions<"pem", "der">,
3607
- ): Promise<{
3608
- publicKey: string;
3609
- privateKey: NonSharedBuffer;
3610
- }>;
3611
- function __promisify__(
2817
+ options?: T,
2818
+ ): Promise<KeyPairExportResult<T>>;
2819
+ function __promisify__<T extends X448KeyPairOptions = {}>(
3612
2820
  type: "x448",
3613
- options: X448KeyPairOptions<"der", "pem">,
3614
- ): Promise<{
3615
- publicKey: NonSharedBuffer;
3616
- privateKey: string;
3617
- }>;
3618
- function __promisify__(
3619
- type: "x448",
3620
- options: X448KeyPairOptions<"der", "der">,
3621
- ): Promise<{
3622
- publicKey: NonSharedBuffer;
3623
- privateKey: NonSharedBuffer;
3624
- }>;
3625
- function __promisify__(type: "x448", options?: X448KeyPairKeyObjectOptions): Promise<KeyPairKeyObjectResult>;
3626
- function __promisify__(
3627
- type: "ml-dsa-44" | "ml-dsa-65" | "ml-dsa-87",
3628
- options: MLDSAKeyPairOptions<"pem", "pem">,
3629
- ): Promise<{
3630
- publicKey: string;
3631
- privateKey: string;
3632
- }>;
3633
- function __promisify__(
3634
- type: "ml-dsa-44" | "ml-dsa-65" | "ml-dsa-87",
3635
- options: MLDSAKeyPairOptions<"pem", "der">,
3636
- ): Promise<{
3637
- publicKey: string;
3638
- privateKey: NonSharedBuffer;
3639
- }>;
3640
- function __promisify__(
3641
- type: "ml-dsa-44" | "ml-dsa-65" | "ml-dsa-87",
3642
- options: MLDSAKeyPairOptions<"der", "pem">,
3643
- ): Promise<{
3644
- publicKey: NonSharedBuffer;
3645
- privateKey: string;
3646
- }>;
3647
- function __promisify__(
3648
- type: "ml-dsa-44" | "ml-dsa-65" | "ml-dsa-87",
3649
- options: MLDSAKeyPairOptions<"der", "der">,
3650
- ): Promise<{
3651
- publicKey: NonSharedBuffer;
3652
- privateKey: NonSharedBuffer;
3653
- }>;
3654
- function __promisify__(
3655
- type: "ml-dsa-44" | "ml-dsa-65" | "ml-dsa-87",
3656
- options?: MLDSAKeyPairKeyObjectOptions,
3657
- ): Promise<KeyPairKeyObjectResult>;
3658
- function __promisify__(
3659
- type: "ml-kem-1024" | "ml-kem-512" | "ml-kem-768",
3660
- options: MLKEMKeyPairOptions<"pem", "pem">,
3661
- ): Promise<{
3662
- publicKey: string;
3663
- privateKey: string;
3664
- }>;
3665
- function __promisify__(
3666
- type: "ml-kem-1024" | "ml-kem-512" | "ml-kem-768",
3667
- options: MLKEMKeyPairOptions<"pem", "der">,
3668
- ): Promise<{
3669
- publicKey: string;
3670
- privateKey: NonSharedBuffer;
3671
- }>;
3672
- function __promisify__(
3673
- type: "ml-kem-1024" | "ml-kem-512" | "ml-kem-768",
3674
- options: MLKEMKeyPairOptions<"der", "pem">,
3675
- ): Promise<{
3676
- publicKey: NonSharedBuffer;
3677
- privateKey: string;
3678
- }>;
3679
- function __promisify__(
3680
- type: "ml-kem-1024" | "ml-kem-512" | "ml-kem-768",
3681
- options: MLKEMKeyPairOptions<"der", "der">,
3682
- ): Promise<{
3683
- publicKey: NonSharedBuffer;
3684
- privateKey: NonSharedBuffer;
3685
- }>;
3686
- function __promisify__(
3687
- type: "ml-kem-1024" | "ml-kem-512" | "ml-kem-768",
3688
- options?: MLKEMKeyPairKeyObjectOptions,
3689
- ): Promise<KeyPairKeyObjectResult>;
3690
- function __promisify__(
3691
- type:
3692
- | "slh-dsa-sha2-128f"
3693
- | "slh-dsa-sha2-128s"
3694
- | "slh-dsa-sha2-192f"
3695
- | "slh-dsa-sha2-192s"
3696
- | "slh-dsa-sha2-256f"
3697
- | "slh-dsa-sha2-256s"
3698
- | "slh-dsa-shake-128f"
3699
- | "slh-dsa-shake-128s"
3700
- | "slh-dsa-shake-192f"
3701
- | "slh-dsa-shake-192s"
3702
- | "slh-dsa-shake-256f"
3703
- | "slh-dsa-shake-256s",
3704
- options: SLHDSAKeyPairOptions<"pem", "pem">,
3705
- ): Promise<{
3706
- publicKey: string;
3707
- privateKey: string;
3708
- }>;
3709
- function __promisify__(
3710
- type:
3711
- | "slh-dsa-sha2-128f"
3712
- | "slh-dsa-sha2-128s"
3713
- | "slh-dsa-sha2-192f"
3714
- | "slh-dsa-sha2-192s"
3715
- | "slh-dsa-sha2-256f"
3716
- | "slh-dsa-sha2-256s"
3717
- | "slh-dsa-shake-128f"
3718
- | "slh-dsa-shake-128s"
3719
- | "slh-dsa-shake-192f"
3720
- | "slh-dsa-shake-192s"
3721
- | "slh-dsa-shake-256f"
3722
- | "slh-dsa-shake-256s",
3723
- options: SLHDSAKeyPairOptions<"pem", "der">,
3724
- ): Promise<{
3725
- publicKey: string;
3726
- privateKey: Buffer;
3727
- }>;
3728
- function __promisify__(
3729
- type:
3730
- | "slh-dsa-sha2-128f"
3731
- | "slh-dsa-sha2-128s"
3732
- | "slh-dsa-sha2-192f"
3733
- | "slh-dsa-sha2-192s"
3734
- | "slh-dsa-sha2-256f"
3735
- | "slh-dsa-sha2-256s"
3736
- | "slh-dsa-shake-128f"
3737
- | "slh-dsa-shake-128s"
3738
- | "slh-dsa-shake-192f"
3739
- | "slh-dsa-shake-192s"
3740
- | "slh-dsa-shake-256f"
3741
- | "slh-dsa-shake-256s",
3742
- options: SLHDSAKeyPairOptions<"der", "pem">,
3743
- ): Promise<{
3744
- publicKey: Buffer;
3745
- privateKey: string;
3746
- }>;
3747
- function __promisify__(
3748
- type:
3749
- | "slh-dsa-sha2-128f"
3750
- | "slh-dsa-sha2-128s"
3751
- | "slh-dsa-sha2-192f"
3752
- | "slh-dsa-sha2-192s"
3753
- | "slh-dsa-sha2-256f"
3754
- | "slh-dsa-sha2-256s"
3755
- | "slh-dsa-shake-128f"
3756
- | "slh-dsa-shake-128s"
3757
- | "slh-dsa-shake-192f"
3758
- | "slh-dsa-shake-192s"
3759
- | "slh-dsa-shake-256f"
3760
- | "slh-dsa-shake-256s",
3761
- options: SLHDSAKeyPairOptions<"der", "der">,
3762
- ): Promise<{
3763
- publicKey: Buffer;
3764
- privateKey: Buffer;
3765
- }>;
3766
- function __promisify__(
3767
- type:
3768
- | "slh-dsa-sha2-128f"
3769
- | "slh-dsa-sha2-128s"
3770
- | "slh-dsa-sha2-192f"
3771
- | "slh-dsa-sha2-192s"
3772
- | "slh-dsa-sha2-256f"
3773
- | "slh-dsa-sha2-256s"
3774
- | "slh-dsa-shake-128f"
3775
- | "slh-dsa-shake-128s"
3776
- | "slh-dsa-shake-192f"
3777
- | "slh-dsa-shake-192s"
3778
- | "slh-dsa-shake-256f"
3779
- | "slh-dsa-shake-256s",
3780
- options?: SLHDSAKeyPairKeyObjectOptions,
3781
- ): Promise<KeyPairKeyObjectResult>;
2821
+ options?: T,
2822
+ ): Promise<KeyPairExportResult<T>>;
3782
2823
  }
3783
2824
  /**
3784
2825
  * Calculates and returns the signature for `data` using the given private key and
@@ -4557,7 +3598,12 @@ declare module "crypto" {
4557
3598
  * @since v17.4.0
4558
3599
  * @return Returns `typedArray`.
4559
3600
  */
4560
- function getRandomValues<T extends webcrypto.BufferSource>(typedArray: T): T;
3601
+ function getRandomValues<
3602
+ T extends Exclude<
3603
+ NodeJS.NonSharedTypedArray,
3604
+ NodeJS.NonSharedFloat16Array | NodeJS.NonSharedFloat32Array | NodeJS.NonSharedFloat64Array
3605
+ >,
3606
+ >(typedArray: T): T;
4561
3607
  type Argon2Algorithm = "argon2d" | "argon2i" | "argon2id";
4562
3608
  interface Argon2Parameters {
4563
3609
  /**
@@ -4611,7 +3657,7 @@ declare module "crypto" {
4611
3657
  * random and at least 16 bytes long. See [NIST SP 800-132](https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-132.pdf) for details.
4612
3658
  *
4613
3659
  * When passing strings for `message`, `nonce`, `secret` or `associatedData`, please
4614
- * consider [caveats when using strings as inputs to cryptographic APIs](https://nodejs.org/docs/latest-v24.x/api/crypto.html#using-strings-as-inputs-to-cryptographic-apis).
3660
+ * consider [caveats when using strings as inputs to cryptographic APIs](https://nodejs.org/docs/latest-v25.x/api/crypto.html#using-strings-as-inputs-to-cryptographic-apis).
4615
3661
  *
4616
3662
  * The `callback` function is called with two arguments: `err` and `derivedKey`.
4617
3663
  * `err` is an exception object when key derivation fails, otherwise `err` is
@@ -4655,7 +3701,7 @@ declare module "crypto" {
4655
3701
  * random and at least 16 bytes long. See [NIST SP 800-132](https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-132.pdf) for details.
4656
3702
  *
4657
3703
  * When passing strings for `message`, `nonce`, `secret` or `associatedData`, please
4658
- * consider [caveats when using strings as inputs to cryptographic APIs](https://nodejs.org/docs/latest-v24.x/api/crypto.html#using-strings-as-inputs-to-cryptographic-apis).
3704
+ * consider [caveats when using strings as inputs to cryptographic APIs](https://nodejs.org/docs/latest-v25.x/api/crypto.html#using-strings-as-inputs-to-cryptographic-apis).
4659
3705
  *
4660
3706
  * An exception is thrown when key derivation fails, otherwise the derived key is
4661
3707
  * returned as a `Buffer`.
@@ -4695,48 +3741,40 @@ declare module "crypto" {
4695
3741
  */
4696
3742
  const webcrypto: webcrypto.Crypto;
4697
3743
  namespace webcrypto {
4698
- type BufferSource = ArrayBufferView | ArrayBuffer;
3744
+ type AlgorithmIdentifier = Algorithm | string;
3745
+ type BigInteger = NodeJS.NonSharedUint8Array;
4699
3746
  type KeyFormat = "jwk" | "pkcs8" | "raw" | "raw-public" | "raw-secret" | "raw-seed" | "spki";
4700
3747
  type KeyType = "private" | "public" | "secret";
4701
3748
  type KeyUsage =
4702
- | "encrypt"
3749
+ | "decapsulateBits"
3750
+ | "decapsulateKey"
4703
3751
  | "decrypt"
4704
- | "sign"
4705
- | "verify"
4706
- | "deriveKey"
4707
3752
  | "deriveBits"
3753
+ | "deriveKey"
4708
3754
  | "encapsulateBits"
4709
- | "decapsulateBits"
4710
3755
  | "encapsulateKey"
4711
- | "decapsulateKey"
4712
- | "wrapKey"
4713
- | "unwrapKey";
4714
- type AlgorithmIdentifier = Algorithm | string;
3756
+ | "encrypt"
3757
+ | "sign"
3758
+ | "unwrapKey"
3759
+ | "verify"
3760
+ | "wrapKey";
4715
3761
  type HashAlgorithmIdentifier = AlgorithmIdentifier;
4716
3762
  type NamedCurve = string;
4717
- type BigInteger = Uint8Array;
4718
3763
  interface AeadParams extends Algorithm {
4719
- additionalData?: BufferSource;
4720
- iv: BufferSource;
3764
+ additionalData?: NodeJS.BufferSource;
3765
+ iv: NodeJS.BufferSource;
4721
3766
  tagLength: number;
4722
3767
  }
4723
3768
  interface AesCbcParams extends Algorithm {
4724
- iv: BufferSource;
3769
+ iv: NodeJS.BufferSource;
4725
3770
  }
4726
3771
  interface AesCtrParams extends Algorithm {
4727
- counter: BufferSource;
3772
+ counter: NodeJS.BufferSource;
4728
3773
  length: number;
4729
3774
  }
4730
3775
  interface AesDerivedKeyParams extends Algorithm {
4731
3776
  length: number;
4732
3777
  }
4733
- // TODO: remove in next major
4734
- /** @deprecated Replaced by `AeadParams`. */
4735
- interface AesGcmParams extends Algorithm {
4736
- additionalData?: BufferSource;
4737
- iv: BufferSource;
4738
- tagLength?: number;
4739
- }
4740
3778
  interface AesKeyAlgorithm extends KeyAlgorithm {
4741
3779
  length: number;
4742
3780
  }
@@ -4747,21 +3785,21 @@ declare module "crypto" {
4747
3785
  name: string;
4748
3786
  }
4749
3787
  interface Argon2Params extends Algorithm {
4750
- associatedData?: BufferSource;
3788
+ associatedData?: NodeJS.BufferSource;
4751
3789
  memory: number;
4752
- nonce: BufferSource;
3790
+ nonce: NodeJS.BufferSource;
4753
3791
  parallelism: number;
4754
3792
  passes: number;
4755
- secretValue?: BufferSource;
3793
+ secretValue?: NodeJS.BufferSource;
4756
3794
  version?: number;
4757
3795
  }
4758
3796
  interface CShakeParams extends Algorithm {
4759
- customization?: BufferSource;
4760
- functionName?: BufferSource;
3797
+ customization?: NodeJS.BufferSource;
3798
+ functionName?: NodeJS.BufferSource;
4761
3799
  length: number;
4762
3800
  }
4763
3801
  interface ContextParams extends Algorithm {
4764
- context?: BufferSource;
3802
+ context?: NodeJS.BufferSource;
4765
3803
  }
4766
3804
  interface EcKeyAlgorithm extends KeyAlgorithm {
4767
3805
  namedCurve: NamedCurve;
@@ -4780,8 +3818,8 @@ declare module "crypto" {
4780
3818
  }
4781
3819
  interface HkdfParams extends Algorithm {
4782
3820
  hash: HashAlgorithmIdentifier;
4783
- info: BufferSource;
4784
- salt: BufferSource;
3821
+ info: NodeJS.BufferSource;
3822
+ salt: NodeJS.BufferSource;
4785
3823
  }
4786
3824
  interface HmacImportParams extends Algorithm {
4787
3825
  hash: HashAlgorithmIdentifier;
@@ -4828,13 +3866,13 @@ declare module "crypto" {
4828
3866
  length?: number;
4829
3867
  }
4830
3868
  interface KmacParams extends Algorithm {
4831
- customization?: BufferSource;
3869
+ customization?: NodeJS.BufferSource;
4832
3870
  length: number;
4833
3871
  }
4834
3872
  interface Pbkdf2Params extends Algorithm {
4835
3873
  hash: HashAlgorithmIdentifier;
4836
3874
  iterations: number;
4837
- salt: BufferSource;
3875
+ salt: NodeJS.BufferSource;
4838
3876
  }
4839
3877
  interface RsaHashedImportParams extends Algorithm {
4840
3878
  hash: HashAlgorithmIdentifier;
@@ -4854,7 +3892,7 @@ declare module "crypto" {
4854
3892
  publicExponent: BigInteger;
4855
3893
  }
4856
3894
  interface RsaOaepParams extends Algorithm {
4857
- label?: BufferSource;
3895
+ label?: NodeJS.BufferSource;
4858
3896
  }
4859
3897
  interface RsaOtherPrimesInfo {
4860
3898
  d?: string;
@@ -4864,87 +3902,26 @@ declare module "crypto" {
4864
3902
  interface RsaPssParams extends Algorithm {
4865
3903
  saltLength: number;
4866
3904
  }
4867
- /**
4868
- * Importing the `webcrypto` object (`import { webcrypto } from 'node:crypto'`) gives an instance of the `Crypto` class.
4869
- * `Crypto` is a singleton that provides access to the remainder of the crypto API.
4870
- * @since v15.0.0
4871
- */
4872
3905
  interface Crypto {
4873
- /**
4874
- * Provides access to the `SubtleCrypto` API.
4875
- * @since v15.0.0
4876
- */
4877
3906
  readonly subtle: SubtleCrypto;
4878
- /**
4879
- * Generates cryptographically strong random values.
4880
- * The given `typedArray` is filled with random values, and a reference to `typedArray` is returned.
4881
- *
4882
- * The given `typedArray` must be an integer-based instance of {@link NodeJS.TypedArray}, i.e. `Float32Array` and `Float64Array` are not accepted.
4883
- *
4884
- * An error will be thrown if the given `typedArray` is larger than 65,536 bytes.
4885
- * @since v15.0.0
4886
- */
4887
- getRandomValues<T extends Exclude<NodeJS.TypedArray, Float16Array | Float32Array | Float64Array>>(
3907
+ getRandomValues<
3908
+ T extends Exclude<
3909
+ NodeJS.NonSharedTypedArray,
3910
+ NodeJS.NonSharedFloat16Array | NodeJS.NonSharedFloat32Array | NodeJS.NonSharedFloat64Array
3911
+ >,
3912
+ >(
4888
3913
  typedArray: T,
4889
3914
  ): T;
4890
- /**
4891
- * Generates a random {@link https://www.rfc-editor.org/rfc/rfc4122.txt RFC 4122} version 4 UUID.
4892
- * The UUID is generated using a cryptographic pseudorandom number generator.
4893
- * @since v16.7.0
4894
- */
4895
3915
  randomUUID(): UUID;
4896
3916
  }
4897
- /**
4898
- * @since v15.0.0
4899
- */
4900
3917
  interface CryptoKey {
4901
- /**
4902
- * An object detailing the algorithm for which the key can be used along with additional algorithm-specific parameters.
4903
- * @since v15.0.0
4904
- */
4905
3918
  readonly algorithm: KeyAlgorithm;
4906
- /**
4907
- * When `true`, the {@link CryptoKey} can be extracted using either `subtleCrypto.exportKey()` or `subtleCrypto.wrapKey()`.
4908
- * @since v15.0.0
4909
- */
4910
3919
  readonly extractable: boolean;
4911
- /**
4912
- * A string identifying whether the key is a symmetric (`'secret'`) or asymmetric (`'private'` or `'public'`) key.
4913
- * @since v15.0.0
4914
- */
4915
3920
  readonly type: KeyType;
4916
- /**
4917
- * An array of strings identifying the operations for which the key may be used.
4918
- *
4919
- * The possible usages are:
4920
- * - `'encrypt'` - The key may be used to encrypt data.
4921
- * - `'decrypt'` - The key may be used to decrypt data.
4922
- * - `'sign'` - The key may be used to generate digital signatures.
4923
- * - `'verify'` - The key may be used to verify digital signatures.
4924
- * - `'deriveKey'` - The key may be used to derive a new key.
4925
- * - `'deriveBits'` - The key may be used to derive bits.
4926
- * - `'wrapKey'` - The key may be used to wrap another key.
4927
- * - `'unwrapKey'` - The key may be used to unwrap another key.
4928
- *
4929
- * Valid key usages depend on the key algorithm (identified by `cryptokey.algorithm.name`).
4930
- * @since v15.0.0
4931
- */
4932
3921
  readonly usages: KeyUsage[];
4933
3922
  }
4934
- /**
4935
- * The `CryptoKeyPair` is a simple dictionary object with `publicKey` and `privateKey` properties, representing an asymmetric key pair.
4936
- * @since v15.0.0
4937
- */
4938
3923
  interface CryptoKeyPair {
4939
- /**
4940
- * A {@link CryptoKey} whose type will be `'private'`.
4941
- * @since v15.0.0
4942
- */
4943
3924
  privateKey: CryptoKey;
4944
- /**
4945
- * A {@link CryptoKey} whose type will be `'public'`.
4946
- * @since v15.0.0
4947
- */
4948
3925
  publicKey: CryptoKey;
4949
3926
  }
4950
3927
  interface EncapsulatedBits {
@@ -4955,293 +3932,73 @@ declare module "crypto" {
4955
3932
  sharedKey: CryptoKey;
4956
3933
  ciphertext: ArrayBuffer;
4957
3934
  }
4958
- /**
4959
- * @since v15.0.0
4960
- */
4961
3935
  interface SubtleCrypto {
4962
- /**
4963
- * A message recipient uses their asymmetric private key to decrypt an
4964
- * "encapsulated key" (ciphertext), thereby recovering a temporary symmetric
4965
- * key (represented as `ArrayBuffer`) which is then used to decrypt a message.
4966
- *
4967
- * The algorithms currently supported include:
4968
- *
4969
- * * `'ML-KEM-512'`
4970
- * * `'ML-KEM-768'`
4971
- * * `'ML-KEM-1024'`
4972
- * @since v24.7.0
4973
- * @returns Fulfills with `ArrayBuffer` upon success.
4974
- */
4975
3936
  decapsulateBits(
4976
3937
  decapsulationAlgorithm: AlgorithmIdentifier,
4977
3938
  decapsulationKey: CryptoKey,
4978
- ciphertext: BufferSource,
3939
+ ciphertext: NodeJS.BufferSource,
4979
3940
  ): Promise<ArrayBuffer>;
4980
- /**
4981
- * A message recipient uses their asymmetric private key to decrypt an
4982
- * "encapsulated key" (ciphertext), thereby recovering a temporary symmetric
4983
- * key (represented as `CryptoKey`) which is then used to decrypt a message.
4984
- *
4985
- * The algorithms currently supported include:
4986
- *
4987
- * * `'ML-KEM-512'`
4988
- * * `'ML-KEM-768'`
4989
- * * `'ML-KEM-1024'`
4990
- * @since v24.7.0
4991
- * @param usages See [Key usages](https://nodejs.org/docs/latest-v24.x/api/webcrypto.html#cryptokeyusages).
4992
- * @returns Fulfills with `CryptoKey` upon success.
4993
- */
4994
3941
  decapsulateKey(
4995
3942
  decapsulationAlgorithm: AlgorithmIdentifier,
4996
3943
  decapsulationKey: CryptoKey,
4997
- ciphertext: BufferSource,
3944
+ ciphertext: NodeJS.BufferSource,
4998
3945
  sharedKeyAlgorithm: AlgorithmIdentifier | HmacImportParams | AesDerivedKeyParams | KmacImportParams,
4999
3946
  extractable: boolean,
5000
3947
  usages: KeyUsage[],
5001
3948
  ): Promise<CryptoKey>;
5002
- /**
5003
- * Using the method and parameters specified in `algorithm` and the keying material provided by `key`,
5004
- * this method attempts to decipher the provided `data`. If successful,
5005
- * the returned promise will be resolved with an `<ArrayBuffer>` containing the plaintext result.
5006
- *
5007
- * The algorithms currently supported include:
5008
- *
5009
- * * `'AES-CBC'`
5010
- * * `'AES-CTR'`
5011
- * * `'AES-GCM'`
5012
- * * `'AES-OCB'`
5013
- * * `'ChaCha20-Poly1305'`
5014
- * * `'RSA-OAEP'`
5015
- * @since v15.0.0
5016
- */
5017
3949
  decrypt(
5018
3950
  algorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AeadParams,
5019
3951
  key: CryptoKey,
5020
- data: BufferSource,
3952
+ data: NodeJS.BufferSource,
5021
3953
  ): Promise<ArrayBuffer>;
5022
- /**
5023
- * Using the method and parameters specified in `algorithm` and the keying material provided by `baseKey`,
5024
- * this method attempts to generate `length` bits.
5025
- * The Node.js implementation requires that when `length` is a number it must be multiple of `8`.
5026
- * When `length` is `null` the maximum number of bits for a given algorithm is generated. This is allowed
5027
- * for the `'ECDH'`, `'X25519'`, and `'X448'` algorithms.
5028
- * If successful, the returned promise will be resolved with an `<ArrayBuffer>` containing the generated data.
5029
- *
5030
- * The algorithms currently supported include:
5031
- *
5032
- * * `'Argon2d'`
5033
- * * `'Argon2i'`
5034
- * * `'Argon2id'`
5035
- * * `'ECDH'`
5036
- * * `'HKDF'`
5037
- * * `'PBKDF2'`
5038
- * * `'X25519'`
5039
- * * `'X448'`
5040
- * @since v15.0.0
5041
- */
5042
3954
  deriveBits(
5043
- algorithm: EcdhKeyDeriveParams,
3955
+ algorithm: AlgorithmIdentifier | EcdhKeyDeriveParams | HkdfParams | Pbkdf2Params | Argon2Params,
5044
3956
  baseKey: CryptoKey,
5045
3957
  length?: number | null,
5046
3958
  ): Promise<ArrayBuffer>;
5047
- deriveBits(
5048
- algorithm: EcdhKeyDeriveParams | HkdfParams | Pbkdf2Params | Argon2Params,
5049
- baseKey: CryptoKey,
5050
- length: number,
5051
- ): Promise<ArrayBuffer>;
5052
- /**
5053
- * Using the method and parameters specified in `algorithm`, and the keying material provided by `baseKey`,
5054
- * this method attempts to generate a new <CryptoKey>` based on the method and parameters in `derivedKeyAlgorithm`.
5055
- *
5056
- * Calling `subtle.deriveKey()` is equivalent to calling `subtle.deriveBits()` to generate raw keying material,
5057
- * then passing the result into the `subtle.importKey()` method using the `deriveKeyAlgorithm`, `extractable`, and `keyUsages` parameters as input.
5058
- *
5059
- * The algorithms currently supported include:
5060
- *
5061
- * * `'Argon2d'`
5062
- * * `'Argon2i'`
5063
- * * `'Argon2id'`
5064
- * * `'ECDH'`
5065
- * * `'HKDF'`
5066
- * * `'PBKDF2'`
5067
- * * `'X25519'`
5068
- * * `'X448'`
5069
- * @param keyUsages See {@link https://nodejs.org/docs/latest/api/webcrypto.html#cryptokeyusages Key usages}.
5070
- * @since v15.0.0
5071
- */
5072
3959
  deriveKey(
5073
- algorithm: EcdhKeyDeriveParams | HkdfParams | Pbkdf2Params | Argon2Params,
3960
+ algorithm: AlgorithmIdentifier | EcdhKeyDeriveParams | HkdfParams | Pbkdf2Params | Argon2Params,
5074
3961
  baseKey: CryptoKey,
5075
- derivedKeyAlgorithm: AlgorithmIdentifier | HmacImportParams | AesDerivedKeyParams | KmacImportParams,
3962
+ derivedKeyType: AlgorithmIdentifier | AesDerivedKeyParams | HmacImportParams | KmacImportParams,
5076
3963
  extractable: boolean,
5077
3964
  keyUsages: readonly KeyUsage[],
5078
3965
  ): Promise<CryptoKey>;
5079
- /**
5080
- * Using the method identified by `algorithm`, `subtle.digest()` attempts to generate a digest of `data`.
5081
- * If successful, the returned promise is resolved with an `<ArrayBuffer>` containing the computed digest.
5082
- *
5083
- * If `algorithm` is provided as a `<string>`, it must be one of:
5084
- *
5085
- * * `'cSHAKE128'`
5086
- * * `'cSHAKE256'`
5087
- * * `'SHA-1'`
5088
- * * `'SHA-256'`
5089
- * * `'SHA-384'`
5090
- * * `'SHA-512'`
5091
- * * `'SHA3-256'`
5092
- * * `'SHA3-384'`
5093
- * * `'SHA3-512'`
5094
- *
5095
- * If `algorithm` is provided as an `<Object>`, it must have a `name` property whose value is one of the above.
5096
- * @since v15.0.0
5097
- */
5098
- digest(algorithm: AlgorithmIdentifier | CShakeParams, data: BufferSource): Promise<ArrayBuffer>;
5099
- /**
5100
- * Uses a message recipient's asymmetric public key to encrypt a temporary symmetric key.
5101
- * This encrypted key is the "encapsulated key" represented as `EncapsulatedBits`.
5102
- *
5103
- * The algorithms currently supported include:
5104
- *
5105
- * * `'ML-KEM-512'`
5106
- * * `'ML-KEM-768'`
5107
- * * `'ML-KEM-1024'`
5108
- * @since v24.7.0
5109
- * @returns Fulfills with `EncapsulatedBits` upon success.
5110
- */
3966
+ digest(algorithm: AlgorithmIdentifier | CShakeParams, data: NodeJS.BufferSource): Promise<ArrayBuffer>;
5111
3967
  encapsulateBits(
5112
3968
  encapsulationAlgorithm: AlgorithmIdentifier,
5113
3969
  encapsulationKey: CryptoKey,
5114
3970
  ): Promise<EncapsulatedBits>;
5115
- /**
5116
- * Uses a message recipient's asymmetric public key to encrypt a temporary symmetric key.
5117
- * This encrypted key is the "encapsulated key" represented as `EncapsulatedKey`.
5118
- *
5119
- * The algorithms currently supported include:
5120
- *
5121
- * * `'ML-KEM-512'`
5122
- * * `'ML-KEM-768'`
5123
- * * `'ML-KEM-1024'`
5124
- * @since v24.7.0
5125
- * @param usages See [Key usages](https://nodejs.org/docs/latest-v24.x/api/webcrypto.html#cryptokeyusages).
5126
- * @returns Fulfills with `EncapsulatedKey` upon success.
5127
- */
5128
3971
  encapsulateKey(
5129
3972
  encapsulationAlgorithm: AlgorithmIdentifier,
5130
3973
  encapsulationKey: CryptoKey,
5131
- sharedKeyAlgorithm: AlgorithmIdentifier | HmacImportParams | AesDerivedKeyParams | KmacImportParams,
3974
+ sharedKeyAlgorithm: AlgorithmIdentifier | AesDerivedKeyParams | HmacImportParams | KmacImportParams,
5132
3975
  extractable: boolean,
5133
3976
  usages: KeyUsage[],
5134
3977
  ): Promise<EncapsulatedKey>;
5135
- /**
5136
- * Using the method and parameters specified by `algorithm` and the keying material provided by `key`,
5137
- * this method attempts to encipher `data`. If successful,
5138
- * the returned promise is resolved with an `<ArrayBuffer>` containing the encrypted result.
5139
- *
5140
- * The algorithms currently supported include:
5141
- *
5142
- * * `'AES-CBC'`
5143
- * * `'AES-CTR'`
5144
- * * `'AES-GCM'`
5145
- * * `'AES-OCB'`
5146
- * * `'ChaCha20-Poly1305'`
5147
- * * `'RSA-OAEP'`
5148
- * @since v15.0.0
5149
- */
5150
3978
  encrypt(
5151
3979
  algorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AeadParams,
5152
3980
  key: CryptoKey,
5153
- data: BufferSource,
3981
+ data: NodeJS.BufferSource,
5154
3982
  ): Promise<ArrayBuffer>;
5155
- /**
5156
- * Exports the given key into the specified format, if supported.
5157
- *
5158
- * If the `<CryptoKey>` is not extractable, the returned promise will reject.
5159
- *
5160
- * When `format` is either `'pkcs8'` or `'spki'` and the export is successful,
5161
- * the returned promise will be resolved with an `<ArrayBuffer>` containing the exported key data.
5162
- *
5163
- * When `format` is `'jwk'` and the export is successful, the returned promise will be resolved with a
5164
- * JavaScript object conforming to the {@link https://tools.ietf.org/html/rfc7517 JSON Web Key} specification.
5165
- * @param format Must be one of `'raw'`, `'pkcs8'`, `'spki'`, `'jwk'`, `'raw-secret'`,
5166
- * `'raw-public'`, or `'raw-seed'`.
5167
- * @returns `<Promise>` containing `<ArrayBuffer>`.
5168
- * @since v15.0.0
5169
- */
5170
3983
  exportKey(format: "jwk", key: CryptoKey): Promise<JsonWebKey>;
5171
3984
  exportKey(format: Exclude<KeyFormat, "jwk">, key: CryptoKey): Promise<ArrayBuffer>;
5172
- /**
5173
- * Using the parameters provided in `algorithm`, this method
5174
- * attempts to generate new keying material. Depending on the algorithm used
5175
- * either a single `CryptoKey` or a `CryptoKeyPair` is generated.
5176
- *
5177
- * The `CryptoKeyPair` (public and private key) generating algorithms supported
5178
- * include:
5179
- *
5180
- * * `'ECDH'`
5181
- * * `'ECDSA'`
5182
- * * `'Ed25519'`
5183
- * * `'Ed448'`
5184
- * * `'ML-DSA-44'`
5185
- * * `'ML-DSA-65'`
5186
- * * `'ML-DSA-87'`
5187
- * * `'ML-KEM-512'`
5188
- * * `'ML-KEM-768'`
5189
- * * `'ML-KEM-1024'`
5190
- * * `'RSA-OAEP'`
5191
- * * `'RSA-PSS'`
5192
- * * `'RSASSA-PKCS1-v1_5'`
5193
- * * `'X25519'`
5194
- * * `'X448'`
5195
- *
5196
- * The `CryptoKey` (secret key) generating algorithms supported include:
5197
- * * `'AES-CBC'`
5198
- * * `'AES-CTR'`
5199
- * * `'AES-GCM'`
5200
- * * `'AES-KW'`
5201
- * * `'AES-OCB'`
5202
- * * `'ChaCha20-Poly1305'`
5203
- * * `'HMAC'`
5204
- * * `'KMAC128'`
5205
- * * `'KMAC256'`
5206
- * @param keyUsages See {@link https://nodejs.org/docs/latest/api/webcrypto.html#cryptokeyusages Key usages}.
5207
- * @since v15.0.0
5208
- */
3985
+ exportKey(format: KeyFormat, key: CryptoKey): Promise<ArrayBuffer | JsonWebKey>;
5209
3986
  generateKey(
5210
3987
  algorithm: RsaHashedKeyGenParams | EcKeyGenParams,
5211
3988
  extractable: boolean,
5212
- keyUsages: readonly KeyUsage[],
3989
+ keyUsages: KeyUsage[],
5213
3990
  ): Promise<CryptoKeyPair>;
5214
3991
  generateKey(
5215
3992
  algorithm: AesKeyGenParams | HmacKeyGenParams | Pbkdf2Params | KmacKeyGenParams,
5216
3993
  extractable: boolean,
5217
- keyUsages: readonly KeyUsage[],
3994
+ keyUsages: KeyUsage[],
5218
3995
  ): Promise<CryptoKey>;
5219
3996
  generateKey(
5220
3997
  algorithm: AlgorithmIdentifier,
5221
3998
  extractable: boolean,
5222
3999
  keyUsages: KeyUsage[],
5223
4000
  ): Promise<CryptoKeyPair | CryptoKey>;
5224
- /**
5225
- * Derives the public key from a given private key.
5226
- * @since v24.7.0
5227
- * @param key A private key from which to derive the corresponding public key.
5228
- * @param keyUsages See [Key usages](https://nodejs.org/docs/latest-v24.x/api/webcrypto.html#cryptokeyusages).
5229
- * @returns Fulfills with a `CryptoKey` upon success.
5230
- */
5231
4001
  getPublicKey(key: CryptoKey, keyUsages: KeyUsage[]): Promise<CryptoKey>;
5232
- /**
5233
- * This method attempts to interpret the provided `keyData`
5234
- * as the given `format` to create a `CryptoKey` instance using the provided
5235
- * `algorithm`, `extractable`, and `keyUsages` arguments. If the import is
5236
- * successful, the returned promise will be resolved with a {CryptoKey}
5237
- * representation of the key material.
5238
- *
5239
- * If importing KDF algorithm keys, `extractable` must be `false`.
5240
- * @param format Must be one of `'raw'`, `'pkcs8'`, `'spki'`, `'jwk'`, `'raw-secret'`,
5241
- * `'raw-public'`, or `'raw-seed'`.
5242
- * @param keyUsages See {@link https://nodejs.org/docs/latest/api/webcrypto.html#cryptokeyusages Key usages}.
5243
- * @since v15.0.0
5244
- */
5245
4002
  importKey(
5246
4003
  format: "jwk",
5247
4004
  keyData: JsonWebKey,
@@ -5253,11 +4010,11 @@ declare module "crypto" {
5253
4010
  | AesKeyAlgorithm
5254
4011
  | KmacImportParams,
5255
4012
  extractable: boolean,
5256
- keyUsages: readonly KeyUsage[],
4013
+ keyUsages: KeyUsage[],
5257
4014
  ): Promise<CryptoKey>;
5258
4015
  importKey(
5259
4016
  format: Exclude<KeyFormat, "jwk">,
5260
- keyData: BufferSource,
4017
+ keyData: NodeJS.BufferSource,
5261
4018
  algorithm:
5262
4019
  | AlgorithmIdentifier
5263
4020
  | RsaHashedImportParams
@@ -5268,82 +4025,14 @@ declare module "crypto" {
5268
4025
  extractable: boolean,
5269
4026
  keyUsages: KeyUsage[],
5270
4027
  ): Promise<CryptoKey>;
5271
- /**
5272
- * Using the method and parameters given by `algorithm` and the keying material provided by `key`,
5273
- * this method attempts to generate a cryptographic signature of `data`. If successful,
5274
- * the returned promise is resolved with an `<ArrayBuffer>` containing the generated signature.
5275
- *
5276
- * The algorithms currently supported include:
5277
- *
5278
- * * `'ECDSA'`
5279
- * * `'Ed25519'`
5280
- * * `'Ed448'`
5281
- * * `'HMAC'`
5282
- * * `'KMAC128'`
5283
- * * `'KMAC256'`
5284
- * * `'ML-DSA-44'`
5285
- * * `'ML-DSA-65'`
5286
- * * `'ML-DSA-87'`
5287
- * * `'RSA-PSS'`
5288
- * * `'RSASSA-PKCS1-v1_5'`
5289
- * @since v15.0.0
5290
- */
5291
4028
  sign(
5292
4029
  algorithm: AlgorithmIdentifier | RsaPssParams | EcdsaParams | ContextParams | KmacParams,
5293
4030
  key: CryptoKey,
5294
- data: BufferSource,
4031
+ data: NodeJS.BufferSource,
5295
4032
  ): Promise<ArrayBuffer>;
5296
- /**
5297
- * In cryptography, "wrapping a key" refers to exporting and then encrypting the keying material.
5298
- * This method attempts to decrypt a wrapped key and create a `<CryptoKey>` instance.
5299
- * It is equivalent to calling `subtle.decrypt()` first on the encrypted key data (using the `wrappedKey`, `unwrapAlgo`, and `unwrappingKey` arguments as input)
5300
- * then passing the results in to the `subtle.importKey()` method using the `unwrappedKeyAlgo`, `extractable`, and `keyUsages` arguments as inputs.
5301
- * If successful, the returned promise is resolved with a `<CryptoKey>` object.
5302
- *
5303
- * The wrapping algorithms currently supported include:
5304
- *
5305
- * * `'AES-CBC'`
5306
- * * `'AES-CTR'`
5307
- * * `'AES-GCM'`
5308
- * * `'AES-KW'`
5309
- * * `'AES-OCB'`
5310
- * * `'ChaCha20-Poly1305'`
5311
- * * `'RSA-OAEP'`
5312
- *
5313
- * The unwrapped key algorithms supported include:
5314
- *
5315
- * * `'AES-CBC'`
5316
- * * `'AES-CTR'`
5317
- * * `'AES-GCM'`
5318
- * * `'AES-KW'`
5319
- * * `'AES-OCB'`
5320
- * * `'ChaCha20-Poly1305'`
5321
- * * `'ECDH'`
5322
- * * `'ECDSA'`
5323
- * * `'Ed25519'`
5324
- * * `'Ed448'`
5325
- * * `'HMAC'`
5326
- * * `'KMAC128'`
5327
- * * `'KMAC256'`
5328
- * * `'ML-DSA-44'`
5329
- * * `'ML-DSA-65'`
5330
- * * `'ML-DSA-87'`
5331
- * * `'ML-KEM-512'`
5332
- * * `'ML-KEM-768'`
5333
- * * `'ML-KEM-1024'`
5334
- * * `'RSA-OAEP'`
5335
- * * `'RSA-PSS'`
5336
- * * `'RSASSA-PKCS1-v1_5'`
5337
- * * `'X25519'`
5338
- * * `'X448'`
5339
- * @param format Must be one of `'raw'`, `'pkcs8'`, `'spki'`, `'jwk'`, `'raw-secret'`,
5340
- * `'raw-public'`, or `'raw-seed'`.
5341
- * @param keyUsages See {@link https://nodejs.org/docs/latest/api/webcrypto.html#cryptokeyusages Key usages}.
5342
- * @since v15.0.0
5343
- */
5344
4033
  unwrapKey(
5345
4034
  format: KeyFormat,
5346
- wrappedKey: BufferSource,
4035
+ wrappedKey: NodeJS.BufferSource,
5347
4036
  unwrappingKey: CryptoKey,
5348
4037
  unwrapAlgorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AeadParams,
5349
4038
  unwrappedKeyAlgorithm:
@@ -5356,53 +4045,12 @@ declare module "crypto" {
5356
4045
  extractable: boolean,
5357
4046
  keyUsages: KeyUsage[],
5358
4047
  ): Promise<CryptoKey>;
5359
- /**
5360
- * Using the method and parameters given in `algorithm` and the keying material provided by `key`,
5361
- * This method attempts to verify that `signature` is a valid cryptographic signature of `data`.
5362
- * The returned promise is resolved with either `true` or `false`.
5363
- *
5364
- * The algorithms currently supported include:
5365
- *
5366
- * * `'ECDSA'`
5367
- * * `'Ed25519'`
5368
- * * `'Ed448'`
5369
- * * `'HMAC'`
5370
- * * `'KMAC128'`
5371
- * * `'KMAC256'`
5372
- * * `'ML-DSA-44'`
5373
- * * `'ML-DSA-65'`
5374
- * * `'ML-DSA-87'`
5375
- * * `'RSA-PSS'`
5376
- * * `'RSASSA-PKCS1-v1_5'`
5377
- * @since v15.0.0
5378
- */
5379
4048
  verify(
5380
4049
  algorithm: AlgorithmIdentifier | RsaPssParams | EcdsaParams | ContextParams | KmacParams,
5381
4050
  key: CryptoKey,
5382
- signature: BufferSource,
5383
- data: BufferSource,
4051
+ signature: NodeJS.BufferSource,
4052
+ data: NodeJS.BufferSource,
5384
4053
  ): Promise<boolean>;
5385
- /**
5386
- * In cryptography, "wrapping a key" refers to exporting and then encrypting the keying material.
5387
- * This method exports the keying material into the format identified by `format`,
5388
- * then encrypts it using the method and parameters specified by `wrapAlgo` and the keying material provided by `wrappingKey`.
5389
- * It is the equivalent to calling `subtle.exportKey()` using `format` and `key` as the arguments,
5390
- * then passing the result to the `subtle.encrypt()` method using `wrappingKey` and `wrapAlgo` as inputs.
5391
- * If successful, the returned promise will be resolved with an `<ArrayBuffer>` containing the encrypted key data.
5392
- *
5393
- * The wrapping algorithms currently supported include:
5394
- *
5395
- * * `'AES-CBC'`
5396
- * * `'AES-CTR'`
5397
- * * `'AES-GCM'`
5398
- * * `'AES-KW'`
5399
- * * `'AES-OCB'`
5400
- * * `'ChaCha20-Poly1305'`
5401
- * * `'RSA-OAEP'`
5402
- * @param format Must be one of `'raw'`, `'pkcs8'`, `'spki'`, `'jwk'`, `'raw-secret'`,
5403
- * `'raw-public'`, or `'raw-seed'`.
5404
- * @since v15.0.0
5405
- */
5406
4054
  wrapKey(
5407
4055
  format: KeyFormat,
5408
4056
  key: CryptoKey,
@@ -5412,6 +4060,6 @@ declare module "crypto" {
5412
4060
  }
5413
4061
  }
5414
4062
  }
5415
- declare module "node:crypto" {
5416
- export * from "crypto";
4063
+ declare module "crypto" {
4064
+ export * from "node:crypto";
5417
4065
  }