diff options
author | EnokMan <416828041@qq.com> | 2020-04-18 10:21:20 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-18 11:21:20 -0400 |
commit | 47617e60d551665ec509e013cfcae30987cb3b2b (patch) | |
tree | 5717061b7fd567b5fb8508f565993062f8014722 /cli/js/lib.deno.ns.d.ts | |
parent | 10469ec2798a7f02a6d9371207cc984502039bfa (diff) |
feat: startTLS (#4773)
Diffstat (limited to 'cli/js/lib.deno.ns.d.ts')
-rw-r--r-- | cli/js/lib.deno.ns.d.ts | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/cli/js/lib.deno.ns.d.ts b/cli/js/lib.deno.ns.d.ts index cdaff073b..9ab40248f 100644 --- a/cli/js/lib.deno.ns.d.ts +++ b/cli/js/lib.deno.ns.d.ts @@ -2038,6 +2038,33 @@ declare namespace Deno { */ export function connectTLS(options: ConnectTLSOptions): Promise<Conn>; + export interface StartTLSOptions { + /** A literal IP address or host name that can be resolved to an IP address. + * If not specified, defaults to `127.0.0.1`. */ + hostname?: string; + /** Server certificate file. */ + certFile?: string; + } + + /** **UNSTABLE**: new API, yet to be vetted. + * + * Start TLS handshake from an existing connection using + * an optional cert file, hostname (default is "127.0.0.1"). The + * cert file is optional and if not included Mozilla's root certificates will + * be used (see also https://github.com/ctz/webpki-roots for specifics) + * Using this function requires that the other end of the connection is + * prepared for TLS handshake. + * + * const conn = await Deno.connect({ port: 80, hostname: "127.0.0.1" }); + * const tlsConn = await Deno.startTLS(conn, { certFile: "./certs/my_custom_root_CA.pem", hostname: "127.0.0.1", port: 80 }); + * + * Requires `allow-net` permission. + */ + export function startTLS( + conn: Conn, + options?: StartTLSOptions + ): Promise<Conn>; + /** **UNSTABLE**: not sure if broken or not */ export interface Metrics { opsDispatched: number; |