Use SecureContextOptions in httpsServer.addContext

This commit is contained in:
Maximilien Mellen 2019-03-29 17:32:15 +01:00
parent f45c277760
commit 2bc45778bf
2 changed files with 7 additions and 5 deletions

View File

@ -1,4 +1,5 @@
import { createSecureContext, SecureContext, ConnectionOptions, connect, getCiphers, DEFAULT_ECDH_CURVE, createServer, TLSSocket } from "tls";
import * as fs from "fs";
{
const ctx: SecureContext = createSecureContext({
@ -19,6 +20,11 @@ import { createSecureContext, SecureContext, ConnectionOptions, connect, getCiph
{
const _server = createServer();
_server.addContext("example", {
cert: fs.readFileSync("cert_filepath"),
key: fs.readFileSync("key_filepath")
});
}
{

6
types/node/tls.d.ts vendored
View File

@ -276,11 +276,7 @@ declare module "tls" {
}
class Server extends net.Server {
addContext(hostName: string, credentials: {
key: string;
cert: string;
ca: string;
}): void;
addContext(hostName: string, credentials: SecureContextOptions): void;
/**
* events.EventEmitter