@rio-cloud/cdk-v2-constructs 8.2.0 → 8.2.1-alpha.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 (179) hide show
  1. package/.jsii +2 -2
  2. package/node_modules/@types/node/README.md +3 -3
  3. package/node_modules/@types/node/assert/strict.d.ts +105 -2
  4. package/node_modules/@types/node/assert.d.ts +211 -92
  5. package/node_modules/@types/node/async_hooks.d.ts +103 -19
  6. package/node_modules/@types/node/buffer.buffer.d.ts +472 -0
  7. package/node_modules/@types/node/buffer.d.ts +88 -516
  8. package/node_modules/@types/node/child_process.d.ts +167 -231
  9. package/node_modules/@types/node/cluster.d.ts +172 -26
  10. package/node_modules/@types/node/compatibility/iterators.d.ts +21 -0
  11. package/node_modules/@types/node/console.d.ts +66 -28
  12. package/node_modules/@types/node/constants.d.ts +14 -12
  13. package/node_modules/@types/node/crypto.d.ts +1458 -497
  14. package/node_modules/@types/node/dgram.d.ts +44 -30
  15. package/node_modules/@types/node/diagnostics_channel.d.ts +389 -4
  16. package/node_modules/@types/node/dns/promises.d.ts +120 -42
  17. package/node_modules/@types/node/dns.d.ts +209 -95
  18. package/node_modules/@types/node/domain.d.ts +14 -18
  19. package/node_modules/@types/node/events.d.ts +245 -113
  20. package/node_modules/@types/node/fs/promises.d.ts +194 -96
  21. package/node_modules/@types/node/fs.d.ts +695 -270
  22. package/node_modules/@types/node/globals.d.ts +97 -308
  23. package/node_modules/@types/node/globals.typedarray.d.ts +41 -0
  24. package/node_modules/@types/node/http.d.ts +363 -97
  25. package/node_modules/@types/node/http2.d.ts +684 -231
  26. package/node_modules/@types/node/https.d.ts +122 -87
  27. package/node_modules/@types/node/index.d.ts +24 -11
  28. package/node_modules/@types/node/inspector.d.ts +220 -2690
  29. package/node_modules/@types/node/inspector.generated.d.ts +4239 -0
  30. package/node_modules/@types/node/module.d.ts +705 -149
  31. package/node_modules/@types/node/net.d.ts +178 -54
  32. package/node_modules/@types/node/os.d.ts +47 -17
  33. package/node_modules/@types/node/package.json +22 -97
  34. package/node_modules/@types/node/path.d.ts +12 -3
  35. package/node_modules/@types/node/perf_hooks.d.ts +500 -97
  36. package/node_modules/@types/node/process.d.ts +657 -87
  37. package/node_modules/@types/node/punycode.d.ts +5 -5
  38. package/node_modules/@types/node/querystring.d.ts +24 -13
  39. package/node_modules/@types/node/readline/promises.d.ts +25 -14
  40. package/node_modules/@types/node/readline.d.ts +102 -41
  41. package/node_modules/@types/node/repl.d.ts +38 -30
  42. package/node_modules/@types/node/sea.d.ts +162 -0
  43. package/node_modules/@types/node/sqlite.d.ts +1040 -0
  44. package/node_modules/@types/node/stream/consumers.d.ts +33 -7
  45. package/node_modules/@types/node/stream/promises.d.ts +8 -1
  46. package/node_modules/@types/node/stream/web.d.ts +251 -28
  47. package/node_modules/@types/node/stream.d.ts +1060 -1055
  48. package/node_modules/@types/node/string_decoder.d.ts +8 -8
  49. package/node_modules/@types/node/test.d.ts +2133 -1166
  50. package/node_modules/@types/node/timers/promises.d.ts +31 -16
  51. package/node_modules/@types/node/timers.d.ts +159 -114
  52. package/node_modules/@types/node/tls.d.ts +232 -163
  53. package/node_modules/@types/node/trace_events.d.ts +43 -28
  54. package/node_modules/@types/node/ts5.6/buffer.buffer.d.ts +468 -0
  55. package/node_modules/@types/node/ts5.6/compatibility/float16array.d.ts +71 -0
  56. package/node_modules/@types/node/ts5.6/globals.typedarray.d.ts +36 -0
  57. package/node_modules/@types/node/ts5.6/index.d.ts +103 -0
  58. package/node_modules/@types/node/ts5.7/compatibility/float16array.d.ts +72 -0
  59. package/node_modules/@types/node/ts5.7/index.d.ts +103 -0
  60. package/node_modules/@types/node/tty.d.ts +9 -9
  61. package/node_modules/@types/node/url.d.ts +236 -84
  62. package/node_modules/@types/node/util.d.ts +562 -412
  63. package/node_modules/@types/node/v8.d.ts +368 -21
  64. package/node_modules/@types/node/vm.d.ts +443 -149
  65. package/node_modules/@types/node/wasi.d.ts +62 -18
  66. package/node_modules/@types/node/web-globals/abortcontroller.d.ts +34 -0
  67. package/node_modules/@types/node/web-globals/crypto.d.ts +32 -0
  68. package/node_modules/@types/node/web-globals/domexception.d.ts +68 -0
  69. package/node_modules/@types/node/web-globals/events.d.ts +97 -0
  70. package/node_modules/@types/node/web-globals/fetch.d.ts +62 -0
  71. package/node_modules/@types/node/web-globals/navigator.d.ts +25 -0
  72. package/node_modules/@types/node/web-globals/storage.d.ts +24 -0
  73. package/node_modules/@types/node/web-globals/streams.d.ts +22 -0
  74. package/node_modules/@types/node/worker_threads.d.ts +310 -107
  75. package/node_modules/@types/node/zlib.d.ts +301 -73
  76. package/node_modules/undici-types/LICENSE +21 -0
  77. package/node_modules/undici-types/agent.d.ts +13 -12
  78. package/node_modules/undici-types/api.d.ts +26 -26
  79. package/node_modules/undici-types/balanced-pool.d.ts +19 -7
  80. package/node_modules/undici-types/cache-interceptor.d.ts +173 -0
  81. package/node_modules/undici-types/client-stats.d.ts +15 -0
  82. package/node_modules/undici-types/client.d.ts +26 -15
  83. package/node_modules/undici-types/connector.d.ts +2 -2
  84. package/node_modules/undici-types/cookies.d.ts +2 -0
  85. package/node_modules/undici-types/diagnostics-channel.d.ts +19 -12
  86. package/node_modules/undici-types/dispatcher.d.ts +148 -113
  87. package/node_modules/undici-types/env-http-proxy-agent.d.ts +22 -0
  88. package/node_modules/undici-types/errors.d.ts +79 -46
  89. package/node_modules/undici-types/eventsource.d.ts +66 -0
  90. package/node_modules/undici-types/fetch.d.ts +41 -39
  91. package/node_modules/undici-types/formdata.d.ts +8 -8
  92. package/node_modules/undici-types/global-dispatcher.d.ts +4 -4
  93. package/node_modules/undici-types/global-origin.d.ts +5 -5
  94. package/node_modules/undici-types/h2c-client.d.ts +73 -0
  95. package/node_modules/undici-types/handlers.d.ts +11 -5
  96. package/node_modules/undici-types/header.d.ts +157 -1
  97. package/node_modules/undici-types/index.d.ts +68 -43
  98. package/node_modules/undici-types/interceptors.d.ts +71 -3
  99. package/node_modules/undici-types/mock-agent.d.ts +36 -18
  100. package/node_modules/undici-types/mock-call-history.d.ts +111 -0
  101. package/node_modules/undici-types/mock-client.d.ts +6 -4
  102. package/node_modules/undici-types/mock-errors.d.ts +3 -3
  103. package/node_modules/undici-types/mock-interceptor.d.ts +24 -23
  104. package/node_modules/undici-types/mock-pool.d.ts +6 -4
  105. package/node_modules/undici-types/package.json +1 -1
  106. package/node_modules/undici-types/patch.d.ts +0 -42
  107. package/node_modules/undici-types/pool-stats.d.ts +8 -8
  108. package/node_modules/undici-types/pool.d.ts +21 -8
  109. package/node_modules/undici-types/proxy-agent.d.ts +5 -6
  110. package/node_modules/undici-types/readable.d.ts +24 -17
  111. package/node_modules/undici-types/retry-agent.d.ts +8 -0
  112. package/node_modules/undici-types/retry-handler.d.ts +125 -0
  113. package/node_modules/undici-types/round-robin-pool.d.ts +41 -0
  114. package/node_modules/undici-types/snapshot-agent.d.ts +109 -0
  115. package/node_modules/undici-types/util.d.ts +18 -0
  116. package/node_modules/undici-types/utility.d.ts +7 -0
  117. package/node_modules/undici-types/webidl.d.ts +157 -36
  118. package/node_modules/undici-types/websocket.d.ts +67 -12
  119. package/package.json +9 -60
  120. package/version.json +1 -1
  121. package/node_modules/@types/node/dom-events.d.ts +0 -122
  122. package/node_modules/@types/node/globals.global.d.ts +0 -1
  123. package/node_modules/@types/node/ts4.8/assert/strict.d.ts +0 -8
  124. package/node_modules/@types/node/ts4.8/assert.d.ts +0 -996
  125. package/node_modules/@types/node/ts4.8/async_hooks.d.ts +0 -539
  126. package/node_modules/@types/node/ts4.8/buffer.d.ts +0 -2362
  127. package/node_modules/@types/node/ts4.8/child_process.d.ts +0 -1540
  128. package/node_modules/@types/node/ts4.8/cluster.d.ts +0 -432
  129. package/node_modules/@types/node/ts4.8/console.d.ts +0 -415
  130. package/node_modules/@types/node/ts4.8/constants.d.ts +0 -19
  131. package/node_modules/@types/node/ts4.8/crypto.d.ts +0 -4455
  132. package/node_modules/@types/node/ts4.8/dgram.d.ts +0 -586
  133. package/node_modules/@types/node/ts4.8/diagnostics_channel.d.ts +0 -191
  134. package/node_modules/@types/node/ts4.8/dns/promises.d.ts +0 -425
  135. package/node_modules/@types/node/ts4.8/dns.d.ts +0 -809
  136. package/node_modules/@types/node/ts4.8/dom-events.d.ts +0 -122
  137. package/node_modules/@types/node/ts4.8/domain.d.ts +0 -170
  138. package/node_modules/@types/node/ts4.8/events.d.ts +0 -796
  139. package/node_modules/@types/node/ts4.8/fs/promises.d.ts +0 -1232
  140. package/node_modules/@types/node/ts4.8/fs.d.ts +0 -4289
  141. package/node_modules/@types/node/ts4.8/globals.d.ts +0 -381
  142. package/node_modules/@types/node/ts4.8/globals.global.d.ts +0 -1
  143. package/node_modules/@types/node/ts4.8/http.d.ts +0 -1888
  144. package/node_modules/@types/node/ts4.8/http2.d.ts +0 -2382
  145. package/node_modules/@types/node/ts4.8/https.d.ts +0 -550
  146. package/node_modules/@types/node/ts4.8/index.d.ts +0 -88
  147. package/node_modules/@types/node/ts4.8/inspector.d.ts +0 -2747
  148. package/node_modules/@types/node/ts4.8/module.d.ts +0 -287
  149. package/node_modules/@types/node/ts4.8/net.d.ts +0 -949
  150. package/node_modules/@types/node/ts4.8/os.d.ts +0 -477
  151. package/node_modules/@types/node/ts4.8/path.d.ts +0 -191
  152. package/node_modules/@types/node/ts4.8/perf_hooks.d.ts +0 -639
  153. package/node_modules/@types/node/ts4.8/process.d.ts +0 -1532
  154. package/node_modules/@types/node/ts4.8/punycode.d.ts +0 -117
  155. package/node_modules/@types/node/ts4.8/querystring.d.ts +0 -141
  156. package/node_modules/@types/node/ts4.8/readline/promises.d.ts +0 -150
  157. package/node_modules/@types/node/ts4.8/readline.d.ts +0 -539
  158. package/node_modules/@types/node/ts4.8/repl.d.ts +0 -430
  159. package/node_modules/@types/node/ts4.8/stream/consumers.d.ts +0 -12
  160. package/node_modules/@types/node/ts4.8/stream/promises.d.ts +0 -83
  161. package/node_modules/@types/node/ts4.8/stream/web.d.ts +0 -350
  162. package/node_modules/@types/node/ts4.8/stream.d.ts +0 -1701
  163. package/node_modules/@types/node/ts4.8/string_decoder.d.ts +0 -67
  164. package/node_modules/@types/node/ts4.8/test.d.ts +0 -1382
  165. package/node_modules/@types/node/ts4.8/timers/promises.d.ts +0 -93
  166. package/node_modules/@types/node/ts4.8/timers.d.ts +0 -240
  167. package/node_modules/@types/node/ts4.8/tls.d.ts +0 -1210
  168. package/node_modules/@types/node/ts4.8/trace_events.d.ts +0 -182
  169. package/node_modules/@types/node/ts4.8/tty.d.ts +0 -208
  170. package/node_modules/@types/node/ts4.8/url.d.ts +0 -927
  171. package/node_modules/@types/node/ts4.8/util.d.ts +0 -2186
  172. package/node_modules/@types/node/ts4.8/v8.d.ts +0 -635
  173. package/node_modules/@types/node/ts4.8/vm.d.ts +0 -901
  174. package/node_modules/@types/node/ts4.8/wasi.d.ts +0 -158
  175. package/node_modules/@types/node/ts4.8/worker_threads.d.ts +0 -691
  176. package/node_modules/@types/node/ts4.8/zlib.d.ts +0 -517
  177. package/node_modules/argparse/CHANGELOG.md +0 -216
  178. package/node_modules/undici-types/file.d.ts +0 -39
  179. package/node_modules/undici-types/filereader.d.ts +0 -54
@@ -4,41 +4,42 @@
4
4
  * The module can be accessed using:
5
5
  *
6
6
  * ```js
7
- * const tls = require('node:tls');
7
+ * import tls from 'node:tls';
8
8
  * ```
9
- * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/tls.js)
9
+ * @see [source](https://github.com/nodejs/node/blob/v24.x/lib/tls.js)
10
10
  */
11
11
  declare module "tls" {
12
+ import { NonSharedBuffer } from "node:buffer";
12
13
  import { X509Certificate } from "node:crypto";
13
14
  import * as net from "node:net";
14
15
  import * as stream from "stream";
15
16
  const CLIENT_RENEG_LIMIT: number;
16
17
  const CLIENT_RENEG_WINDOW: number;
17
- interface Certificate {
18
+ interface Certificate extends NodeJS.Dict<string | string[]> {
18
19
  /**
19
20
  * Country code.
20
21
  */
21
- C: string;
22
+ C?: string | string[];
22
23
  /**
23
24
  * Street.
24
25
  */
25
- ST: string;
26
+ ST?: string | string[];
26
27
  /**
27
28
  * Locality.
28
29
  */
29
- L: string;
30
+ L?: string | string[];
30
31
  /**
31
32
  * Organization.
32
33
  */
33
- O: string;
34
+ O?: string | string[];
34
35
  /**
35
36
  * Organizational unit.
36
37
  */
37
- OU: string;
38
+ OU?: string | string[];
38
39
  /**
39
40
  * Common name.
40
41
  */
41
- CN: string;
42
+ CN?: string | string[];
42
43
  }
43
44
  interface PeerCertificate {
44
45
  /**
@@ -49,7 +50,7 @@ declare module "tls" {
49
50
  /**
50
51
  * The DER encoded X.509 certificate data.
51
52
  */
52
- raw: Buffer;
53
+ raw: NonSharedBuffer;
53
54
  /**
54
55
  * The certificate subject.
55
56
  */
@@ -115,7 +116,7 @@ declare module "tls" {
115
116
  /**
116
117
  * The public key.
117
118
  */
118
- pubkey?: Buffer;
119
+ pubkey?: NonSharedBuffer;
119
120
  /**
120
121
  * The ASN.1 name of the OID of the elliptic curve.
121
122
  * Well-known curves are identified by an OID.
@@ -125,7 +126,7 @@ declare module "tls" {
125
126
  */
126
127
  asn1Curve?: string;
127
128
  /**
128
- * The NIST name for the elliptic curve,if it has one
129
+ * The NIST name for the elliptic curve, if it has one
129
130
  * (not all well-known curves have been assigned names by NIST).
130
131
  */
131
132
  nistCurve?: string;
@@ -199,12 +200,6 @@ declare module "tls" {
199
200
  * An optional Buffer instance containing a TLS session.
200
201
  */
201
202
  session?: Buffer | undefined;
202
- /**
203
- * If true, specifies that the OCSP status request extension will be
204
- * added to the client hello and an 'OCSPResponse' event will be
205
- * emitted on the socket before establishing a secure communication
206
- */
207
- requestOCSP?: boolean | undefined;
208
203
  }
209
204
  /**
210
205
  * Performs transparent encryption of written data and all required TLS
@@ -220,7 +215,7 @@ declare module "tls" {
220
215
  /**
221
216
  * Construct a new tls.TLSSocket object from an existing TCP socket.
222
217
  */
223
- constructor(socket: net.Socket, options?: TLSSocketOptions);
218
+ constructor(socket: net.Socket | stream.Duplex, options?: TLSSocketOptions);
224
219
  /**
225
220
  * This property is `true` if the peer certificate was signed by one of the CAs
226
221
  * specified when creating the `tls.TLSSocket` instance, otherwise `false`.
@@ -244,6 +239,10 @@ declare module "tls" {
244
239
  * When a handshake is completed but not ALPN protocol was selected, tlsSocket.alpnProtocol equals false.
245
240
  */
246
241
  alpnProtocol: string | false | null;
242
+ /**
243
+ * String containing the server name requested via SNI (Server Name Indication) TLS extension.
244
+ */
245
+ servername: string | false | null;
247
246
  /**
248
247
  * Returns an object representing the local certificate. The returned object has
249
248
  * some properties corresponding to the fields of the certificate.
@@ -278,7 +277,7 @@ declare module "tls" {
278
277
  * an ephemeral key exchange in `perfect forward secrecy` on a client
279
278
  * connection. It returns an empty object when the key exchange is not
280
279
  * ephemeral. As this is only supported on a client socket; `null` is returned
281
- * if called on a server socket. The supported types are `'DH'` and `'ECDH'`. The`name` property is available only when type is `'ECDH'`.
280
+ * if called on a server socket. The supported types are `'DH'` and `'ECDH'`. The `name` property is available only when type is `'ECDH'`.
282
281
  *
283
282
  * For example: `{ type: 'ECDH', name: 'prime256v1', size: 256 }`.
284
283
  * @since v5.0.0
@@ -295,7 +294,7 @@ declare module "tls" {
295
294
  * @since v9.9.0
296
295
  * @return The latest `Finished` message that has been sent to the socket as part of a SSL/TLS handshake, or `undefined` if no `Finished` message has been sent yet.
297
296
  */
298
- getFinished(): Buffer | undefined;
297
+ getFinished(): NonSharedBuffer | undefined;
299
298
  /**
300
299
  * Returns an object representing the peer's certificate. If the peer does not
301
300
  * provide a certificate, an empty object will be returned. If the socket has been
@@ -322,7 +321,7 @@ declare module "tls" {
322
321
  * @return The latest `Finished` message that is expected or has actually been received from the socket as part of a SSL/TLS handshake, or `undefined` if there is no `Finished` message so
323
322
  * far.
324
323
  */
325
- getPeerFinished(): Buffer | undefined;
324
+ getPeerFinished(): NonSharedBuffer | undefined;
326
325
  /**
327
326
  * Returns a string containing the negotiated SSL/TLS protocol version of the
328
327
  * current connection. The value `'unknown'` will be returned for connected
@@ -352,7 +351,7 @@ declare module "tls" {
352
351
  * must use the `'session'` event (it also works for TLSv1.2 and below).
353
352
  * @since v0.11.4
354
353
  */
355
- getSession(): Buffer | undefined;
354
+ getSession(): NonSharedBuffer | undefined;
356
355
  /**
357
356
  * See [SSL\_get\_shared\_sigalgs](https://www.openssl.org/docs/man1.1.1/man3/SSL_get_shared_sigalgs.html) for more information.
358
357
  * @since v12.11.0
@@ -367,7 +366,7 @@ declare module "tls" {
367
366
  * See `Session Resumption` for more information.
368
367
  * @since v0.11.4
369
368
  */
370
- getTLSTicket(): Buffer | undefined;
369
+ getTLSTicket(): NonSharedBuffer | undefined;
371
370
  /**
372
371
  * See `Session Resumption` for more information.
373
372
  * @since v0.5.6
@@ -382,7 +381,7 @@ declare module "tls" {
382
381
  * This method can be used to request a peer's certificate after the secure
383
382
  * connection has been established.
384
383
  *
385
- * When running as the server, the socket will be destroyed with an error after`handshakeTimeout` timeout.
384
+ * When running as the server, the socket will be destroyed with an error after `handshakeTimeout` timeout.
386
385
  *
387
386
  * For TLSv1.3, renegotiation cannot be initiated, it is not supported by the
388
387
  * protocol.
@@ -398,6 +397,14 @@ declare module "tls" {
398
397
  },
399
398
  callback: (err: Error | null) => void,
400
399
  ): undefined | boolean;
400
+ /**
401
+ * The `tlsSocket.setKeyCert()` method sets the private key and certificate to use for the socket.
402
+ * This is mainly useful if you wish to select a server certificate from a TLS server's `ALPNCallback`.
403
+ * @since v22.5.0, v20.17.0
404
+ * @param context An object containing at least `key` and `cert` properties from the {@link createSecureContext()} `options`,
405
+ * or a TLS context object created with {@link createSecureContext()} itself.
406
+ */
407
+ setKeyCert(context: SecureContextOptions | SecureContext): void;
401
408
  /**
402
409
  * The `tlsSocket.setMaxSendFragment()` method sets the maximum TLS fragment size.
403
410
  * Returns `true` if setting the limit succeeded; `false` otherwise.
@@ -470,37 +477,43 @@ declare module "tls" {
470
477
  * @param context Optionally provide a context.
471
478
  * @return requested bytes of the keying material
472
479
  */
473
- exportKeyingMaterial(length: number, label: string, context: Buffer): Buffer;
480
+ exportKeyingMaterial(length: number, label: string, context: Buffer): NonSharedBuffer;
474
481
  addListener(event: string, listener: (...args: any[]) => void): this;
475
- addListener(event: "OCSPResponse", listener: (response: Buffer) => void): this;
482
+ addListener(event: "OCSPResponse", listener: (response: NonSharedBuffer) => void): this;
483
+ addListener(event: "secure", listener: () => void): this;
476
484
  addListener(event: "secureConnect", listener: () => void): this;
477
- addListener(event: "session", listener: (session: Buffer) => void): this;
478
- addListener(event: "keylog", listener: (line: Buffer) => void): this;
485
+ addListener(event: "session", listener: (session: NonSharedBuffer) => void): this;
486
+ addListener(event: "keylog", listener: (line: NonSharedBuffer) => void): this;
479
487
  emit(event: string | symbol, ...args: any[]): boolean;
480
- emit(event: "OCSPResponse", response: Buffer): boolean;
488
+ emit(event: "OCSPResponse", response: NonSharedBuffer): boolean;
489
+ emit(event: "secure"): boolean;
481
490
  emit(event: "secureConnect"): boolean;
482
- emit(event: "session", session: Buffer): boolean;
483
- emit(event: "keylog", line: Buffer): boolean;
491
+ emit(event: "session", session: NonSharedBuffer): boolean;
492
+ emit(event: "keylog", line: NonSharedBuffer): boolean;
484
493
  on(event: string, listener: (...args: any[]) => void): this;
485
- on(event: "OCSPResponse", listener: (response: Buffer) => void): this;
494
+ on(event: "OCSPResponse", listener: (response: NonSharedBuffer) => void): this;
495
+ on(event: "secure", listener: () => void): this;
486
496
  on(event: "secureConnect", listener: () => void): this;
487
- on(event: "session", listener: (session: Buffer) => void): this;
488
- on(event: "keylog", listener: (line: Buffer) => void): this;
497
+ on(event: "session", listener: (session: NonSharedBuffer) => void): this;
498
+ on(event: "keylog", listener: (line: NonSharedBuffer) => void): this;
489
499
  once(event: string, listener: (...args: any[]) => void): this;
490
- once(event: "OCSPResponse", listener: (response: Buffer) => void): this;
500
+ once(event: "OCSPResponse", listener: (response: NonSharedBuffer) => void): this;
501
+ once(event: "secure", listener: () => void): this;
491
502
  once(event: "secureConnect", listener: () => void): this;
492
- once(event: "session", listener: (session: Buffer) => void): this;
493
- once(event: "keylog", listener: (line: Buffer) => void): this;
503
+ once(event: "session", listener: (session: NonSharedBuffer) => void): this;
504
+ once(event: "keylog", listener: (line: NonSharedBuffer) => void): this;
494
505
  prependListener(event: string, listener: (...args: any[]) => void): this;
495
- prependListener(event: "OCSPResponse", listener: (response: Buffer) => void): this;
506
+ prependListener(event: "OCSPResponse", listener: (response: NonSharedBuffer) => void): this;
507
+ prependListener(event: "secure", listener: () => void): this;
496
508
  prependListener(event: "secureConnect", listener: () => void): this;
497
- prependListener(event: "session", listener: (session: Buffer) => void): this;
498
- prependListener(event: "keylog", listener: (line: Buffer) => void): this;
509
+ prependListener(event: "session", listener: (session: NonSharedBuffer) => void): this;
510
+ prependListener(event: "keylog", listener: (line: NonSharedBuffer) => void): this;
499
511
  prependOnceListener(event: string, listener: (...args: any[]) => void): this;
500
- prependOnceListener(event: "OCSPResponse", listener: (response: Buffer) => void): this;
512
+ prependOnceListener(event: "OCSPResponse", listener: (response: NonSharedBuffer) => void): this;
513
+ prependOnceListener(event: "secure", listener: () => void): this;
501
514
  prependOnceListener(event: "secureConnect", listener: () => void): this;
502
- prependOnceListener(event: "session", listener: (session: Buffer) => void): this;
503
- prependOnceListener(event: "keylog", listener: (line: Buffer) => void): this;
515
+ prependOnceListener(event: "session", listener: (session: NonSharedBuffer) => void): this;
516
+ prependOnceListener(event: "keylog", listener: (line: NonSharedBuffer) => void): this;
504
517
  }
505
518
  interface CommonConnectionOptions {
506
519
  /**
@@ -523,7 +536,7 @@ declare module "tls" {
523
536
  * An array of strings or a Buffer naming possible ALPN protocols.
524
537
  * (Protocols should be ordered by their priority.)
525
538
  */
526
- ALPNProtocols?: string[] | Uint8Array[] | Uint8Array | undefined;
539
+ ALPNProtocols?: readonly string[] | NodeJS.ArrayBufferView | undefined;
527
540
  /**
528
541
  * SNICallback(servername, cb) <Function> A function that will be
529
542
  * called if the client supports SNI TLS extension. Two arguments
@@ -541,6 +554,12 @@ declare module "tls" {
541
554
  * @default true
542
555
  */
543
556
  rejectUnauthorized?: boolean | undefined;
557
+ /**
558
+ * If true, specifies that the OCSP status request extension will be
559
+ * added to the client hello and an 'OCSPResponse' event will be
560
+ * emitted on the socket before establishing a secure communication.
561
+ */
562
+ requestOCSP?: boolean | undefined;
544
563
  }
545
564
  interface TlsOptions extends SecureContextOptions, CommonConnectionOptions, net.ServerOpts {
546
565
  /**
@@ -578,7 +597,7 @@ declare module "tls" {
578
597
  * requires explicitly specifying a cipher suite with the `ciphers` option.
579
598
  * More information can be found in the RFC 4279.
580
599
  */
581
- pskCallback?(socket: TLSSocket, identity: string): DataView | NodeJS.TypedArray | null;
600
+ pskCallback?: ((socket: TLSSocket, identity: string) => NodeJS.ArrayBufferView | null) | undefined;
582
601
  /**
583
602
  * hint to send to a client to help
584
603
  * with selecting the identity during TLS-PSK negotiation. Will be ignored
@@ -588,7 +607,7 @@ declare module "tls" {
588
607
  pskIdentityHint?: string | undefined;
589
608
  }
590
609
  interface PSKCallbackNegotation {
591
- psk: DataView | NodeJS.TypedArray;
610
+ psk: NodeJS.ArrayBufferView;
592
611
  identity: string;
593
612
  }
594
613
  interface ConnectionOptions extends SecureContextOptions, CommonConnectionOptions {
@@ -619,7 +638,7 @@ declare module "tls" {
619
638
  * compatible with the selected cipher's digest.
620
639
  * `identity` must use UTF-8 encoding.
621
640
  */
622
- pskCallback?(hint: string | null): PSKCallbackNegotation | null;
641
+ pskCallback?: ((hint: string | null) => PSKCallbackNegotation | null) | undefined;
623
642
  }
624
643
  /**
625
644
  * Accepts encrypted connections using TLS or SSL.
@@ -639,7 +658,7 @@ declare module "tls" {
639
658
  * @param context An object containing any of the possible properties from the {@link createSecureContext} `options` arguments (e.g. `key`, `cert`, `ca`, etc), or a TLS context object created
640
659
  * with {@link createSecureContext} itself.
641
660
  */
642
- addContext(hostname: string, context: SecureContextOptions): void;
661
+ addContext(hostname: string, context: SecureContextOptions | SecureContext): void;
643
662
  /**
644
663
  * Returns the session ticket keys.
645
664
  *
@@ -647,7 +666,7 @@ declare module "tls" {
647
666
  * @since v3.0.0
648
667
  * @return A 48-byte buffer containing the session ticket keys.
649
668
  */
650
- getTicketKeys(): Buffer;
669
+ getTicketKeys(): NonSharedBuffer;
651
670
  /**
652
671
  * The `server.setSecureContext()` method replaces the secure context of an
653
672
  * existing server. Existing connections to the server are not interrupted.
@@ -679,122 +698,138 @@ declare module "tls" {
679
698
  addListener(event: "tlsClientError", listener: (err: Error, tlsSocket: TLSSocket) => void): this;
680
699
  addListener(
681
700
  event: "newSession",
682
- listener: (sessionId: Buffer, sessionData: Buffer, callback: () => void) => void,
701
+ listener: (sessionId: NonSharedBuffer, sessionData: NonSharedBuffer, callback: () => void) => void,
683
702
  ): this;
684
703
  addListener(
685
704
  event: "OCSPRequest",
686
705
  listener: (
687
- certificate: Buffer,
688
- issuer: Buffer,
689
- callback: (err: Error | null, resp: Buffer) => void,
706
+ certificate: NonSharedBuffer,
707
+ issuer: NonSharedBuffer,
708
+ callback: (err: Error | null, resp: Buffer | null) => void,
690
709
  ) => void,
691
710
  ): this;
692
711
  addListener(
693
712
  event: "resumeSession",
694
- listener: (sessionId: Buffer, callback: (err: Error | null, sessionData: Buffer | null) => void) => void,
713
+ listener: (
714
+ sessionId: NonSharedBuffer,
715
+ callback: (err: Error | null, sessionData: Buffer | null) => void,
716
+ ) => void,
695
717
  ): this;
696
718
  addListener(event: "secureConnection", listener: (tlsSocket: TLSSocket) => void): this;
697
- addListener(event: "keylog", listener: (line: Buffer, tlsSocket: TLSSocket) => void): this;
719
+ addListener(event: "keylog", listener: (line: NonSharedBuffer, tlsSocket: TLSSocket) => void): this;
698
720
  emit(event: string | symbol, ...args: any[]): boolean;
699
721
  emit(event: "tlsClientError", err: Error, tlsSocket: TLSSocket): boolean;
700
- emit(event: "newSession", sessionId: Buffer, sessionData: Buffer, callback: () => void): boolean;
722
+ emit(
723
+ event: "newSession",
724
+ sessionId: NonSharedBuffer,
725
+ sessionData: NonSharedBuffer,
726
+ callback: () => void,
727
+ ): boolean;
701
728
  emit(
702
729
  event: "OCSPRequest",
703
- certificate: Buffer,
704
- issuer: Buffer,
705
- callback: (err: Error | null, resp: Buffer) => void,
730
+ certificate: NonSharedBuffer,
731
+ issuer: NonSharedBuffer,
732
+ callback: (err: Error | null, resp: Buffer | null) => void,
706
733
  ): boolean;
707
734
  emit(
708
735
  event: "resumeSession",
709
- sessionId: Buffer,
736
+ sessionId: NonSharedBuffer,
710
737
  callback: (err: Error | null, sessionData: Buffer | null) => void,
711
738
  ): boolean;
712
739
  emit(event: "secureConnection", tlsSocket: TLSSocket): boolean;
713
- emit(event: "keylog", line: Buffer, tlsSocket: TLSSocket): boolean;
740
+ emit(event: "keylog", line: NonSharedBuffer, tlsSocket: TLSSocket): boolean;
714
741
  on(event: string, listener: (...args: any[]) => void): this;
715
742
  on(event: "tlsClientError", listener: (err: Error, tlsSocket: TLSSocket) => void): this;
716
- on(event: "newSession", listener: (sessionId: Buffer, sessionData: Buffer, callback: () => void) => void): this;
743
+ on(
744
+ event: "newSession",
745
+ listener: (sessionId: NonSharedBuffer, sessionData: NonSharedBuffer, callback: () => void) => void,
746
+ ): this;
717
747
  on(
718
748
  event: "OCSPRequest",
719
749
  listener: (
720
- certificate: Buffer,
721
- issuer: Buffer,
722
- callback: (err: Error | null, resp: Buffer) => void,
750
+ certificate: NonSharedBuffer,
751
+ issuer: NonSharedBuffer,
752
+ callback: (err: Error | null, resp: Buffer | null) => void,
723
753
  ) => void,
724
754
  ): this;
725
755
  on(
726
756
  event: "resumeSession",
727
- listener: (sessionId: Buffer, callback: (err: Error | null, sessionData: Buffer | null) => void) => void,
757
+ listener: (
758
+ sessionId: NonSharedBuffer,
759
+ callback: (err: Error | null, sessionData: Buffer | null) => void,
760
+ ) => void,
728
761
  ): this;
729
762
  on(event: "secureConnection", listener: (tlsSocket: TLSSocket) => void): this;
730
- on(event: "keylog", listener: (line: Buffer, tlsSocket: TLSSocket) => void): this;
763
+ on(event: "keylog", listener: (line: NonSharedBuffer, tlsSocket: TLSSocket) => void): this;
731
764
  once(event: string, listener: (...args: any[]) => void): this;
732
765
  once(event: "tlsClientError", listener: (err: Error, tlsSocket: TLSSocket) => void): this;
733
766
  once(
734
767
  event: "newSession",
735
- listener: (sessionId: Buffer, sessionData: Buffer, callback: () => void) => void,
768
+ listener: (sessionId: NonSharedBuffer, sessionData: NonSharedBuffer, callback: () => void) => void,
736
769
  ): this;
737
770
  once(
738
771
  event: "OCSPRequest",
739
772
  listener: (
740
- certificate: Buffer,
741
- issuer: Buffer,
742
- callback: (err: Error | null, resp: Buffer) => void,
773
+ certificate: NonSharedBuffer,
774
+ issuer: NonSharedBuffer,
775
+ callback: (err: Error | null, resp: Buffer | null) => void,
743
776
  ) => void,
744
777
  ): this;
745
778
  once(
746
779
  event: "resumeSession",
747
- listener: (sessionId: Buffer, callback: (err: Error | null, sessionData: Buffer | null) => void) => void,
780
+ listener: (
781
+ sessionId: NonSharedBuffer,
782
+ callback: (err: Error | null, sessionData: Buffer | null) => void,
783
+ ) => void,
748
784
  ): this;
749
785
  once(event: "secureConnection", listener: (tlsSocket: TLSSocket) => void): this;
750
- once(event: "keylog", listener: (line: Buffer, tlsSocket: TLSSocket) => void): this;
786
+ once(event: "keylog", listener: (line: NonSharedBuffer, tlsSocket: TLSSocket) => void): this;
751
787
  prependListener(event: string, listener: (...args: any[]) => void): this;
752
788
  prependListener(event: "tlsClientError", listener: (err: Error, tlsSocket: TLSSocket) => void): this;
753
789
  prependListener(
754
790
  event: "newSession",
755
- listener: (sessionId: Buffer, sessionData: Buffer, callback: () => void) => void,
791
+ listener: (sessionId: NonSharedBuffer, sessionData: NonSharedBuffer, callback: () => void) => void,
756
792
  ): this;
757
793
  prependListener(
758
794
  event: "OCSPRequest",
759
795
  listener: (
760
- certificate: Buffer,
761
- issuer: Buffer,
762
- callback: (err: Error | null, resp: Buffer) => void,
796
+ certificate: NonSharedBuffer,
797
+ issuer: NonSharedBuffer,
798
+ callback: (err: Error | null, resp: Buffer | null) => void,
763
799
  ) => void,
764
800
  ): this;
765
801
  prependListener(
766
802
  event: "resumeSession",
767
- listener: (sessionId: Buffer, callback: (err: Error | null, sessionData: Buffer | null) => void) => void,
803
+ listener: (
804
+ sessionId: NonSharedBuffer,
805
+ callback: (err: Error | null, sessionData: Buffer | null) => void,
806
+ ) => void,
768
807
  ): this;
769
808
  prependListener(event: "secureConnection", listener: (tlsSocket: TLSSocket) => void): this;
770
- prependListener(event: "keylog", listener: (line: Buffer, tlsSocket: TLSSocket) => void): this;
809
+ prependListener(event: "keylog", listener: (line: NonSharedBuffer, tlsSocket: TLSSocket) => void): this;
771
810
  prependOnceListener(event: string, listener: (...args: any[]) => void): this;
772
811
  prependOnceListener(event: "tlsClientError", listener: (err: Error, tlsSocket: TLSSocket) => void): this;
773
812
  prependOnceListener(
774
813
  event: "newSession",
775
- listener: (sessionId: Buffer, sessionData: Buffer, callback: () => void) => void,
814
+ listener: (sessionId: NonSharedBuffer, sessionData: NonSharedBuffer, callback: () => void) => void,
776
815
  ): this;
777
816
  prependOnceListener(
778
817
  event: "OCSPRequest",
779
818
  listener: (
780
- certificate: Buffer,
781
- issuer: Buffer,
782
- callback: (err: Error | null, resp: Buffer) => void,
819
+ certificate: NonSharedBuffer,
820
+ issuer: NonSharedBuffer,
821
+ callback: (err: Error | null, resp: Buffer | null) => void,
783
822
  ) => void,
784
823
  ): this;
785
824
  prependOnceListener(
786
825
  event: "resumeSession",
787
- listener: (sessionId: Buffer, callback: (err: Error | null, sessionData: Buffer | null) => void) => void,
826
+ listener: (
827
+ sessionId: NonSharedBuffer,
828
+ callback: (err: Error | null, sessionData: Buffer | null) => void,
829
+ ) => void,
788
830
  ): this;
789
831
  prependOnceListener(event: "secureConnection", listener: (tlsSocket: TLSSocket) => void): this;
790
- prependOnceListener(event: "keylog", listener: (line: Buffer, tlsSocket: TLSSocket) => void): this;
791
- }
792
- /**
793
- * @deprecated since v0.11.3 Use `tls.TLSSocket` instead.
794
- */
795
- interface SecurePair {
796
- encrypted: TLSSocket;
797
- cleartext: TLSSocket;
832
+ prependOnceListener(event: "keylog", listener: (line: NonSharedBuffer, tlsSocket: TLSSocket) => void): this;
798
833
  }
799
834
  type SecureVersion = "TLSv1.3" | "TLSv1.2" | "TLSv1.1" | "TLSv1";
800
835
  interface SecureContextOptions {
@@ -809,6 +844,12 @@ declare module "tls" {
809
844
  * This option cannot be used with the `ALPNProtocols` option, and setting both options will throw an error.
810
845
  */
811
846
  ALPNCallback?: ((arg: { servername: string; protocols: string[] }) => string | undefined) | undefined;
847
+ /**
848
+ * Treat intermediate (non-self-signed)
849
+ * certificates in the trust CA certificate list as trusted.
850
+ * @since v22.9.0, v20.18.0
851
+ */
852
+ allowPartialTrustChain?: boolean | undefined;
812
853
  /**
813
854
  * Optionally override the trusted CA certificates. Default is to trust
814
855
  * the well-known CAs curated by Mozilla. Mozilla's CAs are completely
@@ -843,6 +884,7 @@ declare module "tls" {
843
884
  ciphers?: string | undefined;
844
885
  /**
845
886
  * Name of an OpenSSL engine which can provide the client certificate.
887
+ * @deprecated
846
888
  */
847
889
  clientCertEngine?: string | undefined;
848
890
  /**
@@ -885,12 +927,14 @@ declare module "tls" {
885
927
  /**
886
928
  * Name of an OpenSSL engine to get private key from. Should be used
887
929
  * together with privateKeyIdentifier.
930
+ * @deprecated
888
931
  */
889
932
  privateKeyEngine?: string | undefined;
890
933
  /**
891
934
  * Identifier of a private key managed by an OpenSSL engine. Should be
892
935
  * used together with privateKeyEngine. Should not be set together with
893
936
  * key, because both options define a private key in different ways.
937
+ * @deprecated
894
938
  */
895
939
  privateKeyIdentifier?: string | undefined;
896
940
  /**
@@ -975,7 +1019,7 @@ declare module "tls" {
975
1019
  * This function is intended to be used in combination with the`checkServerIdentity` option that can be passed to {@link connect} and as
976
1020
  * such operates on a `certificate object`. For other purposes, consider using `x509.checkHost()` instead.
977
1021
  *
978
- * This function can be overwritten by providing an alternative function as the`options.checkServerIdentity` option that is passed to `tls.connect()`. The
1022
+ * This function can be overwritten by providing an alternative function as the `options.checkServerIdentity` option that is passed to `tls.connect()`. The
979
1023
  * overwriting function can call `tls.checkServerIdentity()` of course, to augment
980
1024
  * the checks done with additional verification.
981
1025
  *
@@ -984,7 +1028,7 @@ declare module "tls" {
984
1028
  *
985
1029
  * Earlier versions of Node.js incorrectly accepted certificates for a given`hostname` if a matching `uniformResourceIdentifier` subject alternative name
986
1030
  * was present (see [CVE-2021-44531](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-44531)). Applications that wish to accept`uniformResourceIdentifier` subject alternative names can use
987
- * a custom`options.checkServerIdentity` function that implements the desired behavior.
1031
+ * a custom `options.checkServerIdentity` function that implements the desired behavior.
988
1032
  * @since v0.8.4
989
1033
  * @param hostname The host name or IP address to verify the certificate against.
990
1034
  * @param cert A `certificate object` representing the peer's certificate.
@@ -1000,8 +1044,8 @@ declare module "tls" {
1000
1044
  * The following illustrates a simple echo server:
1001
1045
  *
1002
1046
  * ```js
1003
- * const tls = require('node:tls');
1004
- * const fs = require('node:fs');
1047
+ * import tls from 'node:tls';
1048
+ * import fs from 'node:fs';
1005
1049
  *
1006
1050
  * const options = {
1007
1051
  * key: fs.readFileSync('server-key.pem'),
@@ -1046,8 +1090,8 @@ declare module "tls" {
1046
1090
  *
1047
1091
  * ```js
1048
1092
  * // Assumes an echo server that is listening on port 8000.
1049
- * const tls = require('node:tls');
1050
- * const fs = require('node:fs');
1093
+ * import tls from 'node:tls';
1094
+ * import fs from 'node:fs';
1051
1095
  *
1052
1096
  * const options = {
1053
1097
  * // Necessary only if the server requires client certificate authentication.
@@ -1086,49 +1130,10 @@ declare module "tls" {
1086
1130
  ): TLSSocket;
1087
1131
  function connect(port: number, options?: ConnectionOptions, secureConnectListener?: () => void): TLSSocket;
1088
1132
  /**
1089
- * Creates a new secure pair object with two streams, one of which reads and writes
1090
- * the encrypted data and the other of which reads and writes the cleartext data.
1091
- * Generally, the encrypted stream is piped to/from an incoming encrypted data
1092
- * stream and the cleartext one is used as a replacement for the initial encrypted
1093
- * stream.
1094
- *
1095
- * `tls.createSecurePair()` returns a `tls.SecurePair` object with `cleartext` and`encrypted` stream properties.
1096
- *
1097
- * Using `cleartext` has the same API as {@link TLSSocket}.
1098
- *
1099
- * The `tls.createSecurePair()` method is now deprecated in favor of`tls.TLSSocket()`. For example, the code:
1100
- *
1101
- * ```js
1102
- * pair = tls.createSecurePair(// ... );
1103
- * pair.encrypted.pipe(socket);
1104
- * socket.pipe(pair.encrypted);
1105
- * ```
1106
- *
1107
- * can be replaced by:
1108
- *
1109
- * ```js
1110
- * secureSocket = tls.TLSSocket(socket, options);
1111
- * ```
1112
- *
1113
- * where `secureSocket` has the same API as `pair.cleartext`.
1114
- * @since v0.3.2
1115
- * @deprecated Since v0.11.3 - Use {@link TLSSocket} instead.
1116
- * @param context A secure context object as returned by `tls.createSecureContext()`
1117
- * @param isServer `true` to specify that this TLS connection should be opened as a server.
1118
- * @param requestCert `true` to specify whether a server should request a certificate from a connecting client. Only applies when `isServer` is `true`.
1119
- * @param rejectUnauthorized If not `false` a server automatically reject clients with invalid certificates. Only applies when `isServer` is `true`.
1120
- */
1121
- function createSecurePair(
1122
- context?: SecureContext,
1123
- isServer?: boolean,
1124
- requestCert?: boolean,
1125
- rejectUnauthorized?: boolean,
1126
- ): SecurePair;
1127
- /**
1128
- * {@link createServer} sets the default value of the `honorCipherOrder` option
1133
+ * `{@link createServer}` sets the default value of the `honorCipherOrder` option
1129
1134
  * to `true`, other APIs that create secure contexts leave it unset.
1130
1135
  *
1131
- * {@link createServer} uses a 128 bit truncated SHA1 hash value generated
1136
+ * `{@link createServer}` uses a 128 bit truncated SHA1 hash value generated
1132
1137
  * from `process.argv` as the default value of the `sessionIdContext` option, other
1133
1138
  * APIs that create secure contexts have no default value.
1134
1139
  *
@@ -1136,12 +1141,12 @@ declare module "tls" {
1136
1141
  * usable as an argument to several `tls` APIs, such as `server.addContext()`,
1137
1142
  * but has no public methods. The {@link Server} constructor and the {@link createServer} method do not support the `secureContext` option.
1138
1143
  *
1139
- * A key is _required_ for ciphers that use certificates. Either `key` or`pfx` can be used to provide it.
1144
+ * A key is _required_ for ciphers that use certificates. Either `key` or `pfx` can be used to provide it.
1140
1145
  *
1141
1146
  * If the `ca` option is not given, then Node.js will default to using [Mozilla's publicly trusted list of
1142
1147
  * CAs](https://hg.mozilla.org/mozilla-central/raw-file/tip/security/nss/lib/ckfw/builtins/certdata.txt).
1143
1148
  *
1144
- * Custom DHE parameters are discouraged in favor of the new `dhparam: 'auto'`option. When set to `'auto'`, well-known DHE parameters of sufficient strength
1149
+ * Custom DHE parameters are discouraged in favor of the new `dhparam: 'auto' `option. When set to `'auto'`, well-known DHE parameters of sufficient strength
1145
1150
  * will be selected automatically. Otherwise, if necessary, `openssl dhparam` can
1146
1151
  * be used to create custom parameters. The key length must be greater than or
1147
1152
  * equal to 1024 bits or else an error will be thrown. Although 1024 bits is
@@ -1149,12 +1154,38 @@ declare module "tls" {
1149
1154
  * @since v0.11.13
1150
1155
  */
1151
1156
  function createSecureContext(options?: SecureContextOptions): SecureContext;
1157
+ /**
1158
+ * Returns an array containing the CA certificates from various sources, depending on `type`:
1159
+ *
1160
+ * * `"default"`: return the CA certificates that will be used by the Node.js TLS clients by default.
1161
+ * * When `--use-bundled-ca` is enabled (default), or `--use-openssl-ca` is not enabled,
1162
+ * this would include CA certificates from the bundled Mozilla CA store.
1163
+ * * When `--use-system-ca` is enabled, this would also include certificates from the system's
1164
+ * trusted store.
1165
+ * * When `NODE_EXTRA_CA_CERTS` is used, this would also include certificates loaded from the specified
1166
+ * file.
1167
+ * * `"system"`: return the CA certificates that are loaded from the system's trusted store, according
1168
+ * to rules set by `--use-system-ca`. This can be used to get the certificates from the system
1169
+ * when `--use-system-ca` is not enabled.
1170
+ * * `"bundled"`: return the CA certificates from the bundled Mozilla CA store. This would be the same
1171
+ * as `tls.rootCertificates`.
1172
+ * * `"extra"`: return the CA certificates loaded from `NODE_EXTRA_CA_CERTS`. It's an empty array if
1173
+ * `NODE_EXTRA_CA_CERTS` is not set.
1174
+ * @since v22.15.0
1175
+ * @param type The type of CA certificates that will be returned. Valid values
1176
+ * are `"default"`, `"system"`, `"bundled"` and `"extra"`.
1177
+ * **Default:** `"default"`.
1178
+ * @returns An array of PEM-encoded certificates. The array may contain duplicates
1179
+ * if the same certificate is repeatedly stored in multiple sources.
1180
+ */
1181
+ function getCACertificates(type?: "default" | "system" | "bundled" | "extra"): string[];
1152
1182
  /**
1153
1183
  * Returns an array with the names of the supported TLS ciphers. The names are
1154
1184
  * lower-case for historical reasons, but must be uppercased to be used in
1155
- * the `ciphers` option of {@link createSecureContext}.
1185
+ * the `ciphers` option of `{@link createSecureContext}`.
1156
1186
  *
1157
- * Not all supported ciphers are enabled by default. See `Modifying the default TLS cipher suite`.
1187
+ * Not all supported ciphers are enabled by default. See
1188
+ * [Modifying the default TLS cipher suite](https://nodejs.org/docs/latest-v24.x/api/tls.html#modifying-the-default-tls-cipher-suite).
1158
1189
  *
1159
1190
  * Cipher names that start with `'tls_'` are for TLSv1.3, all the others are for
1160
1191
  * TLSv1.2 and below.
@@ -1165,43 +1196,81 @@ declare module "tls" {
1165
1196
  * @since v0.10.2
1166
1197
  */
1167
1198
  function getCiphers(): string[];
1199
+ /**
1200
+ * Sets the default CA certificates used by Node.js TLS clients. If the provided
1201
+ * certificates are parsed successfully, they will become the default CA
1202
+ * certificate list returned by {@link getCACertificates} and used
1203
+ * by subsequent TLS connections that don't specify their own CA certificates.
1204
+ * The certificates will be deduplicated before being set as the default.
1205
+ *
1206
+ * This function only affects the current Node.js thread. Previous
1207
+ * sessions cached by the HTTPS agent won't be affected by this change, so
1208
+ * this method should be called before any unwanted cachable TLS connections are
1209
+ * made.
1210
+ *
1211
+ * To use system CA certificates as the default:
1212
+ *
1213
+ * ```js
1214
+ * import tls from 'node:tls';
1215
+ * tls.setDefaultCACertificates(tls.getCACertificates('system'));
1216
+ * ```
1217
+ *
1218
+ * This function completely replaces the default CA certificate list. To add additional
1219
+ * certificates to the existing defaults, get the current certificates and append to them:
1220
+ *
1221
+ * ```js
1222
+ * import tls from 'node:tls';
1223
+ * const currentCerts = tls.getCACertificates('default');
1224
+ * const additionalCerts = ['-----BEGIN CERTIFICATE-----\n...'];
1225
+ * tls.setDefaultCACertificates([...currentCerts, ...additionalCerts]);
1226
+ * ```
1227
+ * @since v24.5.0
1228
+ * @param certs An array of CA certificates in PEM format.
1229
+ */
1230
+ function setDefaultCACertificates(certs: ReadonlyArray<string | NodeJS.ArrayBufferView>): void;
1168
1231
  /**
1169
1232
  * The default curve name to use for ECDH key agreement in a tls server.
1170
- * The default value is 'auto'. See tls.createSecureContext() for further
1233
+ * The default value is `'auto'`. See `{@link createSecureContext()}` for further
1171
1234
  * information.
1235
+ * @since v0.11.13
1172
1236
  */
1173
1237
  let DEFAULT_ECDH_CURVE: string;
1174
1238
  /**
1175
- * The default value of the maxVersion option of
1176
- * tls.createSecureContext(). It can be assigned any of the supported TLS
1177
- * protocol versions, 'TLSv1.3', 'TLSv1.2', 'TLSv1.1', or 'TLSv1'. Default:
1178
- * 'TLSv1.3', unless changed using CLI options. Using --tls-max-v1.2 sets
1179
- * the default to 'TLSv1.2'. Using --tls-max-v1.3 sets the default to
1180
- * 'TLSv1.3'. If multiple of the options are provided, the highest maximum
1181
- * is used.
1239
+ * The default value of the `maxVersion` option of `{@link createSecureContext()}`.
1240
+ * It can be assigned any of the supported TLS protocol versions,
1241
+ * `'TLSv1.3'`, `'TLSv1.2'`, `'TLSv1.1'`, or `'TLSv1'`. **Default:** `'TLSv1.3'`, unless
1242
+ * changed using CLI options. Using `--tls-max-v1.2` sets the default to `'TLSv1.2'`. Using
1243
+ * `--tls-max-v1.3` sets the default to `'TLSv1.3'`. If multiple of the options
1244
+ * are provided, the highest maximum is used.
1245
+ * @since v11.4.0
1182
1246
  */
1183
1247
  let DEFAULT_MAX_VERSION: SecureVersion;
1184
1248
  /**
1185
- * The default value of the minVersion option of tls.createSecureContext().
1249
+ * The default value of the `minVersion` option of `{@link createSecureContext()}`.
1186
1250
  * It can be assigned any of the supported TLS protocol versions,
1187
- * 'TLSv1.3', 'TLSv1.2', 'TLSv1.1', or 'TLSv1'. Default: 'TLSv1.2', unless
1188
- * changed using CLI options. Using --tls-min-v1.0 sets the default to
1189
- * 'TLSv1'. Using --tls-min-v1.1 sets the default to 'TLSv1.1'. Using
1190
- * --tls-min-v1.3 sets the default to 'TLSv1.3'. If multiple of the options
1251
+ * `'TLSv1.3'`, `'TLSv1.2'`, `'TLSv1.1'`, or `'TLSv1'`. **Default:** `'TLSv1.2'`, unless
1252
+ * changed using CLI options. Using `--tls-min-v1.0` sets the default to
1253
+ * `'TLSv1'`. Using `--tls-min-v1.1` sets the default to `'TLSv1.1'`. Using
1254
+ * `--tls-min-v1.3` sets the default to `'TLSv1.3'`. If multiple of the options
1191
1255
  * are provided, the lowest minimum is used.
1256
+ * @since v11.4.0
1192
1257
  */
1193
1258
  let DEFAULT_MIN_VERSION: SecureVersion;
1194
1259
  /**
1195
- * The default value of the ciphers option of tls.createSecureContext().
1260
+ * The default value of the `ciphers` option of `{@link createSecureContext()}`.
1196
1261
  * It can be assigned any of the supported OpenSSL ciphers.
1197
- * Defaults to the content of crypto.constants.defaultCoreCipherList, unless
1198
- * changed using CLI options using --tls-default-ciphers.
1262
+ * Defaults to the content of `crypto.constants.defaultCoreCipherList`, unless
1263
+ * changed using CLI options using `--tls-default-ciphers`.
1264
+ * @since v19.8.0
1199
1265
  */
1200
1266
  let DEFAULT_CIPHERS: string;
1201
1267
  /**
1202
- * An immutable array of strings representing the root certificates (in PEM
1203
- * format) used for verifying peer certificates. This is the default value
1204
- * of the ca option to tls.createSecureContext().
1268
+ * An immutable array of strings representing the root certificates (in PEM format)
1269
+ * from the bundled Mozilla CA store as supplied by the current Node.js version.
1270
+ *
1271
+ * The bundled CA store, as supplied by Node.js, is a snapshot of Mozilla CA store
1272
+ * that is fixed at release time. It is identical on all supported platforms.
1273
+ * @since v12.3.0
1205
1274
  */
1206
1275
  const rootCertificates: readonly string[];
1207
1276
  }