@types/node 11.15.51 → 12.0.0

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 (56) hide show
  1. node v11.15/LICENSE → node/LICENSE +21 -21
  2. node/README.md +16 -0
  3. node v11.15/ts3.6/assert.d.ts → node/assert.d.ts +12 -33
  4. node v11.15/async_hooks.d.ts → node/async_hooks.d.ts +1 -13
  5. node/base.d.ts +41 -0
  6. {node v11.15 → node}/buffer.d.ts +0 -0
  7. node v11.15/child_process.d.ts → node/child_process.d.ts +8 -10
  8. {node v11.15 → node}/cluster.d.ts +0 -0
  9. {node v11.15 → node}/console.d.ts +0 -0
  10. node v11.15/constants.d.ts → node/constants.d.ts +0 -36
  11. node v11.15/crypto.d.ts → node/crypto.d.ts +112 -264
  12. node v11.15/dgram.d.ts → node/dgram.d.ts +1 -1
  13. node v11.15/dns.d.ts → node/dns.d.ts +1 -75
  14. node/domain.d.ts +16 -0
  15. node/events.d.ts +30 -0
  16. node v11.15/fs.d.ts → node/fs.d.ts +9 -17
  17. node v11.15/globals.d.ts → node/globals.d.ts +18 -93
  18. node v11.15/http.d.ts → node/http.d.ts +5 -9
  19. node v11.15/http2.d.ts → node/http2.d.ts +3 -3
  20. {node v11.15 → node}/https.d.ts +0 -0
  21. node/index.d.ts +99 -0
  22. node v11.15/inspector.d.ts → node/inspector.d.ts +2 -2
  23. {node v11.15 → node}/module.d.ts +0 -0
  24. {node v11.15 → node}/net.d.ts +0 -0
  25. node v11.15/os.d.ts → node/os.d.ts +0 -4
  26. node v11.15/package.json → node/package.json +34 -24
  27. {node v11.15 → node}/path.d.ts +0 -0
  28. node v11.15/perf_hooks.d.ts → node/perf_hooks.d.ts +77 -5
  29. {node v11.15 → node}/process.d.ts +0 -0
  30. node/punycode.d.ts +12 -0
  31. node v11.15/querystring.d.ts → node/querystring.d.ts +4 -9
  32. node v11.15/readline.d.ts → node/readline.d.ts +1 -2
  33. node v11.15/repl.d.ts → node/repl.d.ts +2 -10
  34. node v11.15/stream.d.ts → node/stream.d.ts +6 -16
  35. {node v11.15 → node}/string_decoder.d.ts +0 -0
  36. {node v11.15 → node}/timers.d.ts +0 -0
  37. node v11.15/tls.d.ts → node/tls.d.ts +3 -4
  38. {node v11.15 → node}/trace_events.d.ts +0 -0
  39. node/ts3.2/globals.d.ts +19 -0
  40. node v11.15/base.d.ts → node/ts3.2/index.d.ts +7 -6
  41. node/ts3.2/util.d.ts +15 -0
  42. node v11.15/tty.d.ts → node/tty.d.ts +0 -2
  43. node v11.15/url.d.ts → node/url.d.ts +1 -7
  44. node v11.15/util.d.ts → node/util.d.ts +20 -49
  45. {node v11.15 → node}/v8.d.ts +0 -0
  46. node v11.15/vm.d.ts → node/vm.d.ts +1 -3
  47. node v11.15/worker_threads.d.ts → node/worker_threads.d.ts +2 -4
  48. node v11.15/zlib.d.ts → node/zlib.d.ts +0 -1
  49. node v11.15/README.md +0 -16
  50. node v11.15/assert.d.ts +0 -99
  51. node v11.15/domain.d.ts +0 -16
  52. node v11.15/events.d.ts +0 -30
  53. node v11.15/index.d.ts +0 -44
  54. node v11.15/punycode.d.ts +0 -68
  55. node v11.15/ts3.6/base.d.ts +0 -54
  56. node v11.15/ts3.6/index.d.ts +0 -6
@@ -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: Binary): 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. */
@@ -113,20 +112,20 @@ declare module 'crypto' {
113
112
  function createHash(algorithm: string, options?: stream.TransformOptions): Hash;
114
113
  function createHmac(algorithm: string, key: BinaryLike, options?: stream.TransformOptions): Hmac;
115
114
 
116
- type Utf8AsciiLatin1Encoding = 'utf8' | 'ascii' | 'latin1';
117
- type HexBase64Latin1Encoding = 'latin1' | 'hex' | 'base64';
118
- type Utf8AsciiBinaryEncoding = 'utf8' | 'ascii' | 'binary';
119
- type HexBase64BinaryEncoding = 'binary' | 'base64' | 'hex';
120
- type ECDHKeyFormat = 'compressed' | 'uncompressed' | 'hybrid';
115
+ type Utf8AsciiLatin1Encoding = "utf8" | "ascii" | "latin1";
116
+ type HexBase64Latin1Encoding = "latin1" | "hex" | "base64";
117
+ type Utf8AsciiBinaryEncoding = "utf8" | "ascii" | "binary";
118
+ type HexBase64BinaryEncoding = "binary" | "base64" | "hex";
119
+ type ECDHKeyFormat = "compressed" | "uncompressed" | "hybrid";
121
120
 
122
- class Hash extends stream.Transform {
121
+ class Hash extends stream.Duplex {
123
122
  private constructor();
124
123
  update(data: BinaryLike): Hash;
125
124
  update(data: string, input_encoding: Utf8AsciiLatin1Encoding): Hash;
126
125
  digest(): Buffer;
127
126
  digest(encoding: HexBase64Latin1Encoding): string;
128
127
  }
129
- class Hmac extends stream.Transform {
128
+ class Hmac extends stream.Duplex {
130
129
  private constructor();
131
130
  update(data: BinaryLike): Hmac;
132
131
  update(data: string, input_encoding: Utf8AsciiLatin1Encoding): Hmac;
@@ -146,6 +145,11 @@ declare module 'crypto' {
146
145
  class KeyObject {
147
146
  private constructor();
148
147
  asymmetricKeyType?: KeyType;
148
+ /**
149
+ * For asymmetric keys, this property represents the size of the embedded key in
150
+ * bytes. This property is `undefined` for symmetric keys.
151
+ */
152
+ asymmetricKeySize?: number;
149
153
  export(options: KeyExportOptions<'pem'>): string | Buffer;
150
154
  export(options?: KeyExportOptions<'der'>): Buffer;
151
155
  symmetricSize?: number;
@@ -177,31 +181,24 @@ declare module 'crypto' {
177
181
  algorithm: CipherCCMTypes,
178
182
  key: CipherKey,
179
183
  iv: BinaryLike | null,
180
- options: CipherCCMOptions,
184
+ options: CipherCCMOptions
181
185
  ): CipherCCM;
182
186
  function createCipheriv(
183
187
  algorithm: CipherGCMTypes,
184
188
  key: CipherKey,
185
189
  iv: BinaryLike | null,
186
- options?: CipherGCMOptions,
190
+ options?: CipherGCMOptions
187
191
  ): CipherGCM;
188
192
  function createCipheriv(
189
- algorithm: string,
190
- key: CipherKey,
191
- iv: BinaryLike | null,
192
- options?: stream.TransformOptions,
193
+ algorithm: string, key: CipherKey, iv: BinaryLike | null, options?: stream.TransformOptions
193
194
  ): Cipher;
194
195
 
195
- class Cipher extends stream.Transform {
196
+ class Cipher extends stream.Duplex {
196
197
  private constructor();
197
198
  update(data: BinaryLike): Buffer;
198
199
  update(data: string, input_encoding: Utf8AsciiBinaryEncoding): Buffer;
199
200
  update(data: Binary, input_encoding: undefined, output_encoding: HexBase64BinaryEncoding): string;
200
- update(
201
- data: string,
202
- input_encoding: Utf8AsciiBinaryEncoding | undefined,
203
- output_encoding: HexBase64BinaryEncoding,
204
- ): string;
201
+ update(data: string, input_encoding: Utf8AsciiBinaryEncoding | undefined, output_encoding: HexBase64BinaryEncoding): string;
205
202
  final(): Buffer;
206
203
  final(output_encoding: string): string;
207
204
  setAutoPadding(auto_padding?: boolean): this;
@@ -216,11 +213,11 @@ declare module 'crypto' {
216
213
  setAAD(buffer: Buffer, options?: { plaintextLength: number }): this;
217
214
  getAuthTag(): Buffer;
218
215
  }
219
- /** @deprecated since v10.0.0 use createDecipheriv() */
216
+ /** @deprecated since v10.0.0 use createCipheriv() */
220
217
  function createDecipher(algorithm: CipherCCMTypes, password: BinaryLike, options: CipherCCMOptions): DecipherCCM;
221
- /** @deprecated since v10.0.0 use createDecipheriv() */
218
+ /** @deprecated since v10.0.0 use createCipheriv() */
222
219
  function createDecipher(algorithm: CipherGCMTypes, password: BinaryLike, options?: CipherGCMOptions): DecipherGCM;
223
- /** @deprecated since v10.0.0 use createDecipheriv() */
220
+ /** @deprecated since v10.0.0 use createCipheriv() */
224
221
  function createDecipher(algorithm: string, password: BinaryLike, options?: stream.TransformOptions): Decipher;
225
222
 
226
223
  function createDecipheriv(
@@ -235,23 +232,14 @@ declare module 'crypto' {
235
232
  iv: BinaryLike | null,
236
233
  options?: CipherGCMOptions,
237
234
  ): DecipherGCM;
238
- function createDecipheriv(
239
- algorithm: string,
240
- key: BinaryLike,
241
- iv: BinaryLike | null,
242
- options?: stream.TransformOptions,
243
- ): Decipher;
235
+ function createDecipheriv(algorithm: string, key: BinaryLike, iv: BinaryLike | null, options?: stream.TransformOptions): Decipher;
244
236
 
245
- class Decipher extends stream.Transform {
237
+ class Decipher extends stream.Duplex {
246
238
  private constructor();
247
239
  update(data: Binary): Buffer;
248
240
  update(data: string, input_encoding: HexBase64BinaryEncoding): Buffer;
249
241
  update(data: Binary, input_encoding: undefined, output_encoding: Utf8AsciiBinaryEncoding): string;
250
- update(
251
- data: string,
252
- input_encoding: HexBase64BinaryEncoding | undefined,
253
- output_encoding: Utf8AsciiBinaryEncoding,
254
- ): string;
242
+ update(data: string, input_encoding: HexBase64BinaryEncoding | undefined, output_encoding: Utf8AsciiBinaryEncoding): string;
255
243
  final(): Buffer;
256
244
  final(output_encoding: string): string;
257
245
  setAutoPadding(auto_padding?: boolean): this;
@@ -286,11 +274,17 @@ declare module 'crypto' {
286
274
 
287
275
  function createSign(algorithm: string, options?: stream.WritableOptions): Signer;
288
276
 
289
- interface SignPrivateKeyInput extends PrivateKeyInput {
277
+ interface SigningOptions {
278
+ /**
279
+ * @See crypto.constants.RSA_PKCS1_PADDING
280
+ */
290
281
  padding?: number;
291
282
  saltLength?: number;
292
283
  }
293
284
 
285
+ interface SignPrivateKeyInput extends PrivateKeyInput, SigningOptions {
286
+ }
287
+
294
288
  type KeyLike = string | Buffer | KeyObject;
295
289
 
296
290
  class Signer extends stream.Writable {
@@ -316,17 +310,8 @@ declare module 'crypto' {
316
310
  function createDiffieHellman(prime_length: number, generator?: number | Binary): DiffieHellman;
317
311
  function createDiffieHellman(prime: Binary): DiffieHellman;
318
312
  function createDiffieHellman(prime: string, prime_encoding: HexBase64Latin1Encoding): DiffieHellman;
319
- function createDiffieHellman(
320
- prime: string,
321
- prime_encoding: HexBase64Latin1Encoding,
322
- generator: number | Binary,
323
- ): DiffieHellman;
324
- function createDiffieHellman(
325
- prime: string,
326
- prime_encoding: HexBase64Latin1Encoding,
327
- generator: string,
328
- generator_encoding: HexBase64Latin1Encoding,
329
- ): DiffieHellman;
313
+ function createDiffieHellman(prime: string, prime_encoding: HexBase64Latin1Encoding, generator: number | Binary): DiffieHellman;
314
+ function createDiffieHellman(prime: string, prime_encoding: HexBase64Latin1Encoding, generator: string, generator_encoding: HexBase64Latin1Encoding): DiffieHellman;
330
315
  class DiffieHellman {
331
316
  private constructor();
332
317
  generateKeys(): Buffer;
@@ -334,11 +319,7 @@ declare module 'crypto' {
334
319
  computeSecret(other_public_key: Binary): Buffer;
335
320
  computeSecret(other_public_key: string, input_encoding: HexBase64Latin1Encoding): Buffer;
336
321
  computeSecret(other_public_key: Binary, output_encoding: HexBase64Latin1Encoding): string;
337
- computeSecret(
338
- other_public_key: string,
339
- input_encoding: HexBase64Latin1Encoding,
340
- output_encoding: HexBase64Latin1Encoding,
341
- ): string;
322
+ computeSecret(other_public_key: string, input_encoding: HexBase64Latin1Encoding, output_encoding: HexBase64Latin1Encoding): string;
342
323
  getPrime(): Buffer;
343
324
  getPrime(encoding: HexBase64Latin1Encoding): string;
344
325
  getGenerator(): Buffer;
@@ -362,13 +343,7 @@ declare module 'crypto' {
362
343
  digest: string,
363
344
  callback: (err: Error | null, derivedKey: Buffer) => any,
364
345
  ): void;
365
- function pbkdf2Sync(
366
- password: BinaryLike,
367
- salt: BinaryLike,
368
- iterations: number,
369
- keylen: number,
370
- digest: string,
371
- ): Buffer;
346
+ function pbkdf2Sync(password: BinaryLike, salt: BinaryLike, iterations: number, keylen: number, digest: string): Buffer;
372
347
 
373
348
  function randomBytes(size: number): Buffer;
374
349
  function randomBytes(size: number, callback: (err: Error | null, buf: Buffer) => void): void;
@@ -377,22 +352,10 @@ declare module 'crypto' {
377
352
 
378
353
  function randomFillSync<T extends Binary>(buffer: T, offset?: number, size?: number): T;
379
354
  function randomFill<T extends Binary>(buffer: T, callback: (err: Error | null, buf: T) => void): void;
380
- function randomFill<T extends Binary>(
381
- buffer: T,
382
- offset: number,
383
- callback: (err: Error | null, buf: T) => void,
384
- ): void;
385
- function randomFill<T extends Binary>(
386
- buffer: T,
387
- offset: number,
388
- size: number,
389
- callback: (err: Error | null, buf: T) => void,
390
- ): void;
355
+ function randomFill<T extends Binary>(buffer: T, offset: number, callback: (err: Error | null, buf: T) => void): void;
356
+ function randomFill<T extends Binary>(buffer: T, offset: number, size: number, callback: (err: Error | null, buf: T) => void): void;
391
357
 
392
358
  interface ScryptOptions {
393
- cost?: number;
394
- blockSize?: number;
395
- parallelization?: number;
396
359
  N?: number;
397
360
  r?: number;
398
361
  p?: number;
@@ -401,8 +364,7 @@ declare module 'crypto' {
401
364
  function scrypt(
402
365
  password: BinaryLike,
403
366
  salt: BinaryLike,
404
- keylen: number,
405
- callback: (err: Error | null, derivedKey: Buffer) => void,
367
+ keylen: number, callback: (err: Error | null, derivedKey: Buffer) => void,
406
368
  ): void;
407
369
  function scrypt(
408
370
  password: BinaryLike,
@@ -428,7 +390,6 @@ declare module 'crypto' {
428
390
  function publicDecrypt(public_key: RsaPublicKey | KeyLike, buffer: Binary): Buffer;
429
391
  function getCiphers(): string[];
430
392
  function getCurves(): string[];
431
- function getFips(): 1 | 0;
432
393
  function getHashes(): string[];
433
394
  class ECDH {
434
395
  private constructor();
@@ -436,19 +397,15 @@ declare module 'crypto' {
436
397
  key: BinaryLike,
437
398
  curve: string,
438
399
  inputEncoding?: HexBase64Latin1Encoding,
439
- outputEncoding?: 'latin1' | 'hex' | 'base64',
440
- format?: 'uncompressed' | 'compressed' | 'hybrid',
400
+ outputEncoding?: "latin1" | "hex" | "base64",
401
+ format?: "uncompressed" | "compressed" | "hybrid",
441
402
  ): Buffer | string;
442
403
  generateKeys(): Buffer;
443
404
  generateKeys(encoding: HexBase64Latin1Encoding, format?: ECDHKeyFormat): string;
444
405
  computeSecret(other_public_key: Binary): Buffer;
445
406
  computeSecret(other_public_key: string, input_encoding: HexBase64Latin1Encoding): Buffer;
446
407
  computeSecret(other_public_key: Binary, output_encoding: HexBase64Latin1Encoding): string;
447
- computeSecret(
448
- other_public_key: string,
449
- input_encoding: HexBase64Latin1Encoding,
450
- output_encoding: HexBase64Latin1Encoding,
451
- ): string;
408
+ computeSecret(other_public_key: string, input_encoding: HexBase64Latin1Encoding, output_encoding: HexBase64Latin1Encoding): string;
452
409
  getPrivateKey(): Buffer;
453
410
  getPrivateKey(encoding: HexBase64Latin1Encoding): string;
454
411
  getPublicKey(): Buffer;
@@ -564,191 +521,82 @@ declare module 'crypto' {
564
521
  privateKey: T2;
565
522
  }
566
523
 
567
- function generateKeyPairSync(
568
- type: 'rsa',
569
- options: RSAKeyPairOptions<'pem', 'pem'>,
570
- ): KeyPairSyncResult<string, string>;
571
- function generateKeyPairSync(
572
- type: 'rsa',
573
- options: RSAKeyPairOptions<'pem', 'der'>,
574
- ): KeyPairSyncResult<string, Buffer>;
575
- function generateKeyPairSync(
576
- type: 'rsa',
577
- options: RSAKeyPairOptions<'der', 'pem'>,
578
- ): KeyPairSyncResult<Buffer, string>;
579
- function generateKeyPairSync(
580
- type: 'rsa',
581
- options: RSAKeyPairOptions<'der', 'der'>,
582
- ): KeyPairSyncResult<Buffer, Buffer>;
524
+ function generateKeyPairSync(type: 'rsa', options: RSAKeyPairOptions<'pem', 'pem'>): KeyPairSyncResult<string, string>;
525
+ function generateKeyPairSync(type: 'rsa', options: RSAKeyPairOptions<'pem', 'der'>): KeyPairSyncResult<string, Buffer>;
526
+ function generateKeyPairSync(type: 'rsa', options: RSAKeyPairOptions<'der', 'pem'>): KeyPairSyncResult<Buffer, string>;
527
+ function generateKeyPairSync(type: 'rsa', options: RSAKeyPairOptions<'der', 'der'>): KeyPairSyncResult<Buffer, Buffer>;
583
528
  function generateKeyPairSync(type: 'rsa', options: RSAKeyPairKeyObjectOptions): KeyPairKeyObjectResult;
584
529
 
585
- function generateKeyPairSync(
586
- type: 'dsa',
587
- options: DSAKeyPairOptions<'pem', 'pem'>,
588
- ): KeyPairSyncResult<string, string>;
589
- function generateKeyPairSync(
590
- type: 'dsa',
591
- options: DSAKeyPairOptions<'pem', 'der'>,
592
- ): KeyPairSyncResult<string, Buffer>;
593
- function generateKeyPairSync(
594
- type: 'dsa',
595
- options: DSAKeyPairOptions<'der', 'pem'>,
596
- ): KeyPairSyncResult<Buffer, string>;
597
- function generateKeyPairSync(
598
- type: 'dsa',
599
- options: DSAKeyPairOptions<'der', 'der'>,
600
- ): KeyPairSyncResult<Buffer, Buffer>;
530
+ function generateKeyPairSync(type: 'dsa', options: DSAKeyPairOptions<'pem', 'pem'>): KeyPairSyncResult<string, string>;
531
+ function generateKeyPairSync(type: 'dsa', options: DSAKeyPairOptions<'pem', 'der'>): KeyPairSyncResult<string, Buffer>;
532
+ function generateKeyPairSync(type: 'dsa', options: DSAKeyPairOptions<'der', 'pem'>): KeyPairSyncResult<Buffer, string>;
533
+ function generateKeyPairSync(type: 'dsa', options: DSAKeyPairOptions<'der', 'der'>): KeyPairSyncResult<Buffer, Buffer>;
601
534
  function generateKeyPairSync(type: 'dsa', options: DSAKeyPairKeyObjectOptions): KeyPairKeyObjectResult;
602
535
 
603
- function generateKeyPairSync(
604
- type: 'ec',
605
- options: ECKeyPairOptions<'pem', 'pem'>,
606
- ): KeyPairSyncResult<string, string>;
607
- function generateKeyPairSync(
608
- type: 'ec',
609
- options: ECKeyPairOptions<'pem', 'der'>,
610
- ): KeyPairSyncResult<string, Buffer>;
611
- function generateKeyPairSync(
612
- type: 'ec',
613
- options: ECKeyPairOptions<'der', 'pem'>,
614
- ): KeyPairSyncResult<Buffer, string>;
615
- function generateKeyPairSync(
616
- type: 'ec',
617
- options: ECKeyPairOptions<'der', 'der'>,
618
- ): KeyPairSyncResult<Buffer, Buffer>;
536
+ function generateKeyPairSync(type: 'ec', options: ECKeyPairOptions<'pem', 'pem'>): KeyPairSyncResult<string, string>;
537
+ function generateKeyPairSync(type: 'ec', options: ECKeyPairOptions<'pem', 'der'>): KeyPairSyncResult<string, Buffer>;
538
+ function generateKeyPairSync(type: 'ec', options: ECKeyPairOptions<'der', 'pem'>): KeyPairSyncResult<Buffer, string>;
539
+ function generateKeyPairSync(type: 'ec', options: ECKeyPairOptions<'der', 'der'>): KeyPairSyncResult<Buffer, Buffer>;
619
540
  function generateKeyPairSync(type: 'ec', options: ECKeyPairKeyObjectOptions): KeyPairKeyObjectResult;
620
541
 
621
- function generateKeyPair(
622
- type: 'rsa',
623
- options: RSAKeyPairOptions<'pem', 'pem'>,
624
- callback: (err: Error | null, publicKey: string, privateKey: string) => void,
625
- ): void;
626
- function generateKeyPair(
627
- type: 'rsa',
628
- options: RSAKeyPairOptions<'pem', 'der'>,
629
- callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void,
630
- ): void;
631
- function generateKeyPair(
632
- type: 'rsa',
633
- options: RSAKeyPairOptions<'der', 'pem'>,
634
- callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void,
635
- ): void;
636
- function generateKeyPair(
637
- type: 'rsa',
638
- options: RSAKeyPairOptions<'der', 'der'>,
639
- callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void,
640
- ): void;
641
- function generateKeyPair(
642
- type: 'rsa',
643
- options: RSAKeyPairKeyObjectOptions,
644
- callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void,
645
- ): void;
542
+ function generateKeyPair(type: 'rsa', options: RSAKeyPairOptions<'pem', 'pem'>, callback: (err: Error | null, publicKey: string, privateKey: string) => void): void;
543
+ function generateKeyPair(type: 'rsa', options: RSAKeyPairOptions<'pem', 'der'>, callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void): void;
544
+ function generateKeyPair(type: 'rsa', options: RSAKeyPairOptions<'der', 'pem'>, callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void): void;
545
+ function generateKeyPair(type: 'rsa', options: RSAKeyPairOptions<'der', 'der'>, callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void): void;
546
+ function generateKeyPair(type: 'rsa', options: RSAKeyPairKeyObjectOptions, callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void): void;
646
547
 
647
- function generateKeyPair(
648
- type: 'dsa',
649
- options: DSAKeyPairOptions<'pem', 'pem'>,
650
- callback: (err: Error | null, publicKey: string, privateKey: string) => void,
651
- ): void;
652
- function generateKeyPair(
653
- type: 'dsa',
654
- options: DSAKeyPairOptions<'pem', 'der'>,
655
- callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void,
656
- ): void;
657
- function generateKeyPair(
658
- type: 'dsa',
659
- options: DSAKeyPairOptions<'der', 'pem'>,
660
- callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void,
661
- ): void;
662
- function generateKeyPair(
663
- type: 'dsa',
664
- options: DSAKeyPairOptions<'der', 'der'>,
665
- callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void,
666
- ): void;
667
- function generateKeyPair(
668
- type: 'dsa',
669
- options: DSAKeyPairKeyObjectOptions,
670
- callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void,
671
- ): void;
548
+ function generateKeyPair(type: 'dsa', options: DSAKeyPairOptions<'pem', 'pem'>, callback: (err: Error | null, publicKey: string, privateKey: string) => void): void;
549
+ function generateKeyPair(type: 'dsa', options: DSAKeyPairOptions<'pem', 'der'>, callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void): void;
550
+ function generateKeyPair(type: 'dsa', options: DSAKeyPairOptions<'der', 'pem'>, callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void): void;
551
+ function generateKeyPair(type: 'dsa', options: DSAKeyPairOptions<'der', 'der'>, callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void): void;
552
+ function generateKeyPair(type: 'dsa', options: DSAKeyPairKeyObjectOptions, callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void): void;
672
553
 
673
- function generateKeyPair(
674
- type: 'ec',
675
- options: ECKeyPairOptions<'pem', 'pem'>,
676
- callback: (err: Error | null, publicKey: string, privateKey: string) => void,
677
- ): void;
678
- function generateKeyPair(
679
- type: 'ec',
680
- options: ECKeyPairOptions<'pem', 'der'>,
681
- callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void,
682
- ): void;
683
- function generateKeyPair(
684
- type: 'ec',
685
- options: ECKeyPairOptions<'der', 'pem'>,
686
- callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void,
687
- ): void;
688
- function generateKeyPair(
689
- type: 'ec',
690
- options: ECKeyPairOptions<'der', 'der'>,
691
- callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void,
692
- ): void;
693
- function generateKeyPair(
694
- type: 'ec',
695
- options: ECKeyPairKeyObjectOptions,
696
- callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void,
697
- ): void;
554
+ function generateKeyPair(type: 'ec', options: ECKeyPairOptions<'pem', 'pem'>, callback: (err: Error | null, publicKey: string, privateKey: string) => void): void;
555
+ function generateKeyPair(type: 'ec', options: ECKeyPairOptions<'pem', 'der'>, callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void): void;
556
+ function generateKeyPair(type: 'ec', options: ECKeyPairOptions<'der', 'pem'>, callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void): void;
557
+ function generateKeyPair(type: 'ec', options: ECKeyPairOptions<'der', 'der'>, callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void): void;
558
+ function generateKeyPair(type: 'ec', options: ECKeyPairKeyObjectOptions, callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void): void;
698
559
 
699
560
  namespace generateKeyPair {
700
- function __promisify__(
701
- type: 'rsa',
702
- options: RSAKeyPairOptions<'pem', 'pem'>,
703
- ): Promise<{ publicKey: string; privateKey: string }>;
704
- function __promisify__(
705
- type: 'rsa',
706
- options: RSAKeyPairOptions<'pem', 'der'>,
707
- ): Promise<{ publicKey: string; privateKey: Buffer }>;
708
- function __promisify__(
709
- type: 'rsa',
710
- options: RSAKeyPairOptions<'der', 'pem'>,
711
- ): Promise<{ publicKey: Buffer; privateKey: string }>;
712
- function __promisify__(
713
- type: 'rsa',
714
- options: RSAKeyPairOptions<'der', 'der'>,
715
- ): Promise<{ publicKey: Buffer; privateKey: Buffer }>;
716
- function __promisify__(type: 'rsa', options: RSAKeyPairKeyObjectOptions): Promise<KeyPairKeyObjectResult>;
717
-
718
- function __promisify__(
719
- type: 'dsa',
720
- options: DSAKeyPairOptions<'pem', 'pem'>,
721
- ): Promise<{ publicKey: string; privateKey: string }>;
722
- function __promisify__(
723
- type: 'dsa',
724
- options: DSAKeyPairOptions<'pem', 'der'>,
725
- ): Promise<{ publicKey: string; privateKey: Buffer }>;
726
- function __promisify__(
727
- type: 'dsa',
728
- options: DSAKeyPairOptions<'der', 'pem'>,
729
- ): Promise<{ publicKey: Buffer; privateKey: string }>;
730
- function __promisify__(
731
- type: 'dsa',
732
- options: DSAKeyPairOptions<'der', 'der'>,
733
- ): Promise<{ publicKey: Buffer; privateKey: Buffer }>;
734
- function __promisify__(type: 'dsa', options: DSAKeyPairKeyObjectOptions): Promise<KeyPairKeyObjectResult>;
735
-
736
- function __promisify__(
737
- type: 'ec',
738
- options: ECKeyPairOptions<'pem', 'pem'>,
739
- ): Promise<{ publicKey: string; privateKey: string }>;
740
- function __promisify__(
741
- type: 'ec',
742
- options: ECKeyPairOptions<'pem', 'der'>,
743
- ): Promise<{ publicKey: string; privateKey: Buffer }>;
744
- function __promisify__(
745
- type: 'ec',
746
- options: ECKeyPairOptions<'der', 'pem'>,
747
- ): Promise<{ publicKey: Buffer; privateKey: string }>;
748
- function __promisify__(
749
- type: 'ec',
750
- options: ECKeyPairOptions<'der', 'der'>,
751
- ): Promise<{ publicKey: Buffer; privateKey: Buffer }>;
752
- function __promisify__(type: 'ec', options: ECKeyPairKeyObjectOptions): Promise<KeyPairKeyObjectResult>;
753
- }
561
+ function __promisify__(type: "rsa", options: RSAKeyPairOptions<'pem', 'pem'>): Promise<{ publicKey: string, privateKey: string }>;
562
+ function __promisify__(type: "rsa", options: RSAKeyPairOptions<'pem', 'der'>): Promise<{ publicKey: string, privateKey: Buffer }>;
563
+ function __promisify__(type: "rsa", options: RSAKeyPairOptions<'der', 'pem'>): Promise<{ publicKey: Buffer, privateKey: string }>;
564
+ function __promisify__(type: "rsa", options: RSAKeyPairOptions<'der', 'der'>): Promise<{ publicKey: Buffer, privateKey: Buffer }>;
565
+ function __promisify__(type: "rsa", options: RSAKeyPairKeyObjectOptions): Promise<KeyPairKeyObjectResult>;
566
+
567
+ function __promisify__(type: "dsa", options: DSAKeyPairOptions<'pem', 'pem'>): Promise<{ publicKey: string, privateKey: string }>;
568
+ function __promisify__(type: "dsa", options: DSAKeyPairOptions<'pem', 'der'>): Promise<{ publicKey: string, privateKey: Buffer }>;
569
+ function __promisify__(type: "dsa", options: DSAKeyPairOptions<'der', 'pem'>): Promise<{ publicKey: Buffer, privateKey: string }>;
570
+ function __promisify__(type: "dsa", options: DSAKeyPairOptions<'der', 'der'>): Promise<{ publicKey: Buffer, privateKey: Buffer }>;
571
+ function __promisify__(type: "dsa", options: DSAKeyPairKeyObjectOptions): Promise<KeyPairKeyObjectResult>;
572
+
573
+ function __promisify__(type: "ec", options: ECKeyPairOptions<'pem', 'pem'>): Promise<{ publicKey: string, privateKey: string }>;
574
+ function __promisify__(type: "ec", options: ECKeyPairOptions<'pem', 'der'>): Promise<{ publicKey: string, privateKey: Buffer }>;
575
+ function __promisify__(type: "ec", options: ECKeyPairOptions<'der', 'pem'>): Promise<{ publicKey: Buffer, privateKey: string }>;
576
+ function __promisify__(type: "ec", options: ECKeyPairOptions<'der', 'der'>): Promise<{ publicKey: Buffer, privateKey: Buffer }>;
577
+ function __promisify__(type: "ec", options: ECKeyPairKeyObjectOptions): Promise<KeyPairKeyObjectResult>;
578
+ }
579
+
580
+ /**
581
+ * Calculates and returns the signature for `data` using the given private key and
582
+ * algorithm. If `algorithm` is `null` or `undefined`, then the algorithm is
583
+ * dependent upon the key type (especially Ed25519 and Ed448).
584
+ *
585
+ * If `key` is not a [`KeyObject`][], this function behaves as if `key` had been
586
+ * passed to [`crypto.createPrivateKey()`][].
587
+ */
588
+ function sign(algorithm: string | null | undefined, data: Binary, key: KeyLike | SignPrivateKeyInput): Buffer;
589
+
590
+ interface VerifyKeyWithOptions extends KeyObject, SigningOptions {
591
+ }
592
+
593
+ /**
594
+ * Calculates and returns the signature for `data` using the given private key and
595
+ * algorithm. If `algorithm` is `null` or `undefined`, then the algorithm is
596
+ * dependent upon the key type (especially Ed25519 and Ed448).
597
+ *
598
+ * If `key` is not a [`KeyObject`][], this function behaves as if `key` had been
599
+ * passed to [`crypto.createPublicKey()`][].
600
+ */
601
+ function verify(algorithm: string | null | undefined, data: Binary, key: KeyLike | VerifyKeyWithOptions, signature: Binary): Buffer;
754
602
  }
@@ -34,7 +34,7 @@ declare module "dgram" {
34
34
  function createSocket(options: SocketOptions, callback?: (msg: Buffer, rinfo: RemoteInfo) => void): Socket;
35
35
 
36
36
  class Socket extends events.EventEmitter {
37
- send(msg: Buffer | string | Uint8Array | ReadonlyArray<any>, port: number, address?: string, callback?: (error: Error | null, bytes: number) => void): void;
37
+ send(msg: Buffer | string | Uint8Array | any[], port: number, address?: string, callback?: (error: Error | null, bytes: number) => void): void;
38
38
  send(msg: Buffer | string | Uint8Array, offset: number, length: number, port: number, address?: string, callback?: (error: Error | null, bytes: number) => void): void;
39
39
  bind(port?: number, address?: string, callback?: () => void): void;
40
40
  bind(port?: number, callback?: () => void): void;
@@ -242,7 +242,7 @@ declare module "dns" {
242
242
  }
243
243
 
244
244
  function reverse(ip: string, callback: (err: NodeJS.ErrnoException | null, hostnames: string[]) => void): void;
245
- function setServers(servers: ReadonlyArray<string>): void;
245
+ function setServers(servers: string[]): void;
246
246
  function getServers(): string[];
247
247
 
248
248
  // Error codes
@@ -289,78 +289,4 @@ declare module "dns" {
289
289
  reverse: typeof reverse;
290
290
  cancel(): void;
291
291
  }
292
-
293
- namespace promises {
294
- function getServers(): string[];
295
-
296
- function lookup(hostname: string, family: number): Promise<LookupAddress>;
297
- function lookup(hostname: string, options: LookupOneOptions): Promise<LookupAddress>;
298
- function lookup(hostname: string, options: LookupAllOptions): Promise<LookupAddress[]>;
299
- function lookup(hostname: string, options: LookupOptions): Promise<LookupAddress | LookupAddress[]>;
300
- function lookup(hostname: string): Promise<LookupAddress>;
301
-
302
- function lookupService(address: string, port: number): Promise<{ hostname: string, service: string }>;
303
-
304
- function resolve(hostname: string): Promise<string[]>;
305
- function resolve(hostname: string, rrtype: "A"): Promise<string[]>;
306
- function resolve(hostname: string, rrtype: "AAAA"): Promise<string[]>;
307
- function resolve(hostname: string, rrtype: "ANY"): Promise<AnyRecord[]>;
308
- function resolve(hostname: string, rrtype: "CNAME"): Promise<string[]>;
309
- function resolve(hostname: string, rrtype: "MX"): Promise<MxRecord[]>;
310
- function resolve(hostname: string, rrtype: "NAPTR"): Promise<NaptrRecord[]>;
311
- function resolve(hostname: string, rrtype: "NS"): Promise<string[]>;
312
- function resolve(hostname: string, rrtype: "PTR"): Promise<string[]>;
313
- function resolve(hostname: string, rrtype: "SOA"): Promise<SoaRecord>;
314
- function resolve(hostname: string, rrtype: "SRV"): Promise<SrvRecord[]>;
315
- function resolve(hostname: string, rrtype: "TXT"): Promise<string[][]>;
316
- function resolve(hostname: string, rrtype: string): Promise<string[] | MxRecord[] | NaptrRecord[] | SoaRecord | SrvRecord[] | string[][] | AnyRecord[]>;
317
-
318
- function resolve4(hostname: string): Promise<string[]>;
319
- function resolve4(hostname: string, options: ResolveWithTtlOptions): Promise<RecordWithTtl[]>;
320
- function resolve4(hostname: string, options: ResolveOptions): Promise<string[] | RecordWithTtl[]>;
321
-
322
- function resolve6(hostname: string): Promise<string[]>;
323
- function resolve6(hostname: string, options: ResolveWithTtlOptions): Promise<RecordWithTtl[]>;
324
- function resolve6(hostname: string, options: ResolveOptions): Promise<string[] | RecordWithTtl[]>;
325
-
326
- function resolveAny(hostname: string): Promise<AnyRecord[]>;
327
-
328
- function resolveCname(hostname: string): Promise<string[]>;
329
-
330
- function resolveMx(hostname: string): Promise<MxRecord[]>;
331
-
332
- function resolveNaptr(hostname: string): Promise<NaptrRecord[]>;
333
-
334
- function resolveNs(hostname: string): Promise<string[]>;
335
-
336
- function resolvePtr(hostname: string): Promise<string[]>;
337
-
338
- function resolveSoa(hostname: string): Promise<SoaRecord>;
339
-
340
- function resolveSrv(hostname: string): Promise<SrvRecord[]>;
341
-
342
- function resolveTxt(hostname: string): Promise<string[][]>;
343
-
344
- function reverse(ip: string): Promise<string[]>;
345
-
346
- function setServers(servers: ReadonlyArray<string>): void;
347
-
348
- class Resolver {
349
- getServers: typeof getServers;
350
- resolve: typeof resolve;
351
- resolve4: typeof resolve4;
352
- resolve6: typeof resolve6;
353
- resolveAny: typeof resolveAny;
354
- resolveCname: typeof resolveCname;
355
- resolveMx: typeof resolveMx;
356
- resolveNaptr: typeof resolveNaptr;
357
- resolveNs: typeof resolveNs;
358
- resolvePtr: typeof resolvePtr;
359
- resolveSoa: typeof resolveSoa;
360
- resolveSrv: typeof resolveSrv;
361
- resolveTxt: typeof resolveTxt;
362
- reverse: typeof reverse;
363
- setServers: typeof setServers;
364
- }
365
- }
366
292
  }
node/domain.d.ts ADDED
@@ -0,0 +1,16 @@
1
+ declare module "domain" {
2
+ import * as events from "events";
3
+
4
+ class Domain extends events.EventEmitter implements NodeJS.Domain {
5
+ run<T>(fn: (...args: any[]) => T, ...args: any[]): T;
6
+ add(emitter: events.EventEmitter | NodeJS.Timer): void;
7
+ remove(emitter: events.EventEmitter | NodeJS.Timer): void;
8
+ bind<T extends Function>(cb: T): T;
9
+ intercept<T extends Function>(cb: T): T;
10
+ members: Array<events.EventEmitter | NodeJS.Timer>;
11
+ enter(): void;
12
+ exit(): void;
13
+ }
14
+
15
+ function create(): Domain;
16
+ }