@openclaw/slack 2026.10.5-beta.1 → 2026.10.5-beta.2

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 (108) hide show
  1. package/node_modules/@slack/bolt/node_modules/@slack/socket-mode/dist/package.json +4 -4
  2. package/node_modules/@slack/bolt/node_modules/@slack/socket-mode/dist/src/SlackWebSocket.d.ts.map +1 -1
  3. package/node_modules/@slack/bolt/node_modules/@slack/socket-mode/dist/src/SlackWebSocket.js +9 -17
  4. package/node_modules/@slack/bolt/node_modules/@slack/socket-mode/dist/src/SlackWebSocket.js.map +1 -1
  5. package/node_modules/@slack/bolt/node_modules/@slack/socket-mode/package.json +4 -4
  6. package/node_modules/@slack/bolt/node_modules/@types/node/README.md +2 -2
  7. package/node_modules/@slack/bolt/node_modules/@types/node/crypto.d.ts +2 -2
  8. package/node_modules/@slack/bolt/node_modules/@types/node/dgram.d.ts +1 -1
  9. package/node_modules/@slack/bolt/node_modules/@types/node/package.json +2 -17
  10. package/node_modules/@slack/bolt/node_modules/@types/node/zlib.d.ts +6 -0
  11. package/node_modules/@slack/web-api/node_modules/@types/node/README.md +1 -1
  12. package/node_modules/@slack/web-api/node_modules/@types/node/crypto.d.ts +2 -2
  13. package/node_modules/@slack/web-api/node_modules/@types/node/dgram.d.ts +1 -1
  14. package/node_modules/@slack/web-api/node_modules/@types/node/package.json +2 -2
  15. package/node_modules/@slack/web-api/node_modules/@types/node/zlib.d.ts +6 -0
  16. package/package.json +4 -4
  17. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/LICENSE +0 -21
  18. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/README.md +0 -15
  19. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/assert/strict.d.ts +0 -68
  20. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/assert.d.ts +0 -1077
  21. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/async_hooks.d.ts +0 -711
  22. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/buffer.buffer.d.ts +0 -471
  23. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/buffer.d.ts +0 -1800
  24. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/child_process.d.ts +0 -1361
  25. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/cluster.d.ts +0 -432
  26. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/console.d.ts +0 -93
  27. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/constants.d.ts +0 -14
  28. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/crypto.d.ts +0 -3964
  29. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/dgram.d.ts +0 -652
  30. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/diagnostics_channel.d.ts +0 -794
  31. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/dns/promises.d.ts +0 -497
  32. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/dns.d.ts +0 -876
  33. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/domain.d.ts +0 -150
  34. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/events.d.ts +0 -1008
  35. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/ffi.d.ts +0 -500
  36. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/fs/promises.d.ts +0 -1477
  37. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/fs.d.ts +0 -4803
  38. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/globals.d.ts +0 -150
  39. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/globals.typedarray.d.ts +0 -101
  40. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/http.d.ts +0 -2218
  41. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/http2.d.ts +0 -2498
  42. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/https.d.ts +0 -400
  43. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/index.d.ts +0 -116
  44. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/inspector/promises.d.ts +0 -35
  45. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/inspector.d.ts +0 -265
  46. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/inspector.generated.d.ts +0 -4406
  47. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/module.d.ts +0 -726
  48. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/net.d.ts +0 -1074
  49. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/os.d.ts +0 -498
  50. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/package.json +0 -155
  51. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/path/posix.d.ts +0 -8
  52. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/path/win32.d.ts +0 -8
  53. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/path.d.ts +0 -178
  54. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/perf_hooks.d.ts +0 -617
  55. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/process.d.ts +0 -2269
  56. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/punycode.d.ts +0 -89
  57. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/querystring.d.ts +0 -139
  58. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/quic.d.ts +0 -2191
  59. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/readline/promises.d.ts +0 -158
  60. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/readline.d.ts +0 -508
  61. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/repl.d.ts +0 -420
  62. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/sea.d.ts +0 -47
  63. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/sqlite.d.ts +0 -1140
  64. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/stream/consumers.d.ts +0 -114
  65. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/stream/iter.d.ts +0 -449
  66. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/stream/promises.d.ts +0 -211
  67. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/stream/web.d.ts +0 -320
  68. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/stream.d.ts +0 -1806
  69. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/string_decoder.d.ts +0 -27
  70. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/test/reporters.d.ts +0 -60
  71. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/test.d.ts +0 -2558
  72. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/timers/promises.d.ts +0 -93
  73. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/timers.d.ts +0 -149
  74. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/tls.d.ts +0 -1232
  75. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/trace_events.d.ts +0 -103
  76. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/ts5.6/buffer.buffer.d.ts +0 -467
  77. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/ts5.6/compatibility/float16array.d.ts +0 -71
  78. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/ts5.6/globals.typedarray.d.ts +0 -36
  79. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/ts5.6/index.d.ts +0 -118
  80. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/ts5.7/compatibility/float16array.d.ts +0 -72
  81. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/ts5.7/index.d.ts +0 -118
  82. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/tty.d.ts +0 -226
  83. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/url.d.ts +0 -556
  84. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/util/types.d.ts +0 -558
  85. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/util.d.ts +0 -1677
  86. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/v8.d.ts +0 -1059
  87. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/vfs.d.ts +0 -211
  88. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/vm.d.ts +0 -1137
  89. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/wasi.d.ts +0 -131
  90. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/web-globals/abortcontroller.d.ts +0 -59
  91. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/web-globals/blob.d.ts +0 -23
  92. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/web-globals/console.d.ts +0 -9
  93. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/web-globals/crypto.d.ts +0 -39
  94. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/web-globals/domexception.d.ts +0 -83
  95. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/web-globals/encoding.d.ts +0 -11
  96. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/web-globals/events.d.ts +0 -106
  97. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/web-globals/fetch.d.ts +0 -69
  98. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/web-globals/importmeta.d.ts +0 -13
  99. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/web-globals/messaging.d.ts +0 -23
  100. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/web-globals/navigator.d.ts +0 -25
  101. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/web-globals/performance.d.ts +0 -45
  102. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/web-globals/storage.d.ts +0 -24
  103. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/web-globals/streams.d.ts +0 -119
  104. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/web-globals/timers.d.ts +0 -44
  105. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/web-globals/url.d.ts +0 -24
  106. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/worker_threads.d.ts +0 -672
  107. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/zlib/iter.d.ts +0 -131
  108. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/zlib.d.ts +0 -606
@@ -1,1232 +0,0 @@
1
- declare module "node:tls" {
2
- import { NonSharedBuffer } from "node:buffer";
3
- import { X509Certificate } from "node:crypto";
4
- import * as net from "node:net";
5
- import * as stream from "stream";
6
- const CLIENT_RENEG_LIMIT: number;
7
- const CLIENT_RENEG_WINDOW: number;
8
- interface Certificate extends NodeJS.Dict<string | string[]> {
9
- /**
10
- * Country code.
11
- */
12
- C?: string | string[];
13
- /**
14
- * Street.
15
- */
16
- ST?: string | string[];
17
- /**
18
- * Locality.
19
- */
20
- L?: string | string[];
21
- /**
22
- * Organization.
23
- */
24
- O?: string | string[];
25
- /**
26
- * Organizational unit.
27
- */
28
- OU?: string | string[];
29
- /**
30
- * Common name.
31
- */
32
- CN?: string | string[];
33
- }
34
- interface PeerCertificate {
35
- /**
36
- * `true` if a Certificate Authority (CA), `false` otherwise.
37
- * @since v18.13.0
38
- */
39
- ca: boolean;
40
- /**
41
- * The DER encoded X.509 certificate data.
42
- */
43
- raw: NonSharedBuffer;
44
- /**
45
- * The certificate subject.
46
- */
47
- subject: Certificate;
48
- /**
49
- * The certificate issuer, described in the same terms as the `subject`.
50
- */
51
- issuer: Certificate;
52
- /**
53
- * The date-time the certificate is valid from.
54
- */
55
- valid_from: string;
56
- /**
57
- * The date-time the certificate is valid to.
58
- */
59
- valid_to: string;
60
- /**
61
- * The certificate serial number, as a hex string.
62
- */
63
- serialNumber: string;
64
- /**
65
- * The SHA-1 digest of the DER encoded certificate.
66
- * It is returned as a `:` separated hexadecimal string.
67
- */
68
- fingerprint: string;
69
- /**
70
- * The SHA-256 digest of the DER encoded certificate.
71
- * It is returned as a `:` separated hexadecimal string.
72
- */
73
- fingerprint256: string;
74
- /**
75
- * The SHA-512 digest of the DER encoded certificate.
76
- * It is returned as a `:` separated hexadecimal string.
77
- */
78
- fingerprint512: string;
79
- /**
80
- * The extended key usage, a set of OIDs.
81
- */
82
- ext_key_usage?: string[];
83
- /**
84
- * A string containing concatenated names for the subject,
85
- * an alternative to the `subject` names.
86
- */
87
- subjectaltname?: string;
88
- /**
89
- * An array describing the AuthorityInfoAccess, used with OCSP.
90
- */
91
- infoAccess?: NodeJS.Dict<string[]>;
92
- /**
93
- * For RSA keys: The RSA bit size.
94
- *
95
- * For EC keys: The key size in bits.
96
- */
97
- bits?: number;
98
- /**
99
- * The RSA exponent, as a string in hexadecimal number notation.
100
- */
101
- exponent?: string;
102
- /**
103
- * The RSA modulus, as a hexadecimal string.
104
- */
105
- modulus?: string;
106
- /**
107
- * The public key.
108
- */
109
- pubkey?: NonSharedBuffer;
110
- /**
111
- * The ASN.1 name of the OID of the elliptic curve.
112
- * Well-known curves are identified by an OID.
113
- * While it is unusual, it is possible that the curve
114
- * is identified by its mathematical properties,
115
- * in which case it will not have an OID.
116
- */
117
- asn1Curve?: string;
118
- /**
119
- * The NIST name for the elliptic curve, if it has one
120
- * (not all well-known curves have been assigned names by NIST).
121
- */
122
- nistCurve?: string;
123
- }
124
- interface DetailedPeerCertificate extends PeerCertificate {
125
- /**
126
- * The issuer certificate object.
127
- * For self-signed certificates, this may be a circular reference.
128
- */
129
- issuerCertificate: DetailedPeerCertificate;
130
- }
131
- interface CipherNameAndProtocol {
132
- /**
133
- * The cipher name.
134
- */
135
- name: string;
136
- /**
137
- * SSL/TLS protocol version.
138
- */
139
- version: string;
140
- /**
141
- * IETF name for the cipher suite.
142
- */
143
- standardName: string;
144
- }
145
- interface EphemeralKeyInfo {
146
- /**
147
- * The supported types are 'DH' and 'ECDH'.
148
- */
149
- type: string;
150
- /**
151
- * The name property is available only when type is 'ECDH'.
152
- */
153
- name?: string | undefined;
154
- /**
155
- * The size of parameter of an ephemeral key exchange.
156
- */
157
- size: number;
158
- }
159
- interface KeyObject {
160
- /**
161
- * Private keys in PEM format.
162
- */
163
- pem: string | Buffer;
164
- /**
165
- * Optional passphrase.
166
- */
167
- passphrase?: string | undefined;
168
- }
169
- interface PxfObject {
170
- /**
171
- * PFX or PKCS12 encoded private key and certificate chain.
172
- */
173
- buf: string | Buffer;
174
- /**
175
- * Optional passphrase.
176
- */
177
- passphrase?: string | undefined;
178
- }
179
- interface TLSSocketOptions extends SecureContextOptions, CommonConnectionOptions {
180
- /**
181
- * If true the TLS socket will be instantiated in server-mode.
182
- * Defaults to false.
183
- */
184
- isServer?: boolean | undefined;
185
- /**
186
- * An optional net.Server instance.
187
- */
188
- server?: net.Server | undefined;
189
- /**
190
- * An optional Buffer instance containing a TLS session.
191
- */
192
- session?: Buffer | undefined;
193
- }
194
- interface TLSSocketEventMap extends net.SocketEventMap {
195
- "keylog": [line: NonSharedBuffer];
196
- "OCSPResponse": [response: NonSharedBuffer];
197
- "secure": [];
198
- "secureConnect": [];
199
- "session": [session: NonSharedBuffer];
200
- }
201
- /**
202
- * Performs transparent encryption of written data and all required TLS
203
- * negotiation.
204
- *
205
- * Instances of `tls.TLSSocket` implement the duplex `Stream` interface.
206
- *
207
- * Methods that return TLS connection metadata (e.g.{@link TLSSocket.getPeerCertificate}) will only return data while the
208
- * connection is open.
209
- * @since v0.11.4
210
- */
211
- class TLSSocket extends net.Socket {
212
- /**
213
- * Construct a new tls.TLSSocket object from an existing TCP socket.
214
- */
215
- constructor(socket: net.Socket | stream.Duplex, options?: TLSSocketOptions);
216
- /**
217
- * This property is `true` if the peer certificate was signed by one of the CAs
218
- * specified when creating the `tls.TLSSocket` instance, otherwise `false`.
219
- * @since v0.11.4
220
- */
221
- authorized: boolean;
222
- /**
223
- * The negotiated ALPN protocol. This is `null` before the handshake completes.
224
- * Once the handshake completes, it settles as either the negotiated protocol
225
- * name, or `false` if the peers did not negotiate an ALPN protocol.
226
- * @since v6.0.0
227
- */
228
- alpnProtocol: string | false | null;
229
- /**
230
- * Returns the reason why the peer's certificate was not been verified. This
231
- * property is set only when `tlsSocket.authorized === false`.
232
- * @since v0.11.4
233
- */
234
- authorizationError: Error;
235
- /**
236
- * Always returns `true`. This may be used to distinguish TLS sockets from regular`net.Socket` instances.
237
- * @since v0.11.4
238
- */
239
- encrypted: true;
240
- /**
241
- * Returns an object representing the local certificate. The returned object has
242
- * some properties corresponding to the fields of the certificate.
243
- *
244
- * See {@link TLSSocket.getPeerCertificate} for an example of the certificate
245
- * structure.
246
- *
247
- * If there is no local certificate, an empty object will be returned. If the
248
- * socket has been destroyed, `null` will be returned.
249
- * @since v11.2.0
250
- */
251
- getCertificate(): PeerCertificate | object | null;
252
- /**
253
- * Returns an object containing information on the negotiated cipher suite.
254
- *
255
- * For example, a TLSv1.2 protocol with AES256-SHA cipher:
256
- *
257
- * ```json
258
- * {
259
- * "name": "AES256-SHA",
260
- * "standardName": "TLS_RSA_WITH_AES_256_CBC_SHA",
261
- * "version": "SSLv3"
262
- * }
263
- * ```
264
- *
265
- * See [SSL\_CIPHER\_get\_name](https://www.openssl.org/docs/man1.1.1/man3/SSL_CIPHER_get_name.html) for more information.
266
- * @since v0.11.4
267
- */
268
- getCipher(): CipherNameAndProtocol;
269
- /**
270
- * Returns an object describing ephemeral key agreement in [perfect forward
271
- * secrecy](https://nodejs.org/docs/latest-v26.x/api/tls.html#perfect-forward-secrecy) on a client connection. It returns an empty object when the key
272
- * agreement is not ephemeral. As this is only supported on a client socket;
273
- * `null` is returned if called on a server socket. The supported types are `'DH'`,
274
- * `'ECDH'`, and `'TLSGroup'`. For `'DH'` and `'ECDH'`, the object describes peer
275
- * temporary key parameters. For `'TLSGroup'`, the object identifies the negotiated
276
- * TLS Supported Group used for key agreement when a peer temporary key object is
277
- * not available.
278
- *
279
- * The `name` property is available only when type is `'ECDH'` or `'TLSGroup'`. The
280
- * `size` property is not available when type is `'TLSGroup'`. For `'TLSGroup'`,
281
- * `name` is the negotiated TLS Supported Group name. Standardized TLS group names
282
- * and code points are listed in the [IANA TLS Supported Groups registry](https://www.iana.org/assignments/tls-parameters/tls-parameters.xhtml#tls-parameters-8).
283
- *
284
- * For example: `{ type: 'ECDH', name: 'prime256v1', size: 256 }`.
285
- * @since v5.0.0
286
- */
287
- getEphemeralKeyInfo(): EphemeralKeyInfo | object | null;
288
- /**
289
- * As the `Finished` messages are message digests of the complete handshake
290
- * (with a total of 192 bits for TLS 1.0 and more for SSL 3.0), they can
291
- * be used for external authentication procedures when the authentication
292
- * provided by SSL/TLS is not desired or is not enough.
293
- *
294
- * Corresponds to the `SSL_get_finished` routine in OpenSSL and may be used
295
- * to implement the `tls-unique` channel binding from [RFC 5929](https://tools.ietf.org/html/rfc5929).
296
- * @since v9.9.0
297
- * @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.
298
- */
299
- getFinished(): NonSharedBuffer | undefined;
300
- /**
301
- * Returns an object representing the peer's certificate. If the peer does not
302
- * provide a certificate, an empty object will be returned. If the socket has been
303
- * destroyed, `null` will be returned.
304
- *
305
- * If the full certificate chain was requested, each certificate will include an`issuerCertificate` property containing an object representing its issuer's
306
- * certificate.
307
- * @since v0.11.4
308
- * @param detailed Include the full certificate chain if `true`, otherwise include just the peer's certificate.
309
- * @return A certificate object.
310
- */
311
- getPeerCertificate(detailed: true): DetailedPeerCertificate;
312
- getPeerCertificate(detailed?: false): PeerCertificate;
313
- getPeerCertificate(detailed?: boolean): PeerCertificate | DetailedPeerCertificate;
314
- /**
315
- * As the `Finished` messages are message digests of the complete handshake
316
- * (with a total of 192 bits for TLS 1.0 and more for SSL 3.0), they can
317
- * be used for external authentication procedures when the authentication
318
- * provided by SSL/TLS is not desired or is not enough.
319
- *
320
- * Corresponds to the `SSL_get_peer_finished` routine in OpenSSL and may be used
321
- * to implement the `tls-unique` channel binding from [RFC 5929](https://tools.ietf.org/html/rfc5929).
322
- * @since v9.9.0
323
- * @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
324
- * far.
325
- */
326
- getPeerFinished(): NonSharedBuffer | undefined;
327
- /**
328
- * Returns a string containing the negotiated SSL/TLS protocol version of the
329
- * current connection. The value `'unknown'` will be returned for connected
330
- * sockets that have not completed the handshaking process. The value `null` will
331
- * be returned for server sockets or disconnected client sockets.
332
- *
333
- * Protocol versions are:
334
- *
335
- * * `'SSLv3'`
336
- * * `'TLSv1'`
337
- * * `'TLSv1.1'`
338
- * * `'TLSv1.2'`
339
- * * `'TLSv1.3'`
340
- *
341
- * See the OpenSSL [`SSL_get_version`](https://www.openssl.org/docs/man1.1.1/man3/SSL_get_version.html) documentation for more information.
342
- * @since v5.7.0
343
- */
344
- getProtocol(): string | null;
345
- /**
346
- * Returns the TLS session data or `undefined` if no session was
347
- * negotiated. On the client, the data can be provided to the `session` option of {@link connect} to resume the connection. On the server, it may be useful
348
- * for debugging.
349
- *
350
- * See `Session Resumption` for more information.
351
- *
352
- * Note: `getSession()` works only for TLSv1.2 and below. For TLSv1.3, applications
353
- * must use the `'session'` event (it also works for TLSv1.2 and below).
354
- * @since v0.11.4
355
- */
356
- getSession(): NonSharedBuffer | undefined;
357
- /**
358
- * See [SSL\_get\_shared\_sigalgs](https://www.openssl.org/docs/man1.1.1/man3/SSL_get_shared_sigalgs.html) for more information.
359
- * @since v12.11.0
360
- * @return List of signature algorithms shared between the server and the client in the order of decreasing preference.
361
- */
362
- getSharedSigalgs(): string[];
363
- /**
364
- * For a client, returns the TLS session ticket if one is available, or`undefined`. For a server, always returns `undefined`.
365
- *
366
- * It may be useful for debugging.
367
- *
368
- * See `Session Resumption` for more information.
369
- * @since v0.11.4
370
- */
371
- getTLSTicket(): NonSharedBuffer | undefined;
372
- /**
373
- * See `Session Resumption` for more information.
374
- * @since v0.5.6
375
- * @return `true` if the session was reused, `false` otherwise.
376
- */
377
- isSessionReused(): boolean;
378
- /**
379
- * The `tlsSocket.renegotiate()` method initiates a TLS renegotiation process.
380
- * Upon completion, the `callback` function will be passed a single argument
381
- * that is either an `Error` (if the request failed) or `null`.
382
- *
383
- * This method can be used to request a peer's certificate after the secure
384
- * connection has been established.
385
- *
386
- * When running as the server, the socket will be destroyed with an error after `handshakeTimeout` timeout.
387
- *
388
- * For TLSv1.3, renegotiation cannot be initiated, it is not supported by the
389
- * protocol.
390
- * @since v0.11.8
391
- * @param callback If `renegotiate()` returned `true`, callback is attached once to the `'secure'` event. If `renegotiate()` returned `false`, `callback` will be called in the next tick with
392
- * an error, unless the `tlsSocket` has been destroyed, in which case `callback` will not be called at all.
393
- * @return `true` if renegotiation was initiated, `false` otherwise.
394
- */
395
- renegotiate(
396
- options: {
397
- rejectUnauthorized?: boolean | undefined;
398
- requestCert?: boolean | undefined;
399
- },
400
- callback: (err: Error | null) => void,
401
- ): undefined | boolean;
402
- /**
403
- * The SNI (Server Name Indication) host name associated with the socket. This is
404
- * `null` before the handshake completes. Once the handshake completes it settles
405
- * as either the host name string, or `false` if SNI was not used.
406
- * @since v0.11.3
407
- */
408
- servername: string | false | null;
409
- /**
410
- * The `tlsSocket.setKeyCert()` method sets the private key and certificate to use for the socket.
411
- * This is mainly useful if you wish to select a server certificate from a TLS server's `ALPNCallback`.
412
- * @since v22.5.0, v20.17.0
413
- * @param context An object containing at least `key` and `cert` properties from the {@link createSecureContext()} `options`,
414
- * or a TLS context object created with {@link createSecureContext()} itself.
415
- */
416
- setKeyCert(context: SecureContextOptions | SecureContext): void;
417
- /**
418
- * The `tlsSocket.setMaxSendFragment()` method sets the maximum TLS fragment size.
419
- * Returns `true` if setting the limit succeeded; `false` otherwise.
420
- *
421
- * Smaller fragment sizes decrease the buffering latency on the client: larger
422
- * fragments are buffered by the TLS layer until the entire fragment is received
423
- * and its integrity is verified; large fragments can span multiple roundtrips
424
- * and their processing can be delayed due to packet loss or reordering. However,
425
- * smaller fragments add extra TLS framing bytes and CPU overhead, which may
426
- * decrease overall server throughput.
427
- * @since v0.11.11
428
- * @param [size=16384] The maximum TLS fragment size. The maximum value is `16384`.
429
- */
430
- setMaxSendFragment(size: number): boolean;
431
- /**
432
- * Disables TLS renegotiation for this `TLSSocket` instance. Once called, attempts
433
- * to renegotiate will trigger an `'error'` event on the `TLSSocket`.
434
- * @since v8.4.0
435
- */
436
- disableRenegotiation(): void;
437
- /**
438
- * When enabled, TLS packet trace information is written to `stderr`. This can be
439
- * used to debug TLS connection problems.
440
- *
441
- * The format of the output is identical to the output of`openssl s_client -trace` or `openssl s_server -trace`. While it is produced by
442
- * OpenSSL's `SSL_trace()` function, the format is undocumented, can change
443
- * without notice, and should not be relied on.
444
- * @since v12.2.0
445
- */
446
- enableTrace(): void;
447
- /**
448
- * Returns the peer certificate as an `X509Certificate` object.
449
- *
450
- * If there is no peer certificate, or the socket has been destroyed,`undefined` will be returned.
451
- * @since v15.9.0
452
- */
453
- getPeerX509Certificate(): X509Certificate | undefined;
454
- /**
455
- * Returns the local certificate as an `X509Certificate` object.
456
- *
457
- * If there is no local certificate, or the socket has been destroyed,`undefined` will be returned.
458
- * @since v15.9.0
459
- */
460
- getX509Certificate(): X509Certificate | undefined;
461
- /**
462
- * Keying material is used for validations to prevent different kind of attacks in
463
- * network protocols, for example in the specifications of IEEE 802.1X.
464
- *
465
- * Example
466
- *
467
- * ```js
468
- * const keyingMaterial = tlsSocket.exportKeyingMaterial(
469
- * 128,
470
- * 'client finished');
471
- *
472
- * /*
473
- * Example return value of keyingMaterial:
474
- * <Buffer 76 26 af 99 c5 56 8e 42 09 91 ef 9f 93 cb ad 6c 7b 65 f8 53 f1 d8 d9
475
- * 12 5a 33 b8 b5 25 df 7b 37 9f e0 e2 4f b8 67 83 a3 2f cd 5d 41 42 4c 91
476
- * 74 ef 2c ... 78 more bytes>
477
- *
478
- * ```
479
- *
480
- * See the OpenSSL [`SSL_export_keying_material`](https://www.openssl.org/docs/man1.1.1/man3/SSL_export_keying_material.html) documentation for more
481
- * information.
482
- * @since v13.10.0, v12.17.0
483
- * @param length number of bytes to retrieve from keying material
484
- * @param label an application specific label, typically this will be a value from the [IANA Exporter Label
485
- * Registry](https://www.iana.org/assignments/tls-parameters/tls-parameters.xhtml#exporter-labels).
486
- * @param context Optionally provide a context.
487
- * @return requested bytes of the keying material
488
- */
489
- exportKeyingMaterial(length: number, label: string, context: Buffer): NonSharedBuffer;
490
- // #region InternalEventEmitter
491
- addListener<E extends keyof TLSSocketEventMap>(
492
- eventName: E,
493
- listener: (...args: TLSSocketEventMap[E]) => void,
494
- ): this;
495
- addListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
496
- emit<E extends keyof TLSSocketEventMap>(eventName: E, ...args: TLSSocketEventMap[E]): boolean;
497
- emit(eventName: string | symbol, ...args: any[]): boolean;
498
- listenerCount<E extends keyof TLSSocketEventMap>(
499
- eventName: E,
500
- listener?: (...args: TLSSocketEventMap[E]) => void,
501
- ): number;
502
- listenerCount(eventName: string | symbol, listener?: (...args: any[]) => void): number;
503
- listeners<E extends keyof TLSSocketEventMap>(eventName: E): ((...args: TLSSocketEventMap[E]) => void)[];
504
- listeners(eventName: string | symbol): ((...args: any[]) => void)[];
505
- off<E extends keyof TLSSocketEventMap>(eventName: E, listener: (...args: TLSSocketEventMap[E]) => void): this;
506
- off(eventName: string | symbol, listener: (...args: any[]) => void): this;
507
- on<E extends keyof TLSSocketEventMap>(eventName: E, listener: (...args: TLSSocketEventMap[E]) => void): this;
508
- on(eventName: string | symbol, listener: (...args: any[]) => void): this;
509
- once<E extends keyof TLSSocketEventMap>(eventName: E, listener: (...args: TLSSocketEventMap[E]) => void): this;
510
- once(eventName: string | symbol, listener: (...args: any[]) => void): this;
511
- prependListener<E extends keyof TLSSocketEventMap>(
512
- eventName: E,
513
- listener: (...args: TLSSocketEventMap[E]) => void,
514
- ): this;
515
- prependListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
516
- prependOnceListener<E extends keyof TLSSocketEventMap>(
517
- eventName: E,
518
- listener: (...args: TLSSocketEventMap[E]) => void,
519
- ): this;
520
- prependOnceListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
521
- rawListeners<E extends keyof TLSSocketEventMap>(eventName: E): ((...args: TLSSocketEventMap[E]) => void)[];
522
- rawListeners(eventName: string | symbol): ((...args: any[]) => void)[];
523
- // eslint-disable-next-line @definitelytyped/no-unnecessary-generics
524
- removeAllListeners<E extends keyof TLSSocketEventMap>(eventName?: E): this;
525
- removeAllListeners(eventName?: string | symbol): this;
526
- removeListener<E extends keyof TLSSocketEventMap>(
527
- eventName: E,
528
- listener: (...args: TLSSocketEventMap[E]) => void,
529
- ): this;
530
- removeListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
531
- // #endregion
532
- }
533
- interface CommonConnectionOptions {
534
- /**
535
- * An optional TLS context object from tls.createSecureContext()
536
- */
537
- secureContext?: SecureContext | undefined;
538
- /**
539
- * When enabled, TLS packet trace information is written to `stderr`. This can be
540
- * used to debug TLS connection problems.
541
- * @default false
542
- */
543
- enableTrace?: boolean | undefined;
544
- /**
545
- * If true the server will request a certificate from clients that
546
- * connect and attempt to verify that certificate. Defaults to
547
- * false.
548
- */
549
- requestCert?: boolean | undefined;
550
- /**
551
- * An array of strings, or a single `Buffer`, `TypedArray`, or `DataView` containing the supported
552
- * ALPN protocols. Buffers should have the format `[len][name][len][name]...`
553
- * e.g. `'\x08http/1.1\x08http/1.0'`, where the `len` byte is the length of the
554
- * next protocol name. Passing an array is usually much simpler, e.g.
555
- * `['http/1.1', 'http/1.0']`. Protocols earlier in the list have higher
556
- * preference than those later.
557
- */
558
- ALPNProtocols?: readonly string[] | NodeJS.ArrayBufferView | undefined;
559
- /**
560
- * SNICallback(servername, cb) <Function> A function that will be
561
- * called if the client supports SNI TLS extension. Two arguments
562
- * will be passed when called: servername and cb. SNICallback should
563
- * invoke cb(null, ctx), where ctx is a SecureContext instance.
564
- * (tls.createSecureContext(...) can be used to get a proper
565
- * SecureContext.) If SNICallback wasn't provided the default callback
566
- * with high-level API will be used (see below).
567
- */
568
- SNICallback?: ((servername: string, cb: (err: Error | null, ctx?: SecureContext) => void) => void) | undefined;
569
- /**
570
- * If true the server will reject any connection which is not
571
- * authorized with the list of supplied CAs. This option only has an
572
- * effect if requestCert is true.
573
- * @default true
574
- */
575
- rejectUnauthorized?: boolean | undefined;
576
- /**
577
- * If true, specifies that the OCSP status request extension will be
578
- * added to the client hello and an 'OCSPResponse' event will be
579
- * emitted on the socket before establishing a secure communication.
580
- */
581
- requestOCSP?: boolean | undefined;
582
- }
583
- interface TlsOptions extends SecureContextOptions, CommonConnectionOptions, net.ServerOpts {
584
- /**
585
- * Abort the connection if the SSL/TLS handshake does not finish in the
586
- * specified number of milliseconds. A 'tlsClientError' is emitted on
587
- * the tls.Server object whenever a handshake times out. Default:
588
- * 120000 (120 seconds).
589
- */
590
- handshakeTimeout?: number | undefined;
591
- /**
592
- * The number of seconds after which a TLS session created by the
593
- * server will no longer be resumable. See Session Resumption for more
594
- * information. Default: 300.
595
- */
596
- sessionTimeout?: number | undefined;
597
- /**
598
- * 48-bytes of cryptographically strong pseudo-random data.
599
- */
600
- ticketKeys?: Buffer | undefined;
601
- /**
602
- * @param socket
603
- * @param identity identity parameter sent from the client.
604
- * @return pre-shared key that must either be
605
- * a buffer or `null` to stop the negotiation process. Returned PSK must be
606
- * compatible with the selected cipher's digest.
607
- *
608
- * When negotiating TLS-PSK (pre-shared keys), this function is called
609
- * with the identity provided by the client.
610
- * If the return value is `null` the negotiation process will stop and an
611
- * "unknown_psk_identity" alert message will be sent to the other party.
612
- * If the server wishes to hide the fact that the PSK identity was not known,
613
- * the callback must provide some random data as `psk` to make the connection
614
- * fail with "decrypt_error" before negotiation is finished.
615
- * PSK ciphers are disabled by default, and using TLS-PSK thus
616
- * requires explicitly specifying a cipher suite with the `ciphers` option.
617
- * More information can be found in the RFC 4279.
618
- */
619
- pskCallback?: ((socket: TLSSocket, identity: string) => NodeJS.ArrayBufferView | null) | undefined;
620
- /**
621
- * hint to send to a client to help
622
- * with selecting the identity during TLS-PSK negotiation. Will be ignored
623
- * in TLS 1.3. Upon failing to set pskIdentityHint `tlsClientError` will be
624
- * emitted with `ERR_TLS_PSK_SET_IDENTIY_HINT_FAILED` code.
625
- */
626
- pskIdentityHint?: string | undefined;
627
- }
628
- interface PSKCallbackNegotation {
629
- psk: NodeJS.ArrayBufferView;
630
- identity: string;
631
- }
632
- interface ConnectionOptions extends SecureContextOptions, CommonConnectionOptions {
633
- host?: string | undefined;
634
- port?: number | undefined;
635
- path?: string | undefined; // Creates unix socket connection to path. If this option is specified, `host` and `port` are ignored.
636
- socket?: stream.Duplex | undefined; // Establish secure connection on a given socket rather than creating a new socket
637
- checkServerIdentity?: typeof checkServerIdentity | undefined;
638
- servername?: string | undefined; // SNI TLS Extension
639
- session?: Buffer | undefined;
640
- minDHSize?: number | undefined;
641
- lookup?: net.LookupFunction | undefined;
642
- timeout?: number | undefined;
643
- /**
644
- * When negotiating TLS-PSK (pre-shared keys), this function is called
645
- * with optional identity `hint` provided by the server or `null`
646
- * in case of TLS 1.3 where `hint` was removed.
647
- * It will be necessary to provide a custom `tls.checkServerIdentity()`
648
- * for the connection as the default one will try to check hostname/IP
649
- * of the server against the certificate but that's not applicable for PSK
650
- * because there won't be a certificate present.
651
- * More information can be found in the RFC 4279.
652
- *
653
- * @param hint message sent from the server to help client
654
- * decide which identity to use during negotiation.
655
- * Always `null` if TLS 1.3 is used.
656
- * @returns Return `null` to stop the negotiation process. `psk` must be
657
- * compatible with the selected cipher's digest.
658
- * `identity` must use UTF-8 encoding.
659
- */
660
- pskCallback?: ((hint: string | null) => PSKCallbackNegotation | null) | undefined;
661
- }
662
- interface ServerEventMap extends net.ServerEventMap {
663
- "connection": [socket: net.Socket];
664
- "keylog": [line: NonSharedBuffer, tlsSocket: TLSSocket];
665
- "newSession": [sessionId: NonSharedBuffer, sessionData: NonSharedBuffer, callback: () => void];
666
- "OCSPRequest": [
667
- certificate: NonSharedBuffer,
668
- issuer: NonSharedBuffer,
669
- callback: (err: Error | null, resp: Buffer | null) => void,
670
- ];
671
- "resumeSession": [sessionId: Buffer, callback: (err: Error | null, sessionData?: Buffer) => void];
672
- "secureConnection": [tlsSocket: TLSSocket];
673
- "tlsClientError": [exception: Error, tlsSocket: TLSSocket];
674
- }
675
- /**
676
- * Accepts encrypted connections using TLS or SSL.
677
- * @since v0.3.2
678
- */
679
- class Server extends net.Server {
680
- constructor(secureConnectionListener?: (socket: TLSSocket) => void);
681
- constructor(options: TlsOptions, secureConnectionListener?: (socket: TLSSocket) => void);
682
- /**
683
- * The `server.addContext()` method adds a secure context that will be used if
684
- * the client request's SNI name matches the supplied `hostname` (or wildcard).
685
- *
686
- * When there are multiple matching contexts, the most recently added one is
687
- * used.
688
- * @since v0.5.3
689
- * @param hostname A SNI host name or wildcard (e.g. `'*'`)
690
- * @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
691
- * with {@link createSecureContext} itself.
692
- */
693
- addContext(hostname: string, context: SecureContextOptions | SecureContext): void;
694
- /**
695
- * Returns the session ticket keys.
696
- *
697
- * See `Session Resumption` for more information.
698
- * @since v3.0.0
699
- * @return A 48-byte buffer containing the session ticket keys.
700
- */
701
- getTicketKeys(): NonSharedBuffer;
702
- /**
703
- * The `server.setSecureContext()` method replaces the secure context of an
704
- * existing server. Existing connections to the server are not interrupted.
705
- * @since v11.0.0
706
- * @param options An object containing any of the possible properties from the {@link createSecureContext} `options` arguments (e.g. `key`, `cert`, `ca`, etc).
707
- */
708
- setSecureContext(options: SecureContextOptions): void;
709
- /**
710
- * Sets the session ticket keys.
711
- *
712
- * Changes to the ticket keys are effective only for future server connections.
713
- * Existing or currently pending server connections will use the previous keys.
714
- *
715
- * See `Session Resumption` for more information.
716
- * @since v3.0.0
717
- * @param keys A 48-byte buffer containing the session ticket keys.
718
- */
719
- setTicketKeys(keys: Buffer): void;
720
- // #region InternalEventEmitter
721
- addListener<E extends keyof ServerEventMap>(eventName: E, listener: (...args: ServerEventMap[E]) => void): this;
722
- addListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
723
- emit<E extends keyof ServerEventMap>(eventName: E, ...args: ServerEventMap[E]): boolean;
724
- emit(eventName: string | symbol, ...args: any[]): boolean;
725
- listenerCount<E extends keyof ServerEventMap>(
726
- eventName: E,
727
- listener?: (...args: ServerEventMap[E]) => void,
728
- ): number;
729
- listenerCount(eventName: string | symbol, listener?: (...args: any[]) => void): number;
730
- listeners<E extends keyof ServerEventMap>(eventName: E): ((...args: ServerEventMap[E]) => void)[];
731
- listeners(eventName: string | symbol): ((...args: any[]) => void)[];
732
- off<E extends keyof ServerEventMap>(eventName: E, listener: (...args: ServerEventMap[E]) => void): this;
733
- off(eventName: string | symbol, listener: (...args: any[]) => void): this;
734
- on<E extends keyof ServerEventMap>(eventName: E, listener: (...args: ServerEventMap[E]) => void): this;
735
- on(eventName: string | symbol, listener: (...args: any[]) => void): this;
736
- once<E extends keyof ServerEventMap>(eventName: E, listener: (...args: ServerEventMap[E]) => void): this;
737
- once(eventName: string | symbol, listener: (...args: any[]) => void): this;
738
- prependListener<E extends keyof ServerEventMap>(
739
- eventName: E,
740
- listener: (...args: ServerEventMap[E]) => void,
741
- ): this;
742
- prependListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
743
- prependOnceListener<E extends keyof ServerEventMap>(
744
- eventName: E,
745
- listener: (...args: ServerEventMap[E]) => void,
746
- ): this;
747
- prependOnceListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
748
- rawListeners<E extends keyof ServerEventMap>(eventName: E): ((...args: ServerEventMap[E]) => void)[];
749
- rawListeners(eventName: string | symbol): ((...args: any[]) => void)[];
750
- // eslint-disable-next-line @definitelytyped/no-unnecessary-generics
751
- removeAllListeners<E extends keyof ServerEventMap>(eventName?: E): this;
752
- removeAllListeners(eventName?: string | symbol): this;
753
- removeListener<E extends keyof ServerEventMap>(
754
- eventName: E,
755
- listener: (...args: ServerEventMap[E]) => void,
756
- ): this;
757
- removeListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
758
- // #endregion
759
- }
760
- type SecureVersion = "TLSv1.3" | "TLSv1.2" | "TLSv1.1" | "TLSv1";
761
- type CertificateCompressionAlgorithm = "zlib" | "brotli" | "zstd";
762
- interface SecureContextOptions {
763
- /**
764
- * If set, this will be called when a client opens a connection using the ALPN extension.
765
- * One argument will be passed to the callback: an object containing `servername` and `protocols` fields,
766
- * respectively containing the server name from the SNI extension (if any) and an array of
767
- * ALPN protocol name strings. The callback must return either one of the strings listed in `protocols`,
768
- * which will be returned to the client as the selected ALPN protocol, or `undefined`,
769
- * to reject the connection with a fatal alert. If a string is returned that does not match one of
770
- * the client's ALPN protocols, an error will be thrown.
771
- * This option cannot be used with the `ALPNProtocols` option, and setting both options will throw an error.
772
- */
773
- ALPNCallback?: ((arg: { servername: string; protocols: string[] }) => string | undefined) | undefined;
774
- /**
775
- * Treat intermediate (non-self-signed)
776
- * certificates in the trust CA certificate list as trusted.
777
- * @since v22.9.0, v20.18.0
778
- */
779
- allowPartialTrustChain?: boolean | undefined;
780
- /**
781
- * Optionally override the trusted CA certificates. Default is to trust
782
- * the well-known CAs curated by Mozilla. Mozilla's CAs are completely
783
- * replaced when CAs are explicitly specified using this option.
784
- */
785
- ca?: string | Buffer | Array<string | Buffer> | undefined;
786
- /**
787
- * Cert chains in PEM format. One cert chain should be provided per
788
- * private key. Each cert chain should consist of the PEM formatted
789
- * certificate for a provided private key, followed by the PEM
790
- * formatted intermediate certificates (if any), in order, and not
791
- * including the root CA (the root CA must be pre-known to the peer,
792
- * see ca). When providing multiple cert chains, they do not have to
793
- * be in the same order as their private keys in key. If the
794
- * intermediate certificates are not provided, the peer will not be
795
- * able to validate the certificate, and the handshake will fail.
796
- */
797
- cert?: string | Buffer | Array<string | Buffer> | undefined;
798
- /**
799
- * An array of supported certificate
800
- * compression algorithm names, in preference order. Supported values are
801
- * `'zlib'`, `'brotli'`, and `'zstd'`. When set, enables TLS certificate
802
- * compression ([RFC 8879](https://tools.ietf.org/html/rfc8879)) which compresses certificates during the TLS
803
- * handshake, reducing handshake size. Only effective with TLSv1.3.
804
- * **Default:** `[]` (disabled).
805
- */
806
- certificateCompression?: readonly CertificateCompressionAlgorithm[] | undefined;
807
- /**
808
- * Colon-separated list of supported signature algorithms. The list
809
- * can contain digest algorithms (SHA256, MD5 etc.), public key
810
- * algorithms (RSA-PSS, ECDSA etc.), combination of both (e.g
811
- * 'RSA+SHA384') or TLS v1.3 scheme names (e.g. rsa_pss_pss_sha512).
812
- */
813
- sigalgs?: string | undefined;
814
- /**
815
- * Cipher suite specification, replacing the default. For more
816
- * information, see modifying the default cipher suite. Permitted
817
- * ciphers can be obtained via tls.getCiphers(). Cipher names must be
818
- * uppercased in order for OpenSSL to accept them.
819
- */
820
- ciphers?: string | undefined;
821
- /**
822
- * Name of an OpenSSL engine which can provide the client certificate.
823
- * @deprecated
824
- */
825
- clientCertEngine?: string | undefined;
826
- /**
827
- * PEM formatted CRLs (Certificate Revocation Lists).
828
- */
829
- crl?: string | Buffer | Array<string | Buffer> | undefined;
830
- /**
831
- * `'auto'` or custom Diffie-Hellman parameters, required for non-ECDHE perfect forward secrecy.
832
- * If omitted or invalid, the parameters are silently discarded and DHE ciphers will not be available.
833
- * ECDHE-based perfect forward secrecy will still be available.
834
- */
835
- dhparam?: string | Buffer | undefined;
836
- /**
837
- * A string describing a named curve, TLS group, or
838
- * colon-separated list of named curves or TLS groups to use for key agreement,
839
- * for example `P-521:P-384:P-256`, `X25519`, or `X25519MLKEM768`. The
840
- * historical name of this option refers to ECDH key agreement in TLSv1.2 and
841
- * below. In TLSv1.3, this option configures the TLS Supported Groups and
842
- * key share groups offered or accepted by the TLS stack. Set to `auto` to
843
- * select the group automatically. Use `crypto.getCurves()` to obtain a
844
- * list of available elliptic curve names. For TLS group names, use
845
- * `openssl list -tls-groups` or consult the [IANA TLS Supported Groups
846
- * registry](https://www.iana.org/assignments/tls-parameters/tls-parameters.xhtml#tls-parameters-8).
847
- */
848
- ecdhCurve?: string | undefined;
849
- /**
850
- * Attempt to use the server's cipher suite preferences instead of the
851
- * client's. When true, causes SSL_OP_CIPHER_SERVER_PREFERENCE to be
852
- * set in secureOptions
853
- */
854
- honorCipherOrder?: boolean | undefined;
855
- /**
856
- * Private keys in PEM format. PEM allows the option of private keys
857
- * being encrypted. Encrypted keys will be decrypted with
858
- * options.passphrase. Multiple keys using different algorithms can be
859
- * provided either as an array of unencrypted key strings or buffers,
860
- * or an array of objects in the form {pem: <string|buffer>[,
861
- * passphrase: <string>]}. The object form can only occur in an array.
862
- * object.passphrase is optional. Encrypted keys will be decrypted with
863
- * object.passphrase if provided, or options.passphrase if it is not.
864
- */
865
- key?: string | Buffer | Array<string | Buffer | KeyObject> | undefined;
866
- /**
867
- * Name of an OpenSSL engine to get private key from. Should be used
868
- * together with privateKeyIdentifier.
869
- * @deprecated
870
- */
871
- privateKeyEngine?: string | undefined;
872
- /**
873
- * Identifier of a private key managed by an OpenSSL engine. Should be
874
- * used together with privateKeyEngine. Should not be set together with
875
- * key, because both options define a private key in different ways.
876
- * @deprecated
877
- */
878
- privateKeyIdentifier?: string | undefined;
879
- /**
880
- * Optionally set the maximum TLS version to allow. One
881
- * of `'TLSv1.3'`, `'TLSv1.2'`, `'TLSv1.1'`, or `'TLSv1'`. Cannot be specified along with the
882
- * `secureProtocol` option, use one or the other.
883
- * **Default:** `'TLSv1.3'`, unless changed using CLI options. Using
884
- * `--tls-max-v1.2` sets the default to `'TLSv1.2'`. Using `--tls-max-v1.3` sets the default to
885
- * `'TLSv1.3'`. If multiple of the options are provided, the highest maximum is used.
886
- */
887
- maxVersion?: SecureVersion | undefined;
888
- /**
889
- * Optionally set the minimum TLS version to allow. One
890
- * of `'TLSv1.3'`, `'TLSv1.2'`, `'TLSv1.1'`, or `'TLSv1'`. Cannot be specified along with the
891
- * `secureProtocol` option, use one or the other. It is not recommended to use
892
- * less than TLSv1.2, but it may be required for interoperability.
893
- * **Default:** `'TLSv1.2'`, unless changed using CLI options. Using
894
- * `--tls-v1.0` sets the default to `'TLSv1'`. Using `--tls-v1.1` sets the default to
895
- * `'TLSv1.1'`. Using `--tls-min-v1.3` sets the default to
896
- * 'TLSv1.3'. If multiple of the options are provided, the lowest minimum is used.
897
- */
898
- minVersion?: SecureVersion | undefined;
899
- /**
900
- * Shared passphrase used for a single private key and/or a PFX.
901
- */
902
- passphrase?: string | undefined;
903
- /**
904
- * PFX or PKCS12 encoded private key and certificate chain. pfx is an
905
- * alternative to providing key and cert individually. PFX is usually
906
- * encrypted, if it is, passphrase will be used to decrypt it. Multiple
907
- * PFX can be provided either as an array of unencrypted PFX buffers,
908
- * or an array of objects in the form {buf: <string|buffer>[,
909
- * passphrase: <string>]}. The object form can only occur in an array.
910
- * object.passphrase is optional. Encrypted PFX will be decrypted with
911
- * object.passphrase if provided, or options.passphrase if it is not.
912
- */
913
- pfx?: string | Buffer | Array<string | Buffer | PxfObject> | undefined;
914
- /**
915
- * Optionally affect the OpenSSL protocol behavior, which is not
916
- * usually necessary. This should be used carefully if at all! Value is
917
- * a numeric bitmask of the SSL_OP_* options from OpenSSL Options
918
- */
919
- secureOptions?: number | undefined; // Value is a numeric bitmask of the `SSL_OP_*` options
920
- /**
921
- * Legacy mechanism to select the TLS protocol version to use, it does
922
- * not support independent control of the minimum and maximum version,
923
- * and does not support limiting the protocol to TLSv1.3. Use
924
- * minVersion and maxVersion instead. The possible values are listed as
925
- * SSL_METHODS, use the function names as strings. For example, use
926
- * 'TLSv1_1_method' to force TLS version 1.1, or 'TLS_method' to allow
927
- * any TLS protocol version up to TLSv1.3. It is not recommended to use
928
- * TLS versions less than 1.2, but it may be required for
929
- * interoperability. Default: none, see minVersion.
930
- */
931
- secureProtocol?: string | undefined;
932
- /**
933
- * Opaque identifier used by servers to ensure session state is not
934
- * shared between applications. Unused by clients.
935
- */
936
- sessionIdContext?: string | undefined;
937
- /**
938
- * 48-bytes of cryptographically strong pseudo-random data.
939
- * See Session Resumption for more information.
940
- */
941
- ticketKeys?: Buffer | undefined;
942
- /**
943
- * The number of seconds after which a TLS session created by the
944
- * server will no longer be resumable. See Session Resumption for more
945
- * information. Default: 300.
946
- */
947
- sessionTimeout?: number | undefined;
948
- }
949
- interface SecureContext {
950
- context: any;
951
- }
952
- /**
953
- * Verifies the certificate `cert` is issued to `hostname`.
954
- *
955
- * Returns [Error](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error) object, populating it with `reason`, `host`, and `cert` on
956
- * failure. On success, returns [undefined](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Undefined_type).
957
- *
958
- * This function is intended to be used in combination with the`checkServerIdentity` option that can be passed to {@link connect} and as
959
- * such operates on a `certificate object`. For other purposes, consider using `x509.checkHost()` instead.
960
- *
961
- * This function can be overwritten by providing an alternative function as the `options.checkServerIdentity` option that is passed to `tls.connect()`. The
962
- * overwriting function can call `tls.checkServerIdentity()` of course, to augment
963
- * the checks done with additional verification.
964
- *
965
- * This function is only called if the certificate passed all other checks, such as
966
- * being issued by trusted CA (`options.ca`).
967
- *
968
- * Earlier versions of Node.js incorrectly accepted certificates for a given`hostname` if a matching `uniformResourceIdentifier` subject alternative name
969
- * 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
970
- * a custom `options.checkServerIdentity` function that implements the desired behavior.
971
- * @since v0.8.4
972
- * @param hostname The host name or IP address to verify the certificate against.
973
- * @param cert A `certificate object` representing the peer's certificate.
974
- */
975
- function checkServerIdentity(hostname: string, cert: PeerCertificate): Error | undefined;
976
- /**
977
- * Creates a new {@link Server}. The `secureConnectionListener`, if provided, is
978
- * automatically set as a listener for the `'secureConnection'` event.
979
- *
980
- * The `ticketKeys` options is automatically shared between `node:cluster` module
981
- * workers.
982
- *
983
- * The following illustrates a simple echo server:
984
- *
985
- * ```js
986
- * import tls from 'node:tls';
987
- * import fs from 'node:fs';
988
- *
989
- * const options = {
990
- * key: fs.readFileSync('server-key.pem'),
991
- * cert: fs.readFileSync('server-cert.pem'),
992
- *
993
- * // This is necessary only if using client certificate authentication.
994
- * requestCert: true,
995
- *
996
- * // This is necessary only if the client uses a self-signed certificate.
997
- * ca: [ fs.readFileSync('client-cert.pem') ],
998
- * };
999
- *
1000
- * const server = tls.createServer(options, (socket) => {
1001
- * console.log('server connected',
1002
- * socket.authorized ? 'authorized' : 'unauthorized');
1003
- * socket.write('welcome!\n');
1004
- * socket.setEncoding('utf8');
1005
- * socket.pipe(socket);
1006
- * });
1007
- * server.listen(8000, () => {
1008
- * console.log('server bound');
1009
- * });
1010
- * ```
1011
- *
1012
- * The server can be tested by connecting to it using the example client from {@link connect}.
1013
- * @since v0.3.2
1014
- */
1015
- function createServer(secureConnectionListener?: (socket: TLSSocket) => void): Server;
1016
- function createServer(options: TlsOptions, secureConnectionListener?: (socket: TLSSocket) => void): Server;
1017
- /**
1018
- * The `callback` function, if specified, will be added as a listener for the `'secureConnect'` event.
1019
- *
1020
- * `tls.connect()` returns a {@link TLSSocket} object.
1021
- *
1022
- * Unlike the `https` API, `tls.connect()` does not enable the
1023
- * SNI (Server Name Indication) extension by default, which may cause some
1024
- * servers to return an incorrect certificate or reject the connection
1025
- * altogether. To enable SNI, set the `servername` option in addition
1026
- * to `host`.
1027
- *
1028
- * The following illustrates a client for the echo server example from {@link createServer}:
1029
- *
1030
- * ```js
1031
- * // Assumes an echo server that is listening on port 8000.
1032
- * import tls from 'node:tls';
1033
- * import fs from 'node:fs';
1034
- *
1035
- * const options = {
1036
- * // Necessary only if the server requires client certificate authentication.
1037
- * key: fs.readFileSync('client-key.pem'),
1038
- * cert: fs.readFileSync('client-cert.pem'),
1039
- *
1040
- * // Necessary only if the server uses a self-signed certificate.
1041
- * ca: [ fs.readFileSync('server-cert.pem') ],
1042
- *
1043
- * // Necessary only if the server's cert isn't for "localhost".
1044
- * checkServerIdentity: () => { return null; },
1045
- * };
1046
- *
1047
- * const socket = tls.connect(8000, options, () => {
1048
- * console.log('client connected',
1049
- * socket.authorized ? 'authorized' : 'unauthorized');
1050
- * process.stdin.pipe(socket);
1051
- * process.stdin.resume();
1052
- * });
1053
- * socket.setEncoding('utf8');
1054
- * socket.on('data', (data) => {
1055
- * console.log(data);
1056
- * });
1057
- * socket.on('end', () => {
1058
- * console.log('server ends connection');
1059
- * });
1060
- * ```
1061
- * @since v0.11.3
1062
- */
1063
- function connect(options: ConnectionOptions, secureConnectListener?: () => void): TLSSocket;
1064
- function connect(
1065
- port: number,
1066
- host?: string,
1067
- options?: ConnectionOptions,
1068
- secureConnectListener?: () => void,
1069
- ): TLSSocket;
1070
- function connect(port: number, options?: ConnectionOptions, secureConnectListener?: () => void): TLSSocket;
1071
- /**
1072
- * `{@link createServer}` sets the default value of the `honorCipherOrder` option
1073
- * to `true`, other APIs that create secure contexts leave it unset.
1074
- *
1075
- * `{@link createServer}` uses a 128 bit truncated SHA1 hash value generated
1076
- * from `process.argv` as the default value of the `sessionIdContext` option, other
1077
- * APIs that create secure contexts have no default value.
1078
- *
1079
- * The `tls.createSecureContext()` method creates a `SecureContext` object. It is
1080
- * usable as an argument to several `tls` APIs, such as `server.addContext()`,
1081
- * but has no public methods. The {@link Server} constructor and the {@link createServer} method do not support the `secureContext` option.
1082
- *
1083
- * A key is _required_ for ciphers that use certificates. Either `key` or `pfx` can be used to provide it.
1084
- *
1085
- * If the `ca` option is not given, then Node.js will default to using [Mozilla's publicly trusted list of
1086
- * CAs](https://hg.mozilla.org/mozilla-central/raw-file/tip/security/nss/lib/ckfw/builtins/certdata.txt).
1087
- *
1088
- * Custom DHE parameters are discouraged in favor of the new `dhparam: 'auto' `option. When set to `'auto'`, well-known DHE parameters of sufficient strength
1089
- * will be selected automatically. Otherwise, if necessary, `openssl dhparam` can
1090
- * be used to create custom parameters. The key length must be greater than or
1091
- * equal to 1024 bits or else an error will be thrown. Although 1024 bits is
1092
- * permissible, use 2048 bits or larger for stronger security.
1093
- * @since v0.11.13
1094
- */
1095
- function createSecureContext(options?: SecureContextOptions): SecureContext;
1096
- /**
1097
- * Returns an array containing the CA certificates from various sources, depending on `type`:
1098
- *
1099
- * * `"default"`: return the CA certificates that will be used by the Node.js TLS clients by default.
1100
- * * When `--use-bundled-ca` is enabled (default), or `--use-openssl-ca` is not enabled,
1101
- * this would include CA certificates from the bundled Mozilla CA store.
1102
- * * When `--use-system-ca` is enabled, this would also include certificates from the system's
1103
- * trusted store.
1104
- * * When `NODE_EXTRA_CA_CERTS` is used, this would also include certificates loaded from the specified
1105
- * file.
1106
- * * `"system"`: return the CA certificates that are loaded from the system's trusted store, according
1107
- * to rules set by `--use-system-ca`. This can be used to get the certificates from the system
1108
- * when `--use-system-ca` is not enabled.
1109
- * * `"bundled"`: return the CA certificates from the bundled Mozilla CA store. This would be the same
1110
- * as `tls.rootCertificates`.
1111
- * * `"extra"`: return the CA certificates loaded from `NODE_EXTRA_CA_CERTS`. It's an empty array if
1112
- * `NODE_EXTRA_CA_CERTS` is not set.
1113
- * @since v22.15.0
1114
- * @param type The type of CA certificates that will be returned. Valid values
1115
- * are `"default"`, `"system"`, `"bundled"` and `"extra"`.
1116
- * **Default:** `"default"`.
1117
- * @returns An array of PEM-encoded certificates. The array may contain duplicates
1118
- * if the same certificate is repeatedly stored in multiple sources.
1119
- */
1120
- function getCACertificates(type?: "default" | "system" | "bundled" | "extra"): string[];
1121
- /**
1122
- * Returns an array with the names of the supported TLS ciphers. The names are
1123
- * lower-case for historical reasons, but must be uppercased to be used in
1124
- * the `ciphers` option of `{@link createSecureContext}`.
1125
- *
1126
- * Not all supported ciphers are enabled by default. See
1127
- * [Modifying the default TLS cipher suite](https://nodejs.org/docs/latest-v26.x/api/tls.html#modifying-the-default-tls-cipher-suite).
1128
- *
1129
- * Cipher names that start with `'tls_'` are for TLSv1.3, all the others are for
1130
- * TLSv1.2 and below.
1131
- *
1132
- * ```js
1133
- * console.log(tls.getCiphers()); // ['aes128-gcm-sha256', 'aes128-sha', ...]
1134
- * ```
1135
- * @since v0.10.2
1136
- */
1137
- function getCiphers(): string[];
1138
- /**
1139
- * Returns an array with the names of the RFC 8879 certificate compression
1140
- * algorithms supported by the current OpenSSL build, suitable for use in the
1141
- * `certificateCompression` option of `tls.createSecureContext()`. Possible
1142
- * values include `'zlib'`, `'brotli'`, and `'zstd'`.
1143
- *
1144
- * The array is empty when certificate compression is unavailable.
1145
- *
1146
- * ```js
1147
- * console.log(tls.getCertificateCompressionAlgorithms()); // ['zlib', 'brotli', 'zstd']
1148
- * ```
1149
- * @since v26.4.0
1150
- */
1151
- function getCertificateCompressionAlgorithms(): CertificateCompressionAlgorithm[];
1152
- /**
1153
- * Sets the default CA certificates used by Node.js TLS clients. If the provided
1154
- * certificates are parsed successfully, they will become the default CA
1155
- * certificate list returned by {@link getCACertificates} and used
1156
- * by subsequent TLS connections that don't specify their own CA certificates.
1157
- * The certificates will be deduplicated before being set as the default.
1158
- *
1159
- * This function only affects the current Node.js thread. Previous
1160
- * sessions cached by the HTTPS agent won't be affected by this change, so
1161
- * this method should be called before any unwanted cachable TLS connections are
1162
- * made.
1163
- *
1164
- * To use system CA certificates as the default:
1165
- *
1166
- * ```js
1167
- * import tls from 'node:tls';
1168
- * tls.setDefaultCACertificates(tls.getCACertificates('system'));
1169
- * ```
1170
- *
1171
- * This function completely replaces the default CA certificate list. To add additional
1172
- * certificates to the existing defaults, get the current certificates and append to them:
1173
- *
1174
- * ```js
1175
- * import tls from 'node:tls';
1176
- * const currentCerts = tls.getCACertificates('default');
1177
- * const additionalCerts = ['-----BEGIN CERTIFICATE-----\n...'];
1178
- * tls.setDefaultCACertificates([...currentCerts, ...additionalCerts]);
1179
- * ```
1180
- * @since v24.5.0
1181
- * @param certs An array of CA certificates in PEM format.
1182
- */
1183
- function setDefaultCACertificates(certs: ReadonlyArray<string | NodeJS.ArrayBufferView>): void;
1184
- /**
1185
- * The default named curve or TLS group list to use for key agreement in a TLS
1186
- * server. The default value is `'auto'`. See `tls.createSecureContext()` for
1187
- * further information.
1188
- * @since v0.11.13
1189
- */
1190
- let DEFAULT_ECDH_CURVE: string;
1191
- /**
1192
- * The default value of the `maxVersion` option of `{@link createSecureContext()}`.
1193
- * It can be assigned any of the supported TLS protocol versions,
1194
- * `'TLSv1.3'`, `'TLSv1.2'`, `'TLSv1.1'`, or `'TLSv1'`. **Default:** `'TLSv1.3'`, unless
1195
- * changed using CLI options. Using `--tls-max-v1.2` sets the default to `'TLSv1.2'`. Using
1196
- * `--tls-max-v1.3` sets the default to `'TLSv1.3'`. If multiple of the options
1197
- * are provided, the highest maximum is used.
1198
- * @since v11.4.0
1199
- */
1200
- let DEFAULT_MAX_VERSION: SecureVersion;
1201
- /**
1202
- * The default value of the `minVersion` option of `{@link createSecureContext()}`.
1203
- * It can be assigned any of the supported TLS protocol versions,
1204
- * `'TLSv1.3'`, `'TLSv1.2'`, `'TLSv1.1'`, or `'TLSv1'`. **Default:** `'TLSv1.2'`, unless
1205
- * changed using CLI options. Using `--tls-min-v1.0` sets the default to
1206
- * `'TLSv1'`. Using `--tls-min-v1.1` sets the default to `'TLSv1.1'`. Using
1207
- * `--tls-min-v1.3` sets the default to `'TLSv1.3'`. If multiple of the options
1208
- * are provided, the lowest minimum is used.
1209
- * @since v11.4.0
1210
- */
1211
- let DEFAULT_MIN_VERSION: SecureVersion;
1212
- /**
1213
- * The default value of the `ciphers` option of `{@link createSecureContext()}`.
1214
- * It can be assigned any of the supported OpenSSL ciphers.
1215
- * Defaults to the content of `crypto.constants.defaultCoreCipherList`, unless
1216
- * changed using CLI options using `--tls-default-ciphers`.
1217
- * @since v19.8.0
1218
- */
1219
- let DEFAULT_CIPHERS: string;
1220
- /**
1221
- * An immutable array of strings representing the root certificates (in PEM format)
1222
- * from the bundled Mozilla CA store as supplied by the current Node.js version.
1223
- *
1224
- * The bundled CA store, as supplied by Node.js, is a snapshot of Mozilla CA store
1225
- * that is fixed at release time. It is identical on all supported platforms.
1226
- * @since v12.3.0
1227
- */
1228
- const rootCertificates: readonly string[];
1229
- }
1230
- declare module "tls" {
1231
- export * from "node:tls";
1232
- }