@types/node 20.6.3 → 20.6.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (104) hide show
  1. node/README.md +1 -1
  2. node/assert/strict.d.ts +4 -4
  3. node/assert.d.ts +48 -24
  4. node/async_hooks.d.ts +13 -6
  5. node/buffer.d.ts +32 -34
  6. node/child_process.d.ts +262 -122
  7. node/cluster.d.ts +107 -89
  8. node/console.d.ts +7 -7
  9. node/constants.d.ts +12 -11
  10. node/crypto.d.ts +746 -268
  11. node/dgram.d.ts +81 -45
  12. node/diagnostics_channel.d.ts +3 -3
  13. node/dns/promises.d.ts +28 -25
  14. node/dns.d.ts +203 -62
  15. node/dom-events.d.ts +67 -71
  16. node/domain.d.ts +4 -4
  17. node/events.d.ts +15 -7
  18. node/fs/promises.d.ts +102 -73
  19. node/fs.d.ts +513 -311
  20. node/globals.d.ts +18 -20
  21. node/http.d.ts +238 -186
  22. node/http2.d.ts +628 -376
  23. node/https.d.ts +221 -112
  24. node/module.d.ts +16 -9
  25. node/net.d.ts +112 -93
  26. node/os.d.ts +7 -7
  27. node/package.json +2 -2
  28. node/path.d.ts +13 -13
  29. node/perf_hooks.d.ts +19 -18
  30. node/process.d.ts +155 -125
  31. node/punycode.d.ts +3 -3
  32. node/querystring.d.ts +14 -4
  33. node/readline/promises.d.ts +12 -7
  34. node/readline.d.ts +69 -56
  35. node/repl.d.ts +67 -61
  36. node/stream/consumers.d.ts +5 -5
  37. node/stream/promises.d.ts +56 -15
  38. node/stream/web.d.ts +26 -20
  39. node/stream.d.ts +361 -228
  40. node/string_decoder.d.ts +3 -3
  41. node/test.d.ts +78 -93
  42. node/timers/promises.d.ts +4 -4
  43. node/timers.d.ts +23 -8
  44. node/tls.d.ts +151 -71
  45. node/trace_events.d.ts +3 -3
  46. node/ts4.8/assert/strict.d.ts +4 -4
  47. node/ts4.8/assert.d.ts +48 -24
  48. node/ts4.8/async_hooks.d.ts +13 -6
  49. node/ts4.8/buffer.d.ts +32 -34
  50. node/ts4.8/child_process.d.ts +262 -122
  51. node/ts4.8/cluster.d.ts +107 -89
  52. node/ts4.8/console.d.ts +7 -7
  53. node/ts4.8/constants.d.ts +12 -11
  54. node/ts4.8/crypto.d.ts +746 -268
  55. node/ts4.8/dgram.d.ts +81 -45
  56. node/ts4.8/diagnostics_channel.d.ts +3 -3
  57. node/ts4.8/dns/promises.d.ts +28 -25
  58. node/ts4.8/dns.d.ts +203 -62
  59. node/ts4.8/dom-events.d.ts +67 -71
  60. node/ts4.8/domain.d.ts +4 -4
  61. node/ts4.8/events.d.ts +15 -7
  62. node/ts4.8/fs/promises.d.ts +102 -73
  63. node/ts4.8/fs.d.ts +513 -311
  64. node/ts4.8/globals.d.ts +18 -20
  65. node/ts4.8/http.d.ts +238 -186
  66. node/ts4.8/http2.d.ts +628 -376
  67. node/ts4.8/https.d.ts +221 -112
  68. node/ts4.8/module.d.ts +16 -9
  69. node/ts4.8/net.d.ts +112 -93
  70. node/ts4.8/os.d.ts +7 -7
  71. node/ts4.8/path.d.ts +13 -13
  72. node/ts4.8/perf_hooks.d.ts +19 -18
  73. node/ts4.8/process.d.ts +155 -125
  74. node/ts4.8/punycode.d.ts +3 -3
  75. node/ts4.8/querystring.d.ts +14 -4
  76. node/ts4.8/readline/promises.d.ts +12 -7
  77. node/ts4.8/readline.d.ts +69 -56
  78. node/ts4.8/repl.d.ts +67 -61
  79. node/ts4.8/stream/consumers.d.ts +5 -5
  80. node/ts4.8/stream/promises.d.ts +56 -15
  81. node/ts4.8/stream/web.d.ts +26 -20
  82. node/ts4.8/stream.d.ts +326 -219
  83. node/ts4.8/string_decoder.d.ts +3 -3
  84. node/ts4.8/test.d.ts +78 -93
  85. node/ts4.8/timers/promises.d.ts +4 -4
  86. node/ts4.8/timers.d.ts +23 -8
  87. node/ts4.8/tls.d.ts +151 -71
  88. node/ts4.8/trace_events.d.ts +3 -3
  89. node/ts4.8/tty.d.ts +10 -10
  90. node/ts4.8/url.d.ts +26 -14
  91. node/ts4.8/util.d.ts +178 -116
  92. node/ts4.8/v8.d.ts +4 -4
  93. node/ts4.8/vm.d.ts +52 -46
  94. node/ts4.8/wasi.d.ts +3 -3
  95. node/ts4.8/worker_threads.d.ts +81 -84
  96. node/ts4.8/zlib.d.ts +9 -9
  97. node/tty.d.ts +10 -10
  98. node/url.d.ts +26 -14
  99. node/util.d.ts +178 -116
  100. node/v8.d.ts +4 -4
  101. node/vm.d.ts +52 -46
  102. node/wasi.d.ts +3 -3
  103. node/worker_threads.d.ts +81 -84
  104. node/zlib.d.ts +9 -9
