@types/node 13.13.50 → 14.0.1

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 (61) hide show
  1. {node v13.13 → node}/LICENSE +0 -0
  2. node/README.md +16 -0
  3. node v13.13/ts3.6/assert.d.ts → node/assert.d.ts +8 -27
  4. node v13.13/async_hooks.d.ts → node/async_hooks.d.ts +1 -29
  5. node/base.d.ts +41 -0
  6. {node v13.13 → node}/buffer.d.ts +0 -0
  7. node v13.13/child_process.d.ts → node/child_process.d.ts +28 -28
  8. {node v13.13 → node}/cluster.d.ts +0 -0
  9. {node v13.13 → node}/console.d.ts +0 -0
  10. {node v13.13 → node}/constants.d.ts +0 -0
  11. node v13.13/crypto.d.ts → node/crypto.d.ts +83 -287
  12. node v13.13/dgram.d.ts → node/dgram.d.ts +3 -3
  13. {node v13.13 → node}/dns.d.ts +0 -0
  14. node v13.13/domain.d.ts → node/domain.d.ts +2 -2
  15. node v13.13/events.d.ts → node/events.d.ts +17 -22
  16. node/fs/promises.d.ts +539 -0
  17. node v13.13/fs.d.ts → node/fs.d.ts +272 -820
  18. node v13.13/globals.d.ts → node/globals.d.ts +15 -94
  19. node v13.13/http.d.ts → node/http.d.ts +4 -11
  20. node v13.13/http2.d.ts → node/http2.d.ts +6 -6
  21. {node v13.13 → node}/https.d.ts +0 -0
  22. node v13.13/index.d.ts → node/index.d.ts +44 -5
  23. node v13.13/inspector.d.ts → node/inspector.d.ts +7 -0
  24. node v13.13/module.d.ts → node/module.d.ts +0 -6
  25. node v13.13/net.d.ts → node/net.d.ts +3 -3
  26. node v13.13/os.d.ts → node/os.d.ts +1 -1
  27. node v13.13/package.json → node/package.json +35 -10
  28. {node v13.13 → node}/path.d.ts +0 -0
  29. node v13.13/perf_hooks.d.ts → node/perf_hooks.d.ts +74 -8
  30. {node v13.13 → node}/process.d.ts +0 -0
  31. node/punycode.d.ts +12 -0
  32. {node v13.13 → node}/querystring.d.ts +0 -0
  33. {node v13.13 → node}/readline.d.ts +0 -0
  34. node v13.13/repl.d.ts → node/repl.d.ts +2 -10
  35. node v13.13/stream.d.ts → node/stream.d.ts +27 -33
  36. node v13.13/string_decoder.d.ts → node/string_decoder.d.ts +1 -1
  37. {node v13.13 → node}/timers.d.ts +0 -0
  38. node v13.13/tls.d.ts → node/tls.d.ts +2 -2
  39. {node v13.13 → node}/trace_events.d.ts +0 -0
  40. node/ts3.2/base.d.ts +22 -0
  41. node/ts3.2/fs.d.ts +33 -0
  42. node/ts3.2/globals.d.ts +19 -0
  43. node/ts3.2/index.d.ts +8 -0
  44. node/ts3.2/util.d.ts +9 -0
  45. node/ts3.5/base.d.ts +20 -0
  46. node v13.13/ts3.6/index.d.ts → node/ts3.5/index.d.ts +4 -2
  47. node v13.13/wasi.d.ts → node/ts3.5/wasi.d.ts +1 -4
  48. node v13.13/assert.d.ts → node/ts3.7/assert.d.ts +9 -54
  49. node v13.13/base.d.ts → node/ts3.7/base.d.ts +2 -1
  50. node/ts3.7/index.d.ts +5 -0
  51. {node v13.13 → node}/tty.d.ts +0 -0
  52. node v13.13/url.d.ts → node/url.d.ts +1 -7
  53. node v13.13/util.d.ts → node/util.d.ts +14 -30
  54. {node v13.13 → node}/v8.d.ts +0 -0
  55. node v13.13/vm.d.ts → node/vm.d.ts +1 -3
  56. node v13.13/worker_threads.d.ts → node/worker_threads.d.ts +3 -21
  57. node v13.13/zlib.d.ts → node/zlib.d.ts +0 -1
  58. node v13.13/README.md +0 -16
  59. node v13.13/globals.global.d.ts +0 -1
  60. node v13.13/punycode.d.ts +0 -68
  61. node v13.13/ts3.6/base.d.ts +0 -60
@@ -1,5 +1,5 @@
1
- declare module 'crypto' {
2
- import * as stream from 'stream';
1
+ declare module "crypto" {
2
+ import * as stream from "stream";
3
3
 
4
4
  interface Certificate {
5
5
  exportChallenge(spkac: BinaryLike): Buffer;
@@ -7,12 +7,11 @@ declare module 'crypto' {
7
7
  verifySpkac(spkac: NodeJS.ArrayBufferView): boolean;
8
8
  }
9
9
  const Certificate: {
10
- new (): Certificate;
10
+ new(): Certificate;
11
11
  (): Certificate;
12
12
  };
13
13
 
14
- namespace constants {
15
- // https://nodejs.org/dist/latest-v10.x/docs/api/crypto.html#crypto_crypto_constants
14
+ namespace constants { // https://nodejs.org/dist/latest-v10.x/docs/api/crypto.html#crypto_crypto_constants
16
15
  const OPENSSL_VERSION_NUMBER: number;
17
16
 
18
17
  /** Applies multiple bug workarounds within OpenSSL. See https://www.openssl.org/docs/man1.0.2/ssl/SSL_CTX_set_options.html for detail. */
@@ -121,11 +120,11 @@ declare module 'crypto' {
121
120
  function createHash(algorithm: string, options?: HashOptions): Hash;
122
121
  function createHmac(algorithm: string, key: BinaryLike | KeyObject, options?: stream.TransformOptions): Hmac;
123
122
 
124
- type Utf8AsciiLatin1Encoding = 'utf8' | 'ascii' | 'latin1';
125
- type HexBase64Latin1Encoding = 'latin1' | 'hex' | 'base64';
126
- type Utf8AsciiBinaryEncoding = 'utf8' | 'ascii' | 'binary';
127
- type HexBase64BinaryEncoding = 'binary' | 'base64' | 'hex';
128
- type ECDHKeyFormat = 'compressed' | 'uncompressed' | 'hybrid';
123
+ type Utf8AsciiLatin1Encoding = "utf8" | "ascii" | "latin1";
124
+ type HexBase64Latin1Encoding = "latin1" | "hex" | "base64";
125
+ type Utf8AsciiBinaryEncoding = "utf8" | "ascii" | "binary";
126
+ type HexBase64BinaryEncoding = "binary" | "base64" | "hex";
127
+ type ECDHKeyFormat = "compressed" | "uncompressed" | "hybrid";
129
128
 
130
129
  class Hash extends stream.Transform {
131
130
  private constructor();
@@ -190,37 +189,26 @@ declare module 'crypto' {
190
189
  algorithm: CipherCCMTypes,
191
190
  key: CipherKey,
192
191
  iv: BinaryLike | null,
193
- options: CipherCCMOptions,
192
+ options: CipherCCMOptions
194
193
  ): CipherCCM;
195
194
  function createCipheriv(
196
195
  algorithm: CipherGCMTypes,
197
196
  key: CipherKey,
198
197
  iv: BinaryLike | null,
199
- options?: CipherGCMOptions,
198
+ options?: CipherGCMOptions
200
199
  ): CipherGCM;
201
200
  function createCipheriv(
202
- algorithm: string,
203
- key: CipherKey,
204
- iv: BinaryLike | null,
205
- options?: stream.TransformOptions,
201
+ algorithm: string, key: CipherKey, iv: BinaryLike | null, options?: stream.TransformOptions
206
202
  ): Cipher;
207
203
 
208
204
  class Cipher extends stream.Transform {
209
205
  private constructor();
210
206
  update(data: BinaryLike): Buffer;
211
207
  update(data: string, input_encoding: Utf8AsciiBinaryEncoding): Buffer;
212
- update(
213
- data: NodeJS.ArrayBufferView,
214
- input_encoding: undefined,
215
- output_encoding: HexBase64BinaryEncoding,
216
- ): string;
217
- update(
218
- data: string,
219
- input_encoding: Utf8AsciiBinaryEncoding | undefined,
220
- output_encoding: HexBase64BinaryEncoding,
221
- ): string;
208
+ update(data: NodeJS.ArrayBufferView, input_encoding: undefined, output_encoding: HexBase64BinaryEncoding): string;
209
+ update(data: string, input_encoding: Utf8AsciiBinaryEncoding | undefined, output_encoding: HexBase64BinaryEncoding): string;
222
210
  final(): Buffer;
223
- final(output_encoding: string): string;
211
+ final(output_encoding: BufferEncoding): string;
224
212
  setAutoPadding(auto_padding?: boolean): this;
225
213
  // getAuthTag(): Buffer;
226
214
  // setAAD(buffer: Buffer): this; // docs only say buffer
@@ -252,29 +240,16 @@ declare module 'crypto' {
252
240
  iv: BinaryLike | null,
253
241
  options?: CipherGCMOptions,
254
242
  ): DecipherGCM;
255
- function createDecipheriv(
256
- algorithm: string,
257
- key: CipherKey,
258
- iv: BinaryLike | null,
259
- options?: stream.TransformOptions,
260
- ): Decipher;
243
+ function createDecipheriv(algorithm: string, key: CipherKey, iv: BinaryLike | null, options?: stream.TransformOptions): Decipher;
261
244
 
262
245
  class Decipher extends stream.Transform {
263
246
  private constructor();
264
247
  update(data: NodeJS.ArrayBufferView): Buffer;
265
248
  update(data: string, input_encoding: HexBase64BinaryEncoding): Buffer;
266
- update(
267
- data: NodeJS.ArrayBufferView,
268
- input_encoding: HexBase64BinaryEncoding | undefined,
269
- output_encoding: Utf8AsciiBinaryEncoding,
270
- ): string;
271
- update(
272
- data: string,
273
- input_encoding: HexBase64BinaryEncoding | undefined,
274
- output_encoding: Utf8AsciiBinaryEncoding,
275
- ): string;
249
+ update(data: NodeJS.ArrayBufferView, input_encoding: HexBase64BinaryEncoding | undefined, output_encoding: Utf8AsciiBinaryEncoding): string;
250
+ update(data: string, input_encoding: HexBase64BinaryEncoding | undefined, output_encoding: Utf8AsciiBinaryEncoding): string;
276
251
  final(): Buffer;
277
- final(output_encoding: string): string;
252
+ final(output_encoding: BufferEncoding): string;
278
253
  setAutoPadding(auto_padding?: boolean): this;
279
254
  // setAuthTag(tag: NodeJS.ArrayBufferView): this;
280
255
  // setAAD(buffer: NodeJS.ArrayBufferView): this;
@@ -315,7 +290,8 @@ declare module 'crypto' {
315
290
  saltLength?: number;
316
291
  }
317
292
 
318
- interface SignPrivateKeyInput extends PrivateKeyInput, SigningOptions {}
293
+ interface SignPrivateKeyInput extends PrivateKeyInput, SigningOptions {
294
+ }
319
295
 
320
296
  type KeyLike = string | Buffer | KeyObject;
321
297
 
@@ -342,17 +318,8 @@ declare module 'crypto' {
342
318
  function createDiffieHellman(prime_length: number, generator?: number | NodeJS.ArrayBufferView): DiffieHellman;
343
319
  function createDiffieHellman(prime: NodeJS.ArrayBufferView): DiffieHellman;
344
320
  function createDiffieHellman(prime: string, prime_encoding: HexBase64Latin1Encoding): DiffieHellman;
345
- function createDiffieHellman(
346
- prime: string,
347
- prime_encoding: HexBase64Latin1Encoding,
348
- generator: number | NodeJS.ArrayBufferView,
349
- ): DiffieHellman;
350
- function createDiffieHellman(
351
- prime: string,
352
- prime_encoding: HexBase64Latin1Encoding,
353
- generator: string,
354
- generator_encoding: HexBase64Latin1Encoding,
355
- ): DiffieHellman;
321
+ function createDiffieHellman(prime: string, prime_encoding: HexBase64Latin1Encoding, generator: number | NodeJS.ArrayBufferView): DiffieHellman;
322
+ function createDiffieHellman(prime: string, prime_encoding: HexBase64Latin1Encoding, generator: string, generator_encoding: HexBase64Latin1Encoding): DiffieHellman;
356
323
  class DiffieHellman {
357
324
  private constructor();
358
325
  generateKeys(): Buffer;
@@ -360,11 +327,7 @@ declare module 'crypto' {
360
327
  computeSecret(other_public_key: NodeJS.ArrayBufferView): Buffer;
361
328
  computeSecret(other_public_key: string, input_encoding: HexBase64Latin1Encoding): Buffer;
362
329
  computeSecret(other_public_key: NodeJS.ArrayBufferView, output_encoding: HexBase64Latin1Encoding): string;
363
- computeSecret(
364
- other_public_key: string,
365
- input_encoding: HexBase64Latin1Encoding,
366
- output_encoding: HexBase64Latin1Encoding,
367
- ): string;
330
+ computeSecret(other_public_key: string, input_encoding: HexBase64Latin1Encoding, output_encoding: HexBase64Latin1Encoding): string;
368
331
  getPrime(): Buffer;
369
332
  getPrime(encoding: HexBase64Latin1Encoding): string;
370
333
  getGenerator(): Buffer;
@@ -374,9 +337,9 @@ declare module 'crypto' {
374
337
  getPrivateKey(): Buffer;
375
338
  getPrivateKey(encoding: HexBase64Latin1Encoding): string;
376
339
  setPublicKey(public_key: NodeJS.ArrayBufferView): void;
377
- setPublicKey(public_key: string, encoding: string): void;
340
+ setPublicKey(public_key: string, encoding: BufferEncoding): void;
378
341
  setPrivateKey(private_key: NodeJS.ArrayBufferView): void;
379
- setPrivateKey(private_key: string, encoding: string): void;
342
+ setPrivateKey(private_key: string, encoding: BufferEncoding): void;
380
343
  verifyError: number;
381
344
  }
382
345
  function getDiffieHellman(group_name: string): DiffieHellman;
@@ -388,13 +351,7 @@ declare module 'crypto' {
388
351
  digest: string,
389
352
  callback: (err: Error | null, derivedKey: Buffer) => any,
390
353
  ): void;
391
- function pbkdf2Sync(
392
- password: BinaryLike,
393
- salt: BinaryLike,
394
- iterations: number,
395
- keylen: number,
396
- digest: string,
397
- ): Buffer;
354
+ function pbkdf2Sync(password: BinaryLike, salt: BinaryLike, iterations: number, keylen: number, digest: string): Buffer;
398
355
 
399
356
  function randomBytes(size: number): Buffer;
400
357
  function randomBytes(size: number, callback: (err: Error | null, buf: Buffer) => void): void;
@@ -402,26 +359,11 @@ declare module 'crypto' {
402
359
  function pseudoRandomBytes(size: number, callback: (err: Error | null, buf: Buffer) => void): void;
403
360
 
404
361
  function randomFillSync<T extends NodeJS.ArrayBufferView>(buffer: T, offset?: number, size?: number): T;
405
- function randomFill<T extends NodeJS.ArrayBufferView>(
406
- buffer: T,
407
- callback: (err: Error | null, buf: T) => void,
408
- ): void;
409
- function randomFill<T extends NodeJS.ArrayBufferView>(
410
- buffer: T,
411
- offset: number,
412
- callback: (err: Error | null, buf: T) => void,
413
- ): void;
414
- function randomFill<T extends NodeJS.ArrayBufferView>(
415
- buffer: T,
416
- offset: number,
417
- size: number,
418
- callback: (err: Error | null, buf: T) => void,
419
- ): void;
362
+ function randomFill<T extends NodeJS.ArrayBufferView>(buffer: T, callback: (err: Error | null, buf: T) => void): void;
363
+ function randomFill<T extends NodeJS.ArrayBufferView>(buffer: T, offset: number, callback: (err: Error | null, buf: T) => void): void;
364
+ function randomFill<T extends NodeJS.ArrayBufferView>(buffer: T, offset: number, size: number, callback: (err: Error | null, buf: T) => void): void;
420
365
 
421
366
  interface ScryptOptions {
422
- cost?: number;
423
- blockSize?: number;
424
- parallelization?: number;
425
367
  N?: number;
426
368
  r?: number;
427
369
  p?: number;
@@ -430,8 +372,7 @@ declare module 'crypto' {
430
372
  function scrypt(
431
373
  password: BinaryLike,
432
374
  salt: BinaryLike,
433
- keylen: number,
434
- callback: (err: Error | null, derivedKey: Buffer) => void,
375
+ keylen: number, callback: (err: Error | null, derivedKey: Buffer) => void,
435
376
  ): void;
436
377
  function scrypt(
437
378
  password: BinaryLike,
@@ -462,7 +403,6 @@ declare module 'crypto' {
462
403
  function privateEncrypt(private_key: RsaPrivateKey | KeyLike, buffer: NodeJS.ArrayBufferView): Buffer;
463
404
  function getCiphers(): string[];
464
405
  function getCurves(): string[];
465
- function getFips(): 1 | 0;
466
406
  function getHashes(): string[];
467
407
  class ECDH {
468
408
  private constructor();
@@ -470,19 +410,15 @@ declare module 'crypto' {
470
410
  key: BinaryLike,
471
411
  curve: string,
472
412
  inputEncoding?: HexBase64Latin1Encoding,
473
- outputEncoding?: 'latin1' | 'hex' | 'base64',
474
- format?: 'uncompressed' | 'compressed' | 'hybrid',
413
+ outputEncoding?: "latin1" | "hex" | "base64",
414
+ format?: "uncompressed" | "compressed" | "hybrid",
475
415
  ): Buffer | string;
476
416
  generateKeys(): Buffer;
477
417
  generateKeys(encoding: HexBase64Latin1Encoding, format?: ECDHKeyFormat): string;
478
418
  computeSecret(other_public_key: NodeJS.ArrayBufferView): Buffer;
479
419
  computeSecret(other_public_key: string, input_encoding: HexBase64Latin1Encoding): Buffer;
480
420
  computeSecret(other_public_key: NodeJS.ArrayBufferView, output_encoding: HexBase64Latin1Encoding): string;
481
- computeSecret(
482
- other_public_key: string,
483
- input_encoding: HexBase64Latin1Encoding,
484
- output_encoding: HexBase64Latin1Encoding,
485
- ): string;
421
+ computeSecret(other_public_key: string, input_encoding: HexBase64Latin1Encoding, output_encoding: HexBase64Latin1Encoding): string;
486
422
  getPrivateKey(): Buffer;
487
423
  getPrivateKey(encoding: HexBase64Latin1Encoding): string;
488
424
  getPublicKey(): Buffer;
@@ -493,7 +429,7 @@ declare module 'crypto' {
493
429
  function createECDH(curve_name: string): ECDH;
494
430
  function timingSafeEqual(a: NodeJS.ArrayBufferView, b: NodeJS.ArrayBufferView): boolean;
495
431
  /** @deprecated since v10.0.0 */
496
- const DEFAULT_ENCODING: string;
432
+ const DEFAULT_ENCODING: BufferEncoding;
497
433
 
498
434
  type KeyType = 'rsa' | 'dsa' | 'ec';
499
435
  type KeyFormat = 'pem' | 'der';
@@ -598,192 +534,60 @@ declare module 'crypto' {
598
534
  privateKey: T2;
599
535
  }
600
536
 
601
- function generateKeyPairSync(
602
- type: 'rsa',
603
- options: RSAKeyPairOptions<'pem', 'pem'>,
604
- ): KeyPairSyncResult<string, string>;
605
- function generateKeyPairSync(
606
- type: 'rsa',
607
- options: RSAKeyPairOptions<'pem', 'der'>,
608
- ): KeyPairSyncResult<string, Buffer>;
609
- function generateKeyPairSync(
610
- type: 'rsa',
611
- options: RSAKeyPairOptions<'der', 'pem'>,
612
- ): KeyPairSyncResult<Buffer, string>;
613
- function generateKeyPairSync(
614
- type: 'rsa',
615
- options: RSAKeyPairOptions<'der', 'der'>,
616
- ): KeyPairSyncResult<Buffer, Buffer>;
537
+ function generateKeyPairSync(type: 'rsa', options: RSAKeyPairOptions<'pem', 'pem'>): KeyPairSyncResult<string, string>;
538
+ function generateKeyPairSync(type: 'rsa', options: RSAKeyPairOptions<'pem', 'der'>): KeyPairSyncResult<string, Buffer>;
539
+ function generateKeyPairSync(type: 'rsa', options: RSAKeyPairOptions<'der', 'pem'>): KeyPairSyncResult<Buffer, string>;
540
+ function generateKeyPairSync(type: 'rsa', options: RSAKeyPairOptions<'der', 'der'>): KeyPairSyncResult<Buffer, Buffer>;
617
541
  function generateKeyPairSync(type: 'rsa', options: RSAKeyPairKeyObjectOptions): KeyPairKeyObjectResult;
618
542
 
619
- function generateKeyPairSync(
620
- type: 'dsa',
621
- options: DSAKeyPairOptions<'pem', 'pem'>,
622
- ): KeyPairSyncResult<string, string>;
623
- function generateKeyPairSync(
624
- type: 'dsa',
625
- options: DSAKeyPairOptions<'pem', 'der'>,
626
- ): KeyPairSyncResult<string, Buffer>;
627
- function generateKeyPairSync(
628
- type: 'dsa',
629
- options: DSAKeyPairOptions<'der', 'pem'>,
630
- ): KeyPairSyncResult<Buffer, string>;
631
- function generateKeyPairSync(
632
- type: 'dsa',
633
- options: DSAKeyPairOptions<'der', 'der'>,
634
- ): KeyPairSyncResult<Buffer, Buffer>;
543
+ function generateKeyPairSync(type: 'dsa', options: DSAKeyPairOptions<'pem', 'pem'>): KeyPairSyncResult<string, string>;
544
+ function generateKeyPairSync(type: 'dsa', options: DSAKeyPairOptions<'pem', 'der'>): KeyPairSyncResult<string, Buffer>;
545
+ function generateKeyPairSync(type: 'dsa', options: DSAKeyPairOptions<'der', 'pem'>): KeyPairSyncResult<Buffer, string>;
546
+ function generateKeyPairSync(type: 'dsa', options: DSAKeyPairOptions<'der', 'der'>): KeyPairSyncResult<Buffer, Buffer>;
635
547
  function generateKeyPairSync(type: 'dsa', options: DSAKeyPairKeyObjectOptions): KeyPairKeyObjectResult;
636
548
 
637
- function generateKeyPairSync(
638
- type: 'ec',
639
- options: ECKeyPairOptions<'pem', 'pem'>,
640
- ): KeyPairSyncResult<string, string>;
641
- function generateKeyPairSync(
642
- type: 'ec',
643
- options: ECKeyPairOptions<'pem', 'der'>,
644
- ): KeyPairSyncResult<string, Buffer>;
645
- function generateKeyPairSync(
646
- type: 'ec',
647
- options: ECKeyPairOptions<'der', 'pem'>,
648
- ): KeyPairSyncResult<Buffer, string>;
649
- function generateKeyPairSync(
650
- type: 'ec',
651
- options: ECKeyPairOptions<'der', 'der'>,
652
- ): KeyPairSyncResult<Buffer, Buffer>;
549
+ function generateKeyPairSync(type: 'ec', options: ECKeyPairOptions<'pem', 'pem'>): KeyPairSyncResult<string, string>;
550
+ function generateKeyPairSync(type: 'ec', options: ECKeyPairOptions<'pem', 'der'>): KeyPairSyncResult<string, Buffer>;
551
+ function generateKeyPairSync(type: 'ec', options: ECKeyPairOptions<'der', 'pem'>): KeyPairSyncResult<Buffer, string>;
552
+ function generateKeyPairSync(type: 'ec', options: ECKeyPairOptions<'der', 'der'>): KeyPairSyncResult<Buffer, Buffer>;
653
553
  function generateKeyPairSync(type: 'ec', options: ECKeyPairKeyObjectOptions): KeyPairKeyObjectResult;
654
554
 
655
- function generateKeyPair(
656
- type: 'rsa',
657
- options: RSAKeyPairOptions<'pem', 'pem'>,
658
- callback: (err: Error | null, publicKey: string, privateKey: string) => void,
659
- ): void;
660
- function generateKeyPair(
661
- type: 'rsa',
662
- options: RSAKeyPairOptions<'pem', 'der'>,
663
- callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void,
664
- ): void;
665
- function generateKeyPair(
666
- type: 'rsa',
667
- options: RSAKeyPairOptions<'der', 'pem'>,
668
- callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void,
669
- ): void;
670
- function generateKeyPair(
671
- type: 'rsa',
672
- options: RSAKeyPairOptions<'der', 'der'>,
673
- callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void,
674
- ): void;
675
- function generateKeyPair(
676
- type: 'rsa',
677
- options: RSAKeyPairKeyObjectOptions,
678
- callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void,
679
- ): void;
555
+ function generateKeyPair(type: 'rsa', options: RSAKeyPairOptions<'pem', 'pem'>, callback: (err: Error | null, publicKey: string, privateKey: string) => void): void;
556
+ function generateKeyPair(type: 'rsa', options: RSAKeyPairOptions<'pem', 'der'>, callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void): void;
557
+ function generateKeyPair(type: 'rsa', options: RSAKeyPairOptions<'der', 'pem'>, callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void): void;
558
+ function generateKeyPair(type: 'rsa', options: RSAKeyPairOptions<'der', 'der'>, callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void): void;
559
+ function generateKeyPair(type: 'rsa', options: RSAKeyPairKeyObjectOptions, callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void): void;
680
560
 
681
- function generateKeyPair(
682
- type: 'dsa',
683
- options: DSAKeyPairOptions<'pem', 'pem'>,
684
- callback: (err: Error | null, publicKey: string, privateKey: string) => void,
685
- ): void;
686
- function generateKeyPair(
687
- type: 'dsa',
688
- options: DSAKeyPairOptions<'pem', 'der'>,
689
- callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void,
690
- ): void;
691
- function generateKeyPair(
692
- type: 'dsa',
693
- options: DSAKeyPairOptions<'der', 'pem'>,
694
- callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void,
695
- ): void;
696
- function generateKeyPair(
697
- type: 'dsa',
698
- options: DSAKeyPairOptions<'der', 'der'>,
699
- callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void,
700
- ): void;
701
- function generateKeyPair(
702
- type: 'dsa',
703
- options: DSAKeyPairKeyObjectOptions,
704
- callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void,
705
- ): void;
561
+ function generateKeyPair(type: 'dsa', options: DSAKeyPairOptions<'pem', 'pem'>, callback: (err: Error | null, publicKey: string, privateKey: string) => void): void;
562
+ function generateKeyPair(type: 'dsa', options: DSAKeyPairOptions<'pem', 'der'>, callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void): void;
563
+ function generateKeyPair(type: 'dsa', options: DSAKeyPairOptions<'der', 'pem'>, callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void): void;
564
+ function generateKeyPair(type: 'dsa', options: DSAKeyPairOptions<'der', 'der'>, callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void): void;
565
+ function generateKeyPair(type: 'dsa', options: DSAKeyPairKeyObjectOptions, callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void): void;
706
566
 
707
- function generateKeyPair(
708
- type: 'ec',
709
- options: ECKeyPairOptions<'pem', 'pem'>,
710
- callback: (err: Error | null, publicKey: string, privateKey: string) => void,
711
- ): void;
712
- function generateKeyPair(
713
- type: 'ec',
714
- options: ECKeyPairOptions<'pem', 'der'>,
715
- callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void,
716
- ): void;
717
- function generateKeyPair(
718
- type: 'ec',
719
- options: ECKeyPairOptions<'der', 'pem'>,
720
- callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void,
721
- ): void;
722
- function generateKeyPair(
723
- type: 'ec',
724
- options: ECKeyPairOptions<'der', 'der'>,
725
- callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void,
726
- ): void;
727
- function generateKeyPair(
728
- type: 'ec',
729
- options: ECKeyPairKeyObjectOptions,
730
- callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void,
731
- ): void;
567
+ function generateKeyPair(type: 'ec', options: ECKeyPairOptions<'pem', 'pem'>, callback: (err: Error | null, publicKey: string, privateKey: string) => void): void;
568
+ function generateKeyPair(type: 'ec', options: ECKeyPairOptions<'pem', 'der'>, callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void): void;
569
+ function generateKeyPair(type: 'ec', options: ECKeyPairOptions<'der', 'pem'>, callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void): void;
570
+ function generateKeyPair(type: 'ec', options: ECKeyPairOptions<'der', 'der'>, callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void): void;
571
+ function generateKeyPair(type: 'ec', options: ECKeyPairKeyObjectOptions, callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void): void;
732
572
 
733
573
  namespace generateKeyPair {
734
- function __promisify__(
735
- type: 'rsa',
736
- options: RSAKeyPairOptions<'pem', 'pem'>,
737
- ): Promise<{ publicKey: string; privateKey: string }>;
738
- function __promisify__(
739
- type: 'rsa',
740
- options: RSAKeyPairOptions<'pem', 'der'>,
741
- ): Promise<{ publicKey: string; privateKey: Buffer }>;
742
- function __promisify__(
743
- type: 'rsa',
744
- options: RSAKeyPairOptions<'der', 'pem'>,
745
- ): Promise<{ publicKey: Buffer; privateKey: string }>;
746
- function __promisify__(
747
- type: 'rsa',
748
- options: RSAKeyPairOptions<'der', 'der'>,
749
- ): Promise<{ publicKey: Buffer; privateKey: Buffer }>;
750
- function __promisify__(type: 'rsa', options: RSAKeyPairKeyObjectOptions): Promise<KeyPairKeyObjectResult>;
751
-
752
- function __promisify__(
753
- type: 'dsa',
754
- options: DSAKeyPairOptions<'pem', 'pem'>,
755
- ): Promise<{ publicKey: string; privateKey: string }>;
756
- function __promisify__(
757
- type: 'dsa',
758
- options: DSAKeyPairOptions<'pem', 'der'>,
759
- ): Promise<{ publicKey: string; privateKey: Buffer }>;
760
- function __promisify__(
761
- type: 'dsa',
762
- options: DSAKeyPairOptions<'der', 'pem'>,
763
- ): Promise<{ publicKey: Buffer; privateKey: string }>;
764
- function __promisify__(
765
- type: 'dsa',
766
- options: DSAKeyPairOptions<'der', 'der'>,
767
- ): Promise<{ publicKey: Buffer; privateKey: Buffer }>;
768
- function __promisify__(type: 'dsa', options: DSAKeyPairKeyObjectOptions): Promise<KeyPairKeyObjectResult>;
769
-
770
- function __promisify__(
771
- type: 'ec',
772
- options: ECKeyPairOptions<'pem', 'pem'>,
773
- ): Promise<{ publicKey: string; privateKey: string }>;
774
- function __promisify__(
775
- type: 'ec',
776
- options: ECKeyPairOptions<'pem', 'der'>,
777
- ): Promise<{ publicKey: string; privateKey: Buffer }>;
778
- function __promisify__(
779
- type: 'ec',
780
- options: ECKeyPairOptions<'der', 'pem'>,
781
- ): Promise<{ publicKey: Buffer; privateKey: string }>;
782
- function __promisify__(
783
- type: 'ec',
784
- options: ECKeyPairOptions<'der', 'der'>,
785
- ): Promise<{ publicKey: Buffer; privateKey: Buffer }>;
786
- function __promisify__(type: 'ec', options: ECKeyPairKeyObjectOptions): Promise<KeyPairKeyObjectResult>;
574
+ function __promisify__(type: "rsa", options: RSAKeyPairOptions<'pem', 'pem'>): Promise<{ publicKey: string, privateKey: string }>;
575
+ function __promisify__(type: "rsa", options: RSAKeyPairOptions<'pem', 'der'>): Promise<{ publicKey: string, privateKey: Buffer }>;
576
+ function __promisify__(type: "rsa", options: RSAKeyPairOptions<'der', 'pem'>): Promise<{ publicKey: Buffer, privateKey: string }>;
577
+ function __promisify__(type: "rsa", options: RSAKeyPairOptions<'der', 'der'>): Promise<{ publicKey: Buffer, privateKey: Buffer }>;
578
+ function __promisify__(type: "rsa", options: RSAKeyPairKeyObjectOptions): Promise<KeyPairKeyObjectResult>;
579
+
580
+ function __promisify__(type: "dsa", options: DSAKeyPairOptions<'pem', 'pem'>): Promise<{ publicKey: string, privateKey: string }>;
581
+ function __promisify__(type: "dsa", options: DSAKeyPairOptions<'pem', 'der'>): Promise<{ publicKey: string, privateKey: Buffer }>;
582
+ function __promisify__(type: "dsa", options: DSAKeyPairOptions<'der', 'pem'>): Promise<{ publicKey: Buffer, privateKey: string }>;
583
+ function __promisify__(type: "dsa", options: DSAKeyPairOptions<'der', 'der'>): Promise<{ publicKey: Buffer, privateKey: Buffer }>;
584
+ function __promisify__(type: "dsa", options: DSAKeyPairKeyObjectOptions): Promise<KeyPairKeyObjectResult>;
585
+
586
+ function __promisify__(type: "ec", options: ECKeyPairOptions<'pem', 'pem'>): Promise<{ publicKey: string, privateKey: string }>;
587
+ function __promisify__(type: "ec", options: ECKeyPairOptions<'pem', 'der'>): Promise<{ publicKey: string, privateKey: Buffer }>;
588
+ function __promisify__(type: "ec", options: ECKeyPairOptions<'der', 'pem'>): Promise<{ publicKey: Buffer, privateKey: string }>;
589
+ function __promisify__(type: "ec", options: ECKeyPairOptions<'der', 'der'>): Promise<{ publicKey: Buffer, privateKey: Buffer }>;
590
+ function __promisify__(type: "ec", options: ECKeyPairKeyObjectOptions): Promise<KeyPairKeyObjectResult>;
787
591
  }
788
592
 
789
593
  /**
@@ -794,13 +598,10 @@ declare module 'crypto' {
794
598
  * If `key` is not a [`KeyObject`][], this function behaves as if `key` had been
795
599
  * passed to [`crypto.createPrivateKey()`][].
796
600
  */
797
- function sign(
798
- algorithm: string | null | undefined,
799
- data: NodeJS.ArrayBufferView,
800
- key: KeyLike | SignPrivateKeyInput,
801
- ): Buffer;
601
+ function sign(algorithm: string | null | undefined, data: NodeJS.ArrayBufferView, key: KeyLike | SignPrivateKeyInput): Buffer;
802
602
 
803
- interface VerifyKeyWithOptions extends KeyObject, SigningOptions {}
603
+ interface VerifyKeyWithOptions extends KeyObject, SigningOptions {
604
+ }
804
605
 
805
606
  /**
806
607
  * Calculates and returns the signature for `data` using the given private key and
@@ -810,10 +611,5 @@ declare module 'crypto' {
810
611
  * If `key` is not a [`KeyObject`][], this function behaves as if `key` had been
811
612
  * passed to [`crypto.createPublicKey()`][].
812
613
  */
813
- function verify(
814
- algorithm: string | null | undefined,
815
- data: NodeJS.ArrayBufferView,
816
- key: KeyLike | VerifyKeyWithOptions,
817
- signature: NodeJS.ArrayBufferView,
818
- ): boolean;
614
+ function verify(algorithm: string | null | undefined, data: NodeJS.ArrayBufferView, key: KeyLike | VerifyKeyWithOptions, signature: NodeJS.ArrayBufferView): boolean;
819
615
  }
@@ -50,9 +50,9 @@ declare module "dgram" {
50
50
  getSendBufferSize(): number;
51
51
  ref(): this;
52
52
  remoteAddress(): AddressInfo;
53
- send(msg: string | Uint8Array | ReadonlyArray<any>, port?: number, address?: string, callback?: (error: Error | null, bytes: number) => void): void;
54
- send(msg: string | Uint8Array | ReadonlyArray<any>, port?: number, callback?: (error: Error | null, bytes: number) => void): void;
55
- send(msg: string | Uint8Array | ReadonlyArray<any>, callback?: (error: Error | null, bytes: number) => void): void;
53
+ send(msg: string | Uint8Array | any[], port?: number, address?: string, callback?: (error: Error | null, bytes: number) => void): void;
54
+ send(msg: string | Uint8Array | any[], port?: number, callback?: (error: Error | null, bytes: number) => void): void;
55
+ send(msg: string | Uint8Array | any[], callback?: (error: Error | null, bytes: number) => void): void;
56
56
  send(msg: string | Uint8Array, offset: number, length: number, port?: number, address?: string, callback?: (error: Error | null, bytes: number) => void): void;
57
57
  send(msg: string | Uint8Array, offset: number, length: number, port?: number, callback?: (error: Error | null, bytes: number) => void): void;
58
58
  send(msg: string | Uint8Array, offset: number, length: number, callback?: (error: Error | null, bytes: number) => void): void;
File without changes
@@ -1,5 +1,5 @@
1
- declare module 'domain' {
2
- import EventEmitter = require('events');
1
+ declare module "domain" {
2
+ import { EventEmitter } from "events";
3
3
 
4
4
  class Domain extends EventEmitter implements NodeJS.Domain {
5
5
  run<T>(fn: (...args: any[]) => T, ...args: any[]): T;
@@ -1,4 +1,4 @@
1
- declare module 'events' {
1
+ declare module "events" {
2
2
  interface EventEmitterOptions {
3
3
  /**
4
4
  * Enables automatic capturing of promise rejection.
@@ -14,16 +14,11 @@ declare module 'events' {
14
14
  addEventListener(event: string, listener: (...args: any[]) => void, opts?: { once: boolean }): any;
15
15
  }
16
16
 
17
- interface EventEmitter extends NodeJS.EventEmitter {}
18
- class EventEmitter {
19
- constructor(options?: EventEmitterOptions);
20
-
21
- static once(emitter: NodeEventTarget, event: string | symbol): Promise<any[]>;
22
- static once(emitter: DOMEventTarget, event: string): Promise<any[]>;
23
- static on(emitter: NodeJS.EventEmitter, event: string): AsyncIterableIterator<any>;
24
-
25
- /** @deprecated since v4.0.0 */
26
- static listenerCount(emitter: NodeJS.EventEmitter, event: string | symbol): number;
17
+ namespace EventEmitter {
18
+ function once(emitter: NodeEventTarget, event: string | symbol): Promise<any[]>;
19
+ function once(emitter: DOMEventTarget, event: string): Promise<any[]>;
20
+ function on(emitter: EventEmitter, event: string): AsyncIterableIterator<any>;
21
+ const captureRejectionSymbol: unique symbol;
27
22
 
28
23
  /**
29
24
  * This symbol shall be used to install a listener for only monitoring `'error'`
@@ -34,21 +29,21 @@ declare module 'events' {
34
29
  * `'error'` event is emitted, therefore the process will still crash if no
35
30
  * regular `'error'` listener is installed.
36
31
  */
37
- static readonly errorMonitor: unique symbol;
38
- static readonly captureRejectionSymbol: unique symbol;
39
-
32
+ const errorMonitor: unique symbol;
40
33
  /**
41
34
  * Sets or gets the default captureRejection value for all emitters.
42
35
  */
43
- // TODO: These should be described using static getter/setter pairs:
44
- static captureRejections: boolean;
45
- static defaultMaxListeners: number;
46
- }
36
+ let captureRejections: boolean;
47
37
 
48
- import internal = require('events');
49
- namespace EventEmitter {
50
- // Should just be `export { EventEmitter }`, but that doesn't work in TypeScript 3.4
51
- export { internal as EventEmitter };
38
+ interface EventEmitter extends NodeJS.EventEmitter {
39
+ }
40
+
41
+ class EventEmitter {
42
+ constructor(options?: EventEmitterOptions);
43
+ /** @deprecated since v4.0.0 */
44
+ static listenerCount(emitter: EventEmitter, event: string | symbol): number;
45
+ static defaultMaxListeners: number;
46
+ }
52
47
  }
53
48
 
54
49
  export = EventEmitter;