@types/node 16.18.53 → 16.18.55

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 (100) hide show
  1. node v16.18/README.md +1 -1
  2. node v16.18/assert/strict.d.ts +4 -4
  3. node v16.18/assert.d.ts +48 -24
  4. node v16.18/async_hooks.d.ts +10 -7
  5. node v16.18/buffer.d.ts +47 -24
  6. node v16.18/child_process.d.ts +262 -122
  7. node v16.18/cluster.d.ts +107 -89
  8. node v16.18/console.d.ts +7 -7
  9. node v16.18/constants.d.ts +12 -11
  10. node v16.18/crypto.d.ts +738 -267
  11. node v16.18/dgram.d.ts +81 -45
  12. node v16.18/diagnostics_channel.d.ts +3 -3
  13. node v16.18/dns/promises.d.ts +28 -25
  14. node v16.18/dns.d.ts +202 -61
  15. node v16.18/domain.d.ts +4 -4
  16. node v16.18/events.d.ts +15 -7
  17. node v16.18/fs/promises.d.ts +93 -64
  18. node v16.18/fs.d.ts +485 -290
  19. node v16.18/globals.d.ts +13 -13
  20. node v16.18/http.d.ts +237 -157
  21. node v16.18/http2.d.ts +628 -376
  22. node v16.18/https.d.ts +107 -105
  23. node v16.18/module.d.ts +11 -8
  24. node v16.18/net.d.ts +106 -87
  25. node v16.18/os.d.ts +7 -7
  26. node v16.18/package.json +2 -2
  27. node v16.18/path.d.ts +13 -13
  28. node v16.18/perf_hooks.d.ts +17 -15
  29. node v16.18/process.d.ts +144 -124
  30. node v16.18/punycode.d.ts +3 -3
  31. node v16.18/querystring.d.ts +14 -4
  32. node v16.18/readline.d.ts +64 -54
  33. node v16.18/repl.d.ts +67 -61
  34. node v16.18/stream/consumers.d.ts +4 -4
  35. node v16.18/stream/promises.d.ts +56 -15
  36. node v16.18/stream/web.d.ts +19 -19
  37. node v16.18/stream.d.ts +314 -216
  38. node v16.18/string_decoder.d.ts +3 -3
  39. node v16.18/test.d.ts +2 -2
  40. node v16.18/timers/promises.d.ts +4 -4
  41. node v16.18/timers.d.ts +23 -8
  42. node v16.18/tls.d.ts +150 -71
  43. node v16.18/trace_events.d.ts +3 -3
  44. node v16.18/ts4.8/assert/strict.d.ts +4 -4
  45. node v16.18/ts4.8/assert.d.ts +48 -24
  46. node v16.18/ts4.8/async_hooks.d.ts +10 -7
  47. node v16.18/ts4.8/buffer.d.ts +47 -24
  48. node v16.18/ts4.8/child_process.d.ts +262 -122
  49. node v16.18/ts4.8/cluster.d.ts +107 -89
  50. node v16.18/ts4.8/console.d.ts +7 -7
  51. node v16.18/ts4.8/constants.d.ts +12 -11
  52. node v16.18/ts4.8/crypto.d.ts +738 -267
  53. node v16.18/ts4.8/dgram.d.ts +81 -45
  54. node v16.18/ts4.8/diagnostics_channel.d.ts +3 -3
  55. node v16.18/ts4.8/dns/promises.d.ts +28 -25
  56. node v16.18/ts4.8/dns.d.ts +202 -61
  57. node v16.18/ts4.8/domain.d.ts +4 -4
  58. node v16.18/ts4.8/events.d.ts +15 -7
  59. node v16.18/ts4.8/fs/promises.d.ts +93 -64
  60. node v16.18/ts4.8/fs.d.ts +485 -290
  61. node v16.18/ts4.8/globals.d.ts +13 -13
  62. node v16.18/ts4.8/http.d.ts +236 -156
  63. node v16.18/ts4.8/http2.d.ts +628 -376
  64. node v16.18/ts4.8/https.d.ts +107 -105
  65. node v16.18/ts4.8/module.d.ts +11 -8
  66. node v16.18/ts4.8/net.d.ts +106 -87
  67. node v16.18/ts4.8/os.d.ts +7 -7
  68. node v16.18/ts4.8/path.d.ts +13 -13
  69. node v16.18/ts4.8/perf_hooks.d.ts +17 -15
  70. node v16.18/ts4.8/process.d.ts +144 -124
  71. node v16.18/ts4.8/punycode.d.ts +3 -3
  72. node v16.18/ts4.8/querystring.d.ts +14 -4
  73. node v16.18/ts4.8/readline.d.ts +64 -54
  74. node v16.18/ts4.8/repl.d.ts +67 -61
  75. node v16.18/ts4.8/stream/consumers.d.ts +4 -4
  76. node v16.18/ts4.8/stream/promises.d.ts +56 -15
  77. node v16.18/ts4.8/stream/web.d.ts +19 -19
  78. node v16.18/ts4.8/stream.d.ts +309 -214
  79. node v16.18/ts4.8/string_decoder.d.ts +3 -3
  80. node v16.18/ts4.8/test.d.ts +2 -2
  81. node v16.18/ts4.8/timers/promises.d.ts +4 -4
  82. node v16.18/ts4.8/timers.d.ts +23 -8
  83. node v16.18/ts4.8/tls.d.ts +150 -71
  84. node v16.18/ts4.8/trace_events.d.ts +3 -3
  85. node v16.18/ts4.8/tty.d.ts +10 -10
  86. node v16.18/ts4.8/url.d.ts +26 -14
  87. node v16.18/ts4.8/util.d.ts +122 -51
  88. node v16.18/ts4.8/v8.d.ts +4 -4
  89. node v16.18/ts4.8/vm.d.ts +18 -18
  90. node v16.18/ts4.8/wasi.d.ts +3 -3
  91. node v16.18/ts4.8/worker_threads.d.ts +77 -77
  92. node v16.18/ts4.8/zlib.d.ts +9 -9
  93. node v16.18/tty.d.ts +10 -10
  94. node v16.18/url.d.ts +26 -14
  95. node v16.18/util.d.ts +122 -51
  96. node v16.18/v8.d.ts +4 -4
  97. node v16.18/vm.d.ts +18 -18
  98. node v16.18/wasi.d.ts +3 -3
  99. node v16.18/worker_threads.d.ts +77 -77
  100. node v16.18/zlib.d.ts +9 -9
@@ -15,9 +15,9 @@
15
15
  * ```
16
16
  * @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/crypto.js)
17
17
  */
18
- declare module 'crypto' {
19
- import * as stream from 'node:stream';
20
- import { PeerCertificate } from 'node:tls';
18
+ declare module "crypto" {
19
+ import * as stream from "node:stream";
20
+ import { PeerCertificate } from "node:tls";
21
21
  interface Certificate {
22
22
  /**
23
23
  * @deprecated
@@ -44,7 +44,7 @@ declare module 'crypto' {
44
44
  }
45
45
  const Certificate: Certificate & {
46
46
  /** @deprecated since v14.9.0 - Use static methods of `crypto.Certificate` instead. */
47
- new (): Certificate;
47
+ new(): Certificate;
48
48
  /** @deprecated since v14.9.0 - Use static methods of `crypto.Certificate` instead. */
49
49
  (): Certificate;
50
50
  /**
@@ -250,11 +250,11 @@ declare module 'crypto' {
250
250
  */
251
251
  function createHmac(algorithm: string, key: BinaryLike | KeyObject, options?: stream.TransformOptions): Hmac;
252
252
  // https://nodejs.org/api/buffer.html#buffer_buffers_and_character_encodings
253
- type BinaryToTextEncoding = 'base64' | 'base64url' | 'hex';
254
- type CharacterEncoding = 'utf8' | 'utf-8' | 'utf16le' | 'latin1';
255
- type LegacyCharacterEncoding = 'ascii' | 'binary' | 'ucs2' | 'ucs-2';
253
+ type BinaryToTextEncoding = "base64" | "base64url" | "hex";
254
+ type CharacterEncoding = "utf8" | "utf-8" | "utf16le" | "latin1";
255
+ type LegacyCharacterEncoding = "ascii" | "binary" | "ucs2" | "ucs-2";
256
256
  type Encoding = BinaryToTextEncoding | CharacterEncoding | LegacyCharacterEncoding;
257
- type ECDHKeyFormat = 'compressed' | 'uncompressed' | 'hybrid';
257
+ type ECDHKeyFormat = "compressed" | "uncompressed" | "hybrid";
258
258
  /**
259
259
  * The `Hash` class is a utility for creating hash digests of data. It can be
260
260
  * used in one of two ways:
@@ -473,15 +473,15 @@ declare module 'crypto' {
473
473
  digest(): Buffer;
474
474
  digest(encoding: BinaryToTextEncoding): string;
475
475
  }
476
- type KeyObjectType = 'secret' | 'public' | 'private';
476
+ type KeyObjectType = "secret" | "public" | "private";
477
477
  interface KeyExportOptions<T extends KeyFormat> {
478
- type: 'pkcs1' | 'spki' | 'pkcs8' | 'sec1';
478
+ type: "pkcs1" | "spki" | "pkcs8" | "sec1";
479
479
  format: T;
480
480
  cipher?: string | undefined;
481
481
  passphrase?: string | Buffer | undefined;
482
482
  }
483
483
  interface JwkKeyExportOptions {
484
- format: 'jwk';
484
+ format: "jwk";
485
485
  }
486
486
  interface JsonWebKey {
487
487
  crv?: string | undefined;
@@ -625,8 +625,8 @@ declare module 'crypto' {
625
625
  * PKCS#1 and SEC1 encryption.
626
626
  * @since v11.6.0
627
627
  */
628
- export(options: KeyExportOptions<'pem'>): string | Buffer;
629
- export(options?: KeyExportOptions<'der'>): Buffer;
628
+ export(options: KeyExportOptions<"pem">): string | Buffer;
629
+ export(options?: KeyExportOptions<"der">): Buffer;
630
630
  export(options?: JwkKeyExportOptions): JsonWebKey;
631
631
  /**
632
632
  * For secret keys, this property represents the size of the key in bytes. This
@@ -641,9 +641,9 @@ declare module 'crypto' {
641
641
  */
642
642
  type: KeyObjectType;
643
643
  }
644
- type CipherCCMTypes = 'aes-128-ccm' | 'aes-192-ccm' | 'aes-256-ccm' | 'chacha20-poly1305';
645
- type CipherGCMTypes = 'aes-128-gcm' | 'aes-192-gcm' | 'aes-256-gcm';
646
- type CipherOCBTypes = 'aes-128-ocb' | 'aes-192-ocb' | 'aes-256-ocb';
644
+ type CipherCCMTypes = "aes-128-ccm" | "aes-192-ccm" | "aes-256-ccm" | "chacha20-poly1305";
645
+ type CipherGCMTypes = "aes-128-gcm" | "aes-192-gcm" | "aes-256-gcm";
646
+ type CipherOCBTypes = "aes-128-ocb" | "aes-192-ocb" | "aes-256-ocb";
647
647
  type BinaryLike = string | NodeJS.ArrayBufferView;
648
648
  type CipherKey = BinaryLike | KeyObject;
649
649
  interface CipherCCMOptions extends stream.TransformOptions {
@@ -721,10 +721,30 @@ declare module 'crypto' {
721
721
  * @since v0.1.94
722
722
  * @param options `stream.transform` options
723
723
  */
724
- function createCipheriv(algorithm: CipherCCMTypes, key: CipherKey, iv: BinaryLike, options: CipherCCMOptions): CipherCCM;
725
- function createCipheriv(algorithm: CipherOCBTypes, key: CipherKey, iv: BinaryLike, options: CipherOCBOptions): CipherOCB;
726
- function createCipheriv(algorithm: CipherGCMTypes, key: CipherKey, iv: BinaryLike, options?: CipherGCMOptions): CipherGCM;
727
- function createCipheriv(algorithm: string, key: CipherKey, iv: BinaryLike | null, options?: stream.TransformOptions): Cipher;
724
+ function createCipheriv(
725
+ algorithm: CipherCCMTypes,
726
+ key: CipherKey,
727
+ iv: BinaryLike,
728
+ options: CipherCCMOptions,
729
+ ): CipherCCM;
730
+ function createCipheriv(
731
+ algorithm: CipherOCBTypes,
732
+ key: CipherKey,
733
+ iv: BinaryLike,
734
+ options: CipherOCBOptions,
735
+ ): CipherOCB;
736
+ function createCipheriv(
737
+ algorithm: CipherGCMTypes,
738
+ key: CipherKey,
739
+ iv: BinaryLike,
740
+ options?: CipherGCMOptions,
741
+ ): CipherGCM;
742
+ function createCipheriv(
743
+ algorithm: string,
744
+ key: CipherKey,
745
+ iv: BinaryLike | null,
746
+ options?: stream.TransformOptions,
747
+ ): Cipher;
728
748
  /**
729
749
  * Instances of the `Cipher` class are used to encrypt data. The class can be
730
750
  * used in one of two ways:
@@ -896,7 +916,7 @@ declare module 'crypto' {
896
916
  buffer: NodeJS.ArrayBufferView,
897
917
  options: {
898
918
  plaintextLength: number;
899
- }
919
+ },
900
920
  ): this;
901
921
  getAuthTag(): Buffer;
902
922
  }
@@ -905,7 +925,7 @@ declare module 'crypto' {
905
925
  buffer: NodeJS.ArrayBufferView,
906
926
  options?: {
907
927
  plaintextLength: number;
908
- }
928
+ },
909
929
  ): this;
910
930
  getAuthTag(): Buffer;
911
931
  }
@@ -914,7 +934,7 @@ declare module 'crypto' {
914
934
  buffer: NodeJS.ArrayBufferView,
915
935
  options?: {
916
936
  plaintextLength: number;
917
- }
937
+ },
918
938
  ): this;
919
939
  getAuthTag(): Buffer;
920
940
  }
@@ -972,10 +992,30 @@ declare module 'crypto' {
972
992
  * @since v0.1.94
973
993
  * @param options `stream.transform` options
974
994
  */
975
- function createDecipheriv(algorithm: CipherCCMTypes, key: CipherKey, iv: BinaryLike, options: CipherCCMOptions): DecipherCCM;
976
- function createDecipheriv(algorithm: CipherOCBTypes, key: CipherKey, iv: BinaryLike, options: CipherOCBOptions): DecipherOCB;
977
- function createDecipheriv(algorithm: CipherGCMTypes, key: CipherKey, iv: BinaryLike, options?: CipherGCMOptions): DecipherGCM;
978
- function createDecipheriv(algorithm: string, key: CipherKey, iv: BinaryLike | null, options?: stream.TransformOptions): Decipher;
995
+ function createDecipheriv(
996
+ algorithm: CipherCCMTypes,
997
+ key: CipherKey,
998
+ iv: BinaryLike,
999
+ options: CipherCCMOptions,
1000
+ ): DecipherCCM;
1001
+ function createDecipheriv(
1002
+ algorithm: CipherOCBTypes,
1003
+ key: CipherKey,
1004
+ iv: BinaryLike,
1005
+ options: CipherOCBOptions,
1006
+ ): DecipherOCB;
1007
+ function createDecipheriv(
1008
+ algorithm: CipherGCMTypes,
1009
+ key: CipherKey,
1010
+ iv: BinaryLike,
1011
+ options?: CipherGCMOptions,
1012
+ ): DecipherGCM;
1013
+ function createDecipheriv(
1014
+ algorithm: string,
1015
+ key: CipherKey,
1016
+ iv: BinaryLike | null,
1017
+ options?: stream.TransformOptions,
1018
+ ): Decipher;
979
1019
  /**
980
1020
  * Instances of the `Decipher` class are used to decrypt data. The class can be
981
1021
  * used in one of two ways:
@@ -1133,7 +1173,7 @@ declare module 'crypto' {
1133
1173
  buffer: NodeJS.ArrayBufferView,
1134
1174
  options: {
1135
1175
  plaintextLength: number;
1136
- }
1176
+ },
1137
1177
  ): this;
1138
1178
  }
1139
1179
  interface DecipherGCM extends Decipher {
@@ -1142,7 +1182,7 @@ declare module 'crypto' {
1142
1182
  buffer: NodeJS.ArrayBufferView,
1143
1183
  options?: {
1144
1184
  plaintextLength: number;
1145
- }
1185
+ },
1146
1186
  ): this;
1147
1187
  }
1148
1188
  interface DecipherOCB extends Decipher {
@@ -1151,19 +1191,19 @@ declare module 'crypto' {
1151
1191
  buffer: NodeJS.ArrayBufferView,
1152
1192
  options?: {
1153
1193
  plaintextLength: number;
1154
- }
1194
+ },
1155
1195
  ): this;
1156
1196
  }
1157
1197
  interface PrivateKeyInput {
1158
1198
  key: string | Buffer;
1159
1199
  format?: KeyFormat | undefined;
1160
- type?: 'pkcs1' | 'pkcs8' | 'sec1' | undefined;
1200
+ type?: "pkcs1" | "pkcs8" | "sec1" | undefined;
1161
1201
  passphrase?: string | Buffer | undefined;
1162
1202
  }
1163
1203
  interface PublicKeyInput {
1164
1204
  key: string | Buffer;
1165
1205
  format?: KeyFormat | undefined;
1166
- type?: 'pkcs1' | 'spki' | undefined;
1206
+ type?: "pkcs1" | "spki" | undefined;
1167
1207
  }
1168
1208
  /**
1169
1209
  * Asynchronously generates a new random secret key of the given `length`. The`type` will determine which validations will be performed on the `length`.
@@ -1182,11 +1222,11 @@ declare module 'crypto' {
1182
1222
  * @param type The intended use of the generated secret key. Currently accepted values are `'hmac'` and `'aes'`.
1183
1223
  */
1184
1224
  function generateKey(
1185
- type: 'hmac' | 'aes',
1225
+ type: "hmac" | "aes",
1186
1226
  options: {
1187
1227
  length: number;
1188
1228
  },
1189
- callback: (err: Error | null, key: KeyObject) => void
1229
+ callback: (err: Error | null, key: KeyObject) => void,
1190
1230
  ): void;
1191
1231
  /**
1192
1232
  * Synchronously generates a new random secret key of the given `length`. The`type` will determine which validations will be performed on the `length`.
@@ -1203,14 +1243,14 @@ declare module 'crypto' {
1203
1243
  * @param type The intended use of the generated secret key. Currently accepted values are `'hmac'` and `'aes'`.
1204
1244
  */
1205
1245
  function generateKeySync(
1206
- type: 'hmac' | 'aes',
1246
+ type: "hmac" | "aes",
1207
1247
  options: {
1208
1248
  length: number;
1209
- }
1249
+ },
1210
1250
  ): KeyObject;
1211
1251
  interface JsonWebKeyInput {
1212
1252
  key: JsonWebKey;
1213
- format: 'jwk';
1253
+ format: "jwk";
1214
1254
  }
1215
1255
  /**
1216
1256
  * Creates and returns a new key object containing a private key. If `key` is a
@@ -1257,7 +1297,7 @@ declare module 'crypto' {
1257
1297
  * @param options `stream.Writable` options
1258
1298
  */
1259
1299
  function createSign(algorithm: string, options?: stream.WritableOptions): Sign;
1260
- type DSAEncoding = 'der' | 'ieee-p1363';
1300
+ type DSAEncoding = "der" | "ieee-p1363";
1261
1301
  interface SigningOptions {
1262
1302
  /**
1263
1303
  * @see crypto.constants.RSA_PKCS1_PADDING
@@ -1366,7 +1406,10 @@ declare module 'crypto' {
1366
1406
  * @since v0.1.92
1367
1407
  */
1368
1408
  sign(privateKey: KeyLike | SignKeyObjectInput | SignPrivateKeyInput): Buffer;
1369
- sign(privateKey: KeyLike | SignKeyObjectInput | SignPrivateKeyInput, outputFormat: BinaryToTextEncoding): string;
1409
+ sign(
1410
+ privateKey: KeyLike | SignKeyObjectInput | SignPrivateKeyInput,
1411
+ outputFormat: BinaryToTextEncoding,
1412
+ ): string;
1370
1413
  }
1371
1414
  /**
1372
1415
  * Creates and returns a `Verify` object that uses the given algorithm.
@@ -1429,8 +1472,15 @@ declare module 'crypto' {
1429
1472
  * be passed instead of a public key.
1430
1473
  * @since v0.1.92
1431
1474
  */
1432
- verify(object: KeyLike | VerifyKeyObjectInput | VerifyPublicKeyInput | VerifyJsonWebKeyInput, signature: NodeJS.ArrayBufferView): boolean;
1433
- verify(object: KeyLike | VerifyKeyObjectInput | VerifyPublicKeyInput | VerifyJsonWebKeyInput, signature: string, signature_format?: BinaryToTextEncoding): boolean;
1475
+ verify(
1476
+ object: KeyLike | VerifyKeyObjectInput | VerifyPublicKeyInput | VerifyJsonWebKeyInput,
1477
+ signature: NodeJS.ArrayBufferView,
1478
+ ): boolean;
1479
+ verify(
1480
+ object: KeyLike | VerifyKeyObjectInput | VerifyPublicKeyInput | VerifyJsonWebKeyInput,
1481
+ signature: string,
1482
+ signature_format?: BinaryToTextEncoding,
1483
+ ): boolean;
1434
1484
  }
1435
1485
  /**
1436
1486
  * Creates a `DiffieHellman` key exchange object using the supplied `prime` and an
@@ -1451,8 +1501,17 @@ declare module 'crypto' {
1451
1501
  function createDiffieHellman(primeLength: number, generator?: number | NodeJS.ArrayBufferView): DiffieHellman;
1452
1502
  function createDiffieHellman(prime: NodeJS.ArrayBufferView): DiffieHellman;
1453
1503
  function createDiffieHellman(prime: string, primeEncoding: BinaryToTextEncoding): DiffieHellman;
1454
- function createDiffieHellman(prime: string, primeEncoding: BinaryToTextEncoding, generator: number | NodeJS.ArrayBufferView): DiffieHellman;
1455
- function createDiffieHellman(prime: string, primeEncoding: BinaryToTextEncoding, generator: string, generatorEncoding: BinaryToTextEncoding): DiffieHellman;
1504
+ function createDiffieHellman(
1505
+ prime: string,
1506
+ primeEncoding: BinaryToTextEncoding,
1507
+ generator: number | NodeJS.ArrayBufferView,
1508
+ ): DiffieHellman;
1509
+ function createDiffieHellman(
1510
+ prime: string,
1511
+ primeEncoding: BinaryToTextEncoding,
1512
+ generator: string,
1513
+ generatorEncoding: BinaryToTextEncoding,
1514
+ ): DiffieHellman;
1456
1515
  /**
1457
1516
  * The `DiffieHellman` class is a utility for creating Diffie-Hellman key
1458
1517
  * exchanges.
@@ -1510,8 +1569,16 @@ declare module 'crypto' {
1510
1569
  */
1511
1570
  computeSecret(otherPublicKey: NodeJS.ArrayBufferView, inputEncoding?: null, outputEncoding?: null): Buffer;
1512
1571
  computeSecret(otherPublicKey: string, inputEncoding: BinaryToTextEncoding, outputEncoding?: null): Buffer;
1513
- computeSecret(otherPublicKey: NodeJS.ArrayBufferView, inputEncoding: null, outputEncoding: BinaryToTextEncoding): string;
1514
- computeSecret(otherPublicKey: string, inputEncoding: BinaryToTextEncoding, outputEncoding: BinaryToTextEncoding): string;
1572
+ computeSecret(
1573
+ otherPublicKey: NodeJS.ArrayBufferView,
1574
+ inputEncoding: null,
1575
+ outputEncoding: BinaryToTextEncoding,
1576
+ ): string;
1577
+ computeSecret(
1578
+ otherPublicKey: string,
1579
+ inputEncoding: BinaryToTextEncoding,
1580
+ outputEncoding: BinaryToTextEncoding,
1581
+ ): string;
1515
1582
  /**
1516
1583
  * Returns the Diffie-Hellman prime in the specified `encoding`.
1517
1584
  * If `encoding` is provided a string is
@@ -1609,7 +1676,7 @@ declare module 'crypto' {
1609
1676
  (name: string): DiffieHellmanGroup;
1610
1677
  readonly prototype: DiffieHellmanGroup;
1611
1678
  }
1612
- type DiffieHellmanGroup = Omit<DiffieHellman, 'setPublicKey' | 'setPrivateKey'>;
1679
+ type DiffieHellmanGroup = Omit<DiffieHellman, "setPublicKey" | "setPrivateKey">;
1613
1680
  /**
1614
1681
  * Creates a predefined `DiffieHellmanGroup` key exchange object. The
1615
1682
  * supported groups are: `'modp1'`, `'modp2'`, `'modp5'` (defined in [RFC 2412](https://www.rfc-editor.org/rfc/rfc2412.txt), but see `Caveats`) and `'modp14'`, `'modp15'`,`'modp16'`, `'modp17'`,
@@ -1696,7 +1763,14 @@ declare module 'crypto' {
1696
1763
  * negative performance implications for some applications; see the `UV_THREADPOOL_SIZE` documentation for more information.
1697
1764
  * @since v0.5.5
1698
1765
  */
1699
- function pbkdf2(password: BinaryLike, salt: BinaryLike, iterations: number, keylen: number, digest: string, callback: (err: Error | null, derivedKey: Buffer) => void): void;
1766
+ function pbkdf2(
1767
+ password: BinaryLike,
1768
+ salt: BinaryLike,
1769
+ iterations: number,
1770
+ keylen: number,
1771
+ digest: string,
1772
+ callback: (err: Error | null, derivedKey: Buffer) => void,
1773
+ ): void;
1700
1774
  /**
1701
1775
  * Provides a synchronous Password-Based Key Derivation Function 2 (PBKDF2)
1702
1776
  * implementation. A selected HMAC digest algorithm specified by `digest` is
@@ -1739,7 +1813,13 @@ declare module 'crypto' {
1739
1813
  * An array of supported digest functions can be retrieved using {@link getHashes}.
1740
1814
  * @since v0.9.3
1741
1815
  */
1742
- function pbkdf2Sync(password: BinaryLike, salt: BinaryLike, iterations: number, keylen: number, digest: string): Buffer;
1816
+ function pbkdf2Sync(
1817
+ password: BinaryLike,
1818
+ salt: BinaryLike,
1819
+ iterations: number,
1820
+ keylen: number,
1821
+ digest: string,
1822
+ ): Buffer;
1743
1823
  /**
1744
1824
  * Generates cryptographically strong pseudorandom data. The `size` argument
1745
1825
  * is a number indicating the number of bytes to generate.
@@ -1963,9 +2043,21 @@ declare module 'crypto' {
1963
2043
  * @param [size=buffer.length - offset]
1964
2044
  * @param callback `function(err, buf) {}`.
1965
2045
  */
1966
- function randomFill<T extends NodeJS.ArrayBufferView>(buffer: T, callback: (err: Error | null, buf: T) => void): void;
1967
- function randomFill<T extends NodeJS.ArrayBufferView>(buffer: T, offset: number, callback: (err: Error | null, buf: T) => void): void;
1968
- function randomFill<T extends NodeJS.ArrayBufferView>(buffer: T, offset: number, size: number, callback: (err: Error | null, buf: T) => void): void;
2046
+ function randomFill<T extends NodeJS.ArrayBufferView>(
2047
+ buffer: T,
2048
+ callback: (err: Error | null, buf: T) => void,
2049
+ ): void;
2050
+ function randomFill<T extends NodeJS.ArrayBufferView>(
2051
+ buffer: T,
2052
+ offset: number,
2053
+ callback: (err: Error | null, buf: T) => void,
2054
+ ): void;
2055
+ function randomFill<T extends NodeJS.ArrayBufferView>(
2056
+ buffer: T,
2057
+ offset: number,
2058
+ size: number,
2059
+ callback: (err: Error | null, buf: T) => void,
2060
+ ): void;
1969
2061
  interface ScryptOptions {
1970
2062
  cost?: number | undefined;
1971
2063
  blockSize?: number | undefined;
@@ -2009,8 +2101,19 @@ declare module 'crypto' {
2009
2101
  * ```
2010
2102
  * @since v10.5.0
2011
2103
  */
2012
- function scrypt(password: BinaryLike, salt: BinaryLike, keylen: number, callback: (err: Error | null, derivedKey: Buffer) => void): void;
2013
- function scrypt(password: BinaryLike, salt: BinaryLike, keylen: number, options: ScryptOptions, callback: (err: Error | null, derivedKey: Buffer) => void): void;
2104
+ function scrypt(
2105
+ password: BinaryLike,
2106
+ salt: BinaryLike,
2107
+ keylen: number,
2108
+ callback: (err: Error | null, derivedKey: Buffer) => void,
2109
+ ): void;
2110
+ function scrypt(
2111
+ password: BinaryLike,
2112
+ salt: BinaryLike,
2113
+ keylen: number,
2114
+ options: ScryptOptions,
2115
+ callback: (err: Error | null, derivedKey: Buffer) => void,
2116
+ ): void;
2014
2117
  /**
2015
2118
  * Provides a synchronous [scrypt](https://en.wikipedia.org/wiki/Scrypt) implementation. Scrypt is a password-based
2016
2119
  * key derivation function that is designed to be expensive computationally and
@@ -2223,8 +2326,8 @@ declare module 'crypto' {
2223
2326
  key: BinaryLike,
2224
2327
  curve: string,
2225
2328
  inputEncoding?: BinaryToTextEncoding,
2226
- outputEncoding?: 'latin1' | 'hex' | 'base64' | 'base64url',
2227
- format?: 'uncompressed' | 'compressed' | 'hybrid'
2329
+ outputEncoding?: "latin1" | "hex" | "base64" | "base64url",
2330
+ format?: "uncompressed" | "compressed" | "hybrid",
2228
2331
  ): Buffer | string;
2229
2332
  /**
2230
2333
  * Generates private and public EC Diffie-Hellman key values, and returns
@@ -2260,7 +2363,11 @@ declare module 'crypto' {
2260
2363
  computeSecret(otherPublicKey: NodeJS.ArrayBufferView): Buffer;
2261
2364
  computeSecret(otherPublicKey: string, inputEncoding: BinaryToTextEncoding): Buffer;
2262
2365
  computeSecret(otherPublicKey: NodeJS.ArrayBufferView, outputEncoding: BinaryToTextEncoding): string;
2263
- computeSecret(otherPublicKey: string, inputEncoding: BinaryToTextEncoding, outputEncoding: BinaryToTextEncoding): string;
2366
+ computeSecret(
2367
+ otherPublicKey: string,
2368
+ inputEncoding: BinaryToTextEncoding,
2369
+ outputEncoding: BinaryToTextEncoding,
2370
+ ): string;
2264
2371
  /**
2265
2372
  * If `encoding` is specified, a string is returned; otherwise a `Buffer` is
2266
2373
  * returned.
@@ -2325,8 +2432,8 @@ declare module 'crypto' {
2325
2432
  function timingSafeEqual(a: NodeJS.ArrayBufferView, b: NodeJS.ArrayBufferView): boolean;
2326
2433
  /** @deprecated since v10.0.0 */
2327
2434
  const DEFAULT_ENCODING: BufferEncoding;
2328
- type KeyType = 'rsa' | 'rsa-pss' | 'dsa' | 'ec' | 'ed25519' | 'ed448' | 'x25519' | 'x448';
2329
- type KeyFormat = 'pem' | 'der' | 'jwk';
2435
+ type KeyType = "rsa" | "rsa-pss" | "dsa" | "ec" | "ed25519" | "ed448" | "x25519" | "x448";
2436
+ type KeyFormat = "pem" | "der" | "jwk";
2330
2437
  interface BasePrivateKeyEncodingOptions<T extends KeyFormat> {
2331
2438
  format: T;
2332
2439
  cipher?: string | undefined;
@@ -2401,11 +2508,11 @@ declare module 'crypto' {
2401
2508
  */
2402
2509
  publicExponent?: number | undefined;
2403
2510
  publicKeyEncoding: {
2404
- type: 'pkcs1' | 'spki';
2511
+ type: "pkcs1" | "spki";
2405
2512
  format: PubF;
2406
2513
  };
2407
2514
  privateKeyEncoding: BasePrivateKeyEncodingOptions<PrivF> & {
2408
- type: 'pkcs1' | 'pkcs8';
2515
+ type: "pkcs1" | "pkcs8";
2409
2516
  };
2410
2517
  }
2411
2518
  interface RSAPSSKeyPairOptions<PubF extends KeyFormat, PrivF extends KeyFormat> {
@@ -2431,11 +2538,11 @@ declare module 'crypto' {
2431
2538
  */
2432
2539
  saltLength?: string;
2433
2540
  publicKeyEncoding: {
2434
- type: 'spki';
2541
+ type: "spki";
2435
2542
  format: PubF;
2436
2543
  };
2437
2544
  privateKeyEncoding: BasePrivateKeyEncodingOptions<PrivF> & {
2438
- type: 'pkcs8';
2545
+ type: "pkcs8";
2439
2546
  };
2440
2547
  }
2441
2548
  interface DSAKeyPairOptions<PubF extends KeyFormat, PrivF extends KeyFormat> {
@@ -2448,11 +2555,11 @@ declare module 'crypto' {
2448
2555
  */
2449
2556
  divisorLength: number;
2450
2557
  publicKeyEncoding: {
2451
- type: 'spki';
2558
+ type: "spki";
2452
2559
  format: PubF;
2453
2560
  };
2454
2561
  privateKeyEncoding: BasePrivateKeyEncodingOptions<PrivF> & {
2455
- type: 'pkcs8';
2562
+ type: "pkcs8";
2456
2563
  };
2457
2564
  }
2458
2565
  interface ECKeyPairOptions<PubF extends KeyFormat, PrivF extends KeyFormat> {
@@ -2461,47 +2568,47 @@ declare module 'crypto' {
2461
2568
  */
2462
2569
  namedCurve: string;
2463
2570
  publicKeyEncoding: {
2464
- type: 'pkcs1' | 'spki';
2571
+ type: "pkcs1" | "spki";
2465
2572
  format: PubF;
2466
2573
  };
2467
2574
  privateKeyEncoding: BasePrivateKeyEncodingOptions<PrivF> & {
2468
- type: 'sec1' | 'pkcs8';
2575
+ type: "sec1" | "pkcs8";
2469
2576
  };
2470
2577
  }
2471
2578
  interface ED25519KeyPairOptions<PubF extends KeyFormat, PrivF extends KeyFormat> {
2472
2579
  publicKeyEncoding: {
2473
- type: 'spki';
2580
+ type: "spki";
2474
2581
  format: PubF;
2475
2582
  };
2476
2583
  privateKeyEncoding: BasePrivateKeyEncodingOptions<PrivF> & {
2477
- type: 'pkcs8';
2584
+ type: "pkcs8";
2478
2585
  };
2479
2586
  }
2480
2587
  interface ED448KeyPairOptions<PubF extends KeyFormat, PrivF extends KeyFormat> {
2481
2588
  publicKeyEncoding: {
2482
- type: 'spki';
2589
+ type: "spki";
2483
2590
  format: PubF;
2484
2591
  };
2485
2592
  privateKeyEncoding: BasePrivateKeyEncodingOptions<PrivF> & {
2486
- type: 'pkcs8';
2593
+ type: "pkcs8";
2487
2594
  };
2488
2595
  }
2489
2596
  interface X25519KeyPairOptions<PubF extends KeyFormat, PrivF extends KeyFormat> {
2490
2597
  publicKeyEncoding: {
2491
- type: 'spki';
2598
+ type: "spki";
2492
2599
  format: PubF;
2493
2600
  };
2494
2601
  privateKeyEncoding: BasePrivateKeyEncodingOptions<PrivF> & {
2495
- type: 'pkcs8';
2602
+ type: "pkcs8";
2496
2603
  };
2497
2604
  }
2498
2605
  interface X448KeyPairOptions<PubF extends KeyFormat, PrivF extends KeyFormat> {
2499
2606
  publicKeyEncoding: {
2500
- type: 'spki';
2607
+ type: "spki";
2501
2608
  format: PubF;
2502
2609
  };
2503
2610
  privateKeyEncoding: BasePrivateKeyEncodingOptions<PrivF> & {
2504
- type: 'pkcs8';
2611
+ type: "pkcs8";
2505
2612
  };
2506
2613
  }
2507
2614
  interface KeyPairSyncResult<T1 extends string | Buffer, T2 extends string | Buffer> {
@@ -2549,46 +2656,142 @@ declare module 'crypto' {
2549
2656
  * @since v10.12.0
2550
2657
  * @param type Must be `'rsa'`, `'rsa-pss'`, `'dsa'`, `'ec'`, `'ed25519'`, `'ed448'`, `'x25519'`, `'x448'`, or `'dh'`.
2551
2658
  */
2552
- function generateKeyPairSync(type: 'rsa', options: RSAKeyPairOptions<'pem', 'pem'>): KeyPairSyncResult<string, string>;
2553
- function generateKeyPairSync(type: 'rsa', options: RSAKeyPairOptions<'pem', 'der'>): KeyPairSyncResult<string, Buffer>;
2554
- function generateKeyPairSync(type: 'rsa', options: RSAKeyPairOptions<'der', 'pem'>): KeyPairSyncResult<Buffer, string>;
2555
- function generateKeyPairSync(type: 'rsa', options: RSAKeyPairOptions<'der', 'der'>): KeyPairSyncResult<Buffer, Buffer>;
2556
- function generateKeyPairSync(type: 'rsa', options: RSAKeyPairKeyObjectOptions): KeyPairKeyObjectResult;
2557
- function generateKeyPairSync(type: 'rsa-pss', options: RSAPSSKeyPairOptions<'pem', 'pem'>): KeyPairSyncResult<string, string>;
2558
- function generateKeyPairSync(type: 'rsa-pss', options: RSAPSSKeyPairOptions<'pem', 'der'>): KeyPairSyncResult<string, Buffer>;
2559
- function generateKeyPairSync(type: 'rsa-pss', options: RSAPSSKeyPairOptions<'der', 'pem'>): KeyPairSyncResult<Buffer, string>;
2560
- function generateKeyPairSync(type: 'rsa-pss', options: RSAPSSKeyPairOptions<'der', 'der'>): KeyPairSyncResult<Buffer, Buffer>;
2561
- function generateKeyPairSync(type: 'rsa-pss', options: RSAPSSKeyPairKeyObjectOptions): KeyPairKeyObjectResult;
2562
- function generateKeyPairSync(type: 'dsa', options: DSAKeyPairOptions<'pem', 'pem'>): KeyPairSyncResult<string, string>;
2563
- function generateKeyPairSync(type: 'dsa', options: DSAKeyPairOptions<'pem', 'der'>): KeyPairSyncResult<string, Buffer>;
2564
- function generateKeyPairSync(type: 'dsa', options: DSAKeyPairOptions<'der', 'pem'>): KeyPairSyncResult<Buffer, string>;
2565
- function generateKeyPairSync(type: 'dsa', options: DSAKeyPairOptions<'der', 'der'>): KeyPairSyncResult<Buffer, Buffer>;
2566
- function generateKeyPairSync(type: 'dsa', options: DSAKeyPairKeyObjectOptions): KeyPairKeyObjectResult;
2567
- function generateKeyPairSync(type: 'ec', options: ECKeyPairOptions<'pem', 'pem'>): KeyPairSyncResult<string, string>;
2568
- function generateKeyPairSync(type: 'ec', options: ECKeyPairOptions<'pem', 'der'>): KeyPairSyncResult<string, Buffer>;
2569
- function generateKeyPairSync(type: 'ec', options: ECKeyPairOptions<'der', 'pem'>): KeyPairSyncResult<Buffer, string>;
2570
- function generateKeyPairSync(type: 'ec', options: ECKeyPairOptions<'der', 'der'>): KeyPairSyncResult<Buffer, Buffer>;
2571
- function generateKeyPairSync(type: 'ec', options: ECKeyPairKeyObjectOptions): KeyPairKeyObjectResult;
2572
- function generateKeyPairSync(type: 'ed25519', options: ED25519KeyPairOptions<'pem', 'pem'>): KeyPairSyncResult<string, string>;
2573
- function generateKeyPairSync(type: 'ed25519', options: ED25519KeyPairOptions<'pem', 'der'>): KeyPairSyncResult<string, Buffer>;
2574
- function generateKeyPairSync(type: 'ed25519', options: ED25519KeyPairOptions<'der', 'pem'>): KeyPairSyncResult<Buffer, string>;
2575
- function generateKeyPairSync(type: 'ed25519', options: ED25519KeyPairOptions<'der', 'der'>): KeyPairSyncResult<Buffer, Buffer>;
2576
- function generateKeyPairSync(type: 'ed25519', options?: ED25519KeyPairKeyObjectOptions): KeyPairKeyObjectResult;
2577
- function generateKeyPairSync(type: 'ed448', options: ED448KeyPairOptions<'pem', 'pem'>): KeyPairSyncResult<string, string>;
2578
- function generateKeyPairSync(type: 'ed448', options: ED448KeyPairOptions<'pem', 'der'>): KeyPairSyncResult<string, Buffer>;
2579
- function generateKeyPairSync(type: 'ed448', options: ED448KeyPairOptions<'der', 'pem'>): KeyPairSyncResult<Buffer, string>;
2580
- function generateKeyPairSync(type: 'ed448', options: ED448KeyPairOptions<'der', 'der'>): KeyPairSyncResult<Buffer, Buffer>;
2581
- function generateKeyPairSync(type: 'ed448', options?: ED448KeyPairKeyObjectOptions): KeyPairKeyObjectResult;
2582
- function generateKeyPairSync(type: 'x25519', options: X25519KeyPairOptions<'pem', 'pem'>): KeyPairSyncResult<string, string>;
2583
- function generateKeyPairSync(type: 'x25519', options: X25519KeyPairOptions<'pem', 'der'>): KeyPairSyncResult<string, Buffer>;
2584
- function generateKeyPairSync(type: 'x25519', options: X25519KeyPairOptions<'der', 'pem'>): KeyPairSyncResult<Buffer, string>;
2585
- function generateKeyPairSync(type: 'x25519', options: X25519KeyPairOptions<'der', 'der'>): KeyPairSyncResult<Buffer, Buffer>;
2586
- function generateKeyPairSync(type: 'x25519', options?: X25519KeyPairKeyObjectOptions): KeyPairKeyObjectResult;
2587
- function generateKeyPairSync(type: 'x448', options: X448KeyPairOptions<'pem', 'pem'>): KeyPairSyncResult<string, string>;
2588
- function generateKeyPairSync(type: 'x448', options: X448KeyPairOptions<'pem', 'der'>): KeyPairSyncResult<string, Buffer>;
2589
- function generateKeyPairSync(type: 'x448', options: X448KeyPairOptions<'der', 'pem'>): KeyPairSyncResult<Buffer, string>;
2590
- function generateKeyPairSync(type: 'x448', options: X448KeyPairOptions<'der', 'der'>): KeyPairSyncResult<Buffer, Buffer>;
2591
- function generateKeyPairSync(type: 'x448', options?: X448KeyPairKeyObjectOptions): KeyPairKeyObjectResult;
2659
+ function generateKeyPairSync(
2660
+ type: "rsa",
2661
+ options: RSAKeyPairOptions<"pem", "pem">,
2662
+ ): KeyPairSyncResult<string, string>;
2663
+ function generateKeyPairSync(
2664
+ type: "rsa",
2665
+ options: RSAKeyPairOptions<"pem", "der">,
2666
+ ): KeyPairSyncResult<string, Buffer>;
2667
+ function generateKeyPairSync(
2668
+ type: "rsa",
2669
+ options: RSAKeyPairOptions<"der", "pem">,
2670
+ ): KeyPairSyncResult<Buffer, string>;
2671
+ function generateKeyPairSync(
2672
+ type: "rsa",
2673
+ options: RSAKeyPairOptions<"der", "der">,
2674
+ ): KeyPairSyncResult<Buffer, Buffer>;
2675
+ function generateKeyPairSync(type: "rsa", options: RSAKeyPairKeyObjectOptions): KeyPairKeyObjectResult;
2676
+ function generateKeyPairSync(
2677
+ type: "rsa-pss",
2678
+ options: RSAPSSKeyPairOptions<"pem", "pem">,
2679
+ ): KeyPairSyncResult<string, string>;
2680
+ function generateKeyPairSync(
2681
+ type: "rsa-pss",
2682
+ options: RSAPSSKeyPairOptions<"pem", "der">,
2683
+ ): KeyPairSyncResult<string, Buffer>;
2684
+ function generateKeyPairSync(
2685
+ type: "rsa-pss",
2686
+ options: RSAPSSKeyPairOptions<"der", "pem">,
2687
+ ): KeyPairSyncResult<Buffer, string>;
2688
+ function generateKeyPairSync(
2689
+ type: "rsa-pss",
2690
+ options: RSAPSSKeyPairOptions<"der", "der">,
2691
+ ): KeyPairSyncResult<Buffer, Buffer>;
2692
+ function generateKeyPairSync(type: "rsa-pss", options: RSAPSSKeyPairKeyObjectOptions): KeyPairKeyObjectResult;
2693
+ function generateKeyPairSync(
2694
+ type: "dsa",
2695
+ options: DSAKeyPairOptions<"pem", "pem">,
2696
+ ): KeyPairSyncResult<string, string>;
2697
+ function generateKeyPairSync(
2698
+ type: "dsa",
2699
+ options: DSAKeyPairOptions<"pem", "der">,
2700
+ ): KeyPairSyncResult<string, Buffer>;
2701
+ function generateKeyPairSync(
2702
+ type: "dsa",
2703
+ options: DSAKeyPairOptions<"der", "pem">,
2704
+ ): KeyPairSyncResult<Buffer, string>;
2705
+ function generateKeyPairSync(
2706
+ type: "dsa",
2707
+ options: DSAKeyPairOptions<"der", "der">,
2708
+ ): KeyPairSyncResult<Buffer, Buffer>;
2709
+ function generateKeyPairSync(type: "dsa", options: DSAKeyPairKeyObjectOptions): KeyPairKeyObjectResult;
2710
+ function generateKeyPairSync(
2711
+ type: "ec",
2712
+ options: ECKeyPairOptions<"pem", "pem">,
2713
+ ): KeyPairSyncResult<string, string>;
2714
+ function generateKeyPairSync(
2715
+ type: "ec",
2716
+ options: ECKeyPairOptions<"pem", "der">,
2717
+ ): KeyPairSyncResult<string, Buffer>;
2718
+ function generateKeyPairSync(
2719
+ type: "ec",
2720
+ options: ECKeyPairOptions<"der", "pem">,
2721
+ ): KeyPairSyncResult<Buffer, string>;
2722
+ function generateKeyPairSync(
2723
+ type: "ec",
2724
+ options: ECKeyPairOptions<"der", "der">,
2725
+ ): KeyPairSyncResult<Buffer, Buffer>;
2726
+ function generateKeyPairSync(type: "ec", options: ECKeyPairKeyObjectOptions): KeyPairKeyObjectResult;
2727
+ function generateKeyPairSync(
2728
+ type: "ed25519",
2729
+ options: ED25519KeyPairOptions<"pem", "pem">,
2730
+ ): KeyPairSyncResult<string, string>;
2731
+ function generateKeyPairSync(
2732
+ type: "ed25519",
2733
+ options: ED25519KeyPairOptions<"pem", "der">,
2734
+ ): KeyPairSyncResult<string, Buffer>;
2735
+ function generateKeyPairSync(
2736
+ type: "ed25519",
2737
+ options: ED25519KeyPairOptions<"der", "pem">,
2738
+ ): KeyPairSyncResult<Buffer, string>;
2739
+ function generateKeyPairSync(
2740
+ type: "ed25519",
2741
+ options: ED25519KeyPairOptions<"der", "der">,
2742
+ ): KeyPairSyncResult<Buffer, Buffer>;
2743
+ function generateKeyPairSync(type: "ed25519", options?: ED25519KeyPairKeyObjectOptions): KeyPairKeyObjectResult;
2744
+ function generateKeyPairSync(
2745
+ type: "ed448",
2746
+ options: ED448KeyPairOptions<"pem", "pem">,
2747
+ ): KeyPairSyncResult<string, string>;
2748
+ function generateKeyPairSync(
2749
+ type: "ed448",
2750
+ options: ED448KeyPairOptions<"pem", "der">,
2751
+ ): KeyPairSyncResult<string, Buffer>;
2752
+ function generateKeyPairSync(
2753
+ type: "ed448",
2754
+ options: ED448KeyPairOptions<"der", "pem">,
2755
+ ): KeyPairSyncResult<Buffer, string>;
2756
+ function generateKeyPairSync(
2757
+ type: "ed448",
2758
+ options: ED448KeyPairOptions<"der", "der">,
2759
+ ): KeyPairSyncResult<Buffer, Buffer>;
2760
+ function generateKeyPairSync(type: "ed448", options?: ED448KeyPairKeyObjectOptions): KeyPairKeyObjectResult;
2761
+ function generateKeyPairSync(
2762
+ type: "x25519",
2763
+ options: X25519KeyPairOptions<"pem", "pem">,
2764
+ ): KeyPairSyncResult<string, string>;
2765
+ function generateKeyPairSync(
2766
+ type: "x25519",
2767
+ options: X25519KeyPairOptions<"pem", "der">,
2768
+ ): KeyPairSyncResult<string, Buffer>;
2769
+ function generateKeyPairSync(
2770
+ type: "x25519",
2771
+ options: X25519KeyPairOptions<"der", "pem">,
2772
+ ): KeyPairSyncResult<Buffer, string>;
2773
+ function generateKeyPairSync(
2774
+ type: "x25519",
2775
+ options: X25519KeyPairOptions<"der", "der">,
2776
+ ): KeyPairSyncResult<Buffer, Buffer>;
2777
+ function generateKeyPairSync(type: "x25519", options?: X25519KeyPairKeyObjectOptions): KeyPairKeyObjectResult;
2778
+ function generateKeyPairSync(
2779
+ type: "x448",
2780
+ options: X448KeyPairOptions<"pem", "pem">,
2781
+ ): KeyPairSyncResult<string, string>;
2782
+ function generateKeyPairSync(
2783
+ type: "x448",
2784
+ options: X448KeyPairOptions<"pem", "der">,
2785
+ ): KeyPairSyncResult<string, Buffer>;
2786
+ function generateKeyPairSync(
2787
+ type: "x448",
2788
+ options: X448KeyPairOptions<"der", "pem">,
2789
+ ): KeyPairSyncResult<Buffer, string>;
2790
+ function generateKeyPairSync(
2791
+ type: "x448",
2792
+ options: X448KeyPairOptions<"der", "der">,
2793
+ ): KeyPairSyncResult<Buffer, Buffer>;
2794
+ function generateKeyPairSync(type: "x448", options?: X448KeyPairKeyObjectOptions): KeyPairKeyObjectResult;
2592
2795
  /**
2593
2796
  * Generates a new asymmetric key pair of the given `type`. RSA, RSA-PSS, DSA, EC,
2594
2797
  * Ed25519, Ed448, X25519, X448, and DH are currently supported.
@@ -2628,279 +2831,448 @@ declare module 'crypto' {
2628
2831
  * @since v10.12.0
2629
2832
  * @param type Must be `'rsa'`, `'rsa-pss'`, `'dsa'`, `'ec'`, `'ed25519'`, `'ed448'`, `'x25519'`, `'x448'`, or `'dh'`.
2630
2833
  */
2631
- function generateKeyPair(type: 'rsa', options: RSAKeyPairOptions<'pem', 'pem'>, callback: (err: Error | null, publicKey: string, privateKey: string) => void): void;
2632
- function generateKeyPair(type: 'rsa', options: RSAKeyPairOptions<'pem', 'der'>, callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void): void;
2633
- function generateKeyPair(type: 'rsa', options: RSAKeyPairOptions<'der', 'pem'>, callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void): void;
2634
- function generateKeyPair(type: 'rsa', options: RSAKeyPairOptions<'der', 'der'>, callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void): void;
2635
- function generateKeyPair(type: 'rsa', options: RSAKeyPairKeyObjectOptions, callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void): void;
2636
- function generateKeyPair(type: 'rsa-pss', options: RSAPSSKeyPairOptions<'pem', 'pem'>, callback: (err: Error | null, publicKey: string, privateKey: string) => void): void;
2637
- function generateKeyPair(type: 'rsa-pss', options: RSAPSSKeyPairOptions<'pem', 'der'>, callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void): void;
2638
- function generateKeyPair(type: 'rsa-pss', options: RSAPSSKeyPairOptions<'der', 'pem'>, callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void): void;
2639
- function generateKeyPair(type: 'rsa-pss', options: RSAPSSKeyPairOptions<'der', 'der'>, callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void): void;
2640
- function generateKeyPair(type: 'rsa-pss', options: RSAPSSKeyPairKeyObjectOptions, callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void): void;
2641
- function generateKeyPair(type: 'dsa', options: DSAKeyPairOptions<'pem', 'pem'>, callback: (err: Error | null, publicKey: string, privateKey: string) => void): void;
2642
- function generateKeyPair(type: 'dsa', options: DSAKeyPairOptions<'pem', 'der'>, callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void): void;
2643
- function generateKeyPair(type: 'dsa', options: DSAKeyPairOptions<'der', 'pem'>, callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void): void;
2644
- function generateKeyPair(type: 'dsa', options: DSAKeyPairOptions<'der', 'der'>, callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void): void;
2645
- function generateKeyPair(type: 'dsa', options: DSAKeyPairKeyObjectOptions, callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void): void;
2646
- function generateKeyPair(type: 'ec', options: ECKeyPairOptions<'pem', 'pem'>, callback: (err: Error | null, publicKey: string, privateKey: string) => void): void;
2647
- function generateKeyPair(type: 'ec', options: ECKeyPairOptions<'pem', 'der'>, callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void): void;
2648
- function generateKeyPair(type: 'ec', options: ECKeyPairOptions<'der', 'pem'>, callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void): void;
2649
- function generateKeyPair(type: 'ec', options: ECKeyPairOptions<'der', 'der'>, callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void): void;
2650
- function generateKeyPair(type: 'ec', options: ECKeyPairKeyObjectOptions, callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void): void;
2651
- function generateKeyPair(type: 'ed25519', options: ED25519KeyPairOptions<'pem', 'pem'>, callback: (err: Error | null, publicKey: string, privateKey: string) => void): void;
2652
- function generateKeyPair(type: 'ed25519', options: ED25519KeyPairOptions<'pem', 'der'>, callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void): void;
2653
- function generateKeyPair(type: 'ed25519', options: ED25519KeyPairOptions<'der', 'pem'>, callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void): void;
2654
- function generateKeyPair(type: 'ed25519', options: ED25519KeyPairOptions<'der', 'der'>, callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void): void;
2655
- function generateKeyPair(type: 'ed25519', options: ED25519KeyPairKeyObjectOptions | undefined, callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void): void;
2656
- function generateKeyPair(type: 'ed448', options: ED448KeyPairOptions<'pem', 'pem'>, callback: (err: Error | null, publicKey: string, privateKey: string) => void): void;
2657
- function generateKeyPair(type: 'ed448', options: ED448KeyPairOptions<'pem', 'der'>, callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void): void;
2658
- function generateKeyPair(type: 'ed448', options: ED448KeyPairOptions<'der', 'pem'>, callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void): void;
2659
- function generateKeyPair(type: 'ed448', options: ED448KeyPairOptions<'der', 'der'>, callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void): void;
2660
- function generateKeyPair(type: 'ed448', options: ED448KeyPairKeyObjectOptions | undefined, callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void): void;
2661
- function generateKeyPair(type: 'x25519', options: X25519KeyPairOptions<'pem', 'pem'>, callback: (err: Error | null, publicKey: string, privateKey: string) => void): void;
2662
- function generateKeyPair(type: 'x25519', options: X25519KeyPairOptions<'pem', 'der'>, callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void): void;
2663
- function generateKeyPair(type: 'x25519', options: X25519KeyPairOptions<'der', 'pem'>, callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void): void;
2664
- function generateKeyPair(type: 'x25519', options: X25519KeyPairOptions<'der', 'der'>, callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void): void;
2665
- function generateKeyPair(type: 'x25519', options: X25519KeyPairKeyObjectOptions | undefined, callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void): void;
2666
- function generateKeyPair(type: 'x448', options: X448KeyPairOptions<'pem', 'pem'>, callback: (err: Error | null, publicKey: string, privateKey: string) => void): void;
2667
- function generateKeyPair(type: 'x448', options: X448KeyPairOptions<'pem', 'der'>, callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void): void;
2668
- function generateKeyPair(type: 'x448', options: X448KeyPairOptions<'der', 'pem'>, callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void): void;
2669
- function generateKeyPair(type: 'x448', options: X448KeyPairOptions<'der', 'der'>, callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void): void;
2670
- function generateKeyPair(type: 'x448', options: X448KeyPairKeyObjectOptions | undefined, callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void): void;
2834
+ function generateKeyPair(
2835
+ type: "rsa",
2836
+ options: RSAKeyPairOptions<"pem", "pem">,
2837
+ callback: (err: Error | null, publicKey: string, privateKey: string) => void,
2838
+ ): void;
2839
+ function generateKeyPair(
2840
+ type: "rsa",
2841
+ options: RSAKeyPairOptions<"pem", "der">,
2842
+ callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void,
2843
+ ): void;
2844
+ function generateKeyPair(
2845
+ type: "rsa",
2846
+ options: RSAKeyPairOptions<"der", "pem">,
2847
+ callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void,
2848
+ ): void;
2849
+ function generateKeyPair(
2850
+ type: "rsa",
2851
+ options: RSAKeyPairOptions<"der", "der">,
2852
+ callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void,
2853
+ ): void;
2854
+ function generateKeyPair(
2855
+ type: "rsa",
2856
+ options: RSAKeyPairKeyObjectOptions,
2857
+ callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void,
2858
+ ): void;
2859
+ function generateKeyPair(
2860
+ type: "rsa-pss",
2861
+ options: RSAPSSKeyPairOptions<"pem", "pem">,
2862
+ callback: (err: Error | null, publicKey: string, privateKey: string) => void,
2863
+ ): void;
2864
+ function generateKeyPair(
2865
+ type: "rsa-pss",
2866
+ options: RSAPSSKeyPairOptions<"pem", "der">,
2867
+ callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void,
2868
+ ): void;
2869
+ function generateKeyPair(
2870
+ type: "rsa-pss",
2871
+ options: RSAPSSKeyPairOptions<"der", "pem">,
2872
+ callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void,
2873
+ ): void;
2874
+ function generateKeyPair(
2875
+ type: "rsa-pss",
2876
+ options: RSAPSSKeyPairOptions<"der", "der">,
2877
+ callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void,
2878
+ ): void;
2879
+ function generateKeyPair(
2880
+ type: "rsa-pss",
2881
+ options: RSAPSSKeyPairKeyObjectOptions,
2882
+ callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void,
2883
+ ): void;
2884
+ function generateKeyPair(
2885
+ type: "dsa",
2886
+ options: DSAKeyPairOptions<"pem", "pem">,
2887
+ callback: (err: Error | null, publicKey: string, privateKey: string) => void,
2888
+ ): void;
2889
+ function generateKeyPair(
2890
+ type: "dsa",
2891
+ options: DSAKeyPairOptions<"pem", "der">,
2892
+ callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void,
2893
+ ): void;
2894
+ function generateKeyPair(
2895
+ type: "dsa",
2896
+ options: DSAKeyPairOptions<"der", "pem">,
2897
+ callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void,
2898
+ ): void;
2899
+ function generateKeyPair(
2900
+ type: "dsa",
2901
+ options: DSAKeyPairOptions<"der", "der">,
2902
+ callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void,
2903
+ ): void;
2904
+ function generateKeyPair(
2905
+ type: "dsa",
2906
+ options: DSAKeyPairKeyObjectOptions,
2907
+ callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void,
2908
+ ): void;
2909
+ function generateKeyPair(
2910
+ type: "ec",
2911
+ options: ECKeyPairOptions<"pem", "pem">,
2912
+ callback: (err: Error | null, publicKey: string, privateKey: string) => void,
2913
+ ): void;
2914
+ function generateKeyPair(
2915
+ type: "ec",
2916
+ options: ECKeyPairOptions<"pem", "der">,
2917
+ callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void,
2918
+ ): void;
2919
+ function generateKeyPair(
2920
+ type: "ec",
2921
+ options: ECKeyPairOptions<"der", "pem">,
2922
+ callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void,
2923
+ ): void;
2924
+ function generateKeyPair(
2925
+ type: "ec",
2926
+ options: ECKeyPairOptions<"der", "der">,
2927
+ callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void,
2928
+ ): void;
2929
+ function generateKeyPair(
2930
+ type: "ec",
2931
+ options: ECKeyPairKeyObjectOptions,
2932
+ callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void,
2933
+ ): void;
2934
+ function generateKeyPair(
2935
+ type: "ed25519",
2936
+ options: ED25519KeyPairOptions<"pem", "pem">,
2937
+ callback: (err: Error | null, publicKey: string, privateKey: string) => void,
2938
+ ): void;
2939
+ function generateKeyPair(
2940
+ type: "ed25519",
2941
+ options: ED25519KeyPairOptions<"pem", "der">,
2942
+ callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void,
2943
+ ): void;
2944
+ function generateKeyPair(
2945
+ type: "ed25519",
2946
+ options: ED25519KeyPairOptions<"der", "pem">,
2947
+ callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void,
2948
+ ): void;
2949
+ function generateKeyPair(
2950
+ type: "ed25519",
2951
+ options: ED25519KeyPairOptions<"der", "der">,
2952
+ callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void,
2953
+ ): void;
2954
+ function generateKeyPair(
2955
+ type: "ed25519",
2956
+ options: ED25519KeyPairKeyObjectOptions | undefined,
2957
+ callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void,
2958
+ ): void;
2959
+ function generateKeyPair(
2960
+ type: "ed448",
2961
+ options: ED448KeyPairOptions<"pem", "pem">,
2962
+ callback: (err: Error | null, publicKey: string, privateKey: string) => void,
2963
+ ): void;
2964
+ function generateKeyPair(
2965
+ type: "ed448",
2966
+ options: ED448KeyPairOptions<"pem", "der">,
2967
+ callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void,
2968
+ ): void;
2969
+ function generateKeyPair(
2970
+ type: "ed448",
2971
+ options: ED448KeyPairOptions<"der", "pem">,
2972
+ callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void,
2973
+ ): void;
2974
+ function generateKeyPair(
2975
+ type: "ed448",
2976
+ options: ED448KeyPairOptions<"der", "der">,
2977
+ callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void,
2978
+ ): void;
2979
+ function generateKeyPair(
2980
+ type: "ed448",
2981
+ options: ED448KeyPairKeyObjectOptions | undefined,
2982
+ callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void,
2983
+ ): void;
2984
+ function generateKeyPair(
2985
+ type: "x25519",
2986
+ options: X25519KeyPairOptions<"pem", "pem">,
2987
+ callback: (err: Error | null, publicKey: string, privateKey: string) => void,
2988
+ ): void;
2989
+ function generateKeyPair(
2990
+ type: "x25519",
2991
+ options: X25519KeyPairOptions<"pem", "der">,
2992
+ callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void,
2993
+ ): void;
2994
+ function generateKeyPair(
2995
+ type: "x25519",
2996
+ options: X25519KeyPairOptions<"der", "pem">,
2997
+ callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void,
2998
+ ): void;
2999
+ function generateKeyPair(
3000
+ type: "x25519",
3001
+ options: X25519KeyPairOptions<"der", "der">,
3002
+ callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void,
3003
+ ): void;
3004
+ function generateKeyPair(
3005
+ type: "x25519",
3006
+ options: X25519KeyPairKeyObjectOptions | undefined,
3007
+ callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void,
3008
+ ): void;
3009
+ function generateKeyPair(
3010
+ type: "x448",
3011
+ options: X448KeyPairOptions<"pem", "pem">,
3012
+ callback: (err: Error | null, publicKey: string, privateKey: string) => void,
3013
+ ): void;
3014
+ function generateKeyPair(
3015
+ type: "x448",
3016
+ options: X448KeyPairOptions<"pem", "der">,
3017
+ callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void,
3018
+ ): void;
3019
+ function generateKeyPair(
3020
+ type: "x448",
3021
+ options: X448KeyPairOptions<"der", "pem">,
3022
+ callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void,
3023
+ ): void;
3024
+ function generateKeyPair(
3025
+ type: "x448",
3026
+ options: X448KeyPairOptions<"der", "der">,
3027
+ callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void,
3028
+ ): void;
3029
+ function generateKeyPair(
3030
+ type: "x448",
3031
+ options: X448KeyPairKeyObjectOptions | undefined,
3032
+ callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void,
3033
+ ): void;
2671
3034
  namespace generateKeyPair {
2672
3035
  function __promisify__(
2673
- type: 'rsa',
2674
- options: RSAKeyPairOptions<'pem', 'pem'>
3036
+ type: "rsa",
3037
+ options: RSAKeyPairOptions<"pem", "pem">,
2675
3038
  ): Promise<{
2676
3039
  publicKey: string;
2677
3040
  privateKey: string;
2678
3041
  }>;
2679
3042
  function __promisify__(
2680
- type: 'rsa',
2681
- options: RSAKeyPairOptions<'pem', 'der'>
3043
+ type: "rsa",
3044
+ options: RSAKeyPairOptions<"pem", "der">,
2682
3045
  ): Promise<{
2683
3046
  publicKey: string;
2684
3047
  privateKey: Buffer;
2685
3048
  }>;
2686
3049
  function __promisify__(
2687
- type: 'rsa',
2688
- options: RSAKeyPairOptions<'der', 'pem'>
3050
+ type: "rsa",
3051
+ options: RSAKeyPairOptions<"der", "pem">,
2689
3052
  ): Promise<{
2690
3053
  publicKey: Buffer;
2691
3054
  privateKey: string;
2692
3055
  }>;
2693
3056
  function __promisify__(
2694
- type: 'rsa',
2695
- options: RSAKeyPairOptions<'der', 'der'>
3057
+ type: "rsa",
3058
+ options: RSAKeyPairOptions<"der", "der">,
2696
3059
  ): Promise<{
2697
3060
  publicKey: Buffer;
2698
3061
  privateKey: Buffer;
2699
3062
  }>;
2700
- function __promisify__(type: 'rsa', options: RSAKeyPairKeyObjectOptions): Promise<KeyPairKeyObjectResult>;
3063
+ function __promisify__(type: "rsa", options: RSAKeyPairKeyObjectOptions): Promise<KeyPairKeyObjectResult>;
2701
3064
  function __promisify__(
2702
- type: 'rsa-pss',
2703
- options: RSAPSSKeyPairOptions<'pem', 'pem'>
3065
+ type: "rsa-pss",
3066
+ options: RSAPSSKeyPairOptions<"pem", "pem">,
2704
3067
  ): Promise<{
2705
3068
  publicKey: string;
2706
3069
  privateKey: string;
2707
3070
  }>;
2708
3071
  function __promisify__(
2709
- type: 'rsa-pss',
2710
- options: RSAPSSKeyPairOptions<'pem', 'der'>
3072
+ type: "rsa-pss",
3073
+ options: RSAPSSKeyPairOptions<"pem", "der">,
2711
3074
  ): Promise<{
2712
3075
  publicKey: string;
2713
3076
  privateKey: Buffer;
2714
3077
  }>;
2715
3078
  function __promisify__(
2716
- type: 'rsa-pss',
2717
- options: RSAPSSKeyPairOptions<'der', 'pem'>
3079
+ type: "rsa-pss",
3080
+ options: RSAPSSKeyPairOptions<"der", "pem">,
2718
3081
  ): Promise<{
2719
3082
  publicKey: Buffer;
2720
3083
  privateKey: string;
2721
3084
  }>;
2722
3085
  function __promisify__(
2723
- type: 'rsa-pss',
2724
- options: RSAPSSKeyPairOptions<'der', 'der'>
3086
+ type: "rsa-pss",
3087
+ options: RSAPSSKeyPairOptions<"der", "der">,
2725
3088
  ): Promise<{
2726
3089
  publicKey: Buffer;
2727
3090
  privateKey: Buffer;
2728
3091
  }>;
2729
- function __promisify__(type: 'rsa-pss', options: RSAPSSKeyPairKeyObjectOptions): Promise<KeyPairKeyObjectResult>;
2730
3092
  function __promisify__(
2731
- type: 'dsa',
2732
- options: DSAKeyPairOptions<'pem', 'pem'>
3093
+ type: "rsa-pss",
3094
+ options: RSAPSSKeyPairKeyObjectOptions,
3095
+ ): Promise<KeyPairKeyObjectResult>;
3096
+ function __promisify__(
3097
+ type: "dsa",
3098
+ options: DSAKeyPairOptions<"pem", "pem">,
2733
3099
  ): Promise<{
2734
3100
  publicKey: string;
2735
3101
  privateKey: string;
2736
3102
  }>;
2737
3103
  function __promisify__(
2738
- type: 'dsa',
2739
- options: DSAKeyPairOptions<'pem', 'der'>
3104
+ type: "dsa",
3105
+ options: DSAKeyPairOptions<"pem", "der">,
2740
3106
  ): Promise<{
2741
3107
  publicKey: string;
2742
3108
  privateKey: Buffer;
2743
3109
  }>;
2744
3110
  function __promisify__(
2745
- type: 'dsa',
2746
- options: DSAKeyPairOptions<'der', 'pem'>
3111
+ type: "dsa",
3112
+ options: DSAKeyPairOptions<"der", "pem">,
2747
3113
  ): Promise<{
2748
3114
  publicKey: Buffer;
2749
3115
  privateKey: string;
2750
3116
  }>;
2751
3117
  function __promisify__(
2752
- type: 'dsa',
2753
- options: DSAKeyPairOptions<'der', 'der'>
3118
+ type: "dsa",
3119
+ options: DSAKeyPairOptions<"der", "der">,
2754
3120
  ): Promise<{
2755
3121
  publicKey: Buffer;
2756
3122
  privateKey: Buffer;
2757
3123
  }>;
2758
- function __promisify__(type: 'dsa', options: DSAKeyPairKeyObjectOptions): Promise<KeyPairKeyObjectResult>;
3124
+ function __promisify__(type: "dsa", options: DSAKeyPairKeyObjectOptions): Promise<KeyPairKeyObjectResult>;
2759
3125
  function __promisify__(
2760
- type: 'ec',
2761
- options: ECKeyPairOptions<'pem', 'pem'>
3126
+ type: "ec",
3127
+ options: ECKeyPairOptions<"pem", "pem">,
2762
3128
  ): Promise<{
2763
3129
  publicKey: string;
2764
3130
  privateKey: string;
2765
3131
  }>;
2766
3132
  function __promisify__(
2767
- type: 'ec',
2768
- options: ECKeyPairOptions<'pem', 'der'>
3133
+ type: "ec",
3134
+ options: ECKeyPairOptions<"pem", "der">,
2769
3135
  ): Promise<{
2770
3136
  publicKey: string;
2771
3137
  privateKey: Buffer;
2772
3138
  }>;
2773
3139
  function __promisify__(
2774
- type: 'ec',
2775
- options: ECKeyPairOptions<'der', 'pem'>
3140
+ type: "ec",
3141
+ options: ECKeyPairOptions<"der", "pem">,
2776
3142
  ): Promise<{
2777
3143
  publicKey: Buffer;
2778
3144
  privateKey: string;
2779
3145
  }>;
2780
3146
  function __promisify__(
2781
- type: 'ec',
2782
- options: ECKeyPairOptions<'der', 'der'>
3147
+ type: "ec",
3148
+ options: ECKeyPairOptions<"der", "der">,
2783
3149
  ): Promise<{
2784
3150
  publicKey: Buffer;
2785
3151
  privateKey: Buffer;
2786
3152
  }>;
2787
- function __promisify__(type: 'ec', options: ECKeyPairKeyObjectOptions): Promise<KeyPairKeyObjectResult>;
3153
+ function __promisify__(type: "ec", options: ECKeyPairKeyObjectOptions): Promise<KeyPairKeyObjectResult>;
2788
3154
  function __promisify__(
2789
- type: 'ed25519',
2790
- options: ED25519KeyPairOptions<'pem', 'pem'>
3155
+ type: "ed25519",
3156
+ options: ED25519KeyPairOptions<"pem", "pem">,
2791
3157
  ): Promise<{
2792
3158
  publicKey: string;
2793
3159
  privateKey: string;
2794
3160
  }>;
2795
3161
  function __promisify__(
2796
- type: 'ed25519',
2797
- options: ED25519KeyPairOptions<'pem', 'der'>
3162
+ type: "ed25519",
3163
+ options: ED25519KeyPairOptions<"pem", "der">,
2798
3164
  ): Promise<{
2799
3165
  publicKey: string;
2800
3166
  privateKey: Buffer;
2801
3167
  }>;
2802
3168
  function __promisify__(
2803
- type: 'ed25519',
2804
- options: ED25519KeyPairOptions<'der', 'pem'>
3169
+ type: "ed25519",
3170
+ options: ED25519KeyPairOptions<"der", "pem">,
2805
3171
  ): Promise<{
2806
3172
  publicKey: Buffer;
2807
3173
  privateKey: string;
2808
3174
  }>;
2809
3175
  function __promisify__(
2810
- type: 'ed25519',
2811
- options: ED25519KeyPairOptions<'der', 'der'>
3176
+ type: "ed25519",
3177
+ options: ED25519KeyPairOptions<"der", "der">,
2812
3178
  ): Promise<{
2813
3179
  publicKey: Buffer;
2814
3180
  privateKey: Buffer;
2815
3181
  }>;
2816
- function __promisify__(type: 'ed25519', options?: ED25519KeyPairKeyObjectOptions): Promise<KeyPairKeyObjectResult>;
2817
3182
  function __promisify__(
2818
- type: 'ed448',
2819
- options: ED448KeyPairOptions<'pem', 'pem'>
3183
+ type: "ed25519",
3184
+ options?: ED25519KeyPairKeyObjectOptions,
3185
+ ): Promise<KeyPairKeyObjectResult>;
3186
+ function __promisify__(
3187
+ type: "ed448",
3188
+ options: ED448KeyPairOptions<"pem", "pem">,
2820
3189
  ): Promise<{
2821
3190
  publicKey: string;
2822
3191
  privateKey: string;
2823
3192
  }>;
2824
3193
  function __promisify__(
2825
- type: 'ed448',
2826
- options: ED448KeyPairOptions<'pem', 'der'>
3194
+ type: "ed448",
3195
+ options: ED448KeyPairOptions<"pem", "der">,
2827
3196
  ): Promise<{
2828
3197
  publicKey: string;
2829
3198
  privateKey: Buffer;
2830
3199
  }>;
2831
3200
  function __promisify__(
2832
- type: 'ed448',
2833
- options: ED448KeyPairOptions<'der', 'pem'>
3201
+ type: "ed448",
3202
+ options: ED448KeyPairOptions<"der", "pem">,
2834
3203
  ): Promise<{
2835
3204
  publicKey: Buffer;
2836
3205
  privateKey: string;
2837
3206
  }>;
2838
3207
  function __promisify__(
2839
- type: 'ed448',
2840
- options: ED448KeyPairOptions<'der', 'der'>
3208
+ type: "ed448",
3209
+ options: ED448KeyPairOptions<"der", "der">,
2841
3210
  ): Promise<{
2842
3211
  publicKey: Buffer;
2843
3212
  privateKey: Buffer;
2844
3213
  }>;
2845
- function __promisify__(type: 'ed448', options?: ED448KeyPairKeyObjectOptions): Promise<KeyPairKeyObjectResult>;
3214
+ function __promisify__(type: "ed448", options?: ED448KeyPairKeyObjectOptions): Promise<KeyPairKeyObjectResult>;
2846
3215
  function __promisify__(
2847
- type: 'x25519',
2848
- options: X25519KeyPairOptions<'pem', 'pem'>
3216
+ type: "x25519",
3217
+ options: X25519KeyPairOptions<"pem", "pem">,
2849
3218
  ): Promise<{
2850
3219
  publicKey: string;
2851
3220
  privateKey: string;
2852
3221
  }>;
2853
3222
  function __promisify__(
2854
- type: 'x25519',
2855
- options: X25519KeyPairOptions<'pem', 'der'>
3223
+ type: "x25519",
3224
+ options: X25519KeyPairOptions<"pem", "der">,
2856
3225
  ): Promise<{
2857
3226
  publicKey: string;
2858
3227
  privateKey: Buffer;
2859
3228
  }>;
2860
3229
  function __promisify__(
2861
- type: 'x25519',
2862
- options: X25519KeyPairOptions<'der', 'pem'>
3230
+ type: "x25519",
3231
+ options: X25519KeyPairOptions<"der", "pem">,
2863
3232
  ): Promise<{
2864
3233
  publicKey: Buffer;
2865
3234
  privateKey: string;
2866
3235
  }>;
2867
3236
  function __promisify__(
2868
- type: 'x25519',
2869
- options: X25519KeyPairOptions<'der', 'der'>
3237
+ type: "x25519",
3238
+ options: X25519KeyPairOptions<"der", "der">,
2870
3239
  ): Promise<{
2871
3240
  publicKey: Buffer;
2872
3241
  privateKey: Buffer;
2873
3242
  }>;
2874
- function __promisify__(type: 'x25519', options?: X25519KeyPairKeyObjectOptions): Promise<KeyPairKeyObjectResult>;
2875
3243
  function __promisify__(
2876
- type: 'x448',
2877
- options: X448KeyPairOptions<'pem', 'pem'>
3244
+ type: "x25519",
3245
+ options?: X25519KeyPairKeyObjectOptions,
3246
+ ): Promise<KeyPairKeyObjectResult>;
3247
+ function __promisify__(
3248
+ type: "x448",
3249
+ options: X448KeyPairOptions<"pem", "pem">,
2878
3250
  ): Promise<{
2879
3251
  publicKey: string;
2880
3252
  privateKey: string;
2881
3253
  }>;
2882
3254
  function __promisify__(
2883
- type: 'x448',
2884
- options: X448KeyPairOptions<'pem', 'der'>
3255
+ type: "x448",
3256
+ options: X448KeyPairOptions<"pem", "der">,
2885
3257
  ): Promise<{
2886
3258
  publicKey: string;
2887
3259
  privateKey: Buffer;
2888
3260
  }>;
2889
3261
  function __promisify__(
2890
- type: 'x448',
2891
- options: X448KeyPairOptions<'der', 'pem'>
3262
+ type: "x448",
3263
+ options: X448KeyPairOptions<"der", "pem">,
2892
3264
  ): Promise<{
2893
3265
  publicKey: Buffer;
2894
3266
  privateKey: string;
2895
3267
  }>;
2896
3268
  function __promisify__(
2897
- type: 'x448',
2898
- options: X448KeyPairOptions<'der', 'der'>
3269
+ type: "x448",
3270
+ options: X448KeyPairOptions<"der", "der">,
2899
3271
  ): Promise<{
2900
3272
  publicKey: Buffer;
2901
3273
  privateKey: Buffer;
2902
3274
  }>;
2903
- function __promisify__(type: 'x448', options?: X448KeyPairKeyObjectOptions): Promise<KeyPairKeyObjectResult>;
3275
+ function __promisify__(type: "x448", options?: X448KeyPairKeyObjectOptions): Promise<KeyPairKeyObjectResult>;
2904
3276
  }
2905
3277
  /**
2906
3278
  * Calculates and returns the signature for `data` using the given private key and
@@ -2914,12 +3286,16 @@ declare module 'crypto' {
2914
3286
  * If the `callback` function is provided this function uses libuv's threadpool.
2915
3287
  * @since v12.0.0
2916
3288
  */
2917
- function sign(algorithm: string | null | undefined, data: NodeJS.ArrayBufferView, key: KeyLike | SignKeyObjectInput | SignPrivateKeyInput): Buffer;
2918
3289
  function sign(
2919
3290
  algorithm: string | null | undefined,
2920
3291
  data: NodeJS.ArrayBufferView,
2921
3292
  key: KeyLike | SignKeyObjectInput | SignPrivateKeyInput,
2922
- callback: (error: Error | null, data: Buffer) => void
3293
+ ): Buffer;
3294
+ function sign(
3295
+ algorithm: string | null | undefined,
3296
+ data: NodeJS.ArrayBufferView,
3297
+ key: KeyLike | SignKeyObjectInput | SignPrivateKeyInput,
3298
+ callback: (error: Error | null, data: Buffer) => void,
2923
3299
  ): void;
2924
3300
  /**
2925
3301
  * 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
@@ -2941,14 +3317,14 @@ declare module 'crypto' {
2941
3317
  algorithm: string | null | undefined,
2942
3318
  data: NodeJS.ArrayBufferView,
2943
3319
  key: KeyLike | VerifyKeyObjectInput | VerifyPublicKeyInput | VerifyJsonWebKeyInput,
2944
- signature: NodeJS.ArrayBufferView
3320
+ signature: NodeJS.ArrayBufferView,
2945
3321
  ): boolean;
2946
3322
  function verify(
2947
3323
  algorithm: string | null | undefined,
2948
3324
  data: NodeJS.ArrayBufferView,
2949
3325
  key: KeyLike | VerifyKeyObjectInput | VerifyPublicKeyInput | VerifyJsonWebKeyInput,
2950
3326
  signature: NodeJS.ArrayBufferView,
2951
- callback: (error: Error | null, result: boolean) => void
3327
+ callback: (error: Error | null, result: boolean) => void,
2952
3328
  ): void;
2953
3329
  /**
2954
3330
  * Computes the Diffie-Hellman secret based on a `privateKey` and a `publicKey`.
@@ -2956,7 +3332,7 @@ declare module 'crypto' {
2956
3332
  * @since v13.9.0, v12.17.0
2957
3333
  */
2958
3334
  function diffieHellman(options: { privateKey: KeyObject; publicKey: KeyObject }): Buffer;
2959
- type CipherMode = 'cbc' | 'ccm' | 'cfb' | 'ctr' | 'ecb' | 'gcm' | 'ocb' | 'ofb' | 'stream' | 'wrap' | 'xts';
3335
+ type CipherMode = "cbc" | "ccm" | "cfb" | "ctr" | "ecb" | "gcm" | "ocb" | "ofb" | "stream" | "wrap" | "xts";
2960
3336
  interface CipherInfoOptions {
2961
3337
  /**
2962
3338
  * A test key length.
@@ -3034,7 +3410,14 @@ declare module 'crypto' {
3034
3410
  * @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`
3035
3411
  * generates 64-byte hashes, making the maximum HKDF output 16320 bytes).
3036
3412
  */
3037
- function hkdf(digest: string, irm: BinaryLike | KeyObject, salt: BinaryLike, info: BinaryLike, keylen: number, callback: (err: Error | null, derivedKey: ArrayBuffer) => void): void;
3413
+ function hkdf(
3414
+ digest: string,
3415
+ irm: BinaryLike | KeyObject,
3416
+ salt: BinaryLike,
3417
+ info: BinaryLike,
3418
+ keylen: number,
3419
+ callback: (err: Error | null, derivedKey: ArrayBuffer) => void,
3420
+ ): void;
3038
3421
  /**
3039
3422
  * Provides a synchronous HKDF key derivation function as defined in RFC 5869\. The
3040
3423
  * given `ikm`, `salt` and `info` are used with the `digest` to derive a key of`keylen` bytes.
@@ -3061,7 +3444,13 @@ declare module 'crypto' {
3061
3444
  * @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`
3062
3445
  * generates 64-byte hashes, making the maximum HKDF output 16320 bytes).
3063
3446
  */
3064
- function hkdfSync(digest: string, ikm: BinaryLike | KeyObject, salt: BinaryLike, info: BinaryLike, keylen: number): ArrayBuffer;
3447
+ function hkdfSync(
3448
+ digest: string,
3449
+ ikm: BinaryLike | KeyObject,
3450
+ salt: BinaryLike,
3451
+ info: BinaryLike,
3452
+ keylen: number,
3453
+ ): ArrayBuffer;
3065
3454
  interface SecureHeapUsage {
3066
3455
  /**
3067
3456
  * The total allocated secure heap size as specified using the `--secure-heap=n` command-line flag.
@@ -3105,7 +3494,7 @@ declare module 'crypto' {
3105
3494
  /**
3106
3495
  * @default 'always'
3107
3496
  */
3108
- subject?: 'always' | 'default' | 'never';
3497
+ subject?: "always" | "default" | "never";
3109
3498
  /**
3110
3499
  * @default true
3111
3500
  */
@@ -3156,7 +3545,7 @@ declare module 'crypto' {
3156
3545
  * The SHA-512 fingerprint of this certificate.
3157
3546
  * @since v16.14.0
3158
3547
  */
3159
- readonly fingerprint512: string;
3548
+ readonly fingerprint512: string;
3160
3549
  /**
3161
3550
  * The complete subject of this certificate.
3162
3551
  * @since v15.6.0
@@ -3221,7 +3610,7 @@ declare module 'crypto' {
3221
3610
  * @since v15.6.0
3222
3611
  * @return Returns `email` if the certificate matches, `undefined` if it does not.
3223
3612
  */
3224
- checkEmail(email: string, options?: Pick<X509CheckOptions, 'subject'>): string | undefined;
3613
+ checkEmail(email: string, options?: Pick<X509CheckOptions, "subject">): string | undefined;
3225
3614
  /**
3226
3615
  * Checks whether the certificate matches the given host name.
3227
3616
  * @since v15.6.0
@@ -3314,9 +3703,21 @@ declare module 'crypto' {
3314
3703
  * @param size The size (in bits) of the prime to generate.
3315
3704
  */
3316
3705
  function generatePrime(size: number, callback: (err: Error | null, prime: ArrayBuffer) => void): void;
3317
- function generatePrime(size: number, options: GeneratePrimeOptionsBigInt, callback: (err: Error | null, prime: bigint) => void): void;
3318
- function generatePrime(size: number, options: GeneratePrimeOptionsArrayBuffer, callback: (err: Error | null, prime: ArrayBuffer) => void): void;
3319
- function generatePrime(size: number, options: GeneratePrimeOptions, callback: (err: Error | null, prime: ArrayBuffer | bigint) => void): void;
3706
+ function generatePrime(
3707
+ size: number,
3708
+ options: GeneratePrimeOptionsBigInt,
3709
+ callback: (err: Error | null, prime: bigint) => void,
3710
+ ): void;
3711
+ function generatePrime(
3712
+ size: number,
3713
+ options: GeneratePrimeOptionsArrayBuffer,
3714
+ callback: (err: Error | null, prime: ArrayBuffer) => void,
3715
+ ): void;
3716
+ function generatePrime(
3717
+ size: number,
3718
+ options: GeneratePrimeOptions,
3719
+ callback: (err: Error | null, prime: ArrayBuffer | bigint) => void,
3720
+ ): void;
3320
3721
  /**
3321
3722
  * Generates a pseudorandom prime of `size` bits.
3322
3723
  *
@@ -3365,7 +3766,11 @@ declare module 'crypto' {
3365
3766
  * @param candidate A possible prime encoded as a sequence of big endian octets of arbitrary length.
3366
3767
  */
3367
3768
  function checkPrime(value: LargeNumberLike, callback: (err: Error | null, result: boolean) => void): void;
3368
- function checkPrime(value: LargeNumberLike, options: CheckPrimeOptions, callback: (err: Error | null, result: boolean) => void): void;
3769
+ function checkPrime(
3770
+ value: LargeNumberLike,
3771
+ options: CheckPrimeOptions,
3772
+ callback: (err: Error | null, result: boolean) => void,
3773
+ ): void;
3369
3774
  /**
3370
3775
  * Checks the primality of the `candidate`.
3371
3776
  * @since v15.8.0
@@ -3411,9 +3816,17 @@ declare module 'crypto' {
3411
3816
  const webcrypto: webcrypto.Crypto;
3412
3817
  namespace webcrypto {
3413
3818
  type BufferSource = ArrayBufferView | ArrayBuffer;
3414
- type KeyFormat = 'jwk' | 'pkcs8' | 'raw' | 'spki';
3415
- type KeyType = 'private' | 'public' | 'secret';
3416
- type KeyUsage = 'decrypt' | 'deriveBits' | 'deriveKey' | 'encrypt' | 'sign' | 'unwrapKey' | 'verify' | 'wrapKey';
3819
+ type KeyFormat = "jwk" | "pkcs8" | "raw" | "spki";
3820
+ type KeyType = "private" | "public" | "secret";
3821
+ type KeyUsage =
3822
+ | "decrypt"
3823
+ | "deriveBits"
3824
+ | "deriveKey"
3825
+ | "encrypt"
3826
+ | "sign"
3827
+ | "unwrapKey"
3828
+ | "verify"
3829
+ | "wrapKey";
3417
3830
  type AlgorithmIdentifier = Algorithm | string;
3418
3831
  type HashAlgorithmIdentifier = AlgorithmIdentifier;
3419
3832
  type NamedCurve = string;
@@ -3567,7 +3980,7 @@ declare module 'crypto' {
3567
3980
  /** Illegal constructor */
3568
3981
  (_: { readonly _: unique symbol }): never; // Allows instanceof to work but not be callable by the user.
3569
3982
  readonly length: 0;
3570
- readonly name: 'CryptoKey';
3983
+ readonly name: "CryptoKey";
3571
3984
  readonly prototype: CryptoKey;
3572
3985
  }
3573
3986
  /**
@@ -3640,7 +4053,11 @@ declare module 'crypto' {
3640
4053
  * - `'AES-GCM'`
3641
4054
  * @since v15.0.0
3642
4055
  */
3643
- decrypt(algorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesGcmParams, key: CryptoKey, data: BufferSource): Promise<ArrayBuffer>;
4056
+ decrypt(
4057
+ algorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesGcmParams,
4058
+ key: CryptoKey,
4059
+ data: BufferSource,
4060
+ ): Promise<ArrayBuffer>;
3644
4061
  /**
3645
4062
  * Using the method and parameters specified in `algorithm` and the keying material provided by `baseKey`,
3646
4063
  * `subtle.deriveBits()` attempts to generate `length` bits.
@@ -3654,7 +4071,11 @@ declare module 'crypto' {
3654
4071
  * - `'PBKDF2'`
3655
4072
  * @since v15.0.0
3656
4073
  */
3657
- deriveBits(algorithm: AlgorithmIdentifier | EcdhKeyDeriveParams | HkdfParams | Pbkdf2Params, baseKey: CryptoKey, length: number): Promise<ArrayBuffer>;
4074
+ deriveBits(
4075
+ algorithm: AlgorithmIdentifier | EcdhKeyDeriveParams | HkdfParams | Pbkdf2Params,
4076
+ baseKey: CryptoKey,
4077
+ length: number,
4078
+ ): Promise<ArrayBuffer>;
3658
4079
  /**
3659
4080
  * Using the method and parameters specified in `algorithm`, and the keying material provided by `baseKey`,
3660
4081
  * `subtle.deriveKey()` attempts to generate a new <CryptoKey>` based on the method and parameters in `derivedKeyAlgorithm`.
@@ -3673,9 +4094,14 @@ declare module 'crypto' {
3673
4094
  deriveKey(
3674
4095
  algorithm: AlgorithmIdentifier | EcdhKeyDeriveParams | HkdfParams | Pbkdf2Params,
3675
4096
  baseKey: CryptoKey,
3676
- derivedKeyAlgorithm: AlgorithmIdentifier | AesDerivedKeyParams | HmacImportParams | HkdfParams | Pbkdf2Params,
4097
+ derivedKeyAlgorithm:
4098
+ | AlgorithmIdentifier
4099
+ | AesDerivedKeyParams
4100
+ | HmacImportParams
4101
+ | HkdfParams
4102
+ | Pbkdf2Params,
3677
4103
  extractable: boolean,
3678
- keyUsages: ReadonlyArray<KeyUsage>
4104
+ keyUsages: ReadonlyArray<KeyUsage>,
3679
4105
  ): Promise<CryptoKey>;
3680
4106
  /**
3681
4107
  * Using the method identified by `algorithm`, `subtle.digest()` attempts to generate a digest of `data`.
@@ -3705,7 +4131,11 @@ declare module 'crypto' {
3705
4131
  * - `'AES-GCM'`
3706
4132
  * @since v15.0.0
3707
4133
  */
3708
- encrypt(algorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesGcmParams, key: CryptoKey, data: BufferSource): Promise<ArrayBuffer>;
4134
+ encrypt(
4135
+ algorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesGcmParams,
4136
+ key: CryptoKey,
4137
+ data: BufferSource,
4138
+ ): Promise<ArrayBuffer>;
3709
4139
  /**
3710
4140
  * Exports the given key into the specified format, if supported.
3711
4141
  *
@@ -3720,8 +4150,8 @@ declare module 'crypto' {
3720
4150
  * @returns `<Promise>` containing `<ArrayBuffer>`.
3721
4151
  * @since v15.0.0
3722
4152
  */
3723
- exportKey(format: 'jwk', key: CryptoKey): Promise<JsonWebKey>;
3724
- exportKey(format: Exclude<KeyFormat, 'jwk'>, key: CryptoKey): Promise<ArrayBuffer>;
4153
+ exportKey(format: "jwk", key: CryptoKey): Promise<JsonWebKey>;
4154
+ exportKey(format: Exclude<KeyFormat, "jwk">, key: CryptoKey): Promise<ArrayBuffer>;
3725
4155
  /**
3726
4156
  * Using the method and parameters provided in `algorithm`,
3727
4157
  * `subtle.generateKey()` attempts to generate new keying material.
@@ -3744,9 +4174,21 @@ declare module 'crypto' {
3744
4174
  * @param keyUsages See {@link https://nodejs.org/docs/latest/api/webcrypto.html#cryptokeyusages Key usages}.
3745
4175
  * @since v15.0.0
3746
4176
  */
3747
- generateKey(algorithm: RsaHashedKeyGenParams | EcKeyGenParams, extractable: boolean, keyUsages: ReadonlyArray<KeyUsage>): Promise<CryptoKeyPair>;
3748
- generateKey(algorithm: AesKeyGenParams | HmacKeyGenParams | Pbkdf2Params, extractable: boolean, keyUsages: ReadonlyArray<KeyUsage>): Promise<CryptoKey>;
3749
- generateKey(algorithm: AlgorithmIdentifier, extractable: boolean, keyUsages: KeyUsage[]): Promise<CryptoKeyPair | CryptoKey>;
4177
+ generateKey(
4178
+ algorithm: RsaHashedKeyGenParams | EcKeyGenParams,
4179
+ extractable: boolean,
4180
+ keyUsages: ReadonlyArray<KeyUsage>,
4181
+ ): Promise<CryptoKeyPair>;
4182
+ generateKey(
4183
+ algorithm: AesKeyGenParams | HmacKeyGenParams | Pbkdf2Params,
4184
+ extractable: boolean,
4185
+ keyUsages: ReadonlyArray<KeyUsage>,
4186
+ ): Promise<CryptoKey>;
4187
+ generateKey(
4188
+ algorithm: AlgorithmIdentifier,
4189
+ extractable: boolean,
4190
+ keyUsages: KeyUsage[],
4191
+ ): Promise<CryptoKeyPair | CryptoKey>;
3750
4192
  /**
3751
4193
  * The `subtle.importKey()` method attempts to interpret the provided `keyData` as the given `format`
3752
4194
  * to create a `<CryptoKey>` instance using the provided `algorithm`, `extractable`, and `keyUsages` arguments.
@@ -3758,18 +4200,28 @@ declare module 'crypto' {
3758
4200
  * @since v15.0.0
3759
4201
  */
3760
4202
  importKey(
3761
- format: 'jwk',
4203
+ format: "jwk",
3762
4204
  keyData: JsonWebKey,
3763
- algorithm: AlgorithmIdentifier | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | AesKeyAlgorithm,
4205
+ algorithm:
4206
+ | AlgorithmIdentifier
4207
+ | RsaHashedImportParams
4208
+ | EcKeyImportParams
4209
+ | HmacImportParams
4210
+ | AesKeyAlgorithm,
3764
4211
  extractable: boolean,
3765
- keyUsages: ReadonlyArray<KeyUsage>
4212
+ keyUsages: ReadonlyArray<KeyUsage>,
3766
4213
  ): Promise<CryptoKey>;
3767
4214
  importKey(
3768
- format: Exclude<KeyFormat, 'jwk'>,
4215
+ format: Exclude<KeyFormat, "jwk">,
3769
4216
  keyData: BufferSource,
3770
- algorithm: AlgorithmIdentifier | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | AesKeyAlgorithm,
4217
+ algorithm:
4218
+ | AlgorithmIdentifier
4219
+ | RsaHashedImportParams
4220
+ | EcKeyImportParams
4221
+ | HmacImportParams
4222
+ | AesKeyAlgorithm,
3771
4223
  extractable: boolean,
3772
- keyUsages: KeyUsage[]
4224
+ keyUsages: KeyUsage[],
3773
4225
  ): Promise<CryptoKey>;
3774
4226
  /**
3775
4227
  * Using the method and parameters given by `algorithm` and the keying material provided by `key`,
@@ -3784,7 +4236,11 @@ declare module 'crypto' {
3784
4236
  * - `'HMAC'`
3785
4237
  * @since v15.0.0
3786
4238
  */
3787
- sign(algorithm: AlgorithmIdentifier | RsaPssParams | EcdsaParams | Ed448Params, key: CryptoKey, data: BufferSource): Promise<ArrayBuffer>;
4239
+ sign(
4240
+ algorithm: AlgorithmIdentifier | RsaPssParams | EcdsaParams | Ed448Params,
4241
+ key: CryptoKey,
4242
+ data: BufferSource,
4243
+ ): Promise<ArrayBuffer>;
3788
4244
  /**
3789
4245
  * In cryptography, "wrapping a key" refers to exporting and then encrypting the keying material.
3790
4246
  * The `subtle.unwrapKey()` method attempts to decrypt a wrapped key and create a `<CryptoKey>` instance.
@@ -3821,9 +4277,14 @@ declare module 'crypto' {
3821
4277
  wrappedKey: BufferSource,
3822
4278
  unwrappingKey: CryptoKey,
3823
4279
  unwrapAlgorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesGcmParams,
3824
- unwrappedKeyAlgorithm: AlgorithmIdentifier | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | AesKeyAlgorithm,
4280
+ unwrappedKeyAlgorithm:
4281
+ | AlgorithmIdentifier
4282
+ | RsaHashedImportParams
4283
+ | EcKeyImportParams
4284
+ | HmacImportParams
4285
+ | AesKeyAlgorithm,
3825
4286
  extractable: boolean,
3826
- keyUsages: KeyUsage[]
4287
+ keyUsages: KeyUsage[],
3827
4288
  ): Promise<CryptoKey>;
3828
4289
  /**
3829
4290
  * Using the method and parameters given in `algorithm` and the keying material provided by `key`,
@@ -3838,7 +4299,12 @@ declare module 'crypto' {
3838
4299
  * - `'HMAC'`
3839
4300
  * @since v15.0.0
3840
4301
  */
3841
- verify(algorithm: AlgorithmIdentifier | RsaPssParams | EcdsaParams | Ed448Params, key: CryptoKey, signature: BufferSource, data: BufferSource): Promise<boolean>;
4302
+ verify(
4303
+ algorithm: AlgorithmIdentifier | RsaPssParams | EcdsaParams | Ed448Params,
4304
+ key: CryptoKey,
4305
+ signature: BufferSource,
4306
+ data: BufferSource,
4307
+ ): Promise<boolean>;
3842
4308
  /**
3843
4309
  * In cryptography, "wrapping a key" refers to exporting and then encrypting the keying material.
3844
4310
  * The `subtle.wrapKey()` method exports the keying material into the format identified by `format`,
@@ -3857,10 +4323,15 @@ declare module 'crypto' {
3857
4323
  * @param format Must be one of `'raw'`, `'pkcs8'`, `'spki'`, or `'jwk'`.
3858
4324
  * @since v15.0.0
3859
4325
  */
3860
- wrapKey(format: KeyFormat, key: CryptoKey, wrappingKey: CryptoKey, wrapAlgorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesGcmParams): Promise<ArrayBuffer>;
4326
+ wrapKey(
4327
+ format: KeyFormat,
4328
+ key: CryptoKey,
4329
+ wrappingKey: CryptoKey,
4330
+ wrapAlgorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesGcmParams,
4331
+ ): Promise<ArrayBuffer>;
3861
4332
  }
3862
4333
  }
3863
4334
  }
3864
- declare module 'node:crypto' {
3865
- export * from 'crypto';
4335
+ declare module "node:crypto" {
4336
+ export * from "crypto";
3866
4337
  }