node/crypto.d.ts CHANGED
@@ -16,9 +16,9 @@
16
16
  * ```
17
17
  * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/crypto.js)
18
18
  */
19
- declare module 'crypto' {
20
- import * as stream from 'node:stream';
21
- import { PeerCertificate } from 'node:tls';
19
+ declare module "crypto" {
20
+ import * as stream from "node:stream";
21
+ import { PeerCertificate } from "node:tls";
22
22
  /**
23
23
  * SPKAC is a Certificate Signing Request mechanism originally implemented by
24
24
  * Netscape and was specified formally as part of HTML5's `keygen` element.
@@ -259,11 +259,11 @@ declare module 'crypto' {
259
259
  */
260
260
  function createHmac(algorithm: string, key: BinaryLike | KeyObject, options?: stream.TransformOptions): Hmac;
261
261
  // https://nodejs.org/api/buffer.html#buffer_buffers_and_character_encodings
262
- type BinaryToTextEncoding = 'base64' | 'base64url' | 'hex' | 'binary';
263
- type CharacterEncoding = 'utf8' | 'utf-8' | 'utf16le' | 'latin1';
264
- type LegacyCharacterEncoding = 'ascii' | 'binary' | 'ucs2' | 'ucs-2';
262
+ type BinaryToTextEncoding = "base64" | "base64url" | "hex" | "binary";
263
+ type CharacterEncoding = "utf8" | "utf-8" | "utf16le" | "latin1";
264
+ type LegacyCharacterEncoding = "ascii" | "binary" | "ucs2" | "ucs-2";
265
265
  type Encoding = BinaryToTextEncoding | CharacterEncoding | LegacyCharacterEncoding;
266
- type ECDHKeyFormat = 'compressed' | 'uncompressed' | 'hybrid';
266
+ type ECDHKeyFormat = "compressed" | "uncompressed" | "hybrid";
267
267
  /**
268
268
  * The `Hash` class is a utility for creating hash digests of data. It can be
269
269
  * used in one of two ways:
@@ -482,15 +482,15 @@ declare module 'crypto' {
482
482
  digest(): Buffer;
483
483
  digest(encoding: BinaryToTextEncoding): string;
484
484
  }
485
- type KeyObjectType = 'secret' | 'public' | 'private';
485
+ type KeyObjectType = "secret" | "public" | "private";
486
486
  interface KeyExportOptions<T extends KeyFormat> {
487
- type: 'pkcs1' | 'spki' | 'pkcs8' | 'sec1';
487
+ type: "pkcs1" | "spki" | "pkcs8" | "sec1";
488
488
  format: T;
489
489
  cipher?: string | undefined;
490
490
  passphrase?: string | Buffer | undefined;
491
491
  }
492
492
  interface JwkKeyExportOptions {
493
- format: 'jwk';
493
+ format: "jwk";
494
494
  }
495
495
  interface JsonWebKey {
496
496
  crv?: string | undefined;
@@ -634,8 +634,8 @@ declare module 'crypto' {
634
634
  * PKCS#1 and SEC1 encryption.
635
635
  * @since v11.6.0
636
636
  */
637
- export(options: KeyExportOptions<'pem'>): string | Buffer;
638
- export(options?: KeyExportOptions<'der'>): Buffer;
637
+ export(options: KeyExportOptions<"pem">): string | Buffer;
638
+ export(options?: KeyExportOptions<"der">): Buffer;
639
639
  export(options?: JwkKeyExportOptions): JsonWebKey;
640
640
  /**
641
641
  * For secret keys, this property represents the size of the key in bytes. This
@@ -650,9 +650,9 @@ declare module 'crypto' {
650
650
  */
651
651
  type: KeyObjectType;
652
652
  }
653
- type CipherCCMTypes = 'aes-128-ccm' | 'aes-192-ccm' | 'aes-256-ccm' | 'chacha20-poly1305';
654
- type CipherGCMTypes = 'aes-128-gcm' | 'aes-192-gcm' | 'aes-256-gcm';
655
- type CipherOCBTypes = 'aes-128-ocb' | 'aes-192-ocb' | 'aes-256-ocb';
653
+ type CipherCCMTypes = "aes-128-ccm" | "aes-192-ccm" | "aes-256-ccm" | "chacha20-poly1305";
654
+ type CipherGCMTypes = "aes-128-gcm" | "aes-192-gcm" | "aes-256-gcm";
655
+ type CipherOCBTypes = "aes-128-ocb" | "aes-192-ocb" | "aes-256-ocb";
656
656
  type BinaryLike = string | NodeJS.ArrayBufferView;
657
657
  type CipherKey = BinaryLike | KeyObject;
658
658
  interface CipherCCMOptions extends stream.TransformOptions {
@@ -736,10 +736,30 @@ declare module 'crypto' {
736
736
  * @since v0.1.94
737
737
  * @param options `stream.transform` options
738
738
  */
739
- function createCipheriv(algorithm: CipherCCMTypes, key: CipherKey, iv: BinaryLike, options: CipherCCMOptions): CipherCCM;
740
- function createCipheriv(algorithm: CipherOCBTypes, key: CipherKey, iv: BinaryLike, options: CipherOCBOptions): CipherOCB;
741
- function createCipheriv(algorithm: CipherGCMTypes, key: CipherKey, iv: BinaryLike, options?: CipherGCMOptions): CipherGCM;
742
- function createCipheriv(algorithm: string, key: CipherKey, iv: BinaryLike | null, options?: stream.TransformOptions): Cipher;
739
+ function createCipheriv(
740
+ algorithm: CipherCCMTypes,
741
+ key: CipherKey,
742
+ iv: BinaryLike,
743
+ options: CipherCCMOptions,
744
+ ): CipherCCM;
745
+ function createCipheriv(
746
+ algorithm: CipherOCBTypes,
747
+ key: CipherKey,
748
+ iv: BinaryLike,
749
+ options: CipherOCBOptions,
750
+ ): CipherOCB;
751
+ function createCipheriv(
752
+ algorithm: CipherGCMTypes,
753
+ key: CipherKey,
754
+ iv: BinaryLike,
755
+ options?: CipherGCMOptions,
756
+ ): CipherGCM;
757
+ function createCipheriv(
758
+ algorithm: string,
759
+ key: CipherKey,
760
+ iv: BinaryLike | null,
761
+ options?: stream.TransformOptions,
762
+ ): Cipher;
743
763
  /**
744
764
  * Instances of the `Cipher` class are used to encrypt data. The class can be
745
765
  * used in one of two ways:
@@ -911,7 +931,7 @@ declare module 'crypto' {
911
931
  buffer: NodeJS.ArrayBufferView,
912
932
  options: {
913
933
  plaintextLength: number;
914
- }
934
+ },
915
935
  ): this;
916
936
  getAuthTag(): Buffer;
917
937
  }
@@ -920,7 +940,7 @@ declare module 'crypto' {
920
940
  buffer: NodeJS.ArrayBufferView,
921
941
  options?: {
922
942
  plaintextLength: number;
923
- }
943
+ },
924
944
  ): this;
925
945
  getAuthTag(): Buffer;
926
946
  }
@@ -929,7 +949,7 @@ declare module 'crypto' {
929
949
  buffer: NodeJS.ArrayBufferView,
930
950
  options?: {
931
951
  plaintextLength: number;
932
- }
952
+ },
933
953
  ): this;
934
954
  getAuthTag(): Buffer;
935
955
  }
@@ -993,10 +1013,30 @@ declare module 'crypto' {
993
1013
  * @since v0.1.94
994
1014
  * @param options `stream.transform` options
995
1015
  */
996
- function createDecipheriv(algorithm: CipherCCMTypes, key: CipherKey, iv: BinaryLike, options: CipherCCMOptions): DecipherCCM;
997
- function createDecipheriv(algorithm: CipherOCBTypes, key: CipherKey, iv: BinaryLike, options: CipherOCBOptions): DecipherOCB;
998
- function createDecipheriv(algorithm: CipherGCMTypes, key: CipherKey, iv: BinaryLike, options?: CipherGCMOptions): DecipherGCM;
999
- function createDecipheriv(algorithm: string, key: CipherKey, iv: BinaryLike | null, options?: stream.TransformOptions): Decipher;
1016
+ function createDecipheriv(
1017
+ algorithm: CipherCCMTypes,
1018
+ key: CipherKey,
1019
+ iv: BinaryLike,
1020
+ options: CipherCCMOptions,
1021
+ ): DecipherCCM;
1022
+ function createDecipheriv(
1023
+ algorithm: CipherOCBTypes,
1024
+ key: CipherKey,
1025
+ iv: BinaryLike,
1026
+ options: CipherOCBOptions,
1027
+ ): DecipherOCB;
1028
+ function createDecipheriv(
1029
+ algorithm: CipherGCMTypes,
1030
+ key: CipherKey,
1031
+ iv: BinaryLike,
1032
+ options?: CipherGCMOptions,
1033
+ ): DecipherGCM;
1034
+ function createDecipheriv(
1035
+ algorithm: string,
1036
+ key: CipherKey,
1037
+ iv: BinaryLike | null,
1038
+ options?: stream.TransformOptions,
1039
+ ): Decipher;
1000
1040
  /**
1001
1041
  * Instances of the `Decipher` class are used to decrypt data. The class can be
1002
1042
  * used in one of two ways:
@@ -1155,7 +1195,7 @@ declare module 'crypto' {
1155
1195
  buffer: NodeJS.ArrayBufferView,
1156
1196
  options: {
1157
1197
  plaintextLength: number;
1158
- }
1198
+ },
1159
1199
  ): this;
1160
1200
  }
1161
1201
  interface DecipherGCM extends Decipher {
@@ -1164,7 +1204,7 @@ declare module 'crypto' {
1164
1204
  buffer: NodeJS.ArrayBufferView,
1165
1205
  options?: {
1166
1206
  plaintextLength: number;
1167
- }
1207
+ },
1168
1208
  ): this;
1169
1209
  }
1170
1210
  interface DecipherOCB extends Decipher {
@@ -1173,20 +1213,20 @@ declare module 'crypto' {
1173
1213
  buffer: NodeJS.ArrayBufferView,
1174
1214
  options?: {
1175
1215
  plaintextLength: number;
1176
- }
1216
+ },
1177
1217
  ): this;
1178
1218
  }
1179
1219
  interface PrivateKeyInput {
1180
1220
  key: string | Buffer;
1181
1221
  format?: KeyFormat | undefined;
1182
- type?: 'pkcs1' | 'pkcs8' | 'sec1' | undefined;
1222
+ type?: "pkcs1" | "pkcs8" | "sec1" | undefined;
1183
1223
  passphrase?: string | Buffer | undefined;
1184
1224
  encoding?: string | undefined;
1185
1225
  }
1186
1226
  interface PublicKeyInput {
1187
1227
  key: string | Buffer;
1188
1228
  format?: KeyFormat | undefined;
1189
- type?: 'pkcs1' | 'spki' | undefined;
1229
+ type?: "pkcs1" | "spki" | undefined;
1190
1230
  encoding?: string | undefined;
1191
1231
  }
1192
1232
  /**
@@ -1209,11 +1249,11 @@ declare module 'crypto' {
1209
1249
  * @param type The intended use of the generated secret key. Currently accepted values are `'hmac'` and `'aes'`.
1210
1250
  */
1211
1251
  function generateKey(
1212
- type: 'hmac' | 'aes',
1252
+ type: "hmac" | "aes",
1213
1253
  options: {
1214
1254
  length: number;
1215
1255
  },
1216
- callback: (err: Error | null, key: KeyObject) => void
1256
+ callback: (err: Error | null, key: KeyObject) => void,
1217
1257
  ): void;
1218
1258
  /**
1219
1259
  * Synchronously generates a new random secret key of the given `length`. The`type` will determine which validations will be performed on the `length`.
@@ -1233,14 +1273,14 @@ declare module 'crypto' {
1233
1273
  * @param type The intended use of the generated secret key. Currently accepted values are `'hmac'` and `'aes'`.
1234
1274
  */
1235
1275
  function generateKeySync(
1236
- type: 'hmac' | 'aes',
1276
+ type: "hmac" | "aes",
1237
1277
  options: {
1238
1278
  length: number;
1239
- }
1279
+ },
1240
1280
  ): KeyObject;
1241
1281
  interface JsonWebKeyInput {
1242
1282
  key: JsonWebKey;
1243
- format: 'jwk';
1283
+ format: "jwk";
1244
1284
  }
1245
1285
  /**
1246
1286
  * Creates and returns a new key object containing a private key. If `key` is a
@@ -1287,7 +1327,7 @@ declare module 'crypto' {
1287
1327
  * @param options `stream.Writable` options
1288
1328
  */
1289
1329
  function createSign(algorithm: string, options?: stream.WritableOptions): Sign;
1290
- type DSAEncoding = 'der' | 'ieee-p1363';
1330
+ type DSAEncoding = "der" | "ieee-p1363";
1291
1331
  interface SigningOptions {
1292
1332
  /**
1293
1333
  * @see crypto.constants.RSA_PKCS1_PADDING
@@ -1396,7 +1436,10 @@ declare module 'crypto' {
1396
1436
  * @since v0.1.92
1397
1437
  */
1398
1438
  sign(privateKey: KeyLike | SignKeyObjectInput | SignPrivateKeyInput): Buffer;
1399
- sign(privateKey: KeyLike | SignKeyObjectInput | SignPrivateKeyInput, outputFormat: BinaryToTextEncoding): string;
1439
+ sign(
1440
+ privateKey: KeyLike | SignKeyObjectInput | SignPrivateKeyInput,
1441
+ outputFormat: BinaryToTextEncoding,
1442
+ ): string;
1400
1443
  }
1401
1444
  /**
1402
1445
  * Creates and returns a `Verify` object that uses the given algorithm.
@@ -1459,8 +1502,15 @@ declare module 'crypto' {
1459
1502
  * be passed instead of a public key.
1460
1503
  * @since v0.1.92
1461
1504
  */
1462
- verify(object: KeyLike | VerifyKeyObjectInput | VerifyPublicKeyInput | VerifyJsonWebKeyInput, signature: NodeJS.ArrayBufferView): boolean;
1463
- verify(object: KeyLike | VerifyKeyObjectInput | VerifyPublicKeyInput | VerifyJsonWebKeyInput, signature: string, signature_format?: BinaryToTextEncoding): boolean;
1505
+ verify(
1506
+ object: KeyLike | VerifyKeyObjectInput | VerifyPublicKeyInput | VerifyJsonWebKeyInput,
1507
+ signature: NodeJS.ArrayBufferView,
1508
+ ): boolean;
1509
+ verify(
1510
+ object: KeyLike | VerifyKeyObjectInput | VerifyPublicKeyInput | VerifyJsonWebKeyInput,
1511
+ signature: string,
1512
+ signature_format?: BinaryToTextEncoding,
1513
+ ): boolean;
1464
1514
  }
1465
1515
  /**
1466
1516
  * Creates a `DiffieHellman` key exchange object using the supplied `prime` and an
@@ -1479,10 +1529,26 @@ declare module 'crypto' {
1479
1529
  * @param generatorEncoding The `encoding` of the `generator` string.
1480
1530
  */
1481
1531
  function createDiffieHellman(primeLength: number, generator?: number): DiffieHellman;
1482
- function createDiffieHellman(prime: ArrayBuffer | NodeJS.ArrayBufferView, generator?: number | ArrayBuffer | NodeJS.ArrayBufferView): DiffieHellman;
1483
- function createDiffieHellman(prime: ArrayBuffer | NodeJS.ArrayBufferView, generator: string, generatorEncoding: BinaryToTextEncoding): DiffieHellman;
1484
- function createDiffieHellman(prime: string, primeEncoding: BinaryToTextEncoding, generator?: number | ArrayBuffer | NodeJS.ArrayBufferView): DiffieHellman;
1485
- function createDiffieHellman(prime: string, primeEncoding: BinaryToTextEncoding, generator: string, generatorEncoding: BinaryToTextEncoding): DiffieHellman;
1532
+ function createDiffieHellman(
1533
+ prime: ArrayBuffer | NodeJS.ArrayBufferView,
1534
+ generator?: number | ArrayBuffer | NodeJS.ArrayBufferView,
1535
+ ): DiffieHellman;
1536
+ function createDiffieHellman(
1537
+ prime: ArrayBuffer | NodeJS.ArrayBufferView,
1538
+ generator: string,
1539
+ generatorEncoding: BinaryToTextEncoding,
1540
+ ): DiffieHellman;
1541
+ function createDiffieHellman(
1542
+ prime: string,
1543
+ primeEncoding: BinaryToTextEncoding,
1544
+ generator?: number | ArrayBuffer | NodeJS.ArrayBufferView,
1545
+ ): DiffieHellman;
1546
+ function createDiffieHellman(
1547
+ prime: string,
1548
+ primeEncoding: BinaryToTextEncoding,
1549
+ generator: string,
1550
+ generatorEncoding: BinaryToTextEncoding,
1551
+ ): DiffieHellman;
1486
1552
  /**
1487
1553
  * The `DiffieHellman` class is a utility for creating Diffie-Hellman key
1488
1554
  * exchanges.
@@ -1545,8 +1611,16 @@ declare module 'crypto' {
1545
1611
  */
1546
1612
  computeSecret(otherPublicKey: NodeJS.ArrayBufferView, inputEncoding?: null, outputEncoding?: null): Buffer;
1547
1613
  computeSecret(otherPublicKey: string, inputEncoding: BinaryToTextEncoding, outputEncoding?: null): Buffer;
1548
- computeSecret(otherPublicKey: NodeJS.ArrayBufferView, inputEncoding: null, outputEncoding: BinaryToTextEncoding): string;
1549
- computeSecret(otherPublicKey: string, inputEncoding: BinaryToTextEncoding, outputEncoding: BinaryToTextEncoding): string;
1614
+ computeSecret(
1615
+ otherPublicKey: NodeJS.ArrayBufferView,
1616
+ inputEncoding: null,
1617
+ outputEncoding: BinaryToTextEncoding,
1618
+ ): string;
1619
+ computeSecret(
1620
+ otherPublicKey: string,
1621
+ inputEncoding: BinaryToTextEncoding,
1622
+ outputEncoding: BinaryToTextEncoding,
1623
+ ): string;
1550
1624
  /**
1551
1625
  * Returns the Diffie-Hellman prime in the specified `encoding`.
1552
1626
  * If `encoding` is provided a string is
@@ -1643,11 +1717,11 @@ declare module 'crypto' {
1643
1717
  */
1644
1718
  const DiffieHellmanGroup: DiffieHellmanGroupConstructor;
1645
1719
  interface DiffieHellmanGroupConstructor {
1646
- new (name: string): DiffieHellmanGroup;
1720
+ new(name: string): DiffieHellmanGroup;
1647
1721
  (name: string): DiffieHellmanGroup;
1648
1722
  readonly prototype: DiffieHellmanGroup;
1649
1723
  }
1650
- type DiffieHellmanGroup = Omit<DiffieHellman, 'setPublicKey' | 'setPrivateKey'>;
1724
+ type DiffieHellmanGroup = Omit<DiffieHellman, "setPublicKey" | "setPrivateKey">;
1651
1725
  /**
1652
1726
  * Creates a predefined `DiffieHellmanGroup` key exchange object. The
1653
1727
  * supported groups are listed in the documentation for `DiffieHellmanGroup`.
@@ -1719,7 +1793,14 @@ declare module 'crypto' {
1719
1793
  * negative performance implications for some applications; see the `UV_THREADPOOL_SIZE` documentation for more information.
1720
1794
  * @since v0.5.5
1721
1795
  */
1722
- function pbkdf2(password: BinaryLike, salt: BinaryLike, iterations: number, keylen: number, digest: string, callback: (err: Error | null, derivedKey: Buffer) => void): void;
1796
+ function pbkdf2(
1797
+ password: BinaryLike,
1798
+ salt: BinaryLike,
1799
+ iterations: number,
1800
+ keylen: number,
1801
+ digest: string,
1802
+ callback: (err: Error | null, derivedKey: Buffer) => void,
1803
+ ): void;
1723
1804
  /**
1724
1805
  * Provides a synchronous Password-Based Key Derivation Function 2 (PBKDF2)
1725
1806
  * implementation. A selected HMAC digest algorithm specified by `digest` is
@@ -1749,7 +1830,13 @@ declare module 'crypto' {
1749
1830
  * An array of supported digest functions can be retrieved using {@link getHashes}.
1750
1831
  * @since v0.9.3
1751
1832
  */
1752
- function pbkdf2Sync(password: BinaryLike, salt: BinaryLike, iterations: number, keylen: number, digest: string): Buffer;
1833
+ function pbkdf2Sync(
1834
+ password: BinaryLike,
1835
+ salt: BinaryLike,
1836
+ iterations: number,
1837
+ keylen: number,
1838
+ digest: string,
1839
+ ): Buffer;
1753
1840
  /**
1754
1841
  * Generates cryptographically strong pseudorandom data. The `size` argument
1755
1842
  * is a number indicating the number of bytes to generate.
@@ -1973,9 +2060,21 @@ declare module 'crypto' {
1973
2060
  * @param [size=buffer.length - offset]
1974
2061
  * @param callback `function(err, buf) {}`.
1975
2062
  */
1976
- function randomFill<T extends NodeJS.ArrayBufferView>(buffer: T, callback: (err: Error | null, buf: T) => void): void;
1977
- function randomFill<T extends NodeJS.ArrayBufferView>(buffer: T, offset: number, callback: (err: Error | null, buf: T) => void): void;
1978
- function randomFill<T extends NodeJS.ArrayBufferView>(buffer: T, offset: number, size: number, callback: (err: Error | null, buf: T) => void): void;
2063
+ function randomFill<T extends NodeJS.ArrayBufferView>(
2064
+ buffer: T,
2065
+ callback: (err: Error | null, buf: T) => void,
2066
+ ): void;
2067
+ function randomFill<T extends NodeJS.ArrayBufferView>(
2068
+ buffer: T,
2069
+ offset: number,
2070
+ callback: (err: Error | null, buf: T) => void,
2071
+ ): void;
2072
+ function randomFill<T extends NodeJS.ArrayBufferView>(
2073
+ buffer: T,
2074
+ offset: number,
2075
+ size: number,
2076
+ callback: (err: Error | null, buf: T) => void,
2077
+ ): void;
1979
2078
  interface ScryptOptions {
1980
2079
  cost?: number | undefined;
1981
2080
  blockSize?: number | undefined;
@@ -2019,8 +2118,19 @@ declare module 'crypto' {
2019
2118
  * ```
