@wbce/projen-d9 0.0.27

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 (125) hide show
  1. package/.jsii +552 -0
  2. package/API.md +8472 -0
  3. package/CHANGELOG.md +189 -0
  4. package/LICENSE +674 -0
  5. package/README.md +82 -0
  6. package/lib/cli/commands/init.d.ts +1 -0
  7. package/lib/cli/commands/init.js +8 -0
  8. package/lib/cli/commands/save/apply-snapshot.d.ts +7 -0
  9. package/lib/cli/commands/save/apply-snapshot.js +278 -0
  10. package/lib/cli/commands/save/cli.d.ts +8 -0
  11. package/lib/cli/commands/save/cli.js +33 -0
  12. package/lib/cli/commands/save/draft.d.ts +0 -0
  13. package/lib/cli/commands/save/draft.js +2 -0
  14. package/lib/cli/commands/save/utils.d.ts +9 -0
  15. package/lib/cli/commands/save/utils.js +123 -0
  16. package/lib/cli/commands/sync.d.ts +5 -0
  17. package/lib/cli/commands/sync.js +13 -0
  18. package/lib/cli/index.d.ts +2 -0
  19. package/lib/cli/index.js +44 -0
  20. package/lib/index.d.ts +59 -0
  21. package/lib/index.js +322 -0
  22. package/node_modules/@types/node/LICENSE +21 -0
  23. package/node_modules/@types/node/README.md +16 -0
  24. package/node_modules/@types/node/assert.d.ts +117 -0
  25. package/node_modules/@types/node/async_hooks.d.ts +246 -0
  26. package/node_modules/@types/node/buffer.d.ts +22 -0
  27. package/node_modules/@types/node/child_process.d.ts +507 -0
  28. package/node_modules/@types/node/cluster.d.ts +260 -0
  29. package/node_modules/@types/node/console.d.ts +3 -0
  30. package/node_modules/@types/node/constants.d.ts +448 -0
  31. package/node_modules/@types/node/crypto.d.ts +1183 -0
  32. package/node_modules/@types/node/dgram.d.ts +118 -0
  33. package/node_modules/@types/node/dns.d.ts +372 -0
  34. package/node_modules/@types/node/domain.d.ts +16 -0
  35. package/node_modules/@types/node/events.d.ts +47 -0
  36. package/node_modules/@types/node/fs.d.ts +2567 -0
  37. package/node_modules/@types/node/globals.d.ts +1351 -0
  38. package/node_modules/@types/node/globals.global.d.ts +1 -0
  39. package/node_modules/@types/node/http.d.ts +456 -0
  40. package/node_modules/@types/node/http2.d.ts +952 -0
  41. package/node_modules/@types/node/https.d.ts +156 -0
  42. package/node_modules/@types/node/index.d.ts +91 -0
  43. package/node_modules/@types/node/inspector.d.ts +3040 -0
  44. package/node_modules/@types/node/module.d.ts +3 -0
  45. package/node_modules/@types/node/net.d.ts +290 -0
  46. package/node_modules/@types/node/os.d.ts +263 -0
  47. package/node_modules/@types/node/package.json +195 -0
  48. package/node_modules/@types/node/path.d.ts +159 -0
  49. package/node_modules/@types/node/perf_hooks.d.ts +259 -0
  50. package/node_modules/@types/node/process.d.ts +15 -0
  51. package/node_modules/@types/node/punycode.d.ts +75 -0
  52. package/node_modules/@types/node/querystring.d.ts +29 -0
  53. package/node_modules/@types/node/readline.d.ts +158 -0
  54. package/node_modules/@types/node/repl.d.ts +390 -0
  55. package/node_modules/@types/node/stream.d.ts +334 -0
  56. package/node_modules/@types/node/string_decoder.d.ts +7 -0
  57. package/node_modules/@types/node/timers.d.ts +16 -0
  58. package/node_modules/@types/node/tls.d.ts +713 -0
  59. package/node_modules/@types/node/trace_events.d.ts +61 -0
  60. package/node_modules/@types/node/tty.d.ts +66 -0
  61. package/node_modules/@types/node/url.d.ts +147 -0
  62. package/node_modules/@types/node/util.d.ts +200 -0
  63. package/node_modules/@types/node/v8.d.ts +197 -0
  64. package/node_modules/@types/node/vm.d.ts +112 -0
  65. package/node_modules/@types/node/wasi.d.ts +55 -0
  66. package/node_modules/@types/node/worker_threads.d.ts +207 -0
  67. package/node_modules/@types/node/zlib.d.ts +356 -0
  68. package/node_modules/@types/pg/LICENSE +21 -0
  69. package/node_modules/@types/pg/README.md +15 -0
  70. package/node_modules/@types/pg/index.d.mts +56 -0
  71. package/node_modules/@types/pg/index.d.ts +360 -0
  72. package/node_modules/@types/pg/lib/connection-parameters.d.ts +58 -0
  73. package/node_modules/@types/pg/lib/type-overrides.d.ts +77 -0
  74. package/node_modules/@types/pg/package.json +38 -0
  75. package/node_modules/@types/pg-copy-streams/LICENSE +21 -0
  76. package/node_modules/@types/pg-copy-streams/README.md +38 -0
  77. package/node_modules/@types/pg-copy-streams/index.d.ts +19 -0
  78. package/node_modules/@types/pg-copy-streams/package.json +28 -0
  79. package/node_modules/commander/LICENSE +22 -0
  80. package/node_modules/commander/Readme.md +1176 -0
  81. package/node_modules/commander/esm.mjs +16 -0
  82. package/node_modules/commander/index.js +24 -0
  83. package/node_modules/commander/lib/argument.js +150 -0
  84. package/node_modules/commander/lib/command.js +2777 -0
  85. package/node_modules/commander/lib/error.js +39 -0
  86. package/node_modules/commander/lib/help.js +747 -0
  87. package/node_modules/commander/lib/option.js +380 -0
  88. package/node_modules/commander/lib/suggestSimilar.js +101 -0
  89. package/node_modules/commander/package-support.json +19 -0
  90. package/node_modules/commander/package.json +82 -0
  91. package/node_modules/commander/typings/esm.d.mts +3 -0
  92. package/node_modules/commander/typings/index.d.ts +1113 -0
  93. package/node_modules/pg/LICENSE +21 -0
  94. package/node_modules/pg/README.md +95 -0
  95. package/node_modules/pg/esm/index.mjs +20 -0
  96. package/node_modules/pg/lib/client.js +743 -0
  97. package/node_modules/pg/lib/connection-parameters.js +171 -0
  98. package/node_modules/pg/lib/connection.js +221 -0
  99. package/node_modules/pg/lib/crypto/cert-signatures.js +122 -0
  100. package/node_modules/pg/lib/crypto/sasl.js +212 -0
  101. package/node_modules/pg/lib/crypto/utils-legacy.js +43 -0
  102. package/node_modules/pg/lib/crypto/utils-webcrypto.js +89 -0
  103. package/node_modules/pg/lib/crypto/utils.js +9 -0
  104. package/node_modules/pg/lib/defaults.js +91 -0
  105. package/node_modules/pg/lib/index.js +73 -0
  106. package/node_modules/pg/lib/native/client.js +323 -0
  107. package/node_modules/pg/lib/native/index.js +2 -0
  108. package/node_modules/pg/lib/native/query.js +165 -0
  109. package/node_modules/pg/lib/query.js +252 -0
  110. package/node_modules/pg/lib/result.js +109 -0
  111. package/node_modules/pg/lib/stream.js +83 -0
  112. package/node_modules/pg/lib/type-overrides.js +35 -0
  113. package/node_modules/pg/lib/utils.js +217 -0
  114. package/node_modules/pg/package.json +76 -0
  115. package/node_modules/pg-copy-streams/Makefile +19 -0
  116. package/node_modules/pg-copy-streams/README.md +315 -0
  117. package/node_modules/pg-copy-streams/copy-both.js +267 -0
  118. package/node_modules/pg-copy-streams/copy-from.js +173 -0
  119. package/node_modules/pg-copy-streams/copy-to.js +177 -0
  120. package/node_modules/pg-copy-streams/eslint.config.js +55 -0
  121. package/node_modules/pg-copy-streams/index.js +17 -0
  122. package/node_modules/pg-copy-streams/message-formats.js +27 -0
  123. package/node_modules/pg-copy-streams/obuf.js +376 -0
  124. package/node_modules/pg-copy-streams/package.json +51 -0
  125. package/package.json +136 -0
@@ -0,0 +1,713 @@
1
+ declare module 'tls' {
2
+ import * as net from 'net';
3
+ import * as stream from 'stream';
4
+
5
+ const CLIENT_RENEG_LIMIT: number;
6
+ const CLIENT_RENEG_WINDOW: number;
7
+
8
+ interface Certificate {
9
+ /**
10
+ * Country code.
11
+ */
12
+ C: string;
13
+ /**
14
+ * Street.
15
+ */
16
+ ST: string;
17
+ /**
18
+ * Locality.
19
+ */
20
+ L: string;
21
+ /**
22
+ * Organization.
23
+ */
24
+ O: string;
25
+ /**
26
+ * Organizational unit.
27
+ */
28
+ OU: string;
29
+ /**
30
+ * Common name.
31
+ */
32
+ CN: string;
33
+ }
34
+
35
+ interface PeerCertificate {
36
+ subject: Certificate;
37
+ issuer: Certificate;
38
+ subjectaltname: string;
39
+ infoAccess: { [index: string]: string[] | undefined };
40
+ modulus: string;
41
+ exponent: string;
42
+ valid_from: string;
43
+ valid_to: string;
44
+ fingerprint: string;
45
+ fingerprint256: string;
46
+ ext_key_usage: string[];
47
+ serialNumber: string;
48
+ raw: Buffer;
49
+ }
50
+
51
+ interface DetailedPeerCertificate extends PeerCertificate {
52
+ issuerCertificate: DetailedPeerCertificate;
53
+ }
54
+
55
+ interface CipherNameAndProtocol {
56
+ /**
57
+ * The cipher name.
58
+ */
59
+ name: string;
60
+ /**
61
+ * SSL/TLS protocol version.
62
+ */
63
+ version: string;
64
+ }
65
+
66
+ interface EphemeralKeyInfo {
67
+ /**
68
+ * The supported types are 'DH' and 'ECDH'.
69
+ */
70
+ type: string;
71
+ /**
72
+ * The name property is available only when type is 'ECDH'.
73
+ */
74
+ name?: string | undefined;
75
+ /**
76
+ * The size of parameter of an ephemeral key exchange.
77
+ */
78
+ size: number;
79
+ }
80
+
81
+ interface KeyObject {
82
+ /**
83
+ * Private keys in PEM format.
84
+ */
85
+ pem: string | Buffer;
86
+ /**
87
+ * Optional passphrase.
88
+ */
89
+ passphrase?: string | undefined;
90
+ }
91
+
92
+ interface PxfObject {
93
+ /**
94
+ * PFX or PKCS12 encoded private key and certificate chain.
95
+ */
96
+ buf: string | Buffer;
97
+ /**
98
+ * Optional passphrase.
99
+ */
100
+ passphrase?: string | undefined;
101
+ }
102
+
103
+ interface TLSSocketOptions extends SecureContextOptions, CommonConnectionOptions {
104
+ /**
105
+ * If true the TLS socket will be instantiated in server-mode.
106
+ * Defaults to false.
107
+ */
108
+ isServer?: boolean | undefined;
109
+ /**
110
+ * An optional net.Server instance.
111
+ */
112
+ server?: net.Server | undefined;
113
+
114
+ /**
115
+ * An optional Buffer instance containing a TLS session.
116
+ */
117
+ session?: Buffer | undefined;
118
+ /**
119
+ * If true, specifies that the OCSP status request extension will be
120
+ * added to the client hello and an 'OCSPResponse' event will be
121
+ * emitted on the socket before establishing a secure communication
122
+ */
123
+ requestOCSP?: boolean | undefined;
124
+ }
125
+
126
+ class TLSSocket extends net.Socket {
127
+ /**
128
+ * Construct a new tls.TLSSocket object from an existing TCP socket.
129
+ */
130
+ constructor(socket: net.Socket, options?: TLSSocketOptions);
131
+
132
+ /**
133
+ * A boolean that is true if the peer certificate was signed by one of the specified CAs, otherwise false.
134
+ */
135
+ authorized: boolean;
136
+ /**
137
+ * The reason why the peer's certificate has not been verified.
138
+ * This property becomes available only when tlsSocket.authorized === false.
139
+ */
140
+ authorizationError: Error;
141
+ /**
142
+ * Static boolean value, always true.
143
+ * May be used to distinguish TLS sockets from regular ones.
144
+ */
145
+ encrypted: true;
146
+
147
+ /**
148
+ * String containing the selected ALPN protocol.
149
+ * Before a handshake has completed, this value is always null.
150
+ * When a handshake is completed but not ALPN protocol was selected, tlsSocket.alpnProtocol equals false.
151
+ */
152
+ alpnProtocol: string | false | null;
153
+
154
+ /**
155
+ * Returns an object representing the local certificate. The returned
156
+ * object has some properties corresponding to the fields of the
157
+ * certificate.
158
+ *
159
+ * See tls.TLSSocket.getPeerCertificate() for an example of the
160
+ * certificate structure.
161
+ *
162
+ * If there is no local certificate, an empty object will be returned.
163
+ * If the socket has been destroyed, null will be returned.
164
+ */
165
+ getCertificate(): PeerCertificate | object | null;
166
+ /**
167
+ * Returns an object representing the cipher name and the SSL/TLS protocol version of the current connection.
168
+ * @returns Returns an object representing the cipher name
169
+ * and the SSL/TLS protocol version of the current connection.
170
+ */
171
+ getCipher(): CipherNameAndProtocol;
172
+ /**
173
+ * Returns an object representing the type, name, and size of parameter
174
+ * of an ephemeral key exchange in Perfect Forward Secrecy on a client
175
+ * connection. It returns an empty object when the key exchange is not
176
+ * ephemeral. As this is only supported on a client socket; null is
177
+ * returned if called on a server socket. The supported types are 'DH'
178
+ * and 'ECDH'. The name property is available only when type is 'ECDH'.
179
+ *
180
+ * For example: { type: 'ECDH', name: 'prime256v1', size: 256 }.
181
+ */
182
+ getEphemeralKeyInfo(): EphemeralKeyInfo | object | null;
183
+ /**
184
+ * Returns the latest Finished message that has
185
+ * been sent to the socket as part of a SSL/TLS handshake, or undefined
186
+ * if no Finished message has been sent yet.
187
+ *
188
+ * As the Finished messages are message digests of the complete
189
+ * handshake (with a total of 192 bits for TLS 1.0 and more for SSL
190
+ * 3.0), they can be used for external authentication procedures when
191
+ * the authentication provided by SSL/TLS is not desired or is not
192
+ * enough.
193
+ *
194
+ * Corresponds to the SSL_get_finished routine in OpenSSL and may be
195
+ * used to implement the tls-unique channel binding from RFC 5929.
196
+ */
197
+ getFinished(): Buffer | undefined;
198
+ /**
199
+ * Returns an object representing the peer's certificate.
200
+ * The returned object has some properties corresponding to the field of the certificate.
201
+ * If detailed argument is true the full chain with issuer property will be returned,
202
+ * if false only the top certificate without issuer property.
203
+ * If the peer does not provide a certificate, it returns null or an empty object.
204
+ * @param detailed - If true; the full chain with issuer property will be returned.
205
+ * @returns An object representing the peer's certificate.
206
+ */
207
+ getPeerCertificate(detailed: true): DetailedPeerCertificate;
208
+ getPeerCertificate(detailed?: false): PeerCertificate;
209
+ getPeerCertificate(detailed?: boolean): PeerCertificate | DetailedPeerCertificate;
210
+ /**
211
+ * Returns the latest Finished message that is expected or has actually
212
+ * been received from the socket as part of a SSL/TLS handshake, or
213
+ * undefined if there is no Finished message so far.
214
+ *
215
+ * As the Finished messages are message digests of the complete
216
+ * handshake (with a total of 192 bits for TLS 1.0 and more for SSL
217
+ * 3.0), they can be used for external authentication procedures when
218
+ * the authentication provided by SSL/TLS is not desired or is not
219
+ * enough.
220
+ *
221
+ * Corresponds to the SSL_get_peer_finished routine in OpenSSL and may
222
+ * be used to implement the tls-unique channel binding from RFC 5929.
223
+ */
224
+ getPeerFinished(): Buffer | undefined;
225
+ /**
226
+ * Returns a string containing the negotiated SSL/TLS protocol version of the current connection.
227
+ * The value `'unknown'` will be returned for connected sockets that have not completed the handshaking process.
228
+ * The value `null` will be returned for server sockets or disconnected client sockets.
229
+ * See https://www.openssl.org/docs/man1.0.2/ssl/SSL_get_version.html for more information.
230
+ * @returns negotiated SSL/TLS protocol version of the current connection
231
+ */
232
+ getProtocol(): string | null;
233
+ /**
234
+ * Could be used to speed up handshake establishment when reconnecting to the server.
235
+ * @returns ASN.1 encoded TLS session or undefined if none was negotiated.
236
+ */
237
+ getSession(): Buffer | undefined;
238
+ /**
239
+ * Returns a list of signature algorithms shared between the server and
240
+ * the client in the order of decreasing preference.
241
+ */
242
+ getSharedSigalgs(): string[];
243
+ /**
244
+ * NOTE: Works only with client TLS sockets.
245
+ * Useful only for debugging, for session reuse provide session option to tls.connect().
246
+ * @returns TLS session ticket or undefined if none was negotiated.
247
+ */
248
+ getTLSTicket(): Buffer | undefined;
249
+ /**
250
+ * Returns true if the session was reused, false otherwise.
251
+ */
252
+ isSessionReused(): boolean;
253
+ /**
254
+ * Initiate TLS renegotiation process.
255
+ *
256
+ * NOTE: Can be used to request peer's certificate after the secure connection has been established.
257
+ * ANOTHER NOTE: When running as the server, socket will be destroyed with an error after handshakeTimeout timeout.
258
+ * @param options - The options may contain the following fields: rejectUnauthorized,
259
+ * requestCert (See tls.createServer() for details).
260
+ * @param callback - callback(err) will be executed with null as err, once the renegotiation
261
+ * is successfully completed.
262
+ * @return `undefined` when socket is destroy, `false` if negotiaion can't be initiated.
263
+ */
264
+ renegotiate(options: { rejectUnauthorized?: boolean | undefined, requestCert?: boolean | undefined }, callback: (err: Error | null) => void): undefined | boolean;
265
+ /**
266
+ * Set maximum TLS fragment size (default and maximum value is: 16384, minimum is: 512).
267
+ * Smaller fragment size decreases buffering latency on the client: large fragments are buffered by
268
+ * the TLS layer until the entire fragment is received and its integrity is verified;
269
+ * large fragments can span multiple roundtrips, and their processing can be delayed due to packet
270
+ * loss or reordering. However, smaller fragments add extra TLS framing bytes and CPU overhead,
271
+ * which may decrease overall server throughput.
272
+ * @param size - TLS fragment size (default and maximum value is: 16384, minimum is: 512).
273
+ * @returns Returns true on success, false otherwise.
274
+ */
275
+ setMaxSendFragment(size: number): boolean;
276
+
277
+ /**
278
+ * Disables TLS renegotiation for this TLSSocket instance. Once called,
279
+ * attempts to renegotiate will trigger an 'error' event on the
280
+ * TLSSocket.
281
+ */
282
+ disableRenegotiation(): void;
283
+
284
+ /**
285
+ * When enabled, TLS packet trace information is written to `stderr`. This can be
286
+ * used to debug TLS connection problems.
287
+ *
288
+ * Note: The format of the output is identical to the output of `openssl s_client
289
+ * -trace` or `openssl s_server -trace`. While it is produced by OpenSSL's
290
+ * `SSL_trace()` function, the format is undocumented, can change without notice,
291
+ * and should not be relied on.
292
+ */
293
+ enableTrace(): void;
294
+
295
+ addListener(event: string, listener: (...args: any[]) => void): this;
296
+ addListener(event: "OCSPResponse", listener: (response: Buffer) => void): this;
297
+ addListener(event: "secureConnect", listener: () => void): this;
298
+ addListener(event: "session", listener: (session: Buffer) => void): this;
299
+ addListener(event: "keylog", listener: (line: Buffer) => void): this;
300
+
301
+ emit(event: string | symbol, ...args: any[]): boolean;
302
+ emit(event: "OCSPResponse", response: Buffer): boolean;
303
+ emit(event: "secureConnect"): boolean;
304
+ emit(event: "session", session: Buffer): boolean;
305
+ emit(event: "keylog", line: Buffer): boolean;
306
+
307
+ on(event: string, listener: (...args: any[]) => void): this;
308
+ on(event: "OCSPResponse", listener: (response: Buffer) => void): this;
309
+ on(event: "secureConnect", listener: () => void): this;
310
+ on(event: "session", listener: (session: Buffer) => void): this;
311
+ on(event: "keylog", listener: (line: Buffer) => void): this;
312
+
313
+ once(event: string, listener: (...args: any[]) => void): this;
314
+ once(event: "OCSPResponse", listener: (response: Buffer) => void): this;
315
+ once(event: "secureConnect", listener: () => void): this;
316
+ once(event: "session", listener: (session: Buffer) => void): this;
317
+ once(event: "keylog", listener: (line: Buffer) => void): this;
318
+
319
+ prependListener(event: string, listener: (...args: any[]) => void): this;
320
+ prependListener(event: "OCSPResponse", listener: (response: Buffer) => void): this;
321
+ prependListener(event: "secureConnect", listener: () => void): this;
322
+ prependListener(event: "session", listener: (session: Buffer) => void): this;
323
+ prependListener(event: "keylog", listener: (line: Buffer) => void): this;
324
+
325
+ prependOnceListener(event: string, listener: (...args: any[]) => void): this;
326
+ prependOnceListener(event: "OCSPResponse", listener: (response: Buffer) => void): this;
327
+ prependOnceListener(event: "secureConnect", listener: () => void): this;
328
+ prependOnceListener(event: "session", listener: (session: Buffer) => void): this;
329
+ prependOnceListener(event: "keylog", listener: (line: Buffer) => void): this;
330
+ }
331
+
332
+ interface CommonConnectionOptions {
333
+ /**
334
+ * An optional TLS context object from tls.createSecureContext()
335
+ */
336
+ secureContext?: SecureContext | undefined;
337
+
338
+ /**
339
+ * When enabled, TLS packet trace information is written to `stderr`. This can be
340
+ * used to debug TLS connection problems.
341
+ * @default false
342
+ */
343
+ enableTrace?: boolean | undefined;
344
+ /**
345
+ * If true the server will request a certificate from clients that
346
+ * connect and attempt to verify that certificate. Defaults to
347
+ * false.
348
+ */
349
+ requestCert?: boolean | undefined;
350
+ /**
351
+ * An array of strings or a Buffer naming possible ALPN protocols.
352
+ * (Protocols should be ordered by their priority.)
353
+ */
354
+ ALPNProtocols?: string[] | Uint8Array[] | Uint8Array | undefined;
355
+ /**
356
+ * SNICallback(servername, cb) <Function> A function that will be
357
+ * called if the client supports SNI TLS extension. Two arguments
358
+ * will be passed when called: servername and cb. SNICallback should
359
+ * invoke cb(null, ctx), where ctx is a SecureContext instance.
360
+ * (tls.createSecureContext(...) can be used to get a proper
361
+ * SecureContext.) If SNICallback wasn't provided the default callback
362
+ * with high-level API will be used (see below).
363
+ */
364
+ SNICallback?: ((servername: string, cb: (err: Error | null, ctx: SecureContext) => void) => void) | undefined;
365
+ /**
366
+ * If true the server will reject any connection which is not
367
+ * authorized with the list of supplied CAs. This option only has an
368
+ * effect if requestCert is true.
369
+ * @default true
370
+ */
371
+ rejectUnauthorized?: boolean | undefined;
372
+ }
373
+
374
+ interface TlsOptions extends SecureContextOptions, CommonConnectionOptions {
375
+ /**
376
+ * Abort the connection if the SSL/TLS handshake does not finish in the
377
+ * specified number of milliseconds. A 'tlsClientError' is emitted on
378
+ * the tls.Server object whenever a handshake times out. Default:
379
+ * 120000 (120 seconds).
380
+ */
381
+ handshakeTimeout?: number | undefined;
382
+ /**
383
+ * The number of seconds after which a TLS session created by the
384
+ * server will no longer be resumable. See Session Resumption for more
385
+ * information. Default: 300.
386
+ */
387
+ sessionTimeout?: number | undefined;
388
+ /**
389
+ * 48-bytes of cryptographically strong pseudo-random data.
390
+ */
391
+ ticketKeys?: Buffer | undefined;
392
+ }
393
+
394
+ interface ConnectionOptions extends SecureContextOptions, CommonConnectionOptions {
395
+ host?: string | undefined;
396
+ port?: number | undefined;
397
+ path?: string | undefined; // Creates unix socket connection to path. If this option is specified, `host` and `port` are ignored.
398
+ socket?: stream.Duplex | undefined; // Establish secure connection on a given socket rather than creating a new socket
399
+ checkServerIdentity?: typeof checkServerIdentity | undefined;
400
+ servername?: string | undefined; // SNI TLS Extension
401
+ session?: Buffer | undefined;
402
+ minDHSize?: number | undefined;
403
+ lookup?: net.LookupFunction | undefined;
404
+ timeout?: number | undefined;
405
+ }
406
+
407
+ class Server extends net.Server {
408
+ /**
409
+ * The server.addContext() method adds a secure context that will be
410
+ * used if the client request's SNI name matches the supplied hostname
411
+ * (or wildcard).
412
+ */
413
+ addContext(hostName: string, credentials: SecureContextOptions): void;
414
+ /**
415
+ * Returns the session ticket keys.
416
+ */
417
+ getTicketKeys(): Buffer;
418
+ /**
419
+ *
420
+ * The server.setSecureContext() method replaces the
421
+ * secure context of an existing server. Existing connections to the
422
+ * server are not interrupted.
423
+ */
424
+ setSecureContext(details: SecureContextOptions): void;
425
+ /**
426
+ * The server.setSecureContext() method replaces the secure context of
427
+ * an existing server. Existing connections to the server are not
428
+ * interrupted.
429
+ */
430
+ setTicketKeys(keys: Buffer): void;
431
+
432
+ /**
433
+ * events.EventEmitter
434
+ * 1. tlsClientError
435
+ * 2. newSession
436
+ * 3. OCSPRequest
437
+ * 4. resumeSession
438
+ * 5. secureConnection
439
+ * 6. keylog
440
+ */
441
+ addListener(event: string, listener: (...args: any[]) => void): this;
442
+ addListener(event: "tlsClientError", listener: (err: Error, tlsSocket: TLSSocket) => void): this;
443
+ addListener(event: "newSession", listener: (sessionId: Buffer, sessionData: Buffer, callback: (err: Error, resp: Buffer) => void) => void): this;
444
+ addListener(event: "OCSPRequest", listener: (certificate: Buffer, issuer: Buffer, callback: (err: Error | null, resp: Buffer) => void) => void): this;
445
+ addListener(event: "resumeSession", listener: (sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void) => void): this;
446
+ addListener(event: "secureConnection", listener: (tlsSocket: TLSSocket) => void): this;
447
+ addListener(event: "keylog", listener: (line: Buffer, tlsSocket: TLSSocket) => void): this;
448
+
449
+ emit(event: string | symbol, ...args: any[]): boolean;
450
+ emit(event: "tlsClientError", err: Error, tlsSocket: TLSSocket): boolean;
451
+ emit(event: "newSession", sessionId: Buffer, sessionData: Buffer, callback: (err: Error, resp: Buffer) => void): boolean;
452
+ emit(event: "OCSPRequest", certificate: Buffer, issuer: Buffer, callback: (err: Error | null, resp: Buffer) => void): boolean;
453
+ emit(event: "resumeSession", sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void): boolean;
454
+ emit(event: "secureConnection", tlsSocket: TLSSocket): boolean;
455
+ emit(event: "keylog", line: Buffer, tlsSocket: TLSSocket): boolean;
456
+
457
+ on(event: string, listener: (...args: any[]) => void): this;
458
+ on(event: "tlsClientError", listener: (err: Error, tlsSocket: TLSSocket) => void): this;
459
+ on(event: "newSession", listener: (sessionId: Buffer, sessionData: Buffer, callback: (err: Error, resp: Buffer) => void) => void): this;
460
+ on(event: "OCSPRequest", listener: (certificate: Buffer, issuer: Buffer, callback: (err: Error | null, resp: Buffer) => void) => void): this;
461
+ on(event: "resumeSession", listener: (sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void) => void): this;
462
+ on(event: "secureConnection", listener: (tlsSocket: TLSSocket) => void): this;
463
+ on(event: "keylog", listener: (line: Buffer, tlsSocket: TLSSocket) => void): this;
464
+
465
+ once(event: string, listener: (...args: any[]) => void): this;
466
+ once(event: "tlsClientError", listener: (err: Error, tlsSocket: TLSSocket) => void): this;
467
+ once(event: "newSession", listener: (sessionId: Buffer, sessionData: Buffer, callback: (err: Error, resp: Buffer) => void) => void): this;
468
+ once(event: "OCSPRequest", listener: (certificate: Buffer, issuer: Buffer, callback: (err: Error | null, resp: Buffer) => void) => void): this;
469
+ once(event: "resumeSession", listener: (sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void) => void): this;
470
+ once(event: "secureConnection", listener: (tlsSocket: TLSSocket) => void): this;
471
+ once(event: "keylog", listener: (line: Buffer, tlsSocket: TLSSocket) => void): this;
472
+
473
+ prependListener(event: string, listener: (...args: any[]) => void): this;
474
+ prependListener(event: "tlsClientError", listener: (err: Error, tlsSocket: TLSSocket) => void): this;
475
+ prependListener(event: "newSession", listener: (sessionId: Buffer, sessionData: Buffer, callback: (err: Error, resp: Buffer) => void) => void): this;
476
+ prependListener(event: "OCSPRequest", listener: (certificate: Buffer, issuer: Buffer, callback: (err: Error | null, resp: Buffer) => void) => void): this;
477
+ prependListener(event: "resumeSession", listener: (sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void) => void): this;
478
+ prependListener(event: "secureConnection", listener: (tlsSocket: TLSSocket) => void): this;
479
+ prependListener(event: "keylog", listener: (line: Buffer, tlsSocket: TLSSocket) => void): this;
480
+
481
+ prependOnceListener(event: string, listener: (...args: any[]) => void): this;
482
+ prependOnceListener(event: "tlsClientError", listener: (err: Error, tlsSocket: TLSSocket) => void): this;
483
+ prependOnceListener(event: "newSession", listener: (sessionId: Buffer, sessionData: Buffer, callback: (err: Error, resp: Buffer) => void) => void): this;
484
+ prependOnceListener(event: "OCSPRequest", listener: (certificate: Buffer, issuer: Buffer, callback: (err: Error | null, resp: Buffer) => void) => void): this;
485
+ prependOnceListener(event: "resumeSession", listener: (sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void) => void): this;
486
+ prependOnceListener(event: "secureConnection", listener: (tlsSocket: TLSSocket) => void): this;
487
+ prependOnceListener(event: "keylog", listener: (line: Buffer, tlsSocket: TLSSocket) => void): this;
488
+ }
489
+
490
+ interface SecurePair {
491
+ encrypted: TLSSocket;
492
+ cleartext: TLSSocket;
493
+ }
494
+
495
+ type SecureVersion = 'TLSv1.3' | 'TLSv1.2' | 'TLSv1.1' | 'TLSv1';
496
+
497
+ interface SecureContextOptions {
498
+ /**
499
+ * Optionally override the trusted CA certificates. Default is to trust
500
+ * the well-known CAs curated by Mozilla. Mozilla's CAs are completely
501
+ * replaced when CAs are explicitly specified using this option.
502
+ */
503
+ ca?: string | Buffer | Array<string | Buffer> | undefined;
504
+ /**
505
+ * Cert chains in PEM format. One cert chain should be provided per
506
+ * private key. Each cert chain should consist of the PEM formatted
507
+ * certificate for a provided private key, followed by the PEM
508
+ * formatted intermediate certificates (if any), in order, and not
509
+ * including the root CA (the root CA must be pre-known to the peer,
510
+ * see ca). When providing multiple cert chains, they do not have to
511
+ * be in the same order as their private keys in key. If the
512
+ * intermediate certificates are not provided, the peer will not be
513
+ * able to validate the certificate, and the handshake will fail.
514
+ */
515
+ cert?: string | Buffer | Array<string | Buffer> | undefined;
516
+ /**
517
+ * Colon-separated list of supported signature algorithms. The list
518
+ * can contain digest algorithms (SHA256, MD5 etc.), public key
519
+ * algorithms (RSA-PSS, ECDSA etc.), combination of both (e.g
520
+ * 'RSA+SHA384') or TLS v1.3 scheme names (e.g. rsa_pss_pss_sha512).
521
+ */
522
+ sigalgs?: string | undefined;
523
+ /**
524
+ * Cipher suite specification, replacing the default. For more
525
+ * information, see modifying the default cipher suite. Permitted
526
+ * ciphers can be obtained via tls.getCiphers(). Cipher names must be
527
+ * uppercased in order for OpenSSL to accept them.
528
+ */
529
+ ciphers?: string | undefined;
530
+ /**
531
+ * Name of an OpenSSL engine which can provide the client certificate.
532
+ */
533
+ clientCertEngine?: string | undefined;
534
+ /**
535
+ * PEM formatted CRLs (Certificate Revocation Lists).
536
+ */
537
+ crl?: string | Buffer | Array<string | Buffer> | undefined;
538
+ /**
539
+ * Diffie Hellman parameters, required for Perfect Forward Secrecy. Use
540
+ * openssl dhparam to create the parameters. The key length must be
541
+ * greater than or equal to 1024 bits or else an error will be thrown.
542
+ * Although 1024 bits is permissible, use 2048 bits or larger for
543
+ * stronger security. If omitted or invalid, the parameters are
544
+ * silently discarded and DHE ciphers will not be available.
545
+ */
546
+ dhparam?: string | Buffer | undefined;
547
+ /**
548
+ * A string describing a named curve or a colon separated list of curve
549
+ * NIDs or names, for example P-521:P-384:P-256, to use for ECDH key
550
+ * agreement. Set to auto to select the curve automatically. Use
551
+ * crypto.getCurves() to obtain a list of available curve names. On
552
+ * recent releases, openssl ecparam -list_curves will also display the
553
+ * name and description of each available elliptic curve. Default:
554
+ * tls.DEFAULT_ECDH_CURVE.
555
+ */
556
+ ecdhCurve?: string | undefined;
557
+ /**
558
+ * Attempt to use the server's cipher suite preferences instead of the
559
+ * client's. When true, causes SSL_OP_CIPHER_SERVER_PREFERENCE to be
560
+ * set in secureOptions
561
+ */
562
+ honorCipherOrder?: boolean | undefined;
563
+ /**
564
+ * Private keys in PEM format. PEM allows the option of private keys
565
+ * being encrypted. Encrypted keys will be decrypted with
566
+ * options.passphrase. Multiple keys using different algorithms can be
567
+ * provided either as an array of unencrypted key strings or buffers,
568
+ * or an array of objects in the form {pem: <string|buffer>[,
569
+ * passphrase: <string>]}. The object form can only occur in an array.
570
+ * object.passphrase is optional. Encrypted keys will be decrypted with
571
+ * object.passphrase if provided, or options.passphrase if it is not.
572
+ */
573
+ key?: string | Buffer | Array<Buffer | KeyObject> | undefined;
574
+ /**
575
+ * Name of an OpenSSL engine to get private key from. Should be used
576
+ * together with privateKeyIdentifier.
577
+ */
578
+ privateKeyEngine?: string | undefined;
579
+ /**
580
+ * Identifier of a private key managed by an OpenSSL engine. Should be
581
+ * used together with privateKeyEngine. Should not be set together with
582
+ * key, because both options define a private key in different ways.
583
+ */
584
+ privateKeyIdentifier?: string | undefined;
585
+ /**
586
+ * Optionally set the maximum TLS version to allow. One
587
+ * of `'TLSv1.3'`, `'TLSv1.2'`, `'TLSv1.1'`, or `'TLSv1'`. Cannot be specified along with the
588
+ * `secureProtocol` option, use one or the other.
589
+ * **Default:** `'TLSv1.3'`, unless changed using CLI options. Using
590
+ * `--tls-max-v1.2` sets the default to `'TLSv1.2'`. Using `--tls-max-v1.3` sets the default to
591
+ * `'TLSv1.3'`. If multiple of the options are provided, the highest maximum is used.
592
+ */
593
+ maxVersion?: SecureVersion | undefined;
594
+ /**
595
+ * Optionally set the minimum TLS version to allow. One
596
+ * of `'TLSv1.3'`, `'TLSv1.2'`, `'TLSv1.1'`, or `'TLSv1'`. Cannot be specified along with the
597
+ * `secureProtocol` option, use one or the other. It is not recommended to use
598
+ * less than TLSv1.2, but it may be required for interoperability.
599
+ * **Default:** `'TLSv1.2'`, unless changed using CLI options. Using
600
+ * `--tls-v1.0` sets the default to `'TLSv1'`. Using `--tls-v1.1` sets the default to
601
+ * `'TLSv1.1'`. Using `--tls-min-v1.3` sets the default to
602
+ * 'TLSv1.3'. If multiple of the options are provided, the lowest minimum is used.
603
+ */
604
+ minVersion?: SecureVersion | undefined;
605
+ /**
606
+ * Shared passphrase used for a single private key and/or a PFX.
607
+ */
608
+ passphrase?: string | undefined;
609
+ /**
610
+ * PFX or PKCS12 encoded private key and certificate chain. pfx is an
611
+ * alternative to providing key and cert individually. PFX is usually
612
+ * encrypted, if it is, passphrase will be used to decrypt it. Multiple
613
+ * PFX can be provided either as an array of unencrypted PFX buffers,
614
+ * or an array of objects in the form {buf: <string|buffer>[,
615
+ * passphrase: <string>]}. The object form can only occur in an array.
616
+ * object.passphrase is optional. Encrypted PFX will be decrypted with
617
+ * object.passphrase if provided, or options.passphrase if it is not.
618
+ */
619
+ pfx?: string | Buffer | Array<string | Buffer | PxfObject> | undefined;
620
+ /**
621
+ * Optionally affect the OpenSSL protocol behavior, which is not
622
+ * usually necessary. This should be used carefully if at all! Value is
623
+ * a numeric bitmask of the SSL_OP_* options from OpenSSL Options
624
+ */
625
+ secureOptions?: number | undefined; // Value is a numeric bitmask of the `SSL_OP_*` options
626
+ /**
627
+ * Legacy mechanism to select the TLS protocol version to use, it does
628
+ * not support independent control of the minimum and maximum version,
629
+ * and does not support limiting the protocol to TLSv1.3. Use
630
+ * minVersion and maxVersion instead. The possible values are listed as
631
+ * SSL_METHODS, use the function names as strings. For example, use
632
+ * 'TLSv1_1_method' to force TLS version 1.1, or 'TLS_method' to allow
633
+ * any TLS protocol version up to TLSv1.3. It is not recommended to use
634
+ * TLS versions less than 1.2, but it may be required for
635
+ * interoperability. Default: none, see minVersion.
636
+ */
637
+ secureProtocol?: string | undefined;
638
+ /**
639
+ * Opaque identifier used by servers to ensure session state is not
640
+ * shared between applications. Unused by clients.
641
+ */
642
+ sessionIdContext?: string | undefined;
643
+ /**
644
+ * 48-bytes of cryptographically strong pseudo-random data.
645
+ * See Session Resumption for more information.
646
+ */
647
+ ticketKeys?: Buffer | undefined;
648
+ /**
649
+ * The number of seconds after which a TLS session created by the
650
+ * server will no longer be resumable. See Session Resumption for more
651
+ * information. Default: 300.
652
+ */
653
+ sessionTimeout?: number | undefined;
654
+ }
655
+
656
+ interface SecureContext {
657
+ context: any;
658
+ }
659
+
660
+ /*
661
+ * Verifies the certificate `cert` is issued to host `host`.
662
+ * @host The hostname to verify the certificate against
663
+ * @cert PeerCertificate representing the peer's certificate
664
+ *
665
+ * Returns Error object, populating it with the reason, host and cert on failure. On success, returns undefined.
666
+ */
667
+ function checkServerIdentity(host: string, cert: PeerCertificate): Error | undefined;
668
+ function createServer(secureConnectionListener?: (socket: TLSSocket) => void): Server;
669
+ function createServer(options: TlsOptions, secureConnectionListener?: (socket: TLSSocket) => void): Server;
670
+ function connect(options: ConnectionOptions, secureConnectListener?: () => void): TLSSocket;
671
+ function connect(port: number, host?: string, options?: ConnectionOptions, secureConnectListener?: () => void): TLSSocket;
672
+ function connect(port: number, options?: ConnectionOptions, secureConnectListener?: () => void): TLSSocket;
673
+ /**
674
+ * @deprecated
675
+ */
676
+ function createSecurePair(credentials?: SecureContext, isServer?: boolean, requestCert?: boolean, rejectUnauthorized?: boolean): SecurePair;
677
+ function createSecureContext(options?: SecureContextOptions): SecureContext;
678
+ function getCiphers(): string[];
679
+
680
+ /**
681
+ * The default curve name to use for ECDH key agreement in a tls server.
682
+ * The default value is 'auto'. See tls.createSecureContext() for further
683
+ * information.
684
+ */
685
+ let DEFAULT_ECDH_CURVE: string;
686
+ /**
687
+ * The default value of the maxVersion option of
688
+ * tls.createSecureContext(). It can be assigned any of the supported TLS
689
+ * protocol versions, 'TLSv1.3', 'TLSv1.2', 'TLSv1.1', or 'TLSv1'. Default:
690
+ * 'TLSv1.3', unless changed using CLI options. Using --tls-max-v1.2 sets
691
+ * the default to 'TLSv1.2'. Using --tls-max-v1.3 sets the default to
692
+ * 'TLSv1.3'. If multiple of the options are provided, the highest maximum
693
+ * is used.
694
+ */
695
+ let DEFAULT_MAX_VERSION: SecureVersion;
696
+ /**
697
+ * The default value of the minVersion option of tls.createSecureContext().
698
+ * It can be assigned any of the supported TLS protocol versions,
699
+ * 'TLSv1.3', 'TLSv1.2', 'TLSv1.1', or 'TLSv1'. Default: 'TLSv1.2', unless
700
+ * changed using CLI options. Using --tls-min-v1.0 sets the default to
701
+ * 'TLSv1'. Using --tls-min-v1.1 sets the default to 'TLSv1.1'. Using
702
+ * --tls-min-v1.3 sets the default to 'TLSv1.3'. If multiple of the options
703
+ * are provided, the lowest minimum is used.
704
+ */
705
+ let DEFAULT_MIN_VERSION: SecureVersion;
706
+
707
+ /**
708
+ * An immutable array of strings representing the root certificates (in PEM
709
+ * format) used for verifying peer certificates. This is the default value
710
+ * of the ca option to tls.createSecureContext().
711
+ */
712
+ const rootCertificates: ReadonlyArray<string>;
713
+ }