@types/node 17.0.42 → 18.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.
node/README.md CHANGED
@@ -8,7 +8,7 @@ This package contains type definitions for Node.js (https://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: Fri, 10 Jun 2022 23:01:33 GMT
11
+ * Last updated: Wed, 15 Jun 2022 23:01:34 GMT
12
12
  * Dependencies: none
13
13
  * Global values: `AbortController`, `AbortSignal`, `__dirname`, `__filename`, `console`, `exports`, `gc`, `global`, `module`, `process`, `require`, `structuredClone`
14
14
 
node/assert.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * The `assert` module provides a set of assertion functions for verifying
3
3
  * invariants.
4
- * @see [source](https://github.com/nodejs/node/blob/v17.0.0/lib/assert.js)
4
+ * @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/assert.js)
5
5
  */
6
6
  declare module 'assert' {
7
7
  /**
@@ -237,8 +237,8 @@ declare module 'assert' {
237
237
  * > Stability: 3 - Legacy: Use {@link strictEqual} instead.
238
238
  *
239
239
  * Tests shallow, coercive equality between the `actual` and `expected` parameters
240
- * using the [Abstract Equality Comparison](https://tc39.github.io/ecma262/#sec-abstract-equality-comparison) ( `==` ). `NaN` is special handled
241
- * and treated as being identical in case both sides are `NaN`.
240
+ * using the [`==` operator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Equality). `NaN` is specially handled
241
+ * and treated as being identical if both sides are `NaN`.
242
242
  *
243
243
  * ```js
244
244
  * import assert from 'assert';
@@ -270,9 +270,8 @@ declare module 'assert' {
270
270
  *
271
271
  * > Stability: 3 - Legacy: Use {@link notStrictEqual} instead.
272
272
  *
273
- * Tests shallow, coercive inequality with the [Abstract Equality Comparison](https://tc39.github.io/ecma262/#sec-abstract-equality-comparison)(`!=` ). `NaN` is special handled and treated as
274
- * being identical in case both
275
- * sides are `NaN`.
273
+ * Tests shallow, coercive inequality with the [`!=` operator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Inequality). `NaN` is
274
+ * specially handled and treated as being identical if both sides are `NaN`.
276
275
  *
277
276
  * ```js
278
277
  * import assert from 'assert';
@@ -362,7 +361,7 @@ declare module 'assert' {
362
361
  function notDeepEqual(actual: unknown, expected: unknown, message?: string | Error): void;
363
362
  /**
364
363
  * Tests strict equality between the `actual` and `expected` parameters as
365
- * determined by the [SameValue Comparison](https://tc39.github.io/ecma262/#sec-samevalue).
364
+ * determined by [`Object.is()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is).
366
365
  *
367
366
  * ```js
368
367
  * import assert from 'assert/strict';
@@ -400,7 +399,7 @@ declare module 'assert' {
400
399
  function strictEqual<T>(actual: unknown, expected: T, message?: string | Error): asserts actual is T;
401
400
  /**
402
401
  * Tests strict inequality between the `actual` and `expected` parameters as
403
- * determined by the [SameValue Comparison](https://tc39.github.io/ecma262/#sec-samevalue).
402
+ * determined by [`Object.is()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is).
404
403
  *
405
404
  * ```js
406
405
  * import assert from 'assert/strict';
node/async_hooks.d.ts CHANGED
@@ -6,7 +6,7 @@
6
6
  * import async_hooks from 'async_hooks';
7
7
  * ```
8
8
  * @experimental
9
- * @see [source](https://github.com/nodejs/node/blob/v17.0.0/lib/async_hooks.js)
9
+ * @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/async_hooks.js)
10
10
  */
11
11
  declare module 'async_hooks' {
12
12
  /**
@@ -364,7 +364,7 @@ declare module 'async_hooks' {
364
364
  *
365
365
  * Each instance of `AsyncLocalStorage` maintains an independent storage context.
366
366
  * Multiple instances can safely exist simultaneously without risk of interfering
367
- * with each other data.
367
+ * with each other's data.
368
368
  * @since v13.10.0, v12.17.0
369
369
  */
370
370
  class AsyncLocalStorage<T> {
node/buffer.d.ts CHANGED
@@ -41,7 +41,7 @@
41
41
  * // Creates a Buffer containing the Latin-1 bytes [0x74, 0xe9, 0x73, 0x74].
42
42
  * const buf7 = Buffer.from('tést', 'latin1');
43
43
  * ```
44
- * @see [source](https://github.com/nodejs/node/blob/v17.0.0/lib/buffer.js)
44
+ * @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/buffer.js)
45
45
  */
46
46
  declare module 'buffer' {
47
47
  import { BinaryLike } from 'node:crypto';
@@ -114,7 +114,6 @@ declare module 'buffer' {
114
114
  * A [`Blob`](https://developer.mozilla.org/en-US/docs/Web/API/Blob) encapsulates immutable, raw data that can be safely shared across
115
115
  * multiple worker threads.
116
116
  * @since v15.7.0, v14.18.0
117
- * @experimental
118
117
  */
119
118
  export class Blob {
120
119
  /**
@@ -763,8 +762,6 @@ declare module 'buffer' {
763
762
  * Returns a new `Buffer` that references the same memory as the original, but
764
763
  * offset and cropped by the `start` and `end` indices.
765
764
  *
766
- * This is the same behavior as `buf.subarray()`.
767
- *
768
765
  * This method is not compatible with the `Uint8Array.prototype.slice()`,
769
766
  * which is a superclass of `Buffer`. To copy the slice, use`Uint8Array.prototype.slice()`.
770
767
  *
@@ -780,8 +777,17 @@ declare module 'buffer' {
780
777
  *
781
778
  * console.log(buf.toString());
782
779
  * // Prints: buffer
780
+ *
781
+ * // With buf.slice(), the original buffer is modified.
782
+ * const notReallyCopiedBuf = buf.slice();
783
+ * notReallyCopiedBuf[0]++;
784
+ * console.log(notReallyCopiedBuf.toString());
785
+ * // Prints: cuffer
786
+ * console.log(buf.toString());
787
+ * // Also prints: cuffer (!)
783
788
  * ```
784
789
  * @since v0.3.0
790
+ * @deprecated Use `subarray` instead.
785
791
  * @param [start=0] Where the new `Buffer` will start.
786
792
  * @param [end=buf.length] Where the new `Buffer` will end (not inclusive).
787
793
  */
@@ -1948,7 +1954,7 @@ declare module 'buffer' {
1948
1954
  *
1949
1955
  * * a string, `value` is interpreted according to the character encoding in`encoding`.
1950
1956
  * * a `Buffer` or [`Uint8Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array), `value` will be used in its entirety.
1951
- * To compare a partial `Buffer`, use `buf.slice()`.
1957
+ * To compare a partial `Buffer`, use `buf.subarray`.
1952
1958
  * * a number, `value` will be interpreted as an unsigned 8-bit integer
1953
1959
  * value between `0` and `255`.
1954
1960
  *
node/child_process.d.ts CHANGED
@@ -28,8 +28,11 @@
28
28
  * identical to the behavior of pipes in the shell. Use the `{ stdio: 'ignore' }`option if the output will not be consumed.
29
29
  *
30
30
  * The command lookup is performed using the `options.env.PATH` environment
31
- * variable if it is in the `options` object. Otherwise, `process.env.PATH` is
32
- * used.
31
+ * variable if `env` is in the `options` object. Otherwise, `process.env.PATH` is
32
+ * used. If `options.env` is set without `PATH`, lookup on Unix is performed
33
+ * on a default search path search of `/usr/bin:/bin` (see your operating system's
34
+ * manual for execvpe/execvp), on Windows the current processes environment
35
+ * variable `PATH` is used.
33
36
  *
34
37
  * On Windows, environment variables are case-insensitive. Node.js
35
38
  * lexicographically sorts the `env` keys and uses the first one that
@@ -60,7 +63,7 @@
60
63
  * For certain use cases, such as automating shell scripts, the `synchronous counterparts` may be more convenient. In many cases, however,
61
64
  * the synchronous methods can have significant impact on performance due to
62
65
  * stalling the event loop while spawned processes complete.
63
- * @see [source](https://github.com/nodejs/node/blob/v17.0.0/lib/child_process.js)
66
+ * @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/child_process.js)
64
67
  */
65
68
  declare module 'child_process' {
66
69
  import { ObjectEncodingOptions } from 'node:fs';
node/cluster.d.ts CHANGED
@@ -1,7 +1,8 @@
1
1
  /**
2
- * A single instance of Node.js runs in a single thread. To take advantage of
3
- * multi-core systems, the user will sometimes want to launch a cluster of Node.js
4
- * processes to handle the load.
2
+ * Clusters of Node.js processes can be used to run multiple instances of Node.js
3
+ * that can distribute workloads among their application threads. When process
4
+ * isolation is not needed, use the `worker_threads` module instead, which
5
+ * allows running multiple application threads within a single Node.js instance.
5
6
  *
6
7
  * The cluster module allows easy creation of child processes that all share
7
8
  * server ports.
@@ -49,7 +50,7 @@
49
50
  * ```
50
51
  *
51
52
  * On Windows, it is not yet possible to set up a named pipe server in a worker.
52
- * @see [source](https://github.com/nodejs/node/blob/v17.0.0/lib/cluster.js)
53
+ * @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/cluster.js)
53
54
  */
54
55
  declare module 'cluster' {
55
56
  import * as child from 'node:child_process';
@@ -99,9 +100,9 @@ declare module 'cluster' {
99
100
  /**
100
101
  * Send a message to a worker or primary, optionally with a handle.
101
102
  *
102
- * In the primary this sends a message to a specific worker. It is identical to `ChildProcess.send()`.
103
+ * In the primary, this sends a message to a specific worker. It is identical to `ChildProcess.send()`.
103
104
  *
104
- * In a worker this sends a message to the primary. It is identical to`process.send()`.
105
+ * In a worker, this sends a message to the primary. It is identical to`process.send()`.
105
106
  *
106
107
  * This example will echo back all messages from the primary:
107
108
  *
@@ -123,19 +124,13 @@ declare module 'cluster' {
123
124
  send(message: child.Serializable, sendHandle: child.SendHandle, callback?: (error: Error | null) => void): boolean;
124
125
  send(message: child.Serializable, sendHandle: child.SendHandle, options?: child.MessageOptions, callback?: (error: Error | null) => void): boolean;
125
126
  /**
126
- * This function will kill the worker. In the primary, it does this
127
- * by disconnecting the `worker.process`, and once disconnected, killing
128
- * with `signal`. In the worker, it does it by disconnecting the channel,
129
- * and then exiting with code `0`.
127
+ * This function will kill the worker. In the primary worker, it does this by
128
+ * disconnecting the `worker.process`, and once disconnected, killing with`signal`. In the worker, it does it by killing the process with `signal`.
130
129
  *
131
- * Because `kill()` attempts to gracefully disconnect the worker process, it is
132
- * susceptible to waiting indefinitely for the disconnect to complete. For example,
133
- * if the worker enters an infinite loop, a graceful disconnect will never occur.
134
- * If the graceful disconnect behavior is not needed, use `worker.process.kill()`.
130
+ * The `kill()` function kills the worker process without waiting for a graceful
131
+ * disconnect, it has the same behavior as `worker.process.kill()`.
135
132
  *
136
- * Causes `.exitedAfterDisconnect` to be set.
137
- *
138
- * This method is aliased as `worker.destroy()` for backward compatibility.
133
+ * This method is aliased as `worker.destroy()` for backwards compatibility.
139
134
  *
140
135
  * In a worker, `process.kill()` exists, but it is not this function;
141
136
  * it is `kill()`.
@@ -253,7 +248,8 @@ declare module 'cluster' {
253
248
  */
254
249
  isDead(): boolean;
255
250
  /**
256
- * This property is `true` if the worker exited due to `.kill()` or`.disconnect()`. If the worker exited any other way, it is `false`. If the
251
+ * This property is `true` if the worker exited due to `.disconnect()`.
252
+ * If the worker exited any other way, it is `false`. If the
257
253
  * worker has not exited, it is `undefined`.
258
254
  *
259
255
  * The boolean `worker.exitedAfterDisconnect` allows distinguishing between
node/console.d.ts CHANGED
@@ -53,7 +53,7 @@
53
53
  * myConsole.warn(`Danger ${name}! Danger!`);
54
54
  * // Prints: Danger Will Robinson! Danger!, to err
55
55
  * ```
56
- * @see [source](https://github.com/nodejs/node/blob/v17.0.0/lib/console.js)
56
+ * @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/console.js)
57
57
  */
58
58
  declare module 'console' {
59
59
  import console = require('node:console');
node/crypto.d.ts CHANGED
@@ -13,47 +13,73 @@
13
13
  * // Prints:
14
14
  * // c0fa1bc00531bd78ef38c628449c5102aeabd49b5dc3a2a516ea6ea959d6658e
15
15
  * ```
16
- * @see [source](https://github.com/nodejs/node/blob/v17.0.0/lib/crypto.js)
16
+ * @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/crypto.js)
17
17
  */
18
18
  declare module 'crypto' {
19
19
  import * as stream from 'node:stream';
20
20
  import { PeerCertificate } from 'node:tls';
21
- interface Certificate {
21
+ /**
22
+ * SPKAC is a Certificate Signing Request mechanism originally implemented by
23
+ * Netscape and was specified formally as part of [HTML5's `keygen` element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/keygen).
24
+ *
25
+ * `<keygen>` is deprecated since [HTML 5.2](https://www.w3.org/TR/html52/changes.html#features-removed) and new projects
26
+ * should not use this element anymore.
27
+ *
28
+ * The `crypto` module provides the `Certificate` class for working with SPKAC
29
+ * data. The most common usage is handling output generated by the HTML5`<keygen>` element. Node.js uses [OpenSSL's SPKAC
30
+ * implementation](https://www.openssl.org/docs/man1.1.0/apps/openssl-spkac.html) internally.
31
+ * @since v0.11.8
32
+ */
33
+ class Certificate {
22
34
  /**
23
- * @deprecated
24
- * @param spkac
25
- * @returns The challenge component of the `spkac` data structure,
26
- * which includes a public key and a challenge.
35
+ * ```js
36
+ * const { Certificate } = await import('crypto');
37
+ * const spkac = getSpkacSomehow();
38
+ * const challenge = Certificate.exportChallenge(spkac);
39
+ * console.log(challenge.toString('utf8'));
40
+ * // Prints: the challenge as a UTF8 string
41
+ * ```
42
+ * @since v9.0.0
43
+ * @param encoding The `encoding` of the `spkac` string.
44
+ * @return The challenge component of the `spkac` data structure, which includes a public key and a challenge.
27
45
  */
28
- exportChallenge(spkac: BinaryLike): Buffer;
46
+ static exportChallenge(spkac: BinaryLike): Buffer;
29
47
  /**
30
- * @deprecated
31
- * @param spkac
32
- * @param encoding The encoding of the spkac string.
33
- * @returns The public key component of the `spkac` data structure,
34
- * which includes a public key and a challenge.
48
+ * ```js
49
+ * const { Certificate } = await import('crypto');
50
+ * const spkac = getSpkacSomehow();
51
+ * const publicKey = Certificate.exportPublicKey(spkac);
52
+ * console.log(publicKey);
53
+ * // Prints: the public key as <Buffer ...>
54
+ * ```
55
+ * @since v9.0.0
56
+ * @param encoding The `encoding` of the `spkac` string.
57
+ * @return The public key component of the `spkac` data structure, which includes a public key and a challenge.
35
58
  */
36
- exportPublicKey(spkac: BinaryLike, encoding?: string): Buffer;
59
+ static exportPublicKey(spkac: BinaryLike, encoding?: string): Buffer;
37
60
  /**
38
- * @deprecated
39
- * @param spkac
40
- * @returns `true` if the given `spkac` data structure is valid,
41
- * `false` otherwise.
61
+ * ```js
62
+ * import { Buffer } from 'buffer';
63
+ * const { Certificate } = await import('crypto');
64
+ *
65
+ * const spkac = getSpkacSomehow();
66
+ * console.log(Certificate.verifySpkac(Buffer.from(spkac)));
67
+ * // Prints: true or false
68
+ * ```
69
+ * @since v9.0.0
70
+ * @param encoding The `encoding` of the `spkac` string.
71
+ * @return `true` if the given `spkac` data structure is valid, `false` otherwise.
42
72
  */
43
- verifySpkac(spkac: NodeJS.ArrayBufferView): boolean;
44
- }
45
- const Certificate: Certificate & {
46
- /** @deprecated since v14.9.0 - Use static methods of `crypto.Certificate` instead. */
47
- new (): Certificate;
48
- /** @deprecated since v14.9.0 - Use static methods of `crypto.Certificate` instead. */
49
- (): Certificate;
73
+ static verifySpkac(spkac: NodeJS.ArrayBufferView): boolean;
50
74
  /**
75
+ * @deprecated
51
76
  * @param spkac
52
77
  * @returns The challenge component of the `spkac` data structure,
53
78
  * which includes a public key and a challenge.
54
79
  */
55
80
  exportChallenge(spkac: BinaryLike): Buffer;
56
81
  /**
82
+ * @deprecated
57
83
  * @param spkac
58
84
  * @param encoding The encoding of the spkac string.
59
85
  * @returns The public key component of the `spkac` data structure,
@@ -61,12 +87,13 @@ declare module 'crypto' {
61
87
  */
62
88
  exportPublicKey(spkac: BinaryLike, encoding?: string): Buffer;
63
89
  /**
90
+ * @deprecated
64
91
  * @param spkac
65
92
  * @returns `true` if the given `spkac` data structure is valid,
66
93
  * `false` otherwise.
67
94
  */
68
95
  verifySpkac(spkac: NodeJS.ArrayBufferView): boolean;
69
- };
96
+ }
70
97
  namespace constants {
71
98
  // https://nodejs.org/dist/latest-v10.x/docs/api/crypto.html#crypto_crypto_constants
72
99
  const OPENSSL_VERSION_NUMBER: number;
@@ -172,7 +199,7 @@ declare module 'crypto' {
172
199
  *
173
200
  * The `algorithm` is dependent on the available algorithms supported by the
174
201
  * version of OpenSSL on the platform. Examples are `'sha256'`, `'sha512'`, etc.
175
- * On recent releases of OpenSSL, `openssl list -digest-algorithms`(`openssl list-message-digest-algorithms` for older versions of OpenSSL) will
202
+ * On recent releases of OpenSSL, `openssl list -digest-algorithms` will
176
203
  * display the available digest algorithms.
177
204
  *
178
205
  * Example: generating the sha256 sum of a file
@@ -212,7 +239,7 @@ declare module 'crypto' {
212
239
  *
213
240
  * The `algorithm` is dependent on the available algorithms supported by the
214
241
  * version of OpenSSL on the platform. Examples are `'sha256'`, `'sha512'`, etc.
215
- * On recent releases of OpenSSL, `openssl list -digest-algorithms`(`openssl list-message-digest-algorithms` for older versions of OpenSSL) will
242
+ * On recent releases of OpenSSL, `openssl list -digest-algorithms` will
216
243
  * display the available digest algorithms.
217
244
  *
218
245
  * The `key` is the HMAC key used to generate the cryptographic HMAC hash. If it is
@@ -662,12 +689,13 @@ declare module 'crypto' {
662
689
  * Creates and returns a `Cipher` object that uses the given `algorithm` and`password`.
663
690
  *
664
691
  * The `options` argument controls stream behavior and is optional except when a
665
- * cipher in CCM or OCB mode is used (e.g. `'aes-128-ccm'`). In that case, the`authTagLength` option is required and specifies the length of the
692
+ * cipher in CCM or OCB mode (e.g. `'aes-128-ccm'`) is used. In that case, the`authTagLength` option is required and specifies the length of the
666
693
  * authentication tag in bytes, see `CCM mode`. In GCM mode, the `authTagLength`option is not required but can be used to set the length of the authentication
667
694
  * tag that will be returned by `getAuthTag()` and defaults to 16 bytes.
695
+ * For `chacha20-poly1305`, the `authTagLength` option defaults to 16 bytes.
668
696
  *
669
697
  * The `algorithm` is dependent on OpenSSL, examples are `'aes192'`, etc. On
670
- * recent OpenSSL releases, `openssl list -cipher-algorithms`(`openssl list-cipher-algorithms` for older versions of OpenSSL) will
698
+ * recent OpenSSL releases, `openssl list -cipher-algorithms` will
671
699
  * display the available cipher algorithms.
672
700
  *
673
701
  * The `password` is used to derive the cipher key and initialization vector (IV).
@@ -700,12 +728,13 @@ declare module 'crypto' {
700
728
  * initialization vector (`iv`).
701
729
  *
702
730
  * The `options` argument controls stream behavior and is optional except when a
703
- * cipher in CCM or OCB mode is used (e.g. `'aes-128-ccm'`). In that case, the`authTagLength` option is required and specifies the length of the
731
+ * cipher in CCM or OCB mode (e.g. `'aes-128-ccm'`) is used. In that case, the`authTagLength` option is required and specifies the length of the
704
732
  * authentication tag in bytes, see `CCM mode`. In GCM mode, the `authTagLength`option is not required but can be used to set the length of the authentication
705
733
  * tag that will be returned by `getAuthTag()` and defaults to 16 bytes.
734
+ * For `chacha20-poly1305`, the `authTagLength` option defaults to 16 bytes.
706
735
  *
707
736
  * The `algorithm` is dependent on OpenSSL, examples are `'aes192'`, etc. On
708
- * recent OpenSSL releases, `openssl list -cipher-algorithms`(`openssl list-cipher-algorithms` for older versions of OpenSSL) will
737
+ * recent OpenSSL releases, `openssl list -cipher-algorithms` will
709
738
  * display the available cipher algorithms.
710
739
  *
711
740
  * The `key` is the raw key used by the `algorithm` and `iv` is an [initialization vector](https://en.wikipedia.org/wiki/Initialization_vector). Both arguments must be `'utf8'` encoded
@@ -925,8 +954,9 @@ declare module 'crypto' {
925
954
  * Creates and returns a `Decipher` object that uses the given `algorithm` and`password` (key).
926
955
  *
927
956
  * The `options` argument controls stream behavior and is optional except when a
928
- * cipher in CCM or OCB mode is used (e.g. `'aes-128-ccm'`). In that case, the`authTagLength` option is required and specifies the length of the
957
+ * cipher in CCM or OCB mode (e.g. `'aes-128-ccm'`) is used. In that case, the`authTagLength` option is required and specifies the length of the
929
958
  * authentication tag in bytes, see `CCM mode`.
959
+ * For `chacha20-poly1305`, the `authTagLength` option defaults to 16 bytes.
930
960
  *
931
961
  * The implementation of `crypto.createDecipher()` derives keys using the OpenSSL
932
962
  * function [`EVP_BytesToKey`](https://www.openssl.org/docs/man1.1.0/crypto/EVP_BytesToKey.html) with the digest algorithm set to MD5, one
@@ -951,12 +981,13 @@ declare module 'crypto' {
951
981
  * Creates and returns a `Decipher` object that uses the given `algorithm`, `key`and initialization vector (`iv`).
952
982
  *
953
983
  * The `options` argument controls stream behavior and is optional except when a
954
- * cipher in CCM or OCB mode is used (e.g. `'aes-128-ccm'`). In that case, the`authTagLength` option is required and specifies the length of the
984
+ * cipher in CCM or OCB mode (e.g. `'aes-128-ccm'`) is used. In that case, the`authTagLength` option is required and specifies the length of the
955
985
  * authentication tag in bytes, see `CCM mode`. In GCM mode, the `authTagLength`option is not required but can be used to restrict accepted authentication tags
956
986
  * to those with the specified length.
987
+ * For `chacha20-poly1305`, the `authTagLength` option defaults to 16 bytes.
957
988
  *
958
989
  * The `algorithm` is dependent on OpenSSL, examples are `'aes192'`, etc. On
959
- * recent OpenSSL releases, `openssl list -cipher-algorithms`(`openssl list-cipher-algorithms` for older versions of OpenSSL) will
990
+ * recent OpenSSL releases, `openssl list -cipher-algorithms` will
960
991
  * display the available cipher algorithms.
961
992
  *
962
993
  * The `key` is the raw key used by the `algorithm` and `iv` is an [initialization vector](https://en.wikipedia.org/wiki/Initialization_vector). Both arguments must be `'utf8'` encoded
@@ -2272,7 +2303,8 @@ declare module 'crypto' {
2272
2303
  * comparing HMAC digests or secret values like authentication cookies or [capability urls](https://www.w3.org/TR/capability-urls/).
2273
2304
  *
2274
2305
  * `a` and `b` must both be `Buffer`s, `TypedArray`s, or `DataView`s, and they
2275
- * must have the same byte length.
2306
+ * must have the same byte length. An error is thrown if `a` and `b` have
2307
+ * different byte lengths.
2276
2308
  *
2277
2309
  * If at least one of `a` and `b` is a `TypedArray` with more than one byte per
2278
2310
  * entry, such as `Uint16Array`, the result will be computed using the platform
@@ -3094,12 +3126,16 @@ declare module 'crypto' {
3094
3126
  */
3095
3127
  class X509Certificate {
3096
3128
  /**
3097
- * Will be \`true\` if this is a Certificate Authority (ca) certificate.
3129
+ * Will be \`true\` if this is a Certificate Authority (CA) certificate.
3098
3130
  * @since v15.6.0
3099
3131
  */
3100
3132
  readonly ca: boolean;
3101
3133
  /**
3102
3134
  * The SHA-1 fingerprint of this certificate.
3135
+ *
3136
+ * Because SHA-1 is cryptographically broken and because the security of SHA-1 is
3137
+ * significantly worse than that of algorithms that are commonly used to sign
3138
+ * certificates, consider using `x509.fingerprint256` instead.
3103
3139
  * @since v15.6.0
3104
3140
  */
3105
3141
  readonly fingerprint: string;
@@ -3158,6 +3194,10 @@ declare module 'crypto' {
3158
3194
  readonly raw: Buffer;
3159
3195
  /**
3160
3196
  * The serial number of this certificate.
3197
+ *
3198
+ * Serial numbers are assigned by certificate authorities and do not uniquely
3199
+ * identify certificates. Consider using `x509.fingerprint256` as a unique
3200
+ * identifier instead.
3161
3201
  * @since v15.6.0
3162
3202
  */
3163
3203
  readonly serialNumber: string;
@@ -3174,18 +3214,50 @@ declare module 'crypto' {
3174
3214
  constructor(buffer: BinaryLike);
3175
3215
  /**
3176
3216
  * Checks whether the certificate matches the given email address.
3217
+ *
3218
+ * If the `'subject'` option is undefined or set to `'default'`, the certificate
3219
+ * subject is only considered if the subject alternative name extension either does
3220
+ * not exist or does not contain any email addresses.
3221
+ *
3222
+ * If the `'subject'` option is set to `'always'` and if the subject alternative
3223
+ * name extension either does not exist or does not contain a matching email
3224
+ * address, the certificate subject is considered.
3225
+ *
3226
+ * If the `'subject'` option is set to `'never'`, the certificate subject is never
3227
+ * considered, even if the certificate contains no subject alternative names.
3177
3228
  * @since v15.6.0
3178
3229
  * @return Returns `email` if the certificate matches, `undefined` if it does not.
3179
3230
  */
3180
3231
  checkEmail(email: string, options?: Pick<X509CheckOptions, 'subject'>): string | undefined;
3181
3232
  /**
3182
3233
  * Checks whether the certificate matches the given host name.
3234
+ *
3235
+ * If the certificate matches the given host name, the matching subject name is
3236
+ * returned. The returned name might be an exact match (e.g., `foo.example.com`)
3237
+ * or it might contain wildcards (e.g., `*.example.com`). Because host name
3238
+ * comparisons are case-insensitive, the returned subject name might also differ
3239
+ * from the given `name` in capitalization.
3240
+ *
3241
+ * If the `'subject'` option is undefined or set to `'default'`, the certificate
3242
+ * subject is only considered if the subject alternative name extension either does
3243
+ * not exist or does not contain any DNS names. This behavior is consistent with [RFC 2818](https://www.rfc-editor.org/rfc/rfc2818.txt) ("HTTP Over TLS").
3244
+ *
3245
+ * If the `'subject'` option is set to `'always'` and if the subject alternative
3246
+ * name extension either does not exist or does not contain a matching DNS name,
3247
+ * the certificate subject is considered.
3248
+ *
3249
+ * If the `'subject'` option is set to `'never'`, the certificate subject is never
3250
+ * considered, even if the certificate contains no subject alternative names.
3183
3251
  * @since v15.6.0
3184
- * @return Returns `name` if the certificate matches, `undefined` if it does not.
3252
+ * @return Returns a subject name that matches `name`, or `undefined` if no subject name matches `name`.
3185
3253
  */
3186
3254
  checkHost(name: string, options?: X509CheckOptions): string | undefined;
3187
3255
  /**
3188
3256
  * Checks whether the certificate matches the given IP address (IPv4 or IPv6).
3257
+ *
3258
+ * Only [RFC 5280](https://www.rfc-editor.org/rfc/rfc5280.txt) `iPAddress` subject alternative names are considered, and they
3259
+ * must match the given `ip` address exactly. Other subject alternative names as
3260
+ * well as the subject field of the certificate are ignored.
3189
3261
  * @since v15.6.0
3190
3262
  * @return Returns `ip` if the certificate matches, `undefined` if it does not.
3191
3263
  */
node/dgram.d.ts CHANGED
@@ -23,7 +23,7 @@
23
23
  * server.bind(41234);
24
24
  * // Prints: server listening 0.0.0.0:41234
25
25
  * ```
26
- * @see [source](https://github.com/nodejs/node/blob/v17.0.0/lib/dgram.js)
26
+ * @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/dgram.js)
27
27
  */
28
28
  declare module 'dgram' {
29
29
  import { AddressInfo } from 'node:net';
@@ -451,7 +451,7 @@ declare module 'dgram' {
451
451
  * TTL. If the TTL is decremented to 0 by a router, it will not be forwarded.
452
452
  * Changing TTL values is typically done for network probes or when multicasting.
453
453
  *
454
- * The `ttl` argument may be between between 1 and 255\. The default on most systems
454
+ * The `ttl` argument may be between 1 and 255\. The default on most systems
455
455
  * is 64.
456
456
  *
457
457
  * This method throws `EBADF` if called on an unbound socket.
@@ -20,7 +20,7 @@
20
20
  * should generally include the module name to avoid collisions with data from
21
21
  * other modules.
22
22
  * @experimental
23
- * @see [source](https://github.com/nodejs/node/blob/v17.0.0/lib/diagnostics_channel.js)
23
+ * @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/diagnostics_channel.js)
24
24
  */
25
25
  declare module 'diagnostics_channel' {
26
26
  /**
@@ -143,6 +143,7 @@ declare module 'diagnostics_channel' {
143
143
  * ```
144
144
  * @since v15.1.0, v14.17.0
145
145
  * @param onMessage The previous subscribed handler to remove
146
+ * @return `true` if the handler was found, `false` otherwise.
146
147
  */
147
148
  unsubscribe(onMessage: ChannelListener): void;
148
149
  }
node/dns/promises.d.ts CHANGED
@@ -119,7 +119,7 @@ declare module 'dns/promises' {
119
119
  *
120
120
  * <omitted>
121
121
  *
122
- * On error, the `Promise` is rejected with an `Error` object, where `err.code`is one of the DNS error codes.
122
+ * On error, the `Promise` is rejected with an `Error` object, where `err.code`is one of the `DNS error codes`.
123
123
  * @since v10.6.0
124
124
  * @param hostname Host name to resolve.
125
125
  * @param [rrtype='A'] Resource record type.
@@ -300,7 +300,7 @@ declare module 'dns/promises' {
300
300
  * Performs a reverse DNS query that resolves an IPv4 or IPv6 address to an
301
301
  * array of host names.
302
302
  *
303
- * On error, the `Promise` is rejected with an `Error` object, where `err.code`is one of the DNS error codes.
303
+ * On error, the `Promise` is rejected with an `Error` object, where `err.code`is one of the `DNS error codes`.
304
304
  * @since v10.6.0
305
305
  */
306
306
  function reverse(ip: string): Promise<string[]>;
node/dns.d.ts CHANGED
@@ -42,7 +42,7 @@
42
42
  * ```
43
43
  *
44
44
  * See the `Implementation considerations section` for more information.
45
- * @see [source](https://github.com/nodejs/node/blob/v17.0.0/lib/dns.js)
45
+ * @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/dns.js)
46
46
  */
47
47
  declare module 'dns' {
48
48
  import * as dnsPromises from 'node:dns/promises';
@@ -244,7 +244,7 @@ declare module 'dns' {
244
244
  *
245
245
  * <omitted>
246
246
  *
247
- * On error, `err` is an `Error` object, where `err.code` is one of theDNS error codes.
247
+ * On error, `err` is an `Error` object, where `err.code` is one of the `DNS error codes`.
248
248
  * @since v0.1.27
249
249
  * @param hostname Host name to resolve.
250
250
  * @param [rrtype='A'] Resource record type.
node/domain.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  /**
2
2
  * **This module is pending deprecation.** Once a replacement API has been
3
- * finalized, this module will be fully deprecated. Most developers should**not** have cause to use this module. Users who absolutely must have
3
+ * finalized, this module will be fully deprecated. Most developers should
4
+ * **not** have cause to use this module. Users who absolutely must have
4
5
  * the functionality that domains provide may rely on it for the time being
5
6
  * but should expect to have to migrate to a different solution
6
7
  * in the future.
@@ -11,7 +12,7 @@
11
12
  * will be notified, rather than losing the context of the error in the`process.on('uncaughtException')` handler, or causing the program to
12
13
  * exit immediately with an error code.
13
14
  * @deprecated Since v1.4.2 - Deprecated
14
- * @see [source](https://github.com/nodejs/node/blob/v17.0.0/lib/domain.js)
15
+ * @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/domain.js)
15
16
  */
16
17
  declare module 'domain' {
17
18
  import EventEmitter = require('node:events');