mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-23 12:56:46 +08:00
Add tls.createSecureContext to node.js typing.
This commit is contained in:
@@ -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
16
node/node.d.ts
vendored
@@ -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" {
|
||||
|
||||
Reference in New Issue
Block a user