From 255697da9f685347152306b9e2a43041f320691a Mon Sep 17 00:00:00 2001 From: hriss95 Date: Fri, 9 Sep 2016 14:48:55 +0100 Subject: [PATCH] Node.d.ts: Update definitions for module "tls" (#11025) * Node.d.ts: Update definitions for module "tls" * Node.d.ts: Update definitions for module "tls" * Node.d.ts: Revert function connect changes * Node: Update definitions and tests for module "tls" * Node: Fix a typo in definitions for module "tls" --- node/node-tests.ts | 4 ++-- node/node.d.ts | 37 ++++++++++++++++++++++++++----------- 2 files changed, 28 insertions(+), 13 deletions(-) diff --git a/node/node-tests.ts b/node/node-tests.ts index 28a015468cdb7f..05d0b177a2d4cc 100644 --- a/node/node-tests.ts +++ b/node/node-tests.ts @@ -519,11 +519,11 @@ var ctx: tls.SecureContext = tls.createSecureContext({ }); var blah = ctx.context; -var tlsOpts: tls.TlsOptions = { +var connOpts: tls.ConnectionOptions = { host: "127.0.0.1", port: 55 }; -var tlsSocket = tls.connect(tlsOpts); +var tlsSocket = tls.connect(connOpts); //////////////////////////////////////////////////// diff --git a/node/node.d.ts b/node/node.d.ts index 1aa5c272ab1f5b..f2a05aecc892fc 100644 --- a/node/node.d.ts +++ b/node/node.d.ts @@ -2065,18 +2065,26 @@ declare module "tls" { export interface TlsOptions { host?: string; port?: number; - pfx?: any; //string or buffer - key?: any; //string or buffer + pfx?: string | Buffer[]; + key?: string | string[] | Buffer | any[]; passphrase?: string; - cert?: any; - ca?: any; //string or buffer - crl?: any; //string or string array + cert?: string | string[] | Buffer | Buffer[]; + ca?: string | string[] | Buffer | Buffer[]; + crl?: string | string[]; ciphers?: string; - honorCipherOrder?: any; + honorCipherOrder?: boolean; requestCert?: boolean; rejectUnauthorized?: boolean; - NPNProtocols?: any; //array or Buffer; + NPNProtocols?: string[] | Buffer; SNICallback?: (servername: string, cb:(err:Error,ctx:SecureContext)=>any) => any; + ecdhCurve?: string; + dhparam?: string | Buffer; + handshakeTimeout?: number; + ALPNProtocols?: string[] | Buffer; + sessionTimeout?: number; + ticketKeys?: any; + sessionIdContext?: string; + secureProtocol?: string; } export interface ConnectionOptions { @@ -2084,13 +2092,20 @@ declare module "tls" { port?: number; socket?: net.Socket; pfx?: string | Buffer - key?: string | Buffer + key?: string |string[] | Buffer | Buffer[]; passphrase?: string; - cert?: string | Buffer - ca?: (string | Buffer)[]; + cert?: string | string[] | Buffer | Buffer[]; + ca?: string | Buffer | (string | Buffer)[]; rejectUnauthorized?: boolean; NPNProtocols?: (string | Buffer)[]; servername?: string; + path?: string; + ALPNProtocols?: (string | Buffer)[]; + checkServerIdentity?: (servername: string, cert: string | Buffer | (string | Buffer)[]) => any; + secureProtocol?: string; + secureContext?: Object; + session?: Buffer; + minDHSize?: number; } export interface Server extends net.Server { @@ -2143,7 +2158,7 @@ declare module "tls" { } export function createServer(options: TlsOptions, secureConnectionListener?: (cleartextStream: ClearTextStream) => void): Server; - export function connect(options: TlsOptions, secureConnectionListener?: () => void): ClearTextStream; + export function connect(options: ConnectionOptions, secureConnectionListener?: () => void): ClearTextStream; export function connect(port: number, host?: string, options?: ConnectionOptions, secureConnectListener?: () => void): ClearTextStream; export function connect(port: number, options?: ConnectionOptions, secureConnectListener?: () => void): ClearTextStream; export function createSecurePair(credentials?: crypto.Credentials, isServer?: boolean, requestCert?: boolean, rejectUnauthorized?: boolean): SecurePair;