Add tls.createSecureContext to node.js typing.

This commit is contained in:
bls
2015-06-04 17:46:55 +10:00
parent c50b111ded
commit 0d8680a11b
2 changed files with 27 additions and 0 deletions

View File

@@ -7,6 +7,7 @@ import zlib = require("zlib");
import url = require('url');
import util = require("util");
import crypto = require("crypto");
import tls = require("tls");
import http = require("http");
import net = require("net");
import dgram = require("dgram");
@@ -143,6 +144,16 @@ function crypto_cipher_decipher_buffer_test() {
assert.deepEqual(clearText2, clearText);
}
////////////////////////////////////////////////////
/// TLS tests : http://nodejs.org/api/tls.html
////////////////////////////////////////////////////
var ctx: tls.SecureContext = tls.createSecureContext({
key: "NOT REALLY A KEY",
cert: "SOME CERTIFICATE",
});
var blah = ctx.context;
////////////////////////////////////////////////////
// Make sure .listen() and .close() retuern a Server instance

16
node/node.d.ts vendored
View File

@@ -1236,11 +1236,27 @@ declare module "tls" {
cleartext: any;
}
export interface SecureContextOptions {
pfx?: any; //string | buffer
key?: any; //string | buffer
passphrase?: string;
cert?: any; // string | buffer
ca?: any; // string | buffer
crl?: any; // string | string[]
ciphers?: string;
honorCipherOrder?: boolean;
}
export interface SecureContext {
context: any;
}
export function createServer(options: TlsOptions, secureConnectionListener?: (cleartextStream: ClearTextStream) =>void ): Server;
export function connect(options: TlsOptions, 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;
export function createSecureContext(details: SecureContextOptions): SecureContext;
}
declare module "crypto" {