2020
2119
  * @since v10.5.0
2021
2120
  */
2022
- function scrypt(password: BinaryLike, salt: BinaryLike, keylen: number, callback: (err: Error | null, derivedKey: Buffer) => void): void;
2023
- function scrypt(password: BinaryLike, salt: BinaryLike, keylen: number, options: ScryptOptions, callback: (err: Error | null, derivedKey: Buffer) => void): void;
2121
+ function scrypt(
2122
+ password: BinaryLike,
2123
+ salt: BinaryLike,
2124
+ keylen: number,
2125
+ callback: (err: Error | null, derivedKey: Buffer) => void,
2126
+ ): void;
2127
+ function scrypt(
2128
+ password: BinaryLike,
2129
+ salt: BinaryLike,
2130
+ keylen: number,
2131
+ options: ScryptOptions,
2132
+ callback: (err: Error | null, derivedKey: Buffer) => void,
2133
+ ): void;
2024
2134
  /**
2025
2135
  * Provides a synchronous [scrypt](https://en.wikipedia.org/wiki/Scrypt) implementation. Scrypt is a password-based
2026
2136
  * key derivation function that is designed to be expensive computationally and
@@ -2234,8 +2344,8 @@ declare module 'crypto' {
2234
2344
  key: BinaryLike,
2235
2345
  curve: string,
2236
2346
  inputEncoding?: BinaryToTextEncoding,
2237
- outputEncoding?: 'latin1' | 'hex' | 'base64' | 'base64url',
2238
- format?: 'uncompressed' | 'compressed' | 'hybrid'
2347
+ outputEncoding?: "latin1" | "hex" | "base64" | "base64url",
2348
+ format?: "uncompressed" | "compressed" | "hybrid",
2239
2349
  ): Buffer | string;
2240
2350
  /**
2241
2351
  * Generates private and public EC Diffie-Hellman key values, and returns
@@ -2271,7 +2381,11 @@ declare module 'crypto' {
2271
2381
  computeSecret(otherPublicKey: NodeJS.ArrayBufferView): Buffer;
2272
2382
  computeSecret(otherPublicKey: string, inputEncoding: BinaryToTextEncoding): Buffer;
2273
2383
  computeSecret(otherPublicKey: NodeJS.ArrayBufferView, outputEncoding: BinaryToTextEncoding): string;
2274
- computeSecret(otherPublicKey: string, inputEncoding: BinaryToTextEncoding, outputEncoding: BinaryToTextEncoding): string;
2384
+ computeSecret(
2385
+ otherPublicKey: string,
2386
+ inputEncoding: BinaryToTextEncoding,
2387
+ outputEncoding: BinaryToTextEncoding,
2388
+ ): string;
2275
2389
  /**
2276
2390
  * If `encoding` is specified, a string is returned; otherwise a `Buffer` is
2277
2391
  * returned.
@@ -2341,8 +2455,8 @@ declare module 'crypto' {
2341
2455
  * @since v6.6.0
2342
2456
  */
2343
2457
  function timingSafeEqual(a: NodeJS.ArrayBufferView, b: NodeJS.ArrayBufferView): boolean;
2344
- type KeyType = 'rsa' | 'rsa-pss' | 'dsa' | 'ec' | 'ed25519' | 'ed448' | 'x25519' | 'x448';
2345
- type KeyFormat = 'pem' | 'der' | 'jwk';
2458
+ type KeyType = "rsa" | "rsa-pss" | "dsa" | "ec" | "ed25519" | "ed448" | "x25519" | "x448";
2459
+ type KeyFormat = "pem" | "der" | "jwk";
2346
2460
  interface BasePrivateKeyEncodingOptions<T extends KeyFormat> {
2347
2461
  format: T;
2348
2462
  cipher?: string | undefined;
@@ -2417,11 +2531,11 @@ declare module 'crypto' {
2417
2531
  */
2418
2532
  publicExponent?: number | undefined;
2419
2533
  publicKeyEncoding: {
2420
- type: 'pkcs1' | 'spki';
2534
+ type: "pkcs1" | "spki";
2421
2535
  format: PubF;
2422
2536
  };
2423
2537
  privateKeyEncoding: BasePrivateKeyEncodingOptions<PrivF> & {
2424
- type: 'pkcs1' | 'pkcs8';
2538
+ type: "pkcs1" | "pkcs8";
2425
2539
  };
2426
2540
  }
2427
2541
  interface RSAPSSKeyPairOptions<PubF extends KeyFormat, PrivF extends KeyFormat> {
@@ -2447,11 +2561,11 @@ declare module 'crypto' {
2447
2561
  */
2448
2562
  saltLength?: string;
2449
2563
  publicKeyEncoding: {
2450
- type: 'spki';
2564
+ type: "spki";
2451
2565
  format: PubF;
2452
2566
  };
2453
2567
  privateKeyEncoding: BasePrivateKeyEncodingOptions<PrivF> & {
2454
- type: 'pkcs8';
2568
+ type: "pkcs8";
2455
2569
  };
2456
2570
  }
2457
2571
  interface DSAKeyPairOptions<PubF extends KeyFormat, PrivF extends KeyFormat> {
@@ -2464,11 +2578,11 @@ declare module 'crypto' {
2464
2578
  */
2465
2579
  divisorLength: number;
2466
2580
  publicKeyEncoding: {
2467
- type: 'spki';
2581
+ type: "spki";
2468
2582
  format: PubF;
2469
2583
  };
2470
2584
  privateKeyEncoding: BasePrivateKeyEncodingOptions<PrivF> & {
2471
- type: 'pkcs8';
2585
+ type: "pkcs8";
2472
2586
  };
2473
2587
  }
2474
2588
  interface ECKeyPairOptions<PubF extends KeyFormat, PrivF extends KeyFormat> {
@@ -2477,47 +2591,47 @@ declare module 'crypto' {
2477
2591
  */
2478
2592
  namedCurve: string;
2479
2593
  publicKeyEncoding: {
2480
- type: 'pkcs1' | 'spki';
2594
+ type: "pkcs1" | "spki";
2481
2595
  format: PubF;
2482
2596
  };
2483
2597
  privateKeyEncoding: BasePrivateKeyEncodingOptions<PrivF> & {
2484
- type: 'sec1' | 'pkcs8';
2598
+ type: "sec1" | "pkcs8";
2485
2599
  };
2486
2600
  }
2487
2601
  interface ED25519KeyPairOptions<PubF extends KeyFormat, PrivF extends KeyFormat> {
2488
2602
  publicKeyEncoding: {
2489
- type: 'spki';
2603
+ type: "spki";
2490
2604
  format: PubF;
2491
2605
  };
2492
2606
  privateKeyEncoding: BasePrivateKeyEncodingOptions<PrivF> & {
2493
- type: 'pkcs8';
2607
+ type: "pkcs8";
2494
2608
  };
2495
2609
  }
2496
2610
  interface ED448KeyPairOptions<PubF extends KeyFormat, PrivF extends KeyFormat> {
2497
2611
  publicKeyEncoding: {
2498
- type: 'spki';
2612
+ type: "spki";
2499
2613
  format: PubF;
2500
2614
  };
2501
2615
  privateKeyEncoding: BasePrivateKeyEncodingOptions<PrivF> & {
2502
- type: 'pkcs8';
2616
+ type: "pkcs8";
2503
2617
  };
2504
2618
  }
2505
2619
  interface X25519KeyPairOptions<PubF extends KeyFormat, PrivF extends KeyFormat> {
2506
2620
  publicKeyEncoding: {
2507
- type: 'spki';
2621
+ type: "spki";
2508
2622
  format: PubF;
2509
2623
  };
2510
2624
  privateKeyEncoding: BasePrivateKeyEncodingOptions<PrivF> & {
2511
- type: 'pkcs8';
2625
+ type: "pkcs8";
2512
2626
  };
2513
2627
  }
2514
2628
  interface X448KeyPairOptions<PubF extends KeyFormat, PrivF extends KeyFormat> {
2515
2629
  publicKeyEncoding: {
2516
- type: 'spki';
2630
+ type: "spki";
2517
2631
  format: PubF;
2518
2632
  };
2519
2633
  privateKeyEncoding: BasePrivateKeyEncodingOptions<PrivF> & {
2520
- type: 'pkcs8';
2634
+ type: "pkcs8";
2521
2635
  };
2522
2636
  }
2523
2637
  interface KeyPairSyncResult<T1 extends string | Buffer, T2 extends string | Buffer> {
@@ -2565,46 +2679,142 @@ declare module 'crypto' {
2565
2679
  * @since v10.12.0
2566
2680
  * @param type Must be `'rsa'`, `'rsa-pss'`, `'dsa'`, `'ec'`, `'ed25519'`, `'ed448'`, `'x25519'`, `'x448'`, or `'dh'`.
2567
2681
  */
2568
- function generateKeyPairSync(type: 'rsa', options: RSAKeyPairOptions<'pem', 'pem'>): KeyPairSyncResult<string, string>;
2569
- function generateKeyPairSync(type: 'rsa', options: RSAKeyPairOptions<'pem', 'der'>): KeyPairSyncResult<string, Buffer>;
2570
- function generateKeyPairSync(type: 'rsa', options: RSAKeyPairOptions<'der', 'pem'>): KeyPairSyncResult<Buffer, string>;
2571
- function generateKeyPairSync(type: 'rsa', options: RSAKeyPairOptions<'der', 'der'>): KeyPairSyncResult<Buffer, Buffer>;
2572
- function generateKeyPairSync(type: 'rsa', options: RSAKeyPairKeyObjectOptions): KeyPairKeyObjectResult;
2573
- function generateKeyPairSync(type: 'rsa-pss', options: RSAPSSKeyPairOptions<'pem', 'pem'>): KeyPairSyncResult<string, string>;
2574
- function generateKeyPairSync(type: 'rsa-pss', options: RSAPSSKeyPairOptions<'pem', 'der'>): KeyPairSyncResult<string, Buffer>;
2575
- function generateKeyPairSync(type: 'rsa-pss', options: RSAPSSKeyPairOptions<'der', 'pem'>): KeyPairSyncResult<Buffer, string>;
2576
- function generateKeyPairSync(type: 'rsa-pss', options: RSAPSSKeyPairOptions<'der', 'der'>): KeyPairSyncResult<Buffer, Buffer>;
2577
- function generateKeyPairSync(type: 'rsa-pss', options: RSAPSSKeyPairKeyObjectOptions): KeyPairKeyObjectResult;
2578
- function generateKeyPairSync(type: 'dsa', options: DSAKeyPairOptions<'pem', 'pem'>): KeyPairSyncResult<string, string>;
2579
- function generateKeyPairSync(type: 'dsa', options: DSAKeyPairOptions<'pem', 'der'>): KeyPairSyncResult<string, Buffer>;
2580
- function generateKeyPairSync(type: 'dsa', options: DSAKeyPairOptions<'der', 'pem'>): KeyPairSyncResult<Buffer, string>;
2581
- function generateKeyPairSync(type: 'dsa', options: DSAKeyPairOptions<'der', 'der'>): KeyPairSyncResult<Buffer, Buffer>;
2582
- function generateKeyPairSync(type: 'dsa', options: DSAKeyPairKeyObjectOptions): KeyPairKeyObjectResult;
2583
- function generateKeyPairSync(type: 'ec', options: ECKeyPairOptions<'pem', 'pem'>): KeyPairSyncResult<string, string>;
2584
- function generateKeyPairSync(type: 'ec', options: ECKeyPairOptions<'pem', 'der'>): KeyPairSyncResult<string, Buffer>;
2585
- function generateKeyPairSync(type: 'ec', options: ECKeyPairOptions<'der', 'pem'>): KeyPairSyncResult<Buffer, string>;
2586
- function generateKeyPairSync(type: 'ec', options: ECKeyPairOptions<'der', 'der'>): KeyPairSyncResult<Buffer, Buffer>;
2587
- function generateKeyPairSync(type: 'ec', options: ECKeyPairKeyObjectOptions): KeyPairKeyObjectResult;
2588
- function generateKeyPairSync(type: 'ed25519', options: ED25519KeyPairOptions<'pem', 'pem'>): KeyPairSyncResult<string, string>;
2589
- function generateKeyPairSync(type: 'ed25519', options: ED25519KeyPairOptions<'pem', 'der'>): KeyPairSyncResult<string, Buffer>;
2590
- function generateKeyPairSync(type: 'ed25519', options: ED25519KeyPairOptions<'der', 'pem'>): KeyPairSyncResult<Buffer, string>;
2591
- function generateKeyPairSync(type: 'ed25519', options: ED25519KeyPairOptions<'der', 'der'>): KeyPairSyncResult<Buffer, Buffer>;
2592
- function generateKeyPairSync(type: 'ed25519', options?: ED25519KeyPairKeyObjectOptions): KeyPairKeyObjectResult;
2593
- function generateKeyPairSync(type: 'ed448', options: ED448KeyPairOptions<'pem', 'pem'>): KeyPairSyncResult<string, string>;
2594
- function generateKeyPairSync(type: 'ed448', options: ED448KeyPairOptions<'pem', 'der'>): KeyPairSyncResult<string, Buffer>;
2595
- function generateKeyPairSync(type: 'ed448', options: ED448KeyPairOptions<'der', 'pem'>): KeyPairSyncResult<Buffer, string>;
2596
- function generateKeyPairSync(type: 'ed448', options: ED448KeyPairOptions<'der', 'der'>): KeyPairSyncResult<Buffer, Buffer>;
2597
- function generateKeyPairSync(type: 'ed448', options?: ED448KeyPairKeyObjectOptions): KeyPairKeyObjectResult;
2598
- function generateKeyPairSync(type: 'x25519', options: X25519KeyPairOptions<'pem', 'pem'>): KeyPairSyncResult<string, string>;
2599
- function generateKeyPairSync(type: 'x25519', options: X25519KeyPairOptions<'pem', 'der'>): KeyPairSyncResult<string, Buffer>;
2600
- function generateKeyPairSync(type: 'x25519', options: X25519KeyPairOptions<'der', 'pem'>): KeyPairSyncResult<Buffer, string>;
2601
- function generateKeyPairSync(type: 'x25519', options: X25519KeyPairOptions<'der', 'der'>): KeyPairSyncResult<Buffer, Buffer>;
2602
- function generateKeyPairSync(type: 'x25519', options?: X25519KeyPairKeyObjectOptions): KeyPairKeyObjectResult;
2603
- function generateKeyPairSync(type: 'x448', options: X448KeyPairOptions<'pem', 'pem'>): KeyPairSyncResult<string, string>;
2604
- function generateKeyPairSync(type: 'x448', options: X448KeyPairOptions<'pem', 'der'>): KeyPairSyncResult<string, Buffer>;
2605
- function generateKeyPairSync(type: 'x448', options: X448KeyPairOptions<'der', 'pem'>): KeyPairSyncResult<Buffer, string>;
2606
- function generateKeyPairSync(type: 'x448', options: X448KeyPairOptions<'der', 'der'>): KeyPairSyncResult<Buffer, Buffer>;
2607
- function generateKeyPairSync(type: 'x448', options?: X448KeyPairKeyObjectOptions): KeyPairKeyObjectResult;
2682
+ function generateKeyPairSync(
2683
+ type: "rsa",
2684
+ options: RSAKeyPairOptions<"pem", "pem">,
2685
+ ): KeyPairSyncResult<string, string>;
2686
+ function generateKeyPairSync(
2687
+ type: "rsa",
2688
+ options: RSAKeyPairOptions<"pem", "der">,
2689
+ ): KeyPairSyncResult<string, Buffer>;
2690
+ function generateKeyPairSync(
2691
+ type: "rsa",
2692
+ options: RSAKeyPairOptions<"der", "pem">,
2693
+ ): KeyPairSyncResult<Buffer, string>;
2694
+ function generateKeyPairSync(
2695
+ type: "rsa",
2696
+ options: RSAKeyPairOptions<"der", "der">,
2697
+ ): KeyPairSyncResult<Buffer, Buffer>;
2698
+ function generateKeyPairSync(type: "rsa", options: RSAKeyPairKeyObjectOptions): KeyPairKeyObjectResult;
2699
+ function generateKeyPairSync(
2700
+ type: "rsa-pss",
2701
+ options: RSAPSSKeyPairOptions<"pem", "pem">,
2702
+ ): KeyPairSyncResult<string, string>;
2703
+ function generateKeyPairSync(
2704
+ type: "rsa-pss",
2705
+ options: RSAPSSKeyPairOptions<"pem", "der">,
2706
+ ): KeyPairSyncResult<string, Buffer>;
2707
+ function generateKeyPairSync(
2708
+ type: "rsa-pss",
2709
+ options: RSAPSSKeyPairOptions<"der", "pem">,
2710
+ ): KeyPairSyncResult<Buffer, string>;
2711
+ function generateKeyPairSync(
2712
+ type: "rsa-pss",
2713
+ options: RSAPSSKeyPairOptions<"der", "der">,
2714
+ ): KeyPairSyncResult<Buffer, Buffer>;
2715
+ function generateKeyPairSync(type: "rsa-pss", options: RSAPSSKeyPairKeyObjectOptions): KeyPairKeyObjectResult;
2716
+ function generateKeyPairSync(
2717
+ type: "dsa",
2718
+ options: DSAKeyPairOptions<"pem", "pem">,
2719
+ ): KeyPairSyncResult<string, string>;
2720
+ function generateKeyPairSync(
2721
+ type: "dsa",
2722
+ options: DSAKeyPairOptions<"pem", "der">,
2723
+ ): KeyPairSyncResult<string, Buffer>;
2724
+ function generateKeyPairSync(
2725
+ type: "dsa",
2726
+ options: DSAKeyPairOptions<"der", "pem">,
2727
+ ): KeyPairSyncResult<Buffer, string>;
2728
+ function generateKeyPairSync(
2729
+ type: "dsa",
2730
+ options: DSAKeyPairOptions<"der", "der">,
2731
+ ): KeyPairSyncResult<Buffer, Buffer>;
2732
+ function generateKeyPairSync(type: "dsa", options: DSAKeyPairKeyObjectOptions): KeyPairKeyObjectResult;
2733
+ function generateKeyPairSync(
2734
+ type: "ec",
2735
+ options: ECKeyPairOptions<"pem", "pem">,
2736
+ ): KeyPairSyncResult<string, string>;
2737
+ function generateKeyPairSync(
2738
+ type: "ec",
2739
+ options: ECKeyPairOptions<"pem", "der">,
2740
+ ): KeyPairSyncResult<string, Buffer>;
2741
+ function generateKeyPairSync(
2742
+ type: "ec",
2743
+ options: ECKeyPairOptions<"der", "pem">,
2744
+ ): KeyPairSyncResult<Buffer, string>;
2745
+ function generateKeyPairSync(
2746
+ type: "ec",
2747
+ options: ECKeyPairOptions<"der", "der">,
2748
+ ): KeyPairSyncResult<Buffer, Buffer>;
2749
+ function generateKeyPairSync(type: "ec", options: ECKeyPairKeyObjectOptions): KeyPairKeyObjectResult;
2750
+ function generateKeyPairSync(
2751
+ type: "ed25519",
2752
+ options: ED25519KeyPairOptions<"pem", "pem">,
2753
+ ): KeyPairSyncResult<string, string>;
2754
+ function generateKeyPairSync(
2755
+ type: "ed25519",
2756
+ options: ED25519KeyPairOptions<"pem", "der">,
2757
+ ): KeyPairSyncResult<string, Buffer>;
2758
+ function generateKeyPairSync(
2759
+ type: "ed25519",
2760
+ options: ED25519KeyPairOptions<"der", "pem">,
2761
+ ): KeyPairSyncResult<Buffer, string>;
2762
+ function generateKeyPairSync(
2763
+ type: "ed25519",
2764
+ options: ED25519KeyPairOptions<"der", "der">,
2765
+ ): KeyPairSyncResult<Buffer, Buffer>;
2766
+ function generateKeyPairSync(type: "ed25519", options?: ED25519KeyPairKeyObjectOptions): KeyPairKeyObjectResult;
2767
+ function generateKeyPairSync(
2768
+ type: "ed448",
2769
+ options: ED448KeyPairOptions<"pem", "pem">,
2770
+ ): KeyPairSyncResult<string, string>;
2771
+ function generateKeyPairSync(
2772
+ type: "ed448",
2773
+ options: ED448KeyPairOptions<"pem", "der">,
2774
+ ): KeyPairSyncResult<string, Buffer>;
2775
+ function generateKeyPairSync(
2776
+ type: "ed448",
2777
+ options: ED448KeyPairOptions<"der", "pem">,
2778
+ ): KeyPairSyncResult<Buffer, string>;
2779
+ function generateKeyPairSync(
2780
+ type: "ed448",
2781
+ options: ED448KeyPairOptions<"der", "der">,
2782
+ ): KeyPairSyncResult<Buffer, Buffer>;
2783
+ function generateKeyPairSync(type: "ed448", options?: ED448KeyPairKeyObjectOptions): KeyPairKeyObjectResult;
2784
+ function generateKeyPairSync(
2785
+ type: "x25519",
2786
+ options: X25519KeyPairOptions<"pem", "pem">,
2787
+ ): KeyPairSyncResult<string, string>;
2788
+ function generateKeyPairSync(
2789
+ type: "x25519",
2790
+ options: X25519KeyPairOptions<"pem", "der">,
2791
+ ): KeyPairSyncResult<string, Buffer>;
2792
+ function generateKeyPairSync(
2793
+ type: "x25519",
2794
+ options: X25519KeyPairOptions<"der", "pem">,
2795
+ ): KeyPairSyncResult<Buffer, string>;
2796
+ function generateKeyPairSync(
2797
+ type: "x25519",
2798
+ options: X25519KeyPairOptions<"der", "der">,
2799
+ ): KeyPairSyncResult<Buffer, Buffer>;
2800
+ function generateKeyPairSync(type: "x25519", options?: X25519KeyPairKeyObjectOptions): KeyPairKeyObjectResult;
2801
+ function generateKeyPairSync(
2802
+ type: "x448",
2803
+ options: X448KeyPairOptions<"pem", "pem">,
2804
+ ): KeyPairSyncResult<string, string>;
2805
+ function generateKeyPairSync(
2806
+ type: "x448",
2807
+ options: X448KeyPairOptions<"pem", "der">,
2808
+ ): KeyPairSyncResult<string, Buffer>;
2809
+ function generateKeyPairSync(
2810
+ type: "x448",
2811
+ options: X448KeyPairOptions<"der", "pem">,
2812
+ ): KeyPairSyncResult<Buffer, string>;
2813
+ function generateKeyPairSync(
2814
+ type: "x448",
2815
+ options: X448KeyPairOptions<"der", "der">,
2816
+ ): KeyPairSyncResult<Buffer, Buffer>;
2817
+ function generateKeyPairSync(type: "x448", options?: X448KeyPairKeyObjectOptions): KeyPairKeyObjectResult;
2608
2818
  /**
2609
2819
  * Generates a new asymmetric key pair of the given `type`. RSA, RSA-PSS, DSA, EC,
2610
2820
  * Ed25519, Ed448, X25519, X448, and DH are currently supported.
@@ -2644,279 +2854,448 @@ declare module 'crypto' {
2644
2854
  * @since v10.12.0
2645
2855
  * @param type Must be `'rsa'`, `'rsa-pss'`, `'dsa'`, `'ec'`, `'ed25519'`, `'ed448'`, `'x25519'`, `'x448'`, or `'dh'`.
2646
2856
  */
2647
- function generateKeyPair(type: 'rsa', options: RSAKeyPairOptions<'pem', 'pem'>, callback: (err: Error | null, publicKey: string, privateKey: string) => void): void;
2648
- function generateKeyPair(type: 'rsa', options: RSAKeyPairOptions<'pem', 'der'>, callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void): void;
2649
- function generateKeyPair(type: 'rsa', options: RSAKeyPairOptions<'der', 'pem'>, callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void): void;
2650
- function generateKeyPair(type: 'rsa', options: RSAKeyPairOptions<'der', 'der'>, callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void): void;
2651
- function generateKeyPair(type: 'rsa', options: RSAKeyPairKeyObjectOptions, callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void): void;
2652
- function generateKeyPair(type: 'rsa-pss', options: RSAPSSKeyPairOptions<'pem', 'pem'>, callback: (err: Error | null, publicKey: string, privateKey: string) => void): void;
2653
- function generateKeyPair(type: 'rsa-pss', options: RSAPSSKeyPairOptions<'pem', 'der'>, callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void): void;
2654
- function generateKeyPair(type: 'rsa-pss', options: RSAPSSKeyPairOptions<'der', 'pem'>, callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void): void;
2655
- function generateKeyPair(type: 'rsa-pss', options: RSAPSSKeyPairOptions<'der', 'der'>, callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void): void;
2656
- function generateKeyPair(type: 'rsa-pss', options: RSAPSSKeyPairKeyObjectOptions, callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void): void;
2657
- function generateKeyPair(type: 'dsa', options: DSAKeyPairOptions<'pem', 'pem'>, callback: (err: Error | null, publicKey: string, privateKey: string) => void): void;
2658
- function generateKeyPair(type: 'dsa', options: DSAKeyPairOptions<'pem', 'der'>, callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void): void;
2659
- function generateKeyPair(type: 'dsa', options: DSAKeyPairOptions<'der', 'pem'>, callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void): void;
2660
- function generateKeyPair(type: 'dsa', options: DSAKeyPairOptions<'der', 'der'>, callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void): void;
2661
- function generateKeyPair(type: 'dsa', options: DSAKeyPairKeyObjectOptions, callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void): void;
2662
- function generateKeyPair(type: 'ec', options: ECKeyPairOptions<'pem', 'pem'>, callback: (err: Error | null, publicKey: string, privateKey: string) => void): void;
2663
- function generateKeyPair(type: 'ec', options: ECKeyPairOptions<'pem', 'der'>, callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void): void;
2664
- function generateKeyPair(type: 'ec', options: ECKeyPairOptions<'der', 'pem'>, callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void): void;
2665
- function generateKeyPair(type: 'ec', options: ECKeyPairOptions<'der', 'der'>, callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void): void;
2666
- function generateKeyPair(type: 'ec', options: ECKeyPairKeyObjectOptions, callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void): void;
2667
- function generateKeyPair(type: 'ed25519', options: ED25519KeyPairOptions<'pem', 'pem'>, callback: (err: Error | null, publicKey: string, privateKey: string) => void): void;
2668
- function generateKeyPair(type: 'ed25519', options: ED25519KeyPairOptions<'pem', 'der'>, callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void): void;
2669
- function generateKeyPair(type: 'ed25519', options: ED25519KeyPairOptions<'der', 'pem'>, callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void): void;
2670
- function generateKeyPair(type: 'ed25519', options: ED25519KeyPairOptions<'der', 'der'>, callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void): void;
2671
- function generateKeyPair(type: 'ed25519', options: ED25519KeyPairKeyObjectOptions | undefined, callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void): void;
2672
- function generateKeyPair(type: 'ed448', options: ED448KeyPairOptions<'pem', 'pem'>, callback: (err: Error | null, publicKey: string, privateKey: string) => void): void;
2673
- function generateKeyPair(type: 'ed448', options: ED448KeyPairOptions<'pem', 'der'>, callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void): void;
2674
- function generateKeyPair(type: 'ed448', options: ED448KeyPairOptions<'der', 'pem'>, callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void): void;
2675
- function generateKeyPair(type: 'ed448', options: ED448KeyPairOptions<'der', 'der'>, callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void): void;
2676
- function generateKeyPair(type: 'ed448', options: ED448KeyPairKeyObjectOptions | undefined, callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void): void;
2677
- function generateKeyPair(type: 'x25519', options: X25519KeyPairOptions<'pem', 'pem'>, callback: (err: Error | null, publicKey: string, privateKey: string) => void): void;
2678
- function generateKeyPair(type: 'x25519', options: X25519KeyPairOptions<'pem', 'der'>, callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void): void;
2679
- function generateKeyPair(type: 'x25519', options: X25519KeyPairOptions<'der', 'pem'>, callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void): void;
2680
- function generateKeyPair(type: 'x25519', options: X25519KeyPairOptions<'der', 'der'>, callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void): void;
2681
- function generateKeyPair(type: 'x25519', options: X25519KeyPairKeyObjectOptions | undefined, callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void): void;
2682
- function generateKeyPair(type: 'x448', options: X448KeyPairOptions<'pem', 'pem'>, callback: (err: Error | null, publicKey: string, privateKey: string) => void): void;
2683
- function generateKeyPair(type: 'x448', options: X448KeyPairOptions<'pem', 'der'>, callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void): void;
2684
- function generateKeyPair(type: 'x448', options: X448KeyPairOptions<'der', 'pem'>, callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void): void;
2685
- function generateKeyPair(type: 'x448', options: X448KeyPairOptions<'der', 'der'>, callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void): void;
2686
- function generateKeyPair(type: 'x448', options: X448KeyPairKeyObjectOptions | undefined, callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void): void;
2857
+ function generateKeyPair(
2858
+ type: "rsa",
2859
+ options: RSAKeyPairOptions<"pem", "pem">,
2860
+ callback: (err: Error | null, publicKey: string, privateKey: string) => void,
2861
+ ): void;
2862
+ function generateKeyPair(
2863
+ type: "rsa",
2864
+ options: RSAKeyPairOptions<"pem", "der">,
2865
+ callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void,
2866
+ ): void;
2867
+ function generateKeyPair(
2868
+ type: "rsa",
2869
+ options: RSAKeyPairOptions<"der", "pem">,
2870
+ callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void,
2871
+ ): void;
2872
+ function generateKeyPair(
2873
+ type: "rsa",
2874
+ options: RSAKeyPairOptions<"der", "der">,
2875
+ callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void,
2876
+ ): void;
2877
+ function generateKeyPair(
2878
+ type: "rsa",
2879
+ options: RSAKeyPairKeyObjectOptions,
2880
+ callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void,
2881
+ ): void;
2882
+ function generateKeyPair(
2883
+ type: "rsa-pss",
2884
+ options: RSAPSSKeyPairOptions<"pem", "pem">,
2885
+ callback: (err: Error | null, publicKey: string, privateKey: string) => void,
2886
+ ): void;
2887
+ function generateKeyPair(
2888
+ type: "rsa-pss",
2889
+ options: RSAPSSKeyPairOptions<"pem", "der">,
2890
+ callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void,
2891
+ ): void;
2892
+ function generateKeyPair(
2893
+ type: "rsa-pss",
2894
+ options: RSAPSSKeyPairOptions<"der", "pem">,
2895
+ callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void,
2896
+ ): void;
2897
+ function generateKeyPair(
2898
+ type: "rsa-pss",
2899
+ options: RSAPSSKeyPairOptions<"der", "der">,
2900
+ callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void,
2901
+ ): void;
2902
+ function generateKeyPair(
2903
+ type: "rsa-pss",
2904
+ options: RSAPSSKeyPairKeyObjectOptions,
2905
+ callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void,
2906
+ ): void;
2907
+ function generateKeyPair(
2908
+ type: "dsa",
2909
+ options: DSAKeyPairOptions<"pem", "pem">,
2910
+ callback: (err: Error | null, publicKey: string, privateKey: string) => void,
2911
+ ): void;
2912
+ function generateKeyPair(
2913
+ type: "dsa",
2914
+ options: DSAKeyPairOptions<"pem", "der">,
2915
+ callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void,
2916
+ ): void;
2917
+ function generateKeyPair(
2918
+ type: "dsa",
2919
+ options: DSAKeyPairOptions<"der", "pem">,
2920
+ callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void,
2921
+ ): void;
2922
+ function generateKeyPair(
2923
+ type: "dsa",
2924
+ options: DSAKeyPairOptions<"der", "der">,
2925
+ callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void,
2926
+ ): void;
2927
+ function generateKeyPair(
2928
+ type: "dsa",
2929
+ options: DSAKeyPairKeyObjectOptions,
2930
+ callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void,
2931
+ ): void;
2932
+ function generateKeyPair(
2933
+ type: "ec",
2934
+ options: ECKeyPairOptions<"pem", "pem">,
2935
+ callback: (err: Error | null, publicKey: string, privateKey: string) => void,
2936
+ ): void;
2937
+ function generateKeyPair(
2938
+ type: "ec",
2939
+ options: ECKeyPairOptions<"pem", "der">,
2940
+ callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void,
2941
+ ): void;
2942
+ function generateKeyPair(
2943
+ type: "ec",
2944
+ options: ECKeyPairOptions<"der", "pem">,
2945
+ callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void,
2946
+ ): void;
2947
+ function generateKeyPair(
2948
+ type: "ec",
2949
+ options: ECKeyPairOptions<"der", "der">,
2950
+ callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void,
2951
+ ): void;
2952
+ function generateKeyPair(
2953
+ type: "ec",
2954
+ options: ECKeyPairKeyObjectOptions,
2955
+ callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void,
2956
+ ): void;
2957
+ function generateKeyPair(
2958
+ type: "ed25519",
2959
+ options: ED25519KeyPairOptions<"pem", "pem">,
2960
+ callback: (err: Error | null, publicKey: string, privateKey: string) => void,
2961
+ ): void;
2962
+ function generateKeyPair(
2963
+ type: "ed25519",
2964
+ options: ED25519KeyPairOptions<"pem", "der">,
2965
+ callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void,
2966
+ ): void;
2967
+ function generateKeyPair(
2968
+ type: "ed25519",
2969
+ options: ED25519KeyPairOptions<"der", "pem">,
2970
+ callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void,
2971
+ ): void;
2972
+ function generateKeyPair(
2973
+ type: "ed25519",
2974
+ options: ED25519KeyPairOptions<"der", "der">,
2975
+ callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void,
2976
+ ): void;
2977
+ function generateKeyPair(
2978
+ type: "ed25519",
2979
+ options: ED25519KeyPairKeyObjectOptions | undefined,
2980
+ callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void,
2981
+ ): void;
2982
+ function generateKeyPair(
2983
+ type: "ed448",
2984
+ options: ED448KeyPairOptions<"pem", "pem">,
2985
+ callback: (err: Error | null, publicKey: string, privateKey: string) => void,
2986
+ ): void;
2987
+ function generateKeyPair(
2988
+ type: "ed448",
2989
+ options: ED448KeyPairOptions<"pem", "der">,
2990
+ callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void,
2991
+ ): void;
2992
+ function generateKeyPair(
2993
+ type: "ed448",
2994
+ options: ED448KeyPairOptions<"der", "pem">,
2995
+ callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void,
2996
+ ): void;
2997
+ function generateKeyPair(
2998
+ type: "ed448",
2999
+ options: ED448KeyPairOptions<"der", "der">,
3000
+ callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void,
3001
+ ): void;
3002
+ function generateKeyPair(
3003
+ type: "ed448",
3004
+ options: ED448KeyPairKeyObjectOptions | undefined,
3005
+ callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void,
3006
+ ): void;
3007
+ function generateKeyPair(
3008
+ type: "x25519",
3009
+ options: X25519KeyPairOptions<"pem", "pem">,
3010
+ callback: (err: Error | null, publicKey: string, privateKey: string) => void,
3011
+ ): void;
3012
+ function generateKeyPair(
3013
+ type: "x25519",
3014
+ options: X25519KeyPairOptions<"pem", "der">,
3015
+ callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void,
3016
+ ): void;
3017
+ function generateKeyPair(
3018
+ type: "x25519",
3019
+ options: X25519KeyPairOptions<"der", "pem">,
3020
+ callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void,
3021
+ ): void;
3022
+ function generateKeyPair(
3023
+ type: "x25519",
3024
+ options: X25519KeyPairOptions<"der", "der">,
3025
+ callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void,
3026
+ ): void;
3027
+ function generateKeyPair(
3028
+ type: "x25519",
3029
+ options: X25519KeyPairKeyObjectOptions | undefined,
3030
+ callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void,
3031
+ ): void;
3032
+ function generateKeyPair(
3033
+ type: "x448",
3034
+ options: X448KeyPairOptions<"pem", "pem">,
3035
+ callback: (err: Error | null, publicKey: string, privateKey: string) => void,
3036
+ ): void;
3037
+ function generateKeyPair(
3038
+ type: "x448",
3039
+ options: X448KeyPairOptions<"pem", "der">,
3040
+ callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void,
3041
+ ): void;
3042
+ function generateKeyPair(
3043
+ type: "x448",
3044
+ options: X448KeyPairOptions<"der", "pem">,
3045
+ callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void,
3046
+ ): void;
3047
+ function generateKeyPair(
3048
+ type: "x448",
3049
+ options: X448KeyPairOptions<"der", "der">,
3050
+ callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void,
3051
+ ): void;
3052
+ function generateKeyPair(
3053
+ type: "x448",
3054
+ options: X448KeyPairKeyObjectOptions | undefined,
3055
+ callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void,
3056
+ ): void;
2687
3057
  namespace generateKeyPair {
2688
3058
  function __promisify__(
2689
- type: 'rsa',
2690
- options: RSAKeyPairOptions<'pem', 'pem'>
3059
+ type: "rsa",
3060
+ options: RSAKeyPairOptions<"pem", "pem">,
2691
3061
  ): Promise<{
2692
3062
  publicKey: string;
2693
3063
  privateKey: string;
2694
3064
  }>;
2695
3065
  function __promisify__(
2696
- type: 'rsa',
2697
- options: RSAKeyPairOptions<'pem', 'der'>
3066
+ type: "rsa",
3067
+ options: RSAKeyPairOptions<"pem", "der">,
2698
3068
  ): Promise<{
2699
3069
  publicKey: string;
2700
3070
  privateKey: Buffer;
2701
3071
  }>;
2702
3072
  function __promisify__(
2703
- type: 'rsa',
2704
- options: RSAKeyPairOptions<'der', 'pem'>
3073
+ type: "rsa",
3074
+ options: RSAKeyPairOptions<"der", "pem">,
2705
3075
  ): Promise<{
2706
3076
  publicKey: Buffer;
2707
3077
  privateKey: string;
2708
3078
  }>;
2709
3079
  function __promisify__(
2710
- type: 'rsa',
2711
- options: RSAKeyPairOptions<'der', 'der'>
3080
+ type: "rsa",
3081
+ options: RSAKeyPairOptions<"der", "der">,
2712
3082
  ): Promise<{
2713
3083
  publicKey: Buffer;
2714
3084
  privateKey: Buffer;
2715
3085
  }>;
2716
- function __promisify__(type: 'rsa', options: RSAKeyPairKeyObjectOptions): Promise<KeyPairKeyObjectResult>;
3086
+ function __promisify__(type: "rsa", options: RSAKeyPairKeyObjectOptions): Promise<KeyPairKeyObjectResult>;
2717
3087
  function __promisify__(
2718
- type: 'rsa-pss',
2719
- options: RSAPSSKeyPairOptions<'pem', 'pem'>
3088
+ type: "rsa-pss",
3089
+ options: RSAPSSKeyPairOptions<"pem", "pem">,
2720
3090
  ): Promise<{
2721
3091
  publicKey: string;
2722
3092
  privateKey: string;
2723
3093
  }>;
2724
3094
  function __promisify__(
2725
- type: 'rsa-pss',
2726
- options: RSAPSSKeyPairOptions<'pem', 'der'>
3095
+ type: "rsa-pss",
3096
+ options: RSAPSSKeyPairOptions<"pem", "der">,
2727
3097
  ): Promise<{
2728
3098
  publicKey: string;
2729
3099
  privateKey: Buffer;
2730
3100
  }>;
2731
3101
  function __promisify__(
2732
- type: 'rsa-pss',
2733
- options: RSAPSSKeyPairOptions<'der', 'pem'>
3102
+ type: "rsa-pss",
3103
+ options: RSAPSSKeyPairOptions<"der", "pem">,
2734
3104
  ): Promise<{
2735
3105
  publicKey: Buffer;
2736
3106
  privateKey: string;
2737
3107
  }>;
2738
3108
  function __promisify__(
2739
- type: 'rsa-pss',
2740
- options: RSAPSSKeyPairOptions<'der', 'der'>
3109
+ type: "rsa-pss",
3110
+ options: RSAPSSKeyPairOptions<"der", "der">,
2741
3111
  ): Promise<{
2742
3112
  publicKey: Buffer;
2743
3113
  privateKey: Buffer;
2744
3114
  }>;
2745
- function __promisify__(type: 'rsa-pss', options: RSAPSSKeyPairKeyObjectOptions): Promise<KeyPairKeyObjectResult>;
2746
3115
  function __promisify__(
2747
- type: 'dsa',
2748
- options: DSAKeyPairOptions<'pem', 'pem'>
3116
+ type: "rsa-pss",
3117
+ options: RSAPSSKeyPairKeyObjectOptions,
3118
+ ): Promise<KeyPairKeyObjectResult>;
3119
+ function __promisify__(
3120
+ type: "dsa",
3121
+ options: DSAKeyPairOptions<"pem", "pem">,
2749
3122
  ): Promise<{
2750
3123
  publicKey: string;
2751
3124
  privateKey: string;
2752
3125
  }>;
2753
3126
  function __promisify__(
2754
- type: 'dsa',
2755
- options: DSAKeyPairOptions<'pem', 'der'>
3127
+ type: "dsa",
3128
+ options: DSAKeyPairOptions<"pem", "der">,
2756
3129
  ): Promise<{
2757
3130
  publicKey: string;
2758
3131
  privateKey: Buffer;
2759
3132
  }>;
2760
3133
  function __promisify__(
2761
- type: 'dsa',
2762
- options: DSAKeyPairOptions<'der', 'pem'>
3134
+ type: "dsa",
3135
+ options: DSAKeyPairOptions<"der", "pem">,
2763
3136
  ): Promise<{
2764
3137
  publicKey: Buffer;
2765
3138
  privateKey: string;
2766
3139
  }>;
2767
3140
  function __promisify__(
2768
- type: 'dsa',
2769
- options: DSAKeyPairOptions<'der', 'der'>
3141
+ type: "dsa",
3142
+ options: DSAKeyPairOptions<"der", "der">,
2770
3143
  ): Promise<{
2771
3144
  publicKey: Buffer;
2772
3145
  privateKey: Buffer;
2773
3146
  }>;
2774
- function __promisify__(type: 'dsa', options: DSAKeyPairKeyObjectOptions): Promise<KeyPairKeyObjectResult>;
3147
+ function __promisify__(type: "dsa", options: DSAKeyPairKeyObjectOptions): Promise<KeyPairKeyObjectResult>;
2775
3148
  function __promisify__(
2776
- type: 'ec',
2777
- options: ECKeyPairOptions<'pem', 'pem'>
3149
+ type: "ec",
3150
+ options: ECKeyPairOptions<"pem", "pem">,
2778
3151
  ): Promise<{
2779
3152
  publicKey: string;
2780
3153
  privateKey: string;
2781
3154
  }>;
2782
3155
  function __promisify__(
2783
- type: 'ec',
2784
- options: ECKeyPairOptions<'pem', 'der'>
3156
+ type: "ec",
3157
+ options: ECKeyPairOptions<"pem", "der">,
2785
3158
  ): Promise<{
2786
3159
  publicKey: string;
2787
3160
  privateKey: Buffer;
2788
3161
  }>;
2789
3162
  function __promisify__(
2790
- type: 'ec',
2791
- options: ECKeyPairOptions<'der', 'pem'>
3163
+ type: "ec",
3164
+ options: ECKeyPairOptions<"der", "pem">,
2792
3165
  ): Promise<{
2793
3166
  publicKey: Buffer;
2794
3167
  privateKey: string;
2795
3168
  }>;
2796
3169
  function __promisify__(
2797
- type: 'ec',
2798
- options: ECKeyPairOptions<'der', 'der'>
3170
+ type: "ec",
3171
+ options: ECKeyPairOptions<"der", "der">,
2799
3172
  ): Promise<{
2800
3173
  publicKey: Buffer;
2801
3174
  privateKey: Buffer;
2802
3175
  }>;
2803
- function __promisify__(type: 'ec', options: ECKeyPairKeyObjectOptions): Promise<KeyPairKeyObjectResult>;
3176
+ function __promisify__(type: "ec", options: ECKeyPairKeyObjectOptions): Promise<KeyPairKeyObjectResult>;
2804
3177
  function __promisify__(
2805
- type: 'ed25519',
2806
- options: ED25519KeyPairOptions<'pem', 'pem'>
3178
+ type: "ed25519",
3179
+ options: ED25519KeyPairOptions<"pem", "pem">,
2807
3180
  ): Promise<{
2808
3181
  publicKey: string;
2809
3182
  privateKey: string;
2810
3183
  }>;
2811
3184
  function __promisify__(
2812
- type: 'ed25519',
2813
- options: ED25519KeyPairOptions<'pem', 'der'>
3185
+ type: "ed25519",
3186
+ options: ED25519KeyPairOptions<"pem", "der">,
2814
3187
  ): Promise<{
2815
3188
  publicKey: string;
2816
3189
  privateKey: Buffer;
2817
3190
  }>;
2818
3191
  function __promisify__(
2819
- type: 'ed25519',
2820
- options: ED25519KeyPairOptions<'der', 'pem'>
3192
+ type: "ed25519",
3193
+ options: ED25519KeyPairOptions<"der", "pem">,
2821
3194
  ): Promise<{
2822
3195
  publicKey: Buffer;
2823
3196
  privateKey: string;
2824
3197
  }>;
2825
3198
  function __promisify__(
2826
- type: 'ed25519',
2827
- options: ED25519KeyPairOptions<'der', 'der'>
3199
+ type: "ed25519",
3200
+ options: ED25519KeyPairOptions<"der", "der">,
2828
3201
  ): Promise<{
2829
3202
  publicKey: Buffer;
2830
3203
  privateKey: Buffer;
2831
3204
  }>;
2832
- function __promisify__(type: 'ed25519', options?: ED25519KeyPairKeyObjectOptions): Promise<KeyPairKeyObjectResult>;
2833
3205
  function __promisify__(
2834
- type: 'ed448',
2835
- options: ED448KeyPairOptions<'pem', 'pem'>
3206
+ type: "ed25519",
3207
+ options?: ED25519KeyPairKeyObjectOptions,
3208
+ ): Promise<KeyPairKeyObjectResult>;
3209
+ function __promisify__(
3210
+ type: "ed448",
3211
+ options: ED448KeyPairOptions<"pem", "pem">,
2836
3212
  ): Promise<{
2837
3213
  publicKey: string;
2838
3214
  privateKey: string;
2839
3215
  }>;
2840
3216
  function __promisify__(
2841
- type: 'ed448',
2842
- options: ED448KeyPairOptions<'pem', 'der'>
3217
+ type: "ed448",
3218
+ options: ED448KeyPairOptions<"pem", "der">,
2843
3219
  ): Promise<{
2844
3220
  publicKey: string;
2845
3221
  privateKey: Buffer;
2846
3222
  }>;
2847
3223
  function __promisify__(
2848
- type: 'ed448',
2849
- options: ED448KeyPairOptions<'der', 'pem'>
3224
+ type: "ed448",
3225
+ options: ED448KeyPairOptions<"der", "pem">,
2850
3226
  ): Promise<{
2851
3227
  publicKey: Buffer;
2852
3228
  privateKey: string;
2853
3229
  }>;
2854
3230
  function __promisify__(
2855
- type: 'ed448',
2856
- options: ED448KeyPairOptions<'der', 'der'>
3231
+ type: "ed448",
3232
+ options: ED448KeyPairOptions<"der", "der">,
2857
3233
  ): Promise<{
2858
3234
  publicKey: Buffer;
2859
3235
  privateKey: Buffer;
2860
3236
  }>;
2861
- function __promisify__(type: 'ed448', options?: ED448KeyPairKeyObjectOptions): Promise<KeyPairKeyObjectResult>;
3237
+ function __promisify__(type: "ed448", options?: ED448KeyPairKeyObjectOptions): Promise<KeyPairKeyObjectResult>;
2862
3238
  function __promisify__(
2863
- type: 'x25519',
2864
- options: X25519KeyPairOptions<'pem', 'pem'>
3239
+ type: "x25519",
3240
+ options: X25519KeyPairOptions<"pem", "pem">,
2865
3241
  ): Promise<{
2866
3242
  publicKey: string;
2867
3243
  privateKey: string;
2868
3244
  }>;
2869
3245
  function __promisify__(
2870
- type: 'x25519',
2871
- options: X25519KeyPairOptions<'pem', 'der'>
3246
+ type: "x25519",
3247
+ options: X25519KeyPairOptions<"pem", "der">,
2872
3248
  ): Promise<{
2873
3249
  publicKey: string;
2874
3250
  privateKey: Buffer;
2875
3251
  }>;
2876
3252
  function __promisify__(
2877
- type: 'x25519',
2878
- options: X25519KeyPairOptions<'der', 'pem'>
3253
+ type: "x25519",
3254
+ options: X25519KeyPairOptions<"der", "pem">,
2879
3255
  ): Promise<{
2880
3256
  publicKey: Buffer;
2881
3257
  privateKey: string;
2882
3258
  }>;
2883
3259
  function __promisify__(
2884
- type: 'x25519',
2885
- options: X25519KeyPairOptions<'der', 'der'>
3260
+ type: "x25519",
3261
+ options: X25519KeyPairOptions<"der", "der">,
2886
3262
  ): Promise<{
2887
3263
  publicKey: Buffer;
2888
3264
  privateKey: Buffer;
2889
3265
  }>;
2890
- function __promisify__(type: 'x25519', options?: X25519KeyPairKeyObjectOptions): Promise<KeyPairKeyObjectResult>;
2891
3266
  function __promisify__(
2892
- type: 'x448',
2893
- options: X448KeyPairOptions<'pem', 'pem'>
3267
+ type: "x25519",
3268
+ options?: X25519KeyPairKeyObjectOptions,
3269
+ ): Promise<KeyPairKeyObjectResult>;
3270
+ function __promisify__(
3271
+ type: "x448",
3272
+ options: X448KeyPairOptions<"pem", "pem">,
2894
3273
  ): Promise<{
2895
3274
  publicKey: string;
2896
3275
  privateKey: string;
2897
3276
  }>;
2898
3277
  function __promisify__(
2899
- type: 'x448',
2900
- options: X448KeyPairOptions<'pem', 'der'>
3278
+ type: "x448",
3279
+ options: X448KeyPairOptions<"pem", "der">,
2901
3280
  ): Promise<{
2902
3281
  publicKey: string;
2903
3282
  privateKey: Buffer;
2904
3283
  }>;
2905
3284
  function __promisify__(
2906
- type: 'x448',
2907
- options: X448KeyPairOptions<'der', 'pem'>
3285
+ type: "x448",
3286
+ options: X448KeyPairOptions<"der", "pem">,
2908
3287
  ): Promise<{
2909
3288
  publicKey: Buffer;
2910
3289
  privateKey: string;
2911
3290
  }>;
2912
3291
  function __promisify__(
2913
- type: 'x448',
2914
- options: X448KeyPairOptions<'der', 'der'>
3292
+ type: "x448",
3293
+ options: X448KeyPairOptions<"der", "der">,
2915
3294
  ): Promise<{
2916
3295
  publicKey: Buffer;
2917
3296
  privateKey: Buffer;
2918
3297
  }>;
2919
- function __promisify__(type: 'x448', options?: X448KeyPairKeyObjectOptions): Promise<KeyPairKeyObjectResult>;
3298
+ function __promisify__(type: "x448", options?: X448KeyPairKeyObjectOptions): Promise<KeyPairKeyObjectResult>;
2920
3299
  }
2921
3300
  /**
2922
3301
  * Calculates and returns the signature for `data` using the given private key and
@@ -2930,12 +3309,16 @@ declare module 'crypto' {
2930
3309
  * If the `callback` function is provided this function uses libuv's threadpool.
2931
3310
  * @since v12.0.0
2932
3311
  */
2933
- function sign(algorithm: string | null | undefined, data: NodeJS.ArrayBufferView, key: KeyLike | SignKeyObjectInput | SignPrivateKeyInput): Buffer;
2934
3312
  function sign(
2935
3313
  algorithm: string | null | undefined,
2936
3314
  data: NodeJS.ArrayBufferView,
2937
3315
  key: KeyLike | SignKeyObjectInput | SignPrivateKeyInput,
2938
- callback: (error: Error | null, data: Buffer) => void
3316
+ ): Buffer;
3317
+ function sign(
3318
+ algorithm: string | null | undefined,
3319
+ data: NodeJS.ArrayBufferView,
3320
+ key: KeyLike | SignKeyObjectInput | SignPrivateKeyInput,
3321
+ callback: (error: Error | null, data: Buffer) => void,
2939
3322
  ): void;
2940
3323
  /**
2941
3324
  * Verifies the given signature for `data` using the given key and algorithm. If`algorithm` is `null` or `undefined`, then the algorithm is dependent upon the
@@ -2957,14 +3340,14 @@ declare module 'crypto' {
2957
3340
  algorithm: string | null | undefined,
2958
3341
  data: NodeJS.ArrayBufferView,
2959
3342
  key: KeyLike | VerifyKeyObjectInput | VerifyPublicKeyInput | VerifyJsonWebKeyInput,
2960
- signature: NodeJS.ArrayBufferView
3343
+ signature: NodeJS.ArrayBufferView,
2961
3344
  ): boolean;
2962
3345
  function verify(
2963
3346
  algorithm: string | null | undefined,
2964
3347
  data: NodeJS.ArrayBufferView,
2965
3348
  key: KeyLike | VerifyKeyObjectInput | VerifyPublicKeyInput | VerifyJsonWebKeyInput,
2966
3349
  signature: NodeJS.ArrayBufferView,
2967
- callback: (error: Error | null, result: boolean) => void
3350
+ callback: (error: Error | null, result: boolean) => void,
2968
3351
  ): void;
2969
3352
  /**
2970
3353
  * Computes the Diffie-Hellman secret based on a `privateKey` and a `publicKey`.
@@ -2972,7 +3355,7 @@ declare module 'crypto' {
2972
3355
  * @since v13.9.0, v12.17.0
2973
3356
  */
2974
3357
  function diffieHellman(options: { privateKey: KeyObject; publicKey: KeyObject }): Buffer;
2975
- type CipherMode = 'cbc' | 'ccm' | 'cfb' | 'ctr' | 'ecb' | 'gcm' | 'ocb' | 'ofb' | 'stream' | 'wrap' | 'xts';
3358
+ type CipherMode = "cbc" | "ccm" | "cfb" | "ctr" | "ecb" | "gcm" | "ocb" | "ofb" | "stream" | "wrap" | "xts";
2976
3359
  interface CipherInfoOptions {
2977
3360
  /**
2978
3361
  * A test key length.
@@ -3050,7 +3433,14 @@ declare module 'crypto' {
3050
3433
  * @param keylen The length of the key to generate. Must be greater than 0. The maximum allowable value is `255` times the number of bytes produced by the selected digest function (e.g. `sha512`
3051
3434
  * generates 64-byte hashes, making the maximum HKDF output 16320 bytes).
3052
3435
  */
3053
- function hkdf(digest: string, irm: BinaryLike | KeyObject, salt: BinaryLike, info: BinaryLike, keylen: number, callback: (err: Error | null, derivedKey: ArrayBuffer) => void): void;
3436
+ function hkdf(
3437
+ digest: string,
3438
+ irm: BinaryLike | KeyObject,
3439
+ salt: BinaryLike,
3440
+ info: BinaryLike,
3441
+ keylen: number,
3442
+ callback: (err: Error | null, derivedKey: ArrayBuffer) => void,
3443
+ ): void;
3054
3444
  /**
3055
3445
  * Provides a synchronous HKDF key derivation function as defined in RFC 5869\. The
3056
3446
  * given `ikm`, `salt` and `info` are used with the `digest` to derive a key of`keylen` bytes.
@@ -3077,7 +3467,13 @@ declare module 'crypto' {
3077
3467
  * @param keylen The length of the key to generate. Must be greater than 0. The maximum allowable value is `255` times the number of bytes produced by the selected digest function (e.g. `sha512`
3078
3468
  * generates 64-byte hashes, making the maximum HKDF output 16320 bytes).
3079
3469
  */
3080
- function hkdfSync(digest: string, ikm: BinaryLike | KeyObject, salt: BinaryLike, info: BinaryLike, keylen: number): ArrayBuffer;
3470
+ function hkdfSync(
3471
+ digest: string,
3472
+ ikm: BinaryLike | KeyObject,
3473
+ salt: BinaryLike,
3474
+ info: BinaryLike,
3475
+ keylen: number,
3476
+ ): ArrayBuffer;
3081
3477
  interface SecureHeapUsage {
3082
3478
  /**
3083
3479
  * The total allocated secure heap size as specified using the `--secure-heap=n` command-line flag.
@@ -3122,7 +3518,7 @@ declare module 'crypto' {
3122
3518
  /**
3123
3519
  * @default 'always'
3124
3520
  */
3125
- subject?: 'always' | 'default' | 'never';
3521
+ subject?: "always" | "default" | "never";
3126
3522
  /**
3127
3523
  * @default true
3128
3524
  */
@@ -3287,7 +3683,7 @@ declare module 'crypto' {
3287
3683
  * @since v15.6.0
3288
3684
  * @return Returns `email` if the certificate matches, `undefined` if it does not.
3289
3685
  */
3290
- checkEmail(email: string, options?: Pick<X509CheckOptions, 'subject'>): string | undefined;
3686
+ checkEmail(email: string, options?: Pick<X509CheckOptions, "subject">): string | undefined;
3291
3687
  /**
3292
3688
  * Checks whether the certificate matches the given host name.
3293
3689
  *
@@ -3401,9 +3797,21 @@ declare module 'crypto' {
3401
3797
  * @param size The size (in bits) of the prime to generate.
3402
3798
  */
3403
3799
  function generatePrime(size: number, callback: (err: Error | null, prime: ArrayBuffer) => void): void;
3404
- function generatePrime(size: number, options: GeneratePrimeOptionsBigInt, callback: (err: Error | null, prime: bigint) => void): void;
3405
- function generatePrime(size: number, options: GeneratePrimeOptionsArrayBuffer, callback: (err: Error | null, prime: ArrayBuffer) => void): void;
3406
- function generatePrime(size: number, options: GeneratePrimeOptions, callback: (err: Error | null, prime: ArrayBuffer | bigint) => void): void;
3800
+ function generatePrime(
3801
+ size: number,
3802
+ options: GeneratePrimeOptionsBigInt,
3803
+ callback: (err: Error | null, prime: bigint) => void,
3804
+ ): void;
3805
+ function generatePrime(
3806
+ size: number,
3807
+ options: GeneratePrimeOptionsArrayBuffer,
3808
+ callback: (err: Error | null, prime: ArrayBuffer) => void,
3809
+ ): void;
3810
+ function generatePrime(
3811
+ size: number,
3812
+ options: GeneratePrimeOptions,
3813
+ callback: (err: Error | null, prime: ArrayBuffer | bigint) => void,
3814
+ ): void;
3407
3815
  /**
3408
3816
  * Generates a pseudorandom prime of `size` bits.
3409
3817
  *
@@ -3452,7 +3860,11 @@ declare module 'crypto' {
3452
3860
  * @param candidate A possible prime encoded as a sequence of big endian octets of arbitrary length.
3453
3861
  */
3454
3862
  function checkPrime(value: LargeNumberLike, callback: (err: Error | null, result: boolean) => void): void;
3455
- function checkPrime(value: LargeNumberLike, options: CheckPrimeOptions, callback: (err: Error | null, result: boolean) => void): void;
3863
+ function checkPrime(
3864
+ value: LargeNumberLike,
3865
+ options: CheckPrimeOptions,
3866
+ callback: (err: Error | null, result: boolean) => void,
3867
+ ): void;
3456
3868
  /**
3457
3869
  * Checks the primality of the `candidate`.
3458
3870
  * @since v15.8.0
@@ -3504,9 +3916,17 @@ declare module 'crypto' {
3504
3916
  const webcrypto: webcrypto.Crypto;
3505
3917
  namespace webcrypto {
3506
3918
  type BufferSource = ArrayBufferView | ArrayBuffer;
3507
- type KeyFormat = 'jwk' | 'pkcs8' | 'raw' | 'spki';
3508
- type KeyType = 'private' | 'public' | 'secret';
3509
- type KeyUsage = 'decrypt' | 'deriveBits' | 'deriveKey' | 'encrypt' | 'sign' | 'unwrapKey' | 'verify' | 'wrapKey';
3919
+ type KeyFormat = "jwk" | "pkcs8" | "raw" | "spki";
3920
+ type KeyType = "private" | "public" | "secret";
3921
+ type KeyUsage =
3922
+ | "decrypt"
3923
+ | "deriveBits"
3924
+ | "deriveKey"
3925
+ | "encrypt"
3926
+ | "sign"
3927
+ | "unwrapKey"
3928
+ | "verify"
3929
+ | "wrapKey";
3510
3930
  type AlgorithmIdentifier = Algorithm | string;
3511
3931
  type HashAlgorithmIdentifier = AlgorithmIdentifier;
3512
3932
  type NamedCurve = string;
@@ -3660,7 +4080,7 @@ declare module 'crypto' {
3660
4080
  /** Illegal constructor */
3661
4081
  (_: { readonly _: unique symbol }): never; // Allows instanceof to work but not be callable by the user.
3662
4082
  readonly length: 0;
3663
- readonly name: 'CryptoKey';
4083
+ readonly name: "CryptoKey";
3664
4084
  readonly prototype: CryptoKey;
3665
4085
  }
3666
4086
  /**
@@ -3733,7 +4153,11 @@ declare module 'crypto' {
3733
4153
  * - `'AES-GCM'`
3734
4154
  * @since v15.0.0
3735
4155
  */
3736
- decrypt(algorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesGcmParams, key: CryptoKey, data: BufferSource): Promise<ArrayBuffer>;
4156
+ decrypt(
4157
+ algorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesGcmParams,
4158
+ key: CryptoKey,
4159
+ data: BufferSource,
4160
+ ): Promise<ArrayBuffer>;
3737
4161
  /**
3738
4162
  * Using the method and parameters specified in `algorithm` and the keying material provided by `baseKey`,
3739
4163
  * `subtle.deriveBits()` attempts to generate `length` bits.
@@ -3752,7 +4176,11 @@ declare module 'crypto' {
3752
4176
  * @since v15.0.0
3753
4177
  */
3754
4178
  deriveBits(algorithm: EcdhKeyDeriveParams, baseKey: CryptoKey, length: number | null): Promise<ArrayBuffer>;
3755
- deriveBits(algorithm: AlgorithmIdentifier | HkdfParams | Pbkdf2Params, baseKey: CryptoKey, length: number): Promise<ArrayBuffer>;
4179
+ deriveBits(
4180
+ algorithm: AlgorithmIdentifier | HkdfParams | Pbkdf2Params,
4181
+ baseKey: CryptoKey,
4182
+ length: number,
4183
+ ): Promise<ArrayBuffer>;
3756
4184
  /**
3757
4185
  * Using the method and parameters specified in `algorithm`, and the keying material provided by `baseKey`,
3758
4186
  * `subtle.deriveKey()` attempts to generate a new <CryptoKey>` based on the method and parameters in `derivedKeyAlgorithm`.
@@ -3773,9 +4201,14 @@ declare module 'crypto' {
3773
4201
  deriveKey(
3774
4202
  algorithm: AlgorithmIdentifier | EcdhKeyDeriveParams | HkdfParams | Pbkdf2Params,
3775
4203
  baseKey: CryptoKey,
3776
- derivedKeyAlgorithm: AlgorithmIdentifier | AesDerivedKeyParams | HmacImportParams | HkdfParams | Pbkdf2Params,
4204
+ derivedKeyAlgorithm:
4205
+ | AlgorithmIdentifier
4206
+ | AesDerivedKeyParams
4207
+ | HmacImportParams
4208
+ | HkdfParams
4209
+ | Pbkdf2Params,
3777
4210
  extractable: boolean,
3778
- keyUsages: ReadonlyArray<KeyUsage>
4211
+ keyUsages: ReadonlyArray<KeyUsage>,
3779
4212
  ): Promise<CryptoKey>;
3780
4213
  /**
3781
4214
  * Using the method identified by `algorithm`, `subtle.digest()` attempts to generate a digest of `data`.
@@ -3805,7 +4238,11 @@ declare module 'crypto' {
3805
4238
  * - `'AES-GCM'`
3806
4239
  * @since v15.0.0
3807
4240
  */
3808
- encrypt(algorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesGcmParams, key: CryptoKey, data: BufferSource): Promise<ArrayBuffer>;
4241
+ encrypt(
4242
+ algorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesGcmParams,
4243
+ key: CryptoKey,
4244
+ data: BufferSource,
4245
+ ): Promise<ArrayBuffer>;
3809
4246
  /**
3810
4247
  * Exports the given key into the specified format, if supported.
3811
4248
  *
@@ -3820,8 +4257,8 @@ declare module 'crypto' {
3820
4257
  * @returns `<Promise>` containing `<ArrayBuffer>`.
3821
4258
  * @since v15.0.0
3822
4259
  */
3823
- exportKey(format: 'jwk', key: CryptoKey): Promise<JsonWebKey>;
3824
- exportKey(format: Exclude<KeyFormat, 'jwk'>, key: CryptoKey): Promise<ArrayBuffer>;
4260
+ exportKey(format: "jwk", key: CryptoKey): Promise<JsonWebKey>;
4261
+ exportKey(format: Exclude<KeyFormat, "jwk">, key: CryptoKey): Promise<ArrayBuffer>;
3825
4262
  /**
3826
4263
  * Using the method and parameters provided in `algorithm`,
3827
4264
  * `subtle.generateKey()` attempts to generate new keying material.
@@ -3848,9 +4285,21 @@ declare module 'crypto' {
3848
4285
  * @param keyUsages See {@link https://nodejs.org/docs/latest/api/webcrypto.html#cryptokeyusages Key usages}.
3849
4286
  * @since v15.0.0
3850
4287
  */
3851
- generateKey(algorithm: RsaHashedKeyGenParams | EcKeyGenParams, extractable: boolean, keyUsages: ReadonlyArray<KeyUsage>): Promise<CryptoKeyPair>;
3852
- generateKey(algorithm: AesKeyGenParams | HmacKeyGenParams | Pbkdf2Params, extractable: boolean, keyUsages: ReadonlyArray<KeyUsage>): Promise<CryptoKey>;
3853
- generateKey(algorithm: AlgorithmIdentifier, extractable: boolean, keyUsages: KeyUsage[]): Promise<CryptoKeyPair | CryptoKey>;
4288
+ generateKey(
4289
+ algorithm: RsaHashedKeyGenParams | EcKeyGenParams,
4290
+ extractable: boolean,
4291
+ keyUsages: ReadonlyArray<KeyUsage>,
4292
+ ): Promise<CryptoKeyPair>;
4293
+ generateKey(
4294
+ algorithm: AesKeyGenParams | HmacKeyGenParams | Pbkdf2Params,
4295
+ extractable: boolean,
4296
+ keyUsages: ReadonlyArray<KeyUsage>,
4297
+ ): Promise<CryptoKey>;
4298
+ generateKey(
4299
+ algorithm: AlgorithmIdentifier,
4300
+ extractable: boolean,
4301
+ keyUsages: KeyUsage[],
4302
+ ): Promise<CryptoKeyPair | CryptoKey>;
3854
4303
  /**
3855
4304
  * The `subtle.importKey()` method attempts to interpret the provided `keyData` as the given `format`
3856
4305
  * to create a `<CryptoKey>` instance using the provided `algorithm`, `extractable`, and `keyUsages` arguments.
@@ -3862,18 +4311,28 @@ declare module 'crypto' {
3862
4311
  * @since v15.0.0
3863
4312
  */
3864
4313
  importKey(
3865
- format: 'jwk',
4314
+ format: "jwk",
3866
4315
  keyData: JsonWebKey,
3867
- algorithm: AlgorithmIdentifier | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | AesKeyAlgorithm,
4316
+ algorithm:
4317
+ | AlgorithmIdentifier
4318
+ | RsaHashedImportParams
4319
+ | EcKeyImportParams
4320
+ | HmacImportParams
4321
+ | AesKeyAlgorithm,
3868
4322
  extractable: boolean,
3869
- keyUsages: ReadonlyArray<KeyUsage>
4323
+ keyUsages: ReadonlyArray<KeyUsage>,
3870
4324
  ): Promise<CryptoKey>;
3871
4325
  importKey(
3872
- format: Exclude<KeyFormat, 'jwk'>,
4326
+ format: Exclude<KeyFormat, "jwk">,
3873
4327
  keyData: BufferSource,
3874
- algorithm: AlgorithmIdentifier | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | AesKeyAlgorithm,
4328
+ algorithm:
4329
+ | AlgorithmIdentifier
4330
+ | RsaHashedImportParams
4331
+ | EcKeyImportParams
4332
+ | HmacImportParams
4333
+ | AesKeyAlgorithm,
3875
4334
  extractable: boolean,
3876
- keyUsages: KeyUsage[]
4335
+ keyUsages: KeyUsage[],
3877
4336
  ): Promise<CryptoKey>;
3878
4337
  /**
3879
4338
  * Using the method and parameters given by `algorithm` and the keying material provided by `key`,
@@ -3890,7 +4349,11 @@ declare module 'crypto' {
3890
4349
  * - `'HMAC'`
3891
4350
  * @since v15.0.0
3892
4351
  */
3893
- sign(algorithm: AlgorithmIdentifier | RsaPssParams | EcdsaParams | Ed448Params, key: CryptoKey, data: BufferSource): Promise<ArrayBuffer>;
4352
+ sign(
4353
+ algorithm: AlgorithmIdentifier | RsaPssParams | EcdsaParams | Ed448Params,
4354
+ key: CryptoKey,
4355
+ data: BufferSource,
4356
+ ): Promise<ArrayBuffer>;
3894
4357
  /**
3895
4358
  * In cryptography, "wrapping a key" refers to exporting and then encrypting the keying material.
3896
4359
  * The `subtle.unwrapKey()` method attempts to decrypt a wrapped key and create a `<CryptoKey>` instance.
@@ -3931,9 +4394,14 @@ declare module 'crypto' {
3931
4394
  wrappedKey: BufferSource,
3932
4395
  unwrappingKey: CryptoKey,
3933
4396
  unwrapAlgorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesGcmParams,
3934
- unwrappedKeyAlgorithm: AlgorithmIdentifier | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | AesKeyAlgorithm,
4397
+ unwrappedKeyAlgorithm:
4398
+ | AlgorithmIdentifier
4399
+ | RsaHashedImportParams
4400
+ | EcKeyImportParams
4401
+ | HmacImportParams
4402
+ | AesKeyAlgorithm,
3935
4403
  extractable: boolean,
3936
- keyUsages: KeyUsage[]
4404
+ keyUsages: KeyUsage[],
3937
4405
  ): Promise<CryptoKey>;
3938
4406
  /**
3939
4407
  * Using the method and parameters given in `algorithm` and the keying material provided by `key`,
@@ -3950,7 +4418,12 @@ declare module 'crypto' {
3950
4418
  * - `'HMAC'`
3951
4419
  * @since v15.0.0
3952
4420
  */
3953
- verify(algorithm: AlgorithmIdentifier | RsaPssParams | EcdsaParams | Ed448Params, key: CryptoKey, signature: BufferSource, data: BufferSource): Promise<boolean>;
4421
+ verify(
4422
+ algorithm: AlgorithmIdentifier | RsaPssParams | EcdsaParams | Ed448Params,
4423
+ key: CryptoKey,
4424
+ signature: BufferSource,
4425
+ data: BufferSource,
4426
+ ): Promise<boolean>;
3954
4427
  /**
3955
4428
  * In cryptography, "wrapping a key" refers to exporting and then encrypting the keying material.
3956
4429
  * The `subtle.wrapKey()` method exports the keying material into the format identified by `format`,
@@ -3969,10 +4442,15 @@ declare module 'crypto' {
3969
4442
  * @param format Must be one of `'raw'`, `'pkcs8'`, `'spki'`, or `'jwk'`.
3970
4443
  * @since v15.0.0
3971
4444
  */
3972
- wrapKey(format: KeyFormat, key: CryptoKey, wrappingKey: CryptoKey, wrapAlgorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesGcmParams): Promise<ArrayBuffer>;
4445
+ wrapKey(
4446
+ format: KeyFormat,
4447
+ key: CryptoKey,
4448
+ wrappingKey: CryptoKey,
4449
+ wrapAlgorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesGcmParams,
4450
+ ): Promise<ArrayBuffer>;
3973
4451
  }
3974
4452
  }
3975
4453
  }
3976
- declare module 'node:crypto' {
3977
- export * from 'crypto';
4454
+ declare module "node:crypto" {
4455
+ export * from "crypto";
3978
4456
  }