From 1700ece8dee2e954dfcbae66d2abf395a8410db3 Mon Sep 17 00:00:00 2001 From: Steven Date: Tue, 6 Mar 2018 17:26:07 -0500 Subject: [PATCH] Add TlsSocket.getProtocol() to node (#24116) --- types/node/index.d.ts | 8 ++++++++ types/node/v6/index.d.ts | 8 ++++++++ types/node/v7/index.d.ts | 8 ++++++++ types/node/v8/index.d.ts | 8 ++++++++ 4 files changed, 32 insertions(+) diff --git a/types/node/index.d.ts b/types/node/index.d.ts index 717b906b28..b5cc3b094f 100644 --- a/types/node/index.d.ts +++ b/types/node/index.d.ts @@ -4895,6 +4895,14 @@ declare module "tls" { getPeerCertificate(detailed: true): DetailedPeerCertificate; getPeerCertificate(detailed?: false): PeerCertificate; getPeerCertificate(detailed?: boolean): PeerCertificate | DetailedPeerCertificate; + /** + * Returns a string containing the negotiated SSL/TLS protocol version of the current connection. + * The value `'unknown'` will be returned for connected sockets that have not completed the handshaking process. + * The value `null` will be returned for server sockets or disconnected client sockets. + * See https://www.openssl.org/docs/man1.0.2/ssl/SSL_get_version.html for more information. + * @returns negotiated SSL/TLS protocol version of the current connection + */ + getProtocol(): string | null; /** * Could be used to speed up handshake establishment when reconnecting to the server. * @returns ASN.1 encoded TLS session or undefined if none was negotiated. diff --git a/types/node/v6/index.d.ts b/types/node/v6/index.d.ts index 3c81e212b7..152507c3a8 100644 --- a/types/node/v6/index.d.ts +++ b/types/node/v6/index.d.ts @@ -3215,6 +3215,14 @@ declare module "tls" { fingerprint: string; serialNumber: string; }; + /** + * Returns a string containing the negotiated SSL/TLS protocol version of the current connection. + * The value `'unknown'` will be returned for connected sockets that have not completed the handshaking process. + * The value `null` will be returned for server sockets or disconnected client sockets. + * See https://www.openssl.org/docs/man1.0.2/ssl/SSL_get_version.html for more information. + * @returns negotiated SSL/TLS protocol version of the current connection + */ + getProtocol(): string | null; /** * Could be used to speed up handshake establishment when reconnecting to the server. * @returns ASN.1 encoded TLS session or undefined if none was negotiated. diff --git a/types/node/v7/index.d.ts b/types/node/v7/index.d.ts index de69dc94c3..bdcb47d2e1 100644 --- a/types/node/v7/index.d.ts +++ b/types/node/v7/index.d.ts @@ -3313,6 +3313,14 @@ declare module "tls" { getPeerCertificate(detailed: true): DetailedPeerCertificate; getPeerCertificate(detailed?: false): PeerCertificate; getPeerCertificate(detailed?: boolean): PeerCertificate | DetailedPeerCertificate; + /** + * Returns a string containing the negotiated SSL/TLS protocol version of the current connection. + * The value `'unknown'` will be returned for connected sockets that have not completed the handshaking process. + * The value `null` will be returned for server sockets or disconnected client sockets. + * See https://www.openssl.org/docs/man1.0.2/ssl/SSL_get_version.html for more information. + * @returns negotiated SSL/TLS protocol version of the current connection + */ + getProtocol(): string | null; /** * Could be used to speed up handshake establishment when reconnecting to the server. * @returns ASN.1 encoded TLS session or undefined if none was negotiated. diff --git a/types/node/v8/index.d.ts b/types/node/v8/index.d.ts index 5d672296f2..929aa9b642 100644 --- a/types/node/v8/index.d.ts +++ b/types/node/v8/index.d.ts @@ -4873,6 +4873,14 @@ declare module "tls" { getPeerCertificate(detailed: true): DetailedPeerCertificate; getPeerCertificate(detailed?: false): PeerCertificate; getPeerCertificate(detailed?: boolean): PeerCertificate | DetailedPeerCertificate; + /** + * Returns a string containing the negotiated SSL/TLS protocol version of the current connection. + * The value `'unknown'` will be returned for connected sockets that have not completed the handshaking process. + * The value `null` will be returned for server sockets or disconnected client sockets. + * See https://www.openssl.org/docs/man1.0.2/ssl/SSL_get_version.html for more information. + * @returns negotiated SSL/TLS protocol version of the current connection + */ + getProtocol(): string | null; /** * Could be used to speed up handshake establishment when reconnecting to the server. * @returns ASN.1 encoded TLS session or undefined if none was negotiated.