From 0935f94260280d17735f47d7a602926f8a879434 Mon Sep 17 00:00:00 2001 From: nixar Date: Fri, 14 Oct 2016 16:33:44 +0200 Subject: [PATCH 1/3] Add constructor signature for tls.TLSSocket --- node/node.d.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/node/node.d.ts b/node/node.d.ts index 511b08cfd7..0a72d8e560 100644 --- a/node/node.d.ts +++ b/node/node.d.ts @@ -2642,6 +2642,10 @@ declare module "tls" { } export class TLSSocket extends stream.Duplex { + /** + * Construct a new tls.TLSSocket object from an existing TCP socket. + */ + constructor(socket:net.Socket, options?: ConnectionOptions); /** * Returns the bound address, the address family name and port of the underlying socket as reported by * the operating system. From 08af4a37bab7e7557953bb9bd1606a76a4a90b0b Mon Sep 17 00:00:00 2001 From: nixar Date: Fri, 14 Oct 2016 17:06:12 +0200 Subject: [PATCH 2/3] Added documentation for tls.TLSSocket options --- node/node.d.ts | 41 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) diff --git a/node/node.d.ts b/node/node.d.ts index 0a72d8e560..8aa0e5a6e7 100644 --- a/node/node.d.ts +++ b/node/node.d.ts @@ -2645,7 +2645,46 @@ declare module "tls" { /** * Construct a new tls.TLSSocket object from an existing TCP socket. */ - constructor(socket:net.Socket, options?: ConnectionOptions); + constructor(socket:net.Socket, options?: { + /** An optional TLS context object from tls.createSecureContext() */ + secureContext?: SecureContext, + /** If true the TLS socket will be instantiated in server-mode. + * Defaults to false. */ + isServer?: boolean, + /** An optional net.Server instance. */ + server?: net.Server, + /** If true the server will request a certificate from clients that + * connect and attempt to verify that certificate. Defaults to + * false. */ + requestCert?: boolean, + /** If true the server will reject any connection which is not + * authorized with the list of supplied CAs. This option only has an + * effect if requestCert is true. Defaults to false. */ + rejectUnauthorized?: boolean, + /** An array of strings or a Buffer naming possible NPN protocols. + * (Protocols should be ordered by their priority.) */ + NPNProtocols?: string[] | Buffer, + /** An array of strings or a Buffer naming possible ALPN protocols. + * (Protocols should be ordered by their priority.) When the server + * receives both NPN and ALPN extensions from the client, ALPN takes + * precedence over NPN and the server does not send an NPN extension + * to the client. */ + ALPNProtocols?: string[] | Buffer, + /** SNICallback(servername, cb) A function that will be + * called if the client supports SNI TLS extension. Two arguments + * will be passed when called: servername and cb. SNICallback should + * invoke cb(null, ctx), where ctx is a SecureContext instance. + * (tls.createSecureContext(...) can be used to get a proper + * SecureContext.) If SNICallback wasn't provided the default callback + * with high-level API will be used (see below). */ + SNICallback?: Function, + /** An optional Buffer instance containing a TLS session. */ + session?: Buffer, + /** 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 + }); /** * Returns the bound address, the address family name and port of the underlying socket as reported by * the operating system. From 35edbc5cd83b31470a87dc7c07a8f6b7f67e0ea3 Mon Sep 17 00:00:00 2001 From: nixar Date: Fri, 14 Oct 2016 21:18:13 +0200 Subject: [PATCH 3/3] Put start/end jsdoc markers on their own line --- node/node.d.ts | 76 +++++++++++++++++++++++++++++++------------------- 1 file changed, 48 insertions(+), 28 deletions(-) diff --git a/node/node.d.ts b/node/node.d.ts index 8aa0e5a6e7..5824c79491 100644 --- a/node/node.d.ts +++ b/node/node.d.ts @@ -2646,43 +2646,63 @@ declare module "tls" { * Construct a new tls.TLSSocket object from an existing TCP socket. */ constructor(socket:net.Socket, options?: { - /** An optional TLS context object from tls.createSecureContext() */ + /** + * An optional TLS context object from tls.createSecureContext() + */ secureContext?: SecureContext, - /** If true the TLS socket will be instantiated in server-mode. - * Defaults to false. */ + /** + * If true the TLS socket will be instantiated in server-mode. + * Defaults to false. + */ isServer?: boolean, - /** An optional net.Server instance. */ + /** + * An optional net.Server instance. + */ server?: net.Server, - /** If true the server will request a certificate from clients that - * connect and attempt to verify that certificate. Defaults to - * false. */ + /** + * If true the server will request a certificate from clients that + * connect and attempt to verify that certificate. Defaults to + * false. + */ requestCert?: boolean, - /** If true the server will reject any connection which is not - * authorized with the list of supplied CAs. This option only has an - * effect if requestCert is true. Defaults to false. */ + /** + * If true the server will reject any connection which is not + * authorized with the list of supplied CAs. This option only has an + * effect if requestCert is true. Defaults to false. + */ rejectUnauthorized?: boolean, - /** An array of strings or a Buffer naming possible NPN protocols. - * (Protocols should be ordered by their priority.) */ + /** + * An array of strings or a Buffer naming possible NPN protocols. + * (Protocols should be ordered by their priority.) + */ NPNProtocols?: string[] | Buffer, - /** An array of strings or a Buffer naming possible ALPN protocols. - * (Protocols should be ordered by their priority.) When the server - * receives both NPN and ALPN extensions from the client, ALPN takes - * precedence over NPN and the server does not send an NPN extension - * to the client. */ + /** + * An array of strings or a Buffer naming possible ALPN protocols. + * (Protocols should be ordered by their priority.) When the server + * receives both NPN and ALPN extensions from the client, ALPN takes + * precedence over NPN and the server does not send an NPN extension + * to the client. + */ ALPNProtocols?: string[] | Buffer, - /** SNICallback(servername, cb) A function that will be - * called if the client supports SNI TLS extension. Two arguments - * will be passed when called: servername and cb. SNICallback should - * invoke cb(null, ctx), where ctx is a SecureContext instance. - * (tls.createSecureContext(...) can be used to get a proper - * SecureContext.) If SNICallback wasn't provided the default callback - * with high-level API will be used (see below). */ + /** + * SNICallback(servername, cb) A function that will be + * called if the client supports SNI TLS extension. Two arguments + * will be passed when called: servername and cb. SNICallback should + * invoke cb(null, ctx), where ctx is a SecureContext instance. + * (tls.createSecureContext(...) can be used to get a proper + * SecureContext.) If SNICallback wasn't provided the default callback + * with high-level API will be used (see below). + */ SNICallback?: Function, - /** An optional Buffer instance containing a TLS session. */ + /** + * An optional Buffer instance containing a TLS session. + */ session?: Buffer, - /** 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 */ + /** + * 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 }); /**