| | |
| | | /** |
| | | * The `node:tls` module provides an implementation of the Transport Layer Security |
| | | * (TLS) and Secure Socket Layer (SSL) protocols that is built on top of OpenSSL. |
| | | * The module can be accessed using: |
| | | * |
| | | * ```js |
| | | * import tls from 'node:tls'; |
| | | * ``` |
| | | * @see [source](https://github.com/nodejs/node/blob/v25.x/lib/tls.js) |
| | | */ |
| | | declare module "node:tls" { |
| | | import { NonSharedBuffer } from "node:buffer"; |
| | | import { X509Certificate } from "node:crypto"; |
| | |
| | | import * as stream from "stream"; |
| | | const CLIENT_RENEG_LIMIT: number; |
| | | const CLIENT_RENEG_WINDOW: number; |
| | | interface Certificate { |
| | | interface Certificate extends NodeJS.Dict<string | string[]> { |
| | | /** |
| | | * Country code. |
| | | */ |
| | | C: string; |
| | | C?: string | string[]; |
| | | /** |
| | | * Street. |
| | | */ |
| | | ST: string; |
| | | ST?: string | string[]; |
| | | /** |
| | | * Locality. |
| | | */ |
| | | L: string; |
| | | L?: string | string[]; |
| | | /** |
| | | * Organization. |
| | | */ |
| | | O: string; |
| | | O?: string | string[]; |
| | | /** |
| | | * Organizational unit. |
| | | */ |
| | | OU: string; |
| | | OU?: string | string[]; |
| | | /** |
| | | * Common name. |
| | | */ |
| | | CN: string; |
| | | CN?: string | string[]; |
| | | } |
| | | interface PeerCertificate { |
| | | /** |
| | |
| | | * An optional Buffer instance containing a TLS session. |
| | | */ |
| | | session?: Buffer | undefined; |
| | | /** |
| | | * If true, specifies that the OCSP status request extension will be |
| | | * added to the client hello and an 'OCSPResponse' event will be |
| | | * emitted on the socket before establishing a secure communication |
| | | */ |
| | | requestOCSP?: boolean | undefined; |
| | | } |
| | | interface TLSSocketEventMap extends net.SocketEventMap { |
| | | "keylog": [line: NonSharedBuffer]; |
| | | "OCSPResponse": [response: NonSharedBuffer]; |
| | | "secure": []; |
| | | "secureConnect": []; |
| | | "session": [session: NonSharedBuffer]; |
| | | } |
| | |
| | | * When a handshake is completed but not ALPN protocol was selected, tlsSocket.alpnProtocol equals false. |
| | | */ |
| | | alpnProtocol: string | false | null; |
| | | /** |
| | | * String containing the server name requested via SNI (Server Name Indication) TLS extension. |
| | | */ |
| | | servername: string | false | null; |
| | | /** |
| | | * Returns an object representing the local certificate. The returned object has |
| | | * some properties corresponding to the fields of the certificate. |
| | |
| | | */ |
| | | requestCert?: boolean | undefined; |
| | | /** |
| | | * An array of strings or a Buffer naming possible ALPN protocols. |
| | | * (Protocols should be ordered by their priority.) |
| | | * An array of strings, or a single `Buffer`, `TypedArray`, or `DataView` containing the supported |
| | | * ALPN protocols. Buffers should have the format `[len][name][len][name]...` |
| | | * e.g. `'\x08http/1.1\x08http/1.0'`, where the `len` byte is the length of the |
| | | * next protocol name. Passing an array is usually much simpler, e.g. |
| | | * `['http/1.1', 'http/1.0']`. Protocols earlier in the list have higher |
| | | * preference than those later. |
| | | */ |
| | | ALPNProtocols?: readonly string[] | NodeJS.ArrayBufferView | undefined; |
| | | /** |
| | |
| | | * @default true |
| | | */ |
| | | rejectUnauthorized?: boolean | undefined; |
| | | /** |
| | | * If true, specifies that the OCSP status request extension will be |
| | | * added to the client hello and an 'OCSPResponse' event will be |
| | | * emitted on the socket before establishing a secure communication. |
| | | */ |
| | | requestOCSP?: boolean | undefined; |
| | | } |
| | | interface TlsOptions extends SecureContextOptions, CommonConnectionOptions, net.ServerOpts { |
| | | /** |