@node-red/editor-client 3.0.2 → 3.1.0-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.
- package/locales/de/editor.json +2 -0
- package/locales/de/infotips.json +0 -0
- package/locales/de/jsonata.json +0 -0
- package/locales/en-US/editor.json +37 -6
- package/locales/en-US/infotips.json +0 -0
- package/locales/en-US/jsonata.json +0 -0
- package/locales/fr/editor.json +1238 -0
- package/locales/fr/infotips.json +23 -0
- package/locales/fr/jsonata.json +274 -0
- package/locales/ja/editor.json +48 -9
- package/locales/ko/editor.json +233 -31
- package/locales/ko/infotips.json +0 -0
- package/locales/ko/jsonata.json +0 -0
- package/locales/pt-BR/editor.json +1208 -0
- package/locales/pt-BR/infotips.json +23 -0
- package/locales/pt-BR/jsonata.json +274 -0
- package/locales/ru/editor.json +2 -0
- package/locales/ru/infotips.json +0 -0
- package/locales/ru/jsonata.json +0 -0
- package/locales/zh-CN/editor.json +1175 -1049
- package/locales/zh-TW/editor.json +3 -0
- package/package.json +1 -1
- package/public/red/about +140 -0
- package/public/red/red.js +2699 -1397
- package/public/red/red.min.js +4 -3
- package/public/red/style.min.css +1 -1
- package/public/red/tours/3.0/images/context-menu.png +0 -0
- package/public/red/tours/3.0/welcome.js +155 -0
- package/public/red/tours/images/context-menu.png +0 -0
- package/public/red/tours/images/global-env-vars.png +0 -0
- package/public/red/tours/images/hiding-flows.png +0 -0
- package/public/red/tours/images/locking-flows.png +0 -0
- package/public/red/tours/images/mermaid.png +0 -0
- package/public/red/tours/images/node-help.png +0 -0
- package/public/red/tours/images/tab-changes.png +0 -0
- package/public/red/tours/welcome.js +111 -94
- package/public/types/node/assert/strict.d.ts +11 -0
- package/public/types/node/assert.d.ts +898 -64
- package/public/types/node/async_hooks.d.ts +362 -94
- package/public/types/node/buffer.d.ts +2158 -14
- package/public/types/node/child_process.d.ts +1109 -257
- package/public/types/node/cluster.d.ts +349 -200
- package/public/types/node/console.d.ts +313 -43
- package/public/types/node/crypto.d.ts +3329 -656
- package/public/types/node/dgram.d.ts +459 -58
- package/public/types/node/diagnostics_channel.d.ts +155 -0
- package/public/types/node/dns/promises.d.ts +371 -0
- package/public/types/node/dns.d.ts +532 -265
- package/public/types/node/domain.d.ts +159 -16
- package/public/types/node/events.d.ts +589 -30
- package/public/types/node/fs/promises.d.ts +1097 -0
- package/public/types/node/fs.d.ts +2484 -958
- package/public/types/node/globals.d.ts +43 -503
- package/public/types/node/http.d.ts +1156 -145
- package/public/types/node/http2.d.ts +1610 -470
- package/public/types/node/https.d.ts +462 -72
- package/public/types/node/module.d.ts +72 -13
- package/public/types/node/net.d.ts +663 -131
- package/public/types/node/os.d.ts +238 -25
- package/public/types/node/path.d.ts +57 -23
- package/public/types/node/perf_hooks.d.ts +424 -112
- package/public/types/node/process.d.ts +1261 -193
- package/public/types/node/querystring.d.ts +107 -7
- package/public/types/node/readline.d.ts +443 -74
- package/public/types/node/stream/consumers.d.ts +15 -0
- package/public/types/node/stream/promises.d.ts +45 -0
- package/public/types/node/stream/web.d.ts +395 -0
- package/public/types/node/stream.d.ts +1081 -177
- package/public/types/node/string_decoder.d.ts +57 -0
- package/public/types/node/test.d.ts +193 -0
- package/public/types/node/timers/promises.d.ts +96 -0
- package/public/types/node/timers.d.ts +87 -12
- package/public/types/node/tls.d.ts +457 -222
- package/public/types/node/trace_events.d.ts +107 -10
- package/public/types/node/tty.d.ts +158 -23
- package/public/types/node/url.d.ts +734 -28
- package/public/types/node/util.d.ts +1542 -164
- package/public/types/node/v8.d.ts +261 -73
- package/public/types/node/vm.d.ts +384 -32
- package/public/types/node/wasi.d.ts +92 -23
- package/public/types/node/worker_threads.d.ts +531 -123
- package/public/types/node/zlib.d.ts +216 -63
- package/public/types/node-red/func.d.ts +3 -0
- package/public/vendor/jquery/css/base/images/ui-icons_444444_256x240.png +0 -0
- package/public/vendor/jquery/css/base/images/ui-icons_555555_256x240.png +0 -0
- package/public/vendor/jquery/css/base/images/ui-icons_777620_256x240.png +0 -0
- package/public/vendor/jquery/css/base/images/ui-icons_777777_256x240.png +0 -0
- package/public/vendor/jquery/css/base/images/ui-icons_cc0000_256x240.png +0 -0
- package/public/vendor/jquery/css/base/images/ui-icons_ffffff_256x240.png +0 -0
- package/public/vendor/jquery/css/base/jquery-ui.min.css +4 -4
- package/public/vendor/mermaid/mermaid.min.js +1284 -0
- package/public/vendor/monaco/dist/{ade705761eb7e702770d.ttf → 7064e66c3890a12c47b4.ttf} +0 -0
- package/public/vendor/monaco/dist/css.worker.js +1 -1
- package/public/vendor/monaco/dist/css.worker.js.LICENSE.txt +1 -1
- package/public/vendor/monaco/dist/editor.js +1 -1
- package/public/vendor/monaco/dist/editor.js.LICENSE.txt +5 -1
- package/public/vendor/monaco/dist/editor.worker.js +1 -1
- package/public/vendor/monaco/dist/html.worker.js +1 -1
- package/public/vendor/monaco/dist/html.worker.js.LICENSE.txt +1 -1
- package/public/vendor/monaco/dist/json.worker.js +1 -1
- package/public/vendor/monaco/dist/json.worker.js.LICENSE.txt +1 -1
- package/public/vendor/monaco/dist/locale/cs.js +319 -71
- package/public/vendor/monaco/dist/locale/de.js +323 -75
- package/public/vendor/monaco/dist/locale/es.js +318 -70
- package/public/vendor/monaco/dist/locale/fr.js +327 -79
- package/public/vendor/monaco/dist/locale/it.js +325 -77
- package/public/vendor/monaco/dist/locale/ja.js +337 -89
- package/public/vendor/monaco/dist/locale/ko.js +324 -76
- package/public/vendor/monaco/dist/locale/pl.js +322 -74
- package/public/vendor/monaco/dist/locale/pt-br.js +321 -73
- package/public/vendor/monaco/dist/locale/qps-ploc.js +1580 -1332
- package/public/vendor/monaco/dist/locale/ru.js +324 -76
- package/public/vendor/monaco/dist/locale/tr.js +326 -78
- package/public/vendor/monaco/dist/locale/zh-hans.js +328 -80
- package/public/vendor/monaco/dist/locale/zh-hant.js +321 -73
- package/public/vendor/monaco/dist/theme/forge.json +236 -0
- package/public/vendor/monaco/dist/theme/github-dark.json +348 -0
- package/public/vendor/monaco/dist/theme/github-light.json +348 -0
- package/public/vendor/monaco/dist/theme/nord.json +93 -0
- package/public/vendor/monaco/dist/ts.worker.js +1 -1
- package/public/vendor/monaco/dist/ts.worker.js.LICENSE.txt +14 -6
- package/public/vendor/vendor.js +9 -15
- /package/public/red/tours/{images → 3.0/images}/continuous-search.png +0 -0
- /package/public/red/tours/{images → 3.0/images}/debug-path-tooltip.png +0 -0
- /package/public/red/tours/{images → 3.0/images}/junction-quick-add.png +0 -0
- /package/public/red/tours/{images → 3.0/images}/junction-slice.gif +0 -0
- /package/public/red/tours/{images → 3.0/images}/split-wire-with-links.gif +0 -0
|
@@ -1,13 +1,21 @@
|
|
|
1
1
|
|
|
2
2
|
/* NOTE: Do not edit directly! This file is generated using `npm run update-types` in https://github.com/Steve-Mcl/monaco-editor-esm-i18n */
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* The `tls` module provides an implementation of the Transport Layer Security
|
|
6
|
+
* (TLS) and Secure Socket Layer (SSL) protocols that is built on top of OpenSSL.
|
|
7
|
+
* The module can be accessed using:
|
|
8
|
+
*
|
|
9
|
+
* ```js
|
|
10
|
+
* const tls = require('tls');
|
|
11
|
+
* ```
|
|
12
|
+
* @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/tls.js)
|
|
13
|
+
*/
|
|
4
14
|
declare module 'tls' {
|
|
5
|
-
import
|
|
6
|
-
import * as
|
|
7
|
-
|
|
15
|
+
import { X509Certificate } from 'node:crypto';
|
|
16
|
+
import * as net from 'node:net';
|
|
8
17
|
const CLIENT_RENEG_LIMIT: number;
|
|
9
18
|
const CLIENT_RENEG_WINDOW: number;
|
|
10
|
-
|
|
11
19
|
interface Certificate {
|
|
12
20
|
/**
|
|
13
21
|
* Country code.
|
|
@@ -34,7 +42,6 @@ declare module 'tls' {
|
|
|
34
42
|
*/
|
|
35
43
|
CN: string;
|
|
36
44
|
}
|
|
37
|
-
|
|
38
45
|
interface PeerCertificate {
|
|
39
46
|
subject: Certificate;
|
|
40
47
|
issuer: Certificate;
|
|
@@ -50,11 +57,9 @@ declare module 'tls' {
|
|
|
50
57
|
serialNumber: string;
|
|
51
58
|
raw: Buffer;
|
|
52
59
|
}
|
|
53
|
-
|
|
54
60
|
interface DetailedPeerCertificate extends PeerCertificate {
|
|
55
61
|
issuerCertificate: DetailedPeerCertificate;
|
|
56
62
|
}
|
|
57
|
-
|
|
58
63
|
interface CipherNameAndProtocol {
|
|
59
64
|
/**
|
|
60
65
|
* The cipher name.
|
|
@@ -64,13 +69,11 @@ declare module 'tls' {
|
|
|
64
69
|
* SSL/TLS protocol version.
|
|
65
70
|
*/
|
|
66
71
|
version: string;
|
|
67
|
-
|
|
68
72
|
/**
|
|
69
73
|
* IETF name for the cipher suite.
|
|
70
74
|
*/
|
|
71
75
|
standardName: string;
|
|
72
76
|
}
|
|
73
|
-
|
|
74
77
|
interface EphemeralKeyInfo {
|
|
75
78
|
/**
|
|
76
79
|
* The supported types are 'DH' and 'ECDH'.
|
|
@@ -85,7 +88,6 @@ declare module 'tls' {
|
|
|
85
88
|
*/
|
|
86
89
|
size: number;
|
|
87
90
|
}
|
|
88
|
-
|
|
89
91
|
interface KeyObject {
|
|
90
92
|
/**
|
|
91
93
|
* Private keys in PEM format.
|
|
@@ -96,7 +98,6 @@ declare module 'tls' {
|
|
|
96
98
|
*/
|
|
97
99
|
passphrase?: string | undefined;
|
|
98
100
|
}
|
|
99
|
-
|
|
100
101
|
interface PxfObject {
|
|
101
102
|
/**
|
|
102
103
|
* PFX or PKCS12 encoded private key and certificate chain.
|
|
@@ -107,7 +108,6 @@ declare module 'tls' {
|
|
|
107
108
|
*/
|
|
108
109
|
passphrase?: string | undefined;
|
|
109
110
|
}
|
|
110
|
-
|
|
111
111
|
interface TLSSocketOptions extends SecureContextOptions, CommonConnectionOptions {
|
|
112
112
|
/**
|
|
113
113
|
* If true the TLS socket will be instantiated in server-mode.
|
|
@@ -118,7 +118,6 @@ declare module 'tls' {
|
|
|
118
118
|
* An optional net.Server instance.
|
|
119
119
|
*/
|
|
120
120
|
server?: net.Server | undefined;
|
|
121
|
-
|
|
122
121
|
/**
|
|
123
122
|
* An optional Buffer instance containing a TLS session.
|
|
124
123
|
*/
|
|
@@ -130,227 +129,307 @@ declare module 'tls' {
|
|
|
130
129
|
*/
|
|
131
130
|
requestOCSP?: boolean | undefined;
|
|
132
131
|
}
|
|
133
|
-
|
|
132
|
+
/**
|
|
133
|
+
* Performs transparent encryption of written data and all required TLS
|
|
134
|
+
* negotiation.
|
|
135
|
+
*
|
|
136
|
+
* Instances of `tls.TLSSocket` implement the duplex `Stream` interface.
|
|
137
|
+
*
|
|
138
|
+
* Methods that return TLS connection metadata (e.g.{@link TLSSocket.getPeerCertificate} will only return data while the
|
|
139
|
+
* connection is open.
|
|
140
|
+
* @since v0.11.4
|
|
141
|
+
*/
|
|
134
142
|
class TLSSocket extends net.Socket {
|
|
135
143
|
/**
|
|
136
144
|
* Construct a new tls.TLSSocket object from an existing TCP socket.
|
|
137
145
|
*/
|
|
138
146
|
constructor(socket: net.Socket, options?: TLSSocketOptions);
|
|
139
|
-
|
|
140
147
|
/**
|
|
141
|
-
*
|
|
148
|
+
* Returns `true` if the peer certificate was signed by one of the CAs specified
|
|
149
|
+
* when creating the `tls.TLSSocket` instance, otherwise `false`.
|
|
150
|
+
* @since v0.11.4
|
|
142
151
|
*/
|
|
143
152
|
authorized: boolean;
|
|
144
153
|
/**
|
|
145
|
-
*
|
|
146
|
-
*
|
|
154
|
+
* Returns the reason why the peer's certificate was not been verified. This
|
|
155
|
+
* property is set only when `tlsSocket.authorized === false`.
|
|
156
|
+
* @since v0.11.4
|
|
147
157
|
*/
|
|
148
158
|
authorizationError: Error;
|
|
149
159
|
/**
|
|
150
|
-
*
|
|
151
|
-
*
|
|
160
|
+
* Always returns `true`. This may be used to distinguish TLS sockets from regular`net.Socket` instances.
|
|
161
|
+
* @since v0.11.4
|
|
152
162
|
*/
|
|
153
|
-
encrypted:
|
|
154
|
-
|
|
163
|
+
encrypted: true;
|
|
155
164
|
/**
|
|
156
165
|
* String containing the selected ALPN protocol.
|
|
157
166
|
* Before a handshake has completed, this value is always null.
|
|
158
167
|
* When a handshake is completed but not ALPN protocol was selected, tlsSocket.alpnProtocol equals false.
|
|
159
168
|
*/
|
|
160
169
|
alpnProtocol: string | false | null;
|
|
161
|
-
|
|
162
170
|
/**
|
|
163
|
-
* Returns an object representing the local certificate. The returned
|
|
164
|
-
*
|
|
165
|
-
* certificate.
|
|
171
|
+
* Returns an object representing the local certificate. The returned object has
|
|
172
|
+
* some properties corresponding to the fields of the certificate.
|
|
166
173
|
*
|
|
167
|
-
* See
|
|
168
|
-
*
|
|
174
|
+
* See {@link TLSSocket.getPeerCertificate} for an example of the certificate
|
|
175
|
+
* structure.
|
|
169
176
|
*
|
|
170
|
-
* If there is no local certificate, an empty object will be returned.
|
|
171
|
-
*
|
|
177
|
+
* If there is no local certificate, an empty object will be returned. If the
|
|
178
|
+
* socket has been destroyed, `null` will be returned.
|
|
179
|
+
* @since v11.2.0
|
|
172
180
|
*/
|
|
173
181
|
getCertificate(): PeerCertificate | object | null;
|
|
174
182
|
/**
|
|
175
|
-
* Returns an object
|
|
176
|
-
*
|
|
177
|
-
*
|
|
183
|
+
* Returns an object containing information on the negotiated cipher suite.
|
|
184
|
+
*
|
|
185
|
+
* For example:
|
|
186
|
+
*
|
|
187
|
+
* ```json
|
|
188
|
+
* {
|
|
189
|
+
* "name": "AES128-SHA256",
|
|
190
|
+
* "standardName": "TLS_RSA_WITH_AES_128_CBC_SHA256",
|
|
191
|
+
* "version": "TLSv1.2"
|
|
192
|
+
* }
|
|
193
|
+
* ```
|
|
194
|
+
*
|
|
195
|
+
* See [SSL\_CIPHER\_get\_name](https://www.openssl.org/docs/man1.1.1/man3/SSL_CIPHER_get_name.html) for more information.
|
|
196
|
+
* @since v0.11.4
|
|
178
197
|
*/
|
|
179
198
|
getCipher(): CipherNameAndProtocol;
|
|
180
199
|
/**
|
|
181
|
-
* Returns an object representing the type, name, and size of parameter
|
|
182
|
-
*
|
|
200
|
+
* Returns an object representing the type, name, and size of parameter of
|
|
201
|
+
* an ephemeral key exchange in `perfect forward secrecy` on a client
|
|
183
202
|
* connection. It returns an empty object when the key exchange is not
|
|
184
|
-
* ephemeral. As this is only supported on a client socket; null is
|
|
185
|
-
*
|
|
186
|
-
* and 'ECDH'. The name property is available only when type is 'ECDH'.
|
|
203
|
+
* ephemeral. As this is only supported on a client socket; `null` is returned
|
|
204
|
+
* if called on a server socket. The supported types are `'DH'` and `'ECDH'`. The`name` property is available only when type is `'ECDH'`.
|
|
187
205
|
*
|
|
188
|
-
* For example: { type: 'ECDH', name: 'prime256v1', size: 256 }
|
|
206
|
+
* For example: `{ type: 'ECDH', name: 'prime256v1', size: 256 }`.
|
|
207
|
+
* @since v5.0.0
|
|
189
208
|
*/
|
|
190
209
|
getEphemeralKeyInfo(): EphemeralKeyInfo | object | null;
|
|
191
210
|
/**
|
|
192
|
-
*
|
|
193
|
-
*
|
|
194
|
-
*
|
|
195
|
-
*
|
|
196
|
-
* As the Finished messages are message digests of the complete
|
|
197
|
-
* handshake (with a total of 192 bits for TLS 1.0 and more for SSL
|
|
198
|
-
* 3.0), they can be used for external authentication procedures when
|
|
199
|
-
* the authentication provided by SSL/TLS is not desired or is not
|
|
200
|
-
* enough.
|
|
211
|
+
* As the `Finished` messages are message digests of the complete handshake
|
|
212
|
+
* (with a total of 192 bits for TLS 1.0 and more for SSL 3.0), they can
|
|
213
|
+
* be used for external authentication procedures when the authentication
|
|
214
|
+
* provided by SSL/TLS is not desired or is not enough.
|
|
201
215
|
*
|
|
202
|
-
* Corresponds to the SSL_get_finished routine in OpenSSL and may be
|
|
203
|
-
*
|
|
216
|
+
* Corresponds to the `SSL_get_finished` routine in OpenSSL and may be used
|
|
217
|
+
* to implement the `tls-unique` channel binding from [RFC 5929](https://tools.ietf.org/html/rfc5929).
|
|
218
|
+
* @since v9.9.0
|
|
219
|
+
* @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.
|
|
204
220
|
*/
|
|
205
221
|
getFinished(): Buffer | undefined;
|
|
206
222
|
/**
|
|
207
|
-
* Returns an object representing the peer's certificate.
|
|
208
|
-
*
|
|
209
|
-
*
|
|
210
|
-
*
|
|
211
|
-
* If the
|
|
212
|
-
*
|
|
213
|
-
* @
|
|
223
|
+
* Returns an object representing the peer's certificate. If the peer does not
|
|
224
|
+
* provide a certificate, an empty object will be returned. If the socket has been
|
|
225
|
+
* destroyed, `null` will be returned.
|
|
226
|
+
*
|
|
227
|
+
* If the full certificate chain was requested, each certificate will include an`issuerCertificate` property containing an object representing its issuer's
|
|
228
|
+
* certificate.
|
|
229
|
+
* @since v0.11.4
|
|
230
|
+
* @param detailed Include the full certificate chain if `true`, otherwise include just the peer's certificate.
|
|
231
|
+
* @return A certificate object.
|
|
214
232
|
*/
|
|
215
233
|
getPeerCertificate(detailed: true): DetailedPeerCertificate;
|
|
216
234
|
getPeerCertificate(detailed?: false): PeerCertificate;
|
|
217
235
|
getPeerCertificate(detailed?: boolean): PeerCertificate | DetailedPeerCertificate;
|
|
218
236
|
/**
|
|
219
|
-
*
|
|
220
|
-
*
|
|
221
|
-
*
|
|
237
|
+
* As the `Finished` messages are message digests of the complete handshake
|
|
238
|
+
* (with a total of 192 bits for TLS 1.0 and more for SSL 3.0), they can
|
|
239
|
+
* be used for external authentication procedures when the authentication
|
|
240
|
+
* provided by SSL/TLS is not desired or is not enough.
|
|
222
241
|
*
|
|
223
|
-
*
|
|
224
|
-
*
|
|
225
|
-
*
|
|
226
|
-
* the
|
|
227
|
-
*
|
|
228
|
-
*
|
|
229
|
-
* Corresponds to the SSL_get_peer_finished routine in OpenSSL and may
|
|
230
|
-
* be used to implement the tls-unique channel binding from RFC 5929.
|
|
242
|
+
* Corresponds to the `SSL_get_peer_finished` routine in OpenSSL and may be used
|
|
243
|
+
* to implement the `tls-unique` channel binding from [RFC 5929](https://tools.ietf.org/html/rfc5929).
|
|
244
|
+
* @since v9.9.0
|
|
245
|
+
* @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
|
|
246
|
+
* far.
|
|
231
247
|
*/
|
|
232
248
|
getPeerFinished(): Buffer | undefined;
|
|
233
249
|
/**
|
|
234
|
-
* Returns a string containing the negotiated SSL/TLS protocol version of the
|
|
235
|
-
* The value `'unknown'` will be returned for connected
|
|
236
|
-
*
|
|
237
|
-
*
|
|
238
|
-
*
|
|
250
|
+
* Returns a string containing the negotiated SSL/TLS protocol version of the
|
|
251
|
+
* current connection. The value `'unknown'` will be returned for connected
|
|
252
|
+
* sockets that have not completed the handshaking process. The value `null` will
|
|
253
|
+
* be returned for server sockets or disconnected client sockets.
|
|
254
|
+
*
|
|
255
|
+
* Protocol versions are:
|
|
256
|
+
*
|
|
257
|
+
* * `'SSLv3'`
|
|
258
|
+
* * `'TLSv1'`
|
|
259
|
+
* * `'TLSv1.1'`
|
|
260
|
+
* * `'TLSv1.2'`
|
|
261
|
+
* * `'TLSv1.3'`
|
|
262
|
+
*
|
|
263
|
+
* See the OpenSSL [`SSL_get_version`](https://www.openssl.org/docs/man1.1.1/man3/SSL_get_version.html) documentation for more information.
|
|
264
|
+
* @since v5.7.0
|
|
239
265
|
*/
|
|
240
266
|
getProtocol(): string | null;
|
|
241
267
|
/**
|
|
242
|
-
*
|
|
243
|
-
*
|
|
268
|
+
* Returns the TLS session data or `undefined` if no session was
|
|
269
|
+
* 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
|
|
270
|
+
* for debugging.
|
|
271
|
+
*
|
|
272
|
+
* See `Session Resumption` for more information.
|
|
273
|
+
*
|
|
274
|
+
* Note: `getSession()` works only for TLSv1.2 and below. For TLSv1.3, applications
|
|
275
|
+
* must use the `'session'` event (it also works for TLSv1.2 and below).
|
|
276
|
+
* @since v0.11.4
|
|
244
277
|
*/
|
|
245
278
|
getSession(): Buffer | undefined;
|
|
246
279
|
/**
|
|
247
|
-
*
|
|
248
|
-
*
|
|
280
|
+
* See [SSL\_get\_shared\_sigalgs](https://www.openssl.org/docs/man1.1.1/man3/SSL_get_shared_sigalgs.html) for more information.
|
|
281
|
+
* @since v12.11.0
|
|
282
|
+
* @return List of signature algorithms shared between the server and the client in the order of decreasing preference.
|
|
249
283
|
*/
|
|
250
284
|
getSharedSigalgs(): string[];
|
|
251
285
|
/**
|
|
252
|
-
*
|
|
253
|
-
*
|
|
254
|
-
*
|
|
286
|
+
* For a client, returns the TLS session ticket if one is available, or`undefined`. For a server, always returns `undefined`.
|
|
287
|
+
*
|
|
288
|
+
* It may be useful for debugging.
|
|
289
|
+
*
|
|
290
|
+
* See `Session Resumption` for more information.
|
|
291
|
+
* @since v0.11.4
|
|
255
292
|
*/
|
|
256
293
|
getTLSTicket(): Buffer | undefined;
|
|
257
294
|
/**
|
|
258
|
-
*
|
|
295
|
+
* See `Session Resumption` for more information.
|
|
296
|
+
* @since v0.5.6
|
|
297
|
+
* @return `true` if the session was reused, `false` otherwise.
|
|
259
298
|
*/
|
|
260
299
|
isSessionReused(): boolean;
|
|
261
300
|
/**
|
|
262
|
-
*
|
|
301
|
+
* The `tlsSocket.renegotiate()` method initiates a TLS renegotiation process.
|
|
302
|
+
* Upon completion, the `callback` function will be passed a single argument
|
|
303
|
+
* that is either an `Error` (if the request failed) or `null`.
|
|
263
304
|
*
|
|
264
|
-
*
|
|
265
|
-
*
|
|
266
|
-
*
|
|
267
|
-
*
|
|
268
|
-
*
|
|
269
|
-
* is
|
|
270
|
-
*
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
*
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
305
|
+
* This method can be used to request a peer's certificate after the secure
|
|
306
|
+
* connection has been established.
|
|
307
|
+
*
|
|
308
|
+
* When running as the server, the socket will be destroyed with an error after`handshakeTimeout` timeout.
|
|
309
|
+
*
|
|
310
|
+
* For TLSv1.3, renegotiation cannot be initiated, it is not supported by the
|
|
311
|
+
* protocol.
|
|
312
|
+
* @since v0.11.8
|
|
313
|
+
* @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
|
|
314
|
+
* an error, unless the `tlsSocket` has been destroyed, in which case `callback` will not be called at all.
|
|
315
|
+
* @return `true` if renegotiation was initiated, `false` otherwise.
|
|
316
|
+
*/
|
|
317
|
+
renegotiate(
|
|
318
|
+
options: {
|
|
319
|
+
rejectUnauthorized?: boolean | undefined;
|
|
320
|
+
requestCert?: boolean | undefined;
|
|
321
|
+
},
|
|
322
|
+
callback: (err: Error | null) => void
|
|
323
|
+
): undefined | boolean;
|
|
324
|
+
/**
|
|
325
|
+
* The `tlsSocket.setMaxSendFragment()` method sets the maximum TLS fragment size.
|
|
326
|
+
* Returns `true` if setting the limit succeeded; `false` otherwise.
|
|
327
|
+
*
|
|
328
|
+
* Smaller fragment sizes decrease the buffering latency on the client: larger
|
|
329
|
+
* fragments are buffered by the TLS layer until the entire fragment is received
|
|
330
|
+
* and its integrity is verified; large fragments can span multiple roundtrips
|
|
331
|
+
* and their processing can be delayed due to packet loss or reordering. However,
|
|
332
|
+
* smaller fragments add extra TLS framing bytes and CPU overhead, which may
|
|
333
|
+
* decrease overall server throughput.
|
|
334
|
+
* @since v0.11.11
|
|
335
|
+
* @param [size=16384] The maximum TLS fragment size. The maximum value is `16384`.
|
|
282
336
|
*/
|
|
283
337
|
setMaxSendFragment(size: number): boolean;
|
|
284
|
-
|
|
285
338
|
/**
|
|
286
|
-
* Disables TLS renegotiation for this TLSSocket instance. Once called,
|
|
287
|
-
*
|
|
288
|
-
*
|
|
339
|
+
* Disables TLS renegotiation for this `TLSSocket` instance. Once called, attempts
|
|
340
|
+
* to renegotiate will trigger an `'error'` event on the `TLSSocket`.
|
|
341
|
+
* @since v8.4.0
|
|
289
342
|
*/
|
|
290
343
|
disableRenegotiation(): void;
|
|
291
|
-
|
|
292
344
|
/**
|
|
293
345
|
* When enabled, TLS packet trace information is written to `stderr`. This can be
|
|
294
346
|
* used to debug TLS connection problems.
|
|
295
347
|
*
|
|
296
|
-
* Note: The format of the output is identical to the output of `openssl s_client
|
|
297
|
-
*
|
|
298
|
-
* `SSL_trace()` function, the format is undocumented, can change without notice,
|
|
348
|
+
* Note: 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 OpenSSL's`SSL_trace()` function, the format is
|
|
349
|
+
* undocumented, can change without notice,
|
|
299
350
|
* and should not be relied on.
|
|
351
|
+
* @since v12.2.0
|
|
300
352
|
*/
|
|
301
353
|
enableTrace(): void;
|
|
302
|
-
|
|
303
354
|
/**
|
|
355
|
+
* Returns the peer certificate as an `X509Certificate` object.
|
|
356
|
+
*
|
|
357
|
+
* If there is no peer certificate, or the socket has been destroyed,`undefined` will be returned.
|
|
358
|
+
* @since v15.9.0
|
|
359
|
+
*/
|
|
360
|
+
getPeerX509Certificate(): X509Certificate | undefined;
|
|
361
|
+
/**
|
|
362
|
+
* Returns the local certificate as an `X509Certificate` object.
|
|
363
|
+
*
|
|
364
|
+
* If there is no local certificate, or the socket has been destroyed,`undefined` will be returned.
|
|
365
|
+
* @since v15.9.0
|
|
366
|
+
*/
|
|
367
|
+
getX509Certificate(): X509Certificate | undefined;
|
|
368
|
+
/**
|
|
369
|
+
* Keying material is used for validations to prevent different kind of attacks in
|
|
370
|
+
* network protocols, for example in the specifications of IEEE 802.1X.
|
|
371
|
+
*
|
|
372
|
+
* Example
|
|
373
|
+
*
|
|
374
|
+
* ```js
|
|
375
|
+
* const keyingMaterial = tlsSocket.exportKeyingMaterial(
|
|
376
|
+
* 128,
|
|
377
|
+
* 'client finished');
|
|
378
|
+
*
|
|
379
|
+
*
|
|
380
|
+
* Example return value of keyingMaterial:
|
|
381
|
+
* <Buffer 76 26 af 99 c5 56 8e 42 09 91 ef 9f 93 cb ad 6c 7b 65 f8 53 f1 d8 d9
|
|
382
|
+
* 12 5a 33 b8 b5 25 df 7b 37 9f e0 e2 4f b8 67 83 a3 2f cd 5d 41 42 4c 91
|
|
383
|
+
* 74 ef 2c ... 78 more bytes>
|
|
384
|
+
*
|
|
385
|
+
* ```
|
|
386
|
+
*
|
|
387
|
+
* See the OpenSSL [`SSL_export_keying_material`](https://www.openssl.org/docs/man1.1.1/man3/SSL_export_keying_material.html) documentation for more
|
|
388
|
+
* information.
|
|
389
|
+
* @since v13.10.0, v12.17.0
|
|
304
390
|
* @param length number of bytes to retrieve from keying material
|
|
305
|
-
* @param label an application specific label, typically this will be a value from the
|
|
306
|
-
*
|
|
307
|
-
* @param context
|
|
391
|
+
* @param label an application specific label, typically this will be a value from the [IANA Exporter Label
|
|
392
|
+
* Registry](https://www.iana.org/assignments/tls-parameters/tls-parameters.xhtml#exporter-labels).
|
|
393
|
+
* @param context Optionally provide a context.
|
|
394
|
+
* @return requested bytes of the keying material
|
|
308
395
|
*/
|
|
309
396
|
exportKeyingMaterial(length: number, label: string, context: Buffer): Buffer;
|
|
310
|
-
|
|
311
397
|
addListener(event: string, listener: (...args: any[]) => void): this;
|
|
312
|
-
addListener(event:
|
|
313
|
-
addListener(event:
|
|
314
|
-
addListener(event:
|
|
315
|
-
addListener(event:
|
|
316
|
-
|
|
398
|
+
addListener(event: 'OCSPResponse', listener: (response: Buffer) => void): this;
|
|
399
|
+
addListener(event: 'secureConnect', listener: () => void): this;
|
|
400
|
+
addListener(event: 'session', listener: (session: Buffer) => void): this;
|
|
401
|
+
addListener(event: 'keylog', listener: (line: Buffer) => void): this;
|
|
317
402
|
emit(event: string | symbol, ...args: any[]): boolean;
|
|
318
|
-
emit(event:
|
|
319
|
-
emit(event:
|
|
320
|
-
emit(event:
|
|
321
|
-
emit(event:
|
|
322
|
-
|
|
403
|
+
emit(event: 'OCSPResponse', response: Buffer): boolean;
|
|
404
|
+
emit(event: 'secureConnect'): boolean;
|
|
405
|
+
emit(event: 'session', session: Buffer): boolean;
|
|
406
|
+
emit(event: 'keylog', line: Buffer): boolean;
|
|
323
407
|
on(event: string, listener: (...args: any[]) => void): this;
|
|
324
|
-
on(event:
|
|
325
|
-
on(event:
|
|
326
|
-
on(event:
|
|
327
|
-
on(event:
|
|
328
|
-
|
|
408
|
+
on(event: 'OCSPResponse', listener: (response: Buffer) => void): this;
|
|
409
|
+
on(event: 'secureConnect', listener: () => void): this;
|
|
410
|
+
on(event: 'session', listener: (session: Buffer) => void): this;
|
|
411
|
+
on(event: 'keylog', listener: (line: Buffer) => void): this;
|
|
329
412
|
once(event: string, listener: (...args: any[]) => void): this;
|
|
330
|
-
once(event:
|
|
331
|
-
once(event:
|
|
332
|
-
once(event:
|
|
333
|
-
once(event:
|
|
334
|
-
|
|
413
|
+
once(event: 'OCSPResponse', listener: (response: Buffer) => void): this;
|
|
414
|
+
once(event: 'secureConnect', listener: () => void): this;
|
|
415
|
+
once(event: 'session', listener: (session: Buffer) => void): this;
|
|
416
|
+
once(event: 'keylog', listener: (line: Buffer) => void): this;
|
|
335
417
|
prependListener(event: string, listener: (...args: any[]) => void): this;
|
|
336
|
-
prependListener(event:
|
|
337
|
-
prependListener(event:
|
|
338
|
-
prependListener(event:
|
|
339
|
-
prependListener(event:
|
|
340
|
-
|
|
418
|
+
prependListener(event: 'OCSPResponse', listener: (response: Buffer) => void): this;
|
|
419
|
+
prependListener(event: 'secureConnect', listener: () => void): this;
|
|
420
|
+
prependListener(event: 'session', listener: (session: Buffer) => void): this;
|
|
421
|
+
prependListener(event: 'keylog', listener: (line: Buffer) => void): this;
|
|
341
422
|
prependOnceListener(event: string, listener: (...args: any[]) => void): this;
|
|
342
|
-
prependOnceListener(event:
|
|
343
|
-
prependOnceListener(event:
|
|
344
|
-
prependOnceListener(event:
|
|
345
|
-
prependOnceListener(event:
|
|
423
|
+
prependOnceListener(event: 'OCSPResponse', listener: (response: Buffer) => void): this;
|
|
424
|
+
prependOnceListener(event: 'secureConnect', listener: () => void): this;
|
|
425
|
+
prependOnceListener(event: 'session', listener: (session: Buffer) => void): this;
|
|
426
|
+
prependOnceListener(event: 'keylog', listener: (line: Buffer) => void): this;
|
|
346
427
|
}
|
|
347
|
-
|
|
348
428
|
interface CommonConnectionOptions {
|
|
349
429
|
/**
|
|
350
430
|
* An optional TLS context object from tls.createSecureContext()
|
|
351
431
|
*/
|
|
352
432
|
secureContext?: SecureContext | undefined;
|
|
353
|
-
|
|
354
433
|
/**
|
|
355
434
|
* When enabled, TLS packet trace information is written to `stderr`. This can be
|
|
356
435
|
* used to debug TLS connection problems.
|
|
@@ -377,7 +456,7 @@ declare module 'tls' {
|
|
|
377
456
|
* SecureContext.) If SNICallback wasn't provided the default callback
|
|
378
457
|
* with high-level API will be used (see below).
|
|
379
458
|
*/
|
|
380
|
-
SNICallback?: ((servername: string, cb: (err: Error | null, ctx
|
|
459
|
+
SNICallback?: ((servername: string, cb: (err: Error | null, ctx?: SecureContext) => void) => void) | undefined;
|
|
381
460
|
/**
|
|
382
461
|
* If true the server will reject any connection which is not
|
|
383
462
|
* authorized with the list of supplied CAs. This option only has an
|
|
@@ -386,7 +465,6 @@ declare module 'tls' {
|
|
|
386
465
|
*/
|
|
387
466
|
rejectUnauthorized?: boolean | undefined;
|
|
388
467
|
}
|
|
389
|
-
|
|
390
468
|
interface TlsOptions extends SecureContextOptions, CommonConnectionOptions, net.ServerOpts {
|
|
391
469
|
/**
|
|
392
470
|
* Abort the connection if the SSL/TLS handshake does not finish in the
|
|
@@ -405,7 +483,6 @@ declare module 'tls' {
|
|
|
405
483
|
* 48-bytes of cryptographically strong pseudo-random data.
|
|
406
484
|
*/
|
|
407
485
|
ticketKeys?: Buffer | undefined;
|
|
408
|
-
|
|
409
486
|
/**
|
|
410
487
|
*
|
|
411
488
|
* @param socket
|
|
@@ -425,7 +502,6 @@ declare module 'tls' {
|
|
|
425
502
|
* requires explicitly specifying a cipher suite with the `ciphers` option.
|
|
426
503
|
* More information can be found in the RFC 4279.
|
|
427
504
|
*/
|
|
428
|
-
|
|
429
505
|
pskCallback?(socket: TLSSocket, identity: string): DataView | NodeJS.TypedArray | null;
|
|
430
506
|
/**
|
|
431
507
|
* hint to send to a client to help
|
|
@@ -435,17 +511,15 @@ declare module 'tls' {
|
|
|
435
511
|
*/
|
|
436
512
|
pskIdentityHint?: string | undefined;
|
|
437
513
|
}
|
|
438
|
-
|
|
439
514
|
interface PSKCallbackNegotation {
|
|
440
515
|
psk: DataView | NodeJS.TypedArray;
|
|
441
516
|
identity: string;
|
|
442
517
|
}
|
|
443
|
-
|
|
444
518
|
interface ConnectionOptions extends SecureContextOptions, CommonConnectionOptions {
|
|
445
519
|
host?: string | undefined;
|
|
446
520
|
port?: number | undefined;
|
|
447
521
|
path?: string | undefined; // Creates unix socket connection to path. If this option is specified, `host` and `port` are ignored.
|
|
448
|
-
socket?:
|
|
522
|
+
socket?: net.Socket | undefined; // Establish secure connection on a given socket rather than creating a new socket
|
|
449
523
|
checkServerIdentity?: typeof checkServerIdentity | undefined;
|
|
450
524
|
servername?: string | undefined; // SNI TLS Extension
|
|
451
525
|
session?: Buffer | undefined;
|
|
@@ -471,35 +545,50 @@ declare module 'tls' {
|
|
|
471
545
|
*/
|
|
472
546
|
pskCallback?(hint: string | null): PSKCallbackNegotation | null;
|
|
473
547
|
}
|
|
474
|
-
|
|
548
|
+
/**
|
|
549
|
+
* Accepts encrypted connections using TLS or SSL.
|
|
550
|
+
* @since v0.3.2
|
|
551
|
+
*/
|
|
475
552
|
class Server extends net.Server {
|
|
476
553
|
constructor(secureConnectionListener?: (socket: TLSSocket) => void);
|
|
477
554
|
constructor(options: TlsOptions, secureConnectionListener?: (socket: TLSSocket) => void);
|
|
478
|
-
|
|
479
555
|
/**
|
|
480
|
-
* The server.addContext() method adds a secure context that will be
|
|
481
|
-
*
|
|
482
|
-
*
|
|
556
|
+
* The `server.addContext()` method adds a secure context that will be used if
|
|
557
|
+
* the client request's SNI name matches the supplied `hostname` (or wildcard).
|
|
558
|
+
*
|
|
559
|
+
* When there are multiple matching contexts, the most recently added one is
|
|
560
|
+
* used.
|
|
561
|
+
* @since v0.5.3
|
|
562
|
+
* @param hostname A SNI host name or wildcard (e.g. `'*'`)
|
|
563
|
+
* @param context An object containing any of the possible properties from the {@link createSecureContext} `options` arguments (e.g. `key`, `cert`, `ca`, etc).
|
|
483
564
|
*/
|
|
484
|
-
addContext(
|
|
565
|
+
addContext(hostname: string, context: SecureContextOptions): void;
|
|
485
566
|
/**
|
|
486
567
|
* Returns the session ticket keys.
|
|
568
|
+
*
|
|
569
|
+
* See `Session Resumption` for more information.
|
|
570
|
+
* @since v3.0.0
|
|
571
|
+
* @return A 48-byte buffer containing the session ticket keys.
|
|
487
572
|
*/
|
|
488
573
|
getTicketKeys(): Buffer;
|
|
489
574
|
/**
|
|
490
|
-
*
|
|
491
|
-
*
|
|
492
|
-
*
|
|
493
|
-
*
|
|
575
|
+
* The `server.setSecureContext()` method replaces the secure context of an
|
|
576
|
+
* existing server. Existing connections to the server are not interrupted.
|
|
577
|
+
* @since v11.0.0
|
|
578
|
+
* @param options An object containing any of the possible properties from the {@link createSecureContext} `options` arguments (e.g. `key`, `cert`, `ca`, etc).
|
|
494
579
|
*/
|
|
495
|
-
setSecureContext(
|
|
580
|
+
setSecureContext(options: SecureContextOptions): void;
|
|
496
581
|
/**
|
|
497
|
-
*
|
|
498
|
-
*
|
|
499
|
-
*
|
|
582
|
+
* Sets the session ticket keys.
|
|
583
|
+
*
|
|
584
|
+
* Changes to the ticket keys are effective only for future server connections.
|
|
585
|
+
* Existing or currently pending server connections will use the previous keys.
|
|
586
|
+
*
|
|
587
|
+
* See `Session Resumption` for more information.
|
|
588
|
+
* @since v3.0.0
|
|
589
|
+
* @param keys A 48-byte buffer containing the session ticket keys.
|
|
500
590
|
*/
|
|
501
591
|
setTicketKeys(keys: Buffer): void;
|
|
502
|
-
|
|
503
592
|
/**
|
|
504
593
|
* events.EventEmitter
|
|
505
594
|
* 1. tlsClientError
|
|
@@ -510,61 +599,56 @@ declare module 'tls' {
|
|
|
510
599
|
* 6. keylog
|
|
511
600
|
*/
|
|
512
601
|
addListener(event: string, listener: (...args: any[]) => void): this;
|
|
513
|
-
addListener(event:
|
|
514
|
-
addListener(event:
|
|
515
|
-
addListener(event:
|
|
516
|
-
addListener(event:
|
|
517
|
-
addListener(event:
|
|
518
|
-
addListener(event:
|
|
519
|
-
|
|
602
|
+
addListener(event: 'tlsClientError', listener: (err: Error, tlsSocket: TLSSocket) => void): this;
|
|
603
|
+
addListener(event: 'newSession', listener: (sessionId: Buffer, sessionData: Buffer, callback: () => void) => void): this;
|
|
604
|
+
addListener(event: 'OCSPRequest', listener: (certificate: Buffer, issuer: Buffer, callback: (err: Error | null, resp: Buffer) => void) => void): this;
|
|
605
|
+
addListener(event: 'resumeSession', listener: (sessionId: Buffer, callback: (err: Error | null, sessionData: Buffer | null) => void) => void): this;
|
|
606
|
+
addListener(event: 'secureConnection', listener: (tlsSocket: TLSSocket) => void): this;
|
|
607
|
+
addListener(event: 'keylog', listener: (line: Buffer, tlsSocket: TLSSocket) => void): this;
|
|
520
608
|
emit(event: string | symbol, ...args: any[]): boolean;
|
|
521
|
-
emit(event:
|
|
522
|
-
emit(event:
|
|
523
|
-
emit(event:
|
|
524
|
-
emit(event:
|
|
525
|
-
emit(event:
|
|
526
|
-
emit(event:
|
|
527
|
-
|
|
609
|
+
emit(event: 'tlsClientError', err: Error, tlsSocket: TLSSocket): boolean;
|
|
610
|
+
emit(event: 'newSession', sessionId: Buffer, sessionData: Buffer, callback: () => void): boolean;
|
|
611
|
+
emit(event: 'OCSPRequest', certificate: Buffer, issuer: Buffer, callback: (err: Error | null, resp: Buffer) => void): boolean;
|
|
612
|
+
emit(event: 'resumeSession', sessionId: Buffer, callback: (err: Error | null, sessionData: Buffer | null) => void): boolean;
|
|
613
|
+
emit(event: 'secureConnection', tlsSocket: TLSSocket): boolean;
|
|
614
|
+
emit(event: 'keylog', line: Buffer, tlsSocket: TLSSocket): boolean;
|
|
528
615
|
on(event: string, listener: (...args: any[]) => void): this;
|
|
529
|
-
on(event:
|
|
530
|
-
on(event:
|
|
531
|
-
on(event:
|
|
532
|
-
on(event:
|
|
533
|
-
on(event:
|
|
534
|
-
on(event:
|
|
535
|
-
|
|
616
|
+
on(event: 'tlsClientError', listener: (err: Error, tlsSocket: TLSSocket) => void): this;
|
|
617
|
+
on(event: 'newSession', listener: (sessionId: Buffer, sessionData: Buffer, callback: () => void) => void): this;
|
|
618
|
+
on(event: 'OCSPRequest', listener: (certificate: Buffer, issuer: Buffer, callback: (err: Error | null, resp: Buffer) => void) => void): this;
|
|
619
|
+
on(event: 'resumeSession', listener: (sessionId: Buffer, callback: (err: Error | null, sessionData: Buffer | null) => void) => void): this;
|
|
620
|
+
on(event: 'secureConnection', listener: (tlsSocket: TLSSocket) => void): this;
|
|
621
|
+
on(event: 'keylog', listener: (line: Buffer, tlsSocket: TLSSocket) => void): this;
|
|
536
622
|
once(event: string, listener: (...args: any[]) => void): this;
|
|
537
|
-
once(event:
|
|
538
|
-
once(event:
|
|
539
|
-
once(event:
|
|
540
|
-
once(event:
|
|
541
|
-
once(event:
|
|
542
|
-
once(event:
|
|
543
|
-
|
|
623
|
+
once(event: 'tlsClientError', listener: (err: Error, tlsSocket: TLSSocket) => void): this;
|
|
624
|
+
once(event: 'newSession', listener: (sessionId: Buffer, sessionData: Buffer, callback: () => void) => void): this;
|
|
625
|
+
once(event: 'OCSPRequest', listener: (certificate: Buffer, issuer: Buffer, callback: (err: Error | null, resp: Buffer) => void) => void): this;
|
|
626
|
+
once(event: 'resumeSession', listener: (sessionId: Buffer, callback: (err: Error | null, sessionData: Buffer | null) => void) => void): this;
|
|
627
|
+
once(event: 'secureConnection', listener: (tlsSocket: TLSSocket) => void): this;
|
|
628
|
+
once(event: 'keylog', listener: (line: Buffer, tlsSocket: TLSSocket) => void): this;
|
|
544
629
|
prependListener(event: string, listener: (...args: any[]) => void): this;
|
|
545
|
-
prependListener(event:
|
|
546
|
-
prependListener(event:
|
|
547
|
-
prependListener(event:
|
|
548
|
-
prependListener(event:
|
|
549
|
-
prependListener(event:
|
|
550
|
-
prependListener(event:
|
|
551
|
-
|
|
630
|
+
prependListener(event: 'tlsClientError', listener: (err: Error, tlsSocket: TLSSocket) => void): this;
|
|
631
|
+
prependListener(event: 'newSession', listener: (sessionId: Buffer, sessionData: Buffer, callback: () => void) => void): this;
|
|
632
|
+
prependListener(event: 'OCSPRequest', listener: (certificate: Buffer, issuer: Buffer, callback: (err: Error | null, resp: Buffer) => void) => void): this;
|
|
633
|
+
prependListener(event: 'resumeSession', listener: (sessionId: Buffer, callback: (err: Error | null, sessionData: Buffer | null) => void) => void): this;
|
|
634
|
+
prependListener(event: 'secureConnection', listener: (tlsSocket: TLSSocket) => void): this;
|
|
635
|
+
prependListener(event: 'keylog', listener: (line: Buffer, tlsSocket: TLSSocket) => void): this;
|
|
552
636
|
prependOnceListener(event: string, listener: (...args: any[]) => void): this;
|
|
553
|
-
prependOnceListener(event:
|
|
554
|
-
prependOnceListener(event:
|
|
555
|
-
prependOnceListener(event:
|
|
556
|
-
prependOnceListener(event:
|
|
557
|
-
prependOnceListener(event:
|
|
558
|
-
prependOnceListener(event:
|
|
637
|
+
prependOnceListener(event: 'tlsClientError', listener: (err: Error, tlsSocket: TLSSocket) => void): this;
|
|
638
|
+
prependOnceListener(event: 'newSession', listener: (sessionId: Buffer, sessionData: Buffer, callback: () => void) => void): this;
|
|
639
|
+
prependOnceListener(event: 'OCSPRequest', listener: (certificate: Buffer, issuer: Buffer, callback: (err: Error | null, resp: Buffer) => void) => void): this;
|
|
640
|
+
prependOnceListener(event: 'resumeSession', listener: (sessionId: Buffer, callback: (err: Error | null, sessionData: Buffer | null) => void) => void): this;
|
|
641
|
+
prependOnceListener(event: 'secureConnection', listener: (tlsSocket: TLSSocket) => void): this;
|
|
642
|
+
prependOnceListener(event: 'keylog', listener: (line: Buffer, tlsSocket: TLSSocket) => void): this;
|
|
559
643
|
}
|
|
560
|
-
|
|
644
|
+
/**
|
|
645
|
+
* @deprecated since v0.11.3 Use `tls.TLSSocket` instead.
|
|
646
|
+
*/
|
|
561
647
|
interface SecurePair {
|
|
562
648
|
encrypted: TLSSocket;
|
|
563
649
|
cleartext: TLSSocket;
|
|
564
650
|
}
|
|
565
|
-
|
|
566
651
|
type SecureVersion = 'TLSv1.3' | 'TLSv1.2' | 'TLSv1.1' | 'TLSv1';
|
|
567
|
-
|
|
568
652
|
interface SecureContextOptions {
|
|
569
653
|
/**
|
|
570
654
|
* Optionally override the trusted CA certificates. Default is to trust
|
|
@@ -723,31 +807,183 @@ declare module 'tls' {
|
|
|
723
807
|
*/
|
|
724
808
|
sessionTimeout?: number | undefined;
|
|
725
809
|
}
|
|
726
|
-
|
|
727
810
|
interface SecureContext {
|
|
728
811
|
context: any;
|
|
729
812
|
}
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
*
|
|
733
|
-
*
|
|
734
|
-
*
|
|
813
|
+
/**
|
|
814
|
+
* Verifies the certificate `cert` is issued to `hostname`.
|
|
815
|
+
*
|
|
816
|
+
* Returns [Error](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error) object, populating it with `reason`, `host`, and `cert` on
|
|
817
|
+
* failure. On success, returns [undefined](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Undefined_type).
|
|
818
|
+
*
|
|
819
|
+
* This function can be overwritten by providing alternative function as part of
|
|
820
|
+
* the `options.checkServerIdentity` option passed to `tls.connect()`. The
|
|
821
|
+
* overwriting function can call `tls.checkServerIdentity()` of course, to augment
|
|
822
|
+
* the checks done with additional verification.
|
|
823
|
+
*
|
|
824
|
+
* This function is only called if the certificate passed all other checks, such as
|
|
825
|
+
* being issued by trusted CA (`options.ca`).
|
|
826
|
+
* @since v0.8.4
|
|
827
|
+
* @param hostname The host name or IP address to verify the certificate against.
|
|
828
|
+
* @param cert A `certificate object` representing the peer's certificate.
|
|
829
|
+
*/
|
|
830
|
+
function checkServerIdentity(hostname: string, cert: PeerCertificate): Error | undefined;
|
|
831
|
+
/**
|
|
832
|
+
* Creates a new {@link Server}. The `secureConnectionListener`, if provided, is
|
|
833
|
+
* automatically set as a listener for the `'secureConnection'` event.
|
|
834
|
+
*
|
|
835
|
+
* The `ticketKeys` options is automatically shared between `cluster` module
|
|
836
|
+
* workers.
|
|
837
|
+
*
|
|
838
|
+
* The following illustrates a simple echo server:
|
|
839
|
+
*
|
|
840
|
+
* ```js
|
|
841
|
+
* const tls = require('tls');
|
|
842
|
+
* const fs = require('fs');
|
|
843
|
+
*
|
|
844
|
+
* const options = {
|
|
845
|
+
* key: fs.readFileSync('server-key.pem'),
|
|
846
|
+
* cert: fs.readFileSync('server-cert.pem'),
|
|
735
847
|
*
|
|
736
|
-
*
|
|
848
|
+
* // This is necessary only if using client certificate authentication.
|
|
849
|
+
* requestCert: true,
|
|
850
|
+
*
|
|
851
|
+
* // This is necessary only if the client uses a self-signed certificate.
|
|
852
|
+
* ca: [ fs.readFileSync('client-cert.pem') ]
|
|
853
|
+
* };
|
|
854
|
+
*
|
|
855
|
+
* const server = tls.createServer(options, (socket) => {
|
|
856
|
+
* console.log('server connected',
|
|
857
|
+
* socket.authorized ? 'authorized' : 'unauthorized');
|
|
858
|
+
* socket.write('welcome!\n');
|
|
859
|
+
* socket.setEncoding('utf8');
|
|
860
|
+
* socket.pipe(socket);
|
|
861
|
+
* });
|
|
862
|
+
* server.listen(8000, () => {
|
|
863
|
+
* console.log('server bound');
|
|
864
|
+
* });
|
|
865
|
+
* ```
|
|
866
|
+
*
|
|
867
|
+
* The server can be tested by connecting to it using the example client from {@link connect}.
|
|
868
|
+
* @since v0.3.2
|
|
737
869
|
*/
|
|
738
|
-
function checkServerIdentity(host: string, cert: PeerCertificate): Error | undefined;
|
|
739
870
|
function createServer(secureConnectionListener?: (socket: TLSSocket) => void): Server;
|
|
740
871
|
function createServer(options: TlsOptions, secureConnectionListener?: (socket: TLSSocket) => void): Server;
|
|
872
|
+
/**
|
|
873
|
+
* The `callback` function, if specified, will be added as a listener for the `'secureConnect'` event.
|
|
874
|
+
*
|
|
875
|
+
* `tls.connect()` returns a {@link TLSSocket} object.
|
|
876
|
+
*
|
|
877
|
+
* Unlike the `https` API, `tls.connect()` does not enable the
|
|
878
|
+
* SNI (Server Name Indication) extension by default, which may cause some
|
|
879
|
+
* servers to return an incorrect certificate or reject the connection
|
|
880
|
+
* altogether. To enable SNI, set the `servername` option in addition
|
|
881
|
+
* to `host`.
|
|
882
|
+
*
|
|
883
|
+
* The following illustrates a client for the echo server example from {@link createServer}:
|
|
884
|
+
*
|
|
885
|
+
* ```js
|
|
886
|
+
* // Assumes an echo server that is listening on port 8000.
|
|
887
|
+
* const tls = require('tls');
|
|
888
|
+
* const fs = require('fs');
|
|
889
|
+
*
|
|
890
|
+
* const options = {
|
|
891
|
+
* // Necessary only if the server requires client certificate authentication.
|
|
892
|
+
* key: fs.readFileSync('client-key.pem'),
|
|
893
|
+
* cert: fs.readFileSync('client-cert.pem'),
|
|
894
|
+
*
|
|
895
|
+
* // Necessary only if the server uses a self-signed certificate.
|
|
896
|
+
* ca: [ fs.readFileSync('server-cert.pem') ],
|
|
897
|
+
*
|
|
898
|
+
* // Necessary only if the server's cert isn't for "localhost".
|
|
899
|
+
* checkServerIdentity: () => { return null; },
|
|
900
|
+
* };
|
|
901
|
+
*
|
|
902
|
+
* const socket = tls.connect(8000, options, () => {
|
|
903
|
+
* console.log('client connected',
|
|
904
|
+
* socket.authorized ? 'authorized' : 'unauthorized');
|
|
905
|
+
* process.stdin.pipe(socket);
|
|
906
|
+
* process.stdin.resume();
|
|
907
|
+
* });
|
|
908
|
+
* socket.setEncoding('utf8');
|
|
909
|
+
* socket.on('data', (data) => {
|
|
910
|
+
* console.log(data);
|
|
911
|
+
* });
|
|
912
|
+
* socket.on('end', () => {
|
|
913
|
+
* console.log('server ends connection');
|
|
914
|
+
* });
|
|
915
|
+
* ```
|
|
916
|
+
* @since v0.11.3
|
|
917
|
+
*/
|
|
741
918
|
function connect(options: ConnectionOptions, secureConnectListener?: () => void): TLSSocket;
|
|
742
919
|
function connect(port: number, host?: string, options?: ConnectionOptions, secureConnectListener?: () => void): TLSSocket;
|
|
743
920
|
function connect(port: number, options?: ConnectionOptions, secureConnectListener?: () => void): TLSSocket;
|
|
744
921
|
/**
|
|
745
|
-
*
|
|
922
|
+
* Creates a new secure pair object with two streams, one of which reads and writes
|
|
923
|
+
* the encrypted data and the other of which reads and writes the cleartext data.
|
|
924
|
+
* Generally, the encrypted stream is piped to/from an incoming encrypted data
|
|
925
|
+
* stream and the cleartext one is used as a replacement for the initial encrypted
|
|
926
|
+
* stream.
|
|
927
|
+
*
|
|
928
|
+
* `tls.createSecurePair()` returns a `tls.SecurePair` object with `cleartext` and`encrypted` stream properties.
|
|
929
|
+
*
|
|
930
|
+
* Using `cleartext` has the same API as {@link TLSSocket}.
|
|
931
|
+
*
|
|
932
|
+
* The `tls.createSecurePair()` method is now deprecated in favor of`tls.TLSSocket()`. For example, the code:
|
|
933
|
+
*
|
|
934
|
+
* ```js
|
|
935
|
+
* pair = tls.createSecurePair(// ... );
|
|
936
|
+
* pair.encrypted.pipe(socket);
|
|
937
|
+
* socket.pipe(pair.encrypted);
|
|
938
|
+
* ```
|
|
939
|
+
*
|
|
940
|
+
* can be replaced by:
|
|
941
|
+
*
|
|
942
|
+
* ```js
|
|
943
|
+
* secureSocket = tls.TLSSocket(socket, options);
|
|
944
|
+
* ```
|
|
945
|
+
*
|
|
946
|
+
* where `secureSocket` has the same API as `pair.cleartext`.
|
|
947
|
+
* @since v0.3.2
|
|
948
|
+
* @deprecated Since v0.11.3 - Use {@link TLSSocket} instead.
|
|
949
|
+
* @param context A secure context object as returned by `tls.createSecureContext()`
|
|
950
|
+
* @param isServer `true` to specify that this TLS connection should be opened as a server.
|
|
951
|
+
* @param requestCert `true` to specify whether a server should request a certificate from a connecting client. Only applies when `isServer` is `true`.
|
|
952
|
+
* @param rejectUnauthorized If not `false` a server automatically reject clients with invalid certificates. Only applies when `isServer` is `true`.
|
|
953
|
+
*/
|
|
954
|
+
function createSecurePair(context?: SecureContext, isServer?: boolean, requestCert?: boolean, rejectUnauthorized?: boolean): SecurePair;
|
|
955
|
+
/**
|
|
956
|
+
* {@link createServer} sets the default value of the `honorCipherOrder` option
|
|
957
|
+
* to `true`, other APIs that create secure contexts leave it unset.
|
|
958
|
+
*
|
|
959
|
+
* {@link createServer} uses a 128 bit truncated SHA1 hash value generated
|
|
960
|
+
* from `process.argv` as the default value of the `sessionIdContext` option, other
|
|
961
|
+
* APIs that create secure contexts have no default value.
|
|
962
|
+
*
|
|
963
|
+
* The `tls.createSecureContext()` method creates a `SecureContext` object. It is
|
|
964
|
+
* usable as an argument to several `tls` APIs, such as {@link createServer} and `server.addContext()`, but has no public methods.
|
|
965
|
+
*
|
|
966
|
+
* A key is _required_ for ciphers that use certificates. Either `key` or`pfx` can be used to provide it.
|
|
967
|
+
*
|
|
968
|
+
* If the `ca` option is not given, then Node.js will default to using [Mozilla's publicly trusted list of
|
|
969
|
+
* CAs](https://hg.mozilla.org/mozilla-central/raw-file/tip/security/nss/lib/ckfw/builtins/certdata.txt).
|
|
970
|
+
* @since v0.11.13
|
|
746
971
|
*/
|
|
747
|
-
function createSecurePair(credentials?: SecureContext, isServer?: boolean, requestCert?: boolean, rejectUnauthorized?: boolean): SecurePair;
|
|
748
972
|
function createSecureContext(options?: SecureContextOptions): SecureContext;
|
|
973
|
+
/**
|
|
974
|
+
* Returns an array with the names of the supported TLS ciphers. The names are
|
|
975
|
+
* lower-case for historical reasons, but must be uppercased to be used in
|
|
976
|
+
* the `ciphers` option of {@link createSecureContext}.
|
|
977
|
+
*
|
|
978
|
+
* Cipher names that start with `'tls_'` are for TLSv1.3, all the others are for
|
|
979
|
+
* TLSv1.2 and below.
|
|
980
|
+
*
|
|
981
|
+
* ```js
|
|
982
|
+
* console.log(tls.getCiphers()); // ['aes128-gcm-sha256', 'aes128-sha', ...]
|
|
983
|
+
* ```
|
|
984
|
+
* @since v0.10.2
|
|
985
|
+
*/
|
|
749
986
|
function getCiphers(): string[];
|
|
750
|
-
|
|
751
987
|
/**
|
|
752
988
|
* The default curve name to use for ECDH key agreement in a tls server.
|
|
753
989
|
* The default value is 'auto'. See tls.createSecureContext() for further
|
|
@@ -774,7 +1010,6 @@ declare module 'tls' {
|
|
|
774
1010
|
* are provided, the lowest minimum is used.
|
|
775
1011
|
*/
|
|
776
1012
|
let DEFAULT_MIN_VERSION: SecureVersion;
|
|
777
|
-
|
|
778
1013
|
/**
|
|
779
1014
|
* An immutable array of strings representing the root certificates (in PEM
|
|
780
1015
|
* format) used for verifying peer certificates. This is the default value
|