@types/node 12.12.17 → 12.12.21

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.
node/README.md CHANGED
@@ -8,7 +8,7 @@ This package contains type definitions for Node.js (http://nodejs.org/).
8
8
  Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node.
9
9
 
10
10
  ### Additional Details
11
- * Last updated: Tue, 10 Dec 2019 19:20:30 GMT
11
+ * Last updated: Wed, 18 Dec 2019 14:37:03 GMT
12
12
  * Dependencies: none
13
13
  * Global values: `Buffer`, `NodeJS`, `Symbol`, `__dirname`, `__filename`, `clearImmediate`, `clearInterval`, `clearTimeout`, `console`, `exports`, `global`, `module`, `process`, `queueMicrotask`, `require`, `setImmediate`, `setInterval`, `setTimeout`
14
14
 
node/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/node",
3
- "version": "12.12.17",
3
+ "version": "12.12.21",
4
4
  "description": "TypeScript definitions for Node.js",
5
5
  "license": "MIT",
6
6
  "contributors": [
@@ -226,6 +226,6 @@
226
226
  },
227
227
  "scripts": {},
228
228
  "dependencies": {},
229
- "typesPublisherContentHash": "b91bec997aa13851c25ab03f80a82fb680c9a7f692b6c1085fe12b75261e2c93",
229
+ "typesPublisherContentHash": "95df00620e4725d6d034583a81fab4ba24e188951cedc7dc940fd055b4643f0c",
230
230
  "typeScriptVersion": "2.8"
231
231
  }
node/querystring.d.ts CHANGED
@@ -11,7 +11,7 @@ declare module "querystring" {
11
11
  interface ParsedUrlQuery { [key: string]: string | string[]; }
12
12
 
13
13
  interface ParsedUrlQueryInput {
14
- [key: string]: NodeJS.PoorMansUnknown;
14
+ [key: string]: string | number | boolean | string[] | number[] | boolean[] | undefined | null;
15
15
  }
16
16
 
17
17
  function stringify(obj?: ParsedUrlQueryInput, sep?: string, eq?: string, options?: StringifyOptions): string;
node/stream.d.ts CHANGED
@@ -210,6 +210,8 @@ declare module "stream" {
210
210
  allowHalfOpen?: boolean;
211
211
  readableObjectMode?: boolean;
212
212
  writableObjectMode?: boolean;
213
+ readableHighWaterMark?: number;
214
+ writableHighWaterMark?: number;
213
215
  read?(this: Duplex, size: number): void;
214
216
  write?(this: Duplex, chunk: any, encoding: string, callback: (error?: Error | null) => void): void;
215
217
  writev?(this: Duplex, chunks: Array<{ chunk: any, encoding: string }>, callback: (error?: Error | null) => void): void;
node/tls.d.ts CHANGED
@@ -64,6 +64,43 @@ declare module "tls" {
64
64
  version: string;
65
65
  }
66
66
 
67
+ interface EphemeralKeyInfo {
68
+ /**
69
+ * The supported types are 'DH' and 'ECDH'.
70
+ */
71
+ type: string;
72
+ /**
73
+ * The name property is available only when type is 'ECDH'.
74
+ */
75
+ name?: string;
76
+ /**
77
+ * The size of parameter of an ephemeral key exchange.
78
+ */
79
+ size: number;
80
+ }
81
+
82
+ interface KeyObject {
83
+ /**
84
+ * Private keys in PEM format.
85
+ */
86
+ pem: string | Buffer;
87
+ /**
88
+ * Optional passphrase.
89
+ */
90
+ passphrase?: string;
91
+ }
92
+
93
+ interface PxfObject {
94
+ /**
95
+ * PFX or PKCS12 encoded private key and certificate chain.
96
+ */
97
+ buf: string | Buffer;
98
+ /**
99
+ * Optional passphrase.
100
+ */
101
+ passphrase?: string;
102
+ }
103
+
67
104
  interface TLSSocketOptions extends SecureContextOptions, CommonConnectionOptions {
68
105
  /**
69
106
  * If true the TLS socket will be instantiated in server-mode.
@@ -114,12 +151,50 @@ declare module "tls" {
114
151
  */
115
152
  alpnProtocol?: string;
116
153
 
154
+ /**
155
+ * Returns an object representing the local certificate. The returned
156
+ * object has some properties corresponding to the fields of the
157
+ * certificate.
158
+ *
159
+ * See tls.TLSSocket.getPeerCertificate() for an example of the
160
+ * certificate structure.
161
+ *
162
+ * If there is no local certificate, an empty object will be returned.
163
+ * If the socket has been destroyed, null will be returned.
164
+ */
165
+ getCertificate(): PeerCertificate | object | null;
117
166
  /**
118
167
  * Returns an object representing the cipher name and the SSL/TLS protocol version of the current connection.
119
168
  * @returns Returns an object representing the cipher name
120
169
  * and the SSL/TLS protocol version of the current connection.
121
170
  */
122
171
  getCipher(): CipherNameAndProtocol;
172
+ /**
173
+ * Returns an object representing the type, name, and size of parameter
174
+ * of an ephemeral key exchange in Perfect Forward Secrecy on a client
175
+ * connection. It returns an empty object when the key exchange is not
176
+ * ephemeral. As this is only supported on a client socket; null is
177
+ * returned if called on a server socket. The supported types are 'DH'
178
+ * and 'ECDH'. The name property is available only when type is 'ECDH'.
179
+ *
180
+ * For example: { type: 'ECDH', name: 'prime256v1', size: 256 }.
181
+ */
182
+ getEphemeralKeyInfo(): EphemeralKeyInfo | object | null;
183
+ /**
184
+ * Returns the latest Finished message that has
185
+ * been sent to the socket as part of a SSL/TLS handshake, or undefined
186
+ * if no Finished message has been sent yet.
187
+ *
188
+ * As the Finished messages are message digests of the complete
189
+ * handshake (with a total of 192 bits for TLS 1.0 and more for SSL
190
+ * 3.0), they can be used for external authentication procedures when
191
+ * the authentication provided by SSL/TLS is not desired or is not
192
+ * enough.
193
+ *
194
+ * Corresponds to the SSL_get_finished routine in OpenSSL and may be
195
+ * used to implement the tls-unique channel binding from RFC 5929.
196
+ */
197
+ getFinished(): Buffer | undefined;
123
198
  /**
124
199
  * Returns an object representing the peer's certificate.
125
200
  * The returned object has some properties corresponding to the field of the certificate.
@@ -132,6 +207,21 @@ declare module "tls" {
132
207
  getPeerCertificate(detailed: true): DetailedPeerCertificate;
133
208
  getPeerCertificate(detailed?: false): PeerCertificate;
134
209
  getPeerCertificate(detailed?: boolean): PeerCertificate | DetailedPeerCertificate;
210
+ /**
211
+ * Returns the latest Finished message that is expected or has actually
212
+ * been received from the socket as part of a SSL/TLS handshake, or
213
+ * undefined if there is no Finished message so far.
214
+ *
215
+ * As the Finished messages are message digests of the complete
216
+ * handshake (with a total of 192 bits for TLS 1.0 and more for SSL
217
+ * 3.0), they can be used for external authentication procedures when
218
+ * the authentication provided by SSL/TLS is not desired or is not
219
+ * enough.
220
+ *
221
+ * Corresponds to the SSL_get_peer_finished routine in OpenSSL and may
222
+ * be used to implement the tls-unique channel binding from RFC 5929.
223
+ */
224
+ getPeerFinished(): Buffer | undefined;
135
225
  /**
136
226
  * Returns a string containing the negotiated SSL/TLS protocol version of the current connection.
137
227
  * The value `'unknown'` will be returned for connected sockets that have not completed the handshaking process.
@@ -145,12 +235,21 @@ declare module "tls" {
145
235
  * @returns ASN.1 encoded TLS session or undefined if none was negotiated.
146
236
  */
147
237
  getSession(): Buffer | undefined;
238
+ /**
239
+ * Returns a list of signature algorithms shared between the server and
240
+ * the client in the order of decreasing preference.
241
+ */
242
+ getSharedSigalgs(): string[];
148
243
  /**
149
244
  * NOTE: Works only with client TLS sockets.
150
245
  * Useful only for debugging, for session reuse provide session option to tls.connect().
151
246
  * @returns TLS session ticket or undefined if none was negotiated.
152
247
  */
153
248
  getTLSTicket(): Buffer | undefined;
249
+ /**
250
+ * Returns true if the session was reused, false otherwise.
251
+ */
252
+ isSessionReused(): boolean;
154
253
  /**
155
254
  * Initiate TLS renegotiation process.
156
255
  *
@@ -175,6 +274,13 @@ declare module "tls" {
175
274
  */
176
275
  setMaxSendFragment(size: number): boolean;
177
276
 
277
+ /**
278
+ * Disables TLS renegotiation for this TLSSocket instance. Once called,
279
+ * attempts to renegotiate will trigger an 'error' event on the
280
+ * TLSSocket.
281
+ */
282
+ disableRenegotiation(): void;
283
+
178
284
  /**
179
285
  * When enabled, TLS packet trace information is written to `stderr`. This can be
180
286
  * used to debug TLS connection problems.
@@ -266,8 +372,22 @@ declare module "tls" {
266
372
  }
267
373
 
268
374
  interface TlsOptions extends SecureContextOptions, CommonConnectionOptions {
375
+ /**
376
+ * Abort the connection if the SSL/TLS handshake does not finish in the
377
+ * specified number of milliseconds. A 'tlsClientError' is emitted on
378
+ * the tls.Server object whenever a handshake times out. Default:
379
+ * 120000 (120 seconds).
380
+ */
269
381
  handshakeTimeout?: number;
382
+ /**
383
+ * The number of seconds after which a TLS session created by the
384
+ * server will no longer be resumable. See Session Resumption for more
385
+ * information. Default: 300.
386
+ */
270
387
  sessionTimeout?: number;
388
+ /**
389
+ * 48-bytes of cryptographically strong pseudo-random data.
390
+ */
271
391
  ticketKeys?: Buffer;
272
392
  }
273
393
 
@@ -285,7 +405,29 @@ declare module "tls" {
285
405
  }
286
406
 
287
407
  class Server extends net.Server {
408
+ /**
409
+ * The server.addContext() method adds a secure context that will be
410
+ * used if the client request's SNI name matches the supplied hostname
411
+ * (or wildcard).
412
+ */
288
413
  addContext(hostName: string, credentials: SecureContextOptions): void;
414
+ /**
415
+ * Returns the session ticket keys.
416
+ */
417
+ getTicketKeys(): Buffer;
418
+ /**
419
+ *
420
+ * The server.setSecureContext() method replaces the
421
+ * secure context of an existing server. Existing connections to the
422
+ * server are not interrupted.
423
+ */
424
+ setSecureContext(details: SecureContextOptions): void;
425
+ /**
426
+ * The server.setSecureContext() method replaces the secure context of
427
+ * an existing server. Existing connections to the server are not
428
+ * interrupted.
429
+ */
430
+ setTicketKeys(keys: Buffer): void;
289
431
 
290
432
  /**
291
433
  * events.EventEmitter
@@ -294,6 +436,7 @@ declare module "tls" {
294
436
  * 3. OCSPRequest
295
437
  * 4. resumeSession
296
438
  * 5. secureConnection
439
+ * 6. keylog
297
440
  */
298
441
  addListener(event: string, listener: (...args: any[]) => void): this;
299
442
  addListener(event: "tlsClientError", listener: (err: Error, tlsSocket: TLSSocket) => void): this;
@@ -352,20 +495,93 @@ declare module "tls" {
352
495
  type SecureVersion = 'TLSv1.3' | 'TLSv1.2' | 'TLSv1.1' | 'TLSv1';
353
496
 
354
497
  interface SecureContextOptions {
355
- pfx?: string | Buffer | Array<string | Buffer | Object>;
356
- key?: string | Buffer | Array<Buffer | Object>;
357
- passphrase?: string;
358
- cert?: string | Buffer | Array<string | Buffer>;
498
+ /**
499
+ * Optionally override the trusted CA certificates. Default is to trust
500
+ * the well-known CAs curated by Mozilla. Mozilla's CAs are completely
501
+ * replaced when CAs are explicitly specified using this option.
502
+ */
359
503
  ca?: string | Buffer | Array<string | Buffer>;
504
+ /**
505
+ * Cert chains in PEM format. One cert chain should be provided per
506
+ * private key. Each cert chain should consist of the PEM formatted
507
+ * certificate for a provided private key, followed by the PEM
508
+ * formatted intermediate certificates (if any), in order, and not
509
+ * including the root CA (the root CA must be pre-known to the peer,
510
+ * see ca). When providing multiple cert chains, they do not have to
511
+ * be in the same order as their private keys in key. If the
512
+ * intermediate certificates are not provided, the peer will not be
513
+ * able to validate the certificate, and the handshake will fail.
514
+ */
515
+ cert?: string | Buffer | Array<string | Buffer>;
516
+ /**
517
+ * Colon-separated list of supported signature algorithms. The list
518
+ * can contain digest algorithms (SHA256, MD5 etc.), public key
519
+ * algorithms (RSA-PSS, ECDSA etc.), combination of both (e.g
520
+ * 'RSA+SHA384') or TLS v1.3 scheme names (e.g. rsa_pss_pss_sha512).
521
+ */
522
+ sigalgs?: string;
523
+ /**
524
+ * Cipher suite specification, replacing the default. For more
525
+ * information, see modifying the default cipher suite. Permitted
526
+ * ciphers can be obtained via tls.getCiphers(). Cipher names must be
527
+ * uppercased in order for OpenSSL to accept them.
528
+ */
360
529
  ciphers?: string;
361
- honorCipherOrder?: boolean;
362
- ecdhCurve?: string;
530
+ /**
531
+ * Name of an OpenSSL engine which can provide the client certificate.
532
+ */
363
533
  clientCertEngine?: string;
534
+ /**
535
+ * PEM formatted CRLs (Certificate Revocation Lists).
536
+ */
364
537
  crl?: string | Buffer | Array<string | Buffer>;
538
+ /**
539
+ * Diffie Hellman parameters, required for Perfect Forward Secrecy. Use
540
+ * openssl dhparam to create the parameters. The key length must be
541
+ * greater than or equal to 1024 bits or else an error will be thrown.
542
+ * Although 1024 bits is permissible, use 2048 bits or larger for
543
+ * stronger security. If omitted or invalid, the parameters are
544
+ * silently discarded and DHE ciphers will not be available.
545
+ */
365
546
  dhparam?: string | Buffer;
366
- secureOptions?: number; // Value is a numeric bitmask of the `SSL_OP_*` options
367
- secureProtocol?: string; // SSL Method, e.g. SSLv23_method
368
- sessionIdContext?: string;
547
+ /**
548
+ * A string describing a named curve or a colon separated list of curve
549
+ * NIDs or names, for example P-521:P-384:P-256, to use for ECDH key
550
+ * agreement. Set to auto to select the curve automatically. Use
551
+ * crypto.getCurves() to obtain a list of available curve names. On
552
+ * recent releases, openssl ecparam -list_curves will also display the
553
+ * name and description of each available elliptic curve. Default:
554
+ * tls.DEFAULT_ECDH_CURVE.
555
+ */
556
+ ecdhCurve?: string;
557
+ /**
558
+ * Attempt to use the server's cipher suite preferences instead of the
559
+ * client's. When true, causes SSL_OP_CIPHER_SERVER_PREFERENCE to be
560
+ * set in secureOptions
561
+ */
562
+ honorCipherOrder?: boolean;
563
+ /**
564
+ * Private keys in PEM format. PEM allows the option of private keys
565
+ * being encrypted. Encrypted keys will be decrypted with
566
+ * options.passphrase. Multiple keys using different algorithms can be
567
+ * provided either as an array of unencrypted key strings or buffers,
568
+ * or an array of objects in the form {pem: <string|buffer>[,
569
+ * passphrase: <string>]}. The object form can only occur in an array.
570
+ * object.passphrase is optional. Encrypted keys will be decrypted with
571
+ * object.passphrase if provided, or options.passphrase if it is not.
572
+ */
573
+ key?: string | Buffer | Array<Buffer | KeyObject>;
574
+ /**
575
+ * Name of an OpenSSL engine to get private key from. Should be used
576
+ * together with privateKeyIdentifier.
577
+ */
578
+ privateKeyEngine?: string;
579
+ /**
580
+ * Identifier of a private key managed by an OpenSSL engine. Should be
581
+ * used together with privateKeyEngine. Should not be set together with
582
+ * key, because both options define a private key in different ways.
583
+ */
584
+ privateKeyIdentifier?: string;
369
585
  /**
370
586
  * Optionally set the maximum TLS version to allow. One
371
587
  * of `'TLSv1.3'`, `'TLSv1.2'`, `'TLSv1.1'`, or `'TLSv1'`. Cannot be specified along with the
@@ -386,6 +602,44 @@ declare module "tls" {
386
602
  * 'TLSv1.3'. If multiple of the options are provided, the lowest minimum is used.
387
603
  */
388
604
  minVersion?: SecureVersion;
605
+ /**
606
+ * Shared passphrase used for a single private key and/or a PFX.
607
+ */
608
+ passphrase?: string;
609
+ /**
610
+ * PFX or PKCS12 encoded private key and certificate chain. pfx is an
611
+ * alternative to providing key and cert individually. PFX is usually
612
+ * encrypted, if it is, passphrase will be used to decrypt it. Multiple
613
+ * PFX can be provided either as an array of unencrypted PFX buffers,
614
+ * or an array of objects in the form {buf: <string|buffer>[,
615
+ * passphrase: <string>]}. The object form can only occur in an array.
616
+ * object.passphrase is optional. Encrypted PFX will be decrypted with
617
+ * object.passphrase if provided, or options.passphrase if it is not.
618
+ */
619
+ pfx?: string | Buffer | Array<string | Buffer | PxfObject>;
620
+ /**
621
+ * Optionally affect the OpenSSL protocol behavior, which is not
622
+ * usually necessary. This should be used carefully if at all! Value is
623
+ * a numeric bitmask of the SSL_OP_* options from OpenSSL Options
624
+ */
625
+ secureOptions?: number; // Value is a numeric bitmask of the `SSL_OP_*` options
626
+ /**
627
+ * Legacy mechanism to select the TLS protocol version to use, it does
628
+ * not support independent control of the minimum and maximum version,
629
+ * and does not support limiting the protocol to TLSv1.3. Use
630
+ * minVersion and maxVersion instead. The possible values are listed as
631
+ * SSL_METHODS, use the function names as strings. For example, use
632
+ * 'TLSv1_1_method' to force TLS version 1.1, or 'TLS_method' to allow
633
+ * any TLS protocol version up to TLSv1.3. It is not recommended to use
634
+ * TLS versions less than 1.2, but it may be required for
635
+ * interoperability. Default: none, see minVersion.
636
+ */
637
+ secureProtocol?: string;
638
+ /**
639
+ * Opaque identifier used by servers to ensure session state is not
640
+ * shared between applications. Unused by clients.
641
+ */
642
+ sessionIdContext?: string;
389
643
  }
390
644
 
391
645
  interface SecureContext {
@@ -412,7 +666,37 @@ declare module "tls" {
412
666
  function createSecureContext(details: SecureContextOptions): SecureContext;
413
667
  function getCiphers(): string[];
414
668
 
415
- const DEFAULT_ECDH_CURVE: string;
669
+ /**
670
+ * The default curve name to use for ECDH key agreement in a tls server.
671
+ * The default value is 'auto'. See tls.createSecureContext() for further
672
+ * information.
673
+ */
674
+ let DEFAULT_ECDH_CURVE: string;
675
+ /**
676
+ * The default value of the maxVersion option of
677
+ * tls.createSecureContext(). It can be assigned any of the supported TLS
678
+ * protocol versions, 'TLSv1.3', 'TLSv1.2', 'TLSv1.1', or 'TLSv1'. Default:
679
+ * 'TLSv1.3', unless changed using CLI options. Using --tls-max-v1.2 sets
680
+ * the default to 'TLSv1.2'. Using --tls-max-v1.3 sets the default to
681
+ * 'TLSv1.3'. If multiple of the options are provided, the highest maximum
682
+ * is used.
683
+ */
684
+ let DEFAULT_MAX_VERSION: SecureVersion;
685
+ /**
686
+ * The default value of the minVersion option of tls.createSecureContext().
687
+ * It can be assigned any of the supported TLS protocol versions,
688
+ * 'TLSv1.3', 'TLSv1.2', 'TLSv1.1', or 'TLSv1'. Default: 'TLSv1.2', unless
689
+ * changed using CLI options. Using --tls-min-v1.0 sets the default to
690
+ * 'TLSv1'. Using --tls-min-v1.1 sets the default to 'TLSv1.1'. Using
691
+ * --tls-min-v1.3 sets the default to 'TLSv1.3'. If multiple of the options
692
+ * are provided, the lowest minimum is used.
693
+ */
694
+ let DEFAULT_MIN_VERSION: SecureVersion;
416
695
 
696
+ /**
697
+ * An immutable array of strings representing the root certificates (in PEM
698
+ * format) used for verifying peer certificates. This is the default value
699
+ * of the ca option to tls.createSecureContext().
700
+ */
417
701
  const rootCertificates: ReadonlyArray<string>;
418
702
  }