Skip to main content
The Deno 2 Release Candidate is here
Learn more
Module

x/deno/cli/js/lib.deno.unstable.d.ts>Deno.startTls

A modern runtime for JavaScript and TypeScript.
Go to Latest
function Deno.startTls
import { Deno } from "https://deno.land/x/deno@v1.0.0/cli/js/lib.deno.unstable.d.ts";
const { startTls } = Deno;

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.

Parameters

conn: Conn
optional
options: StartTlsOptions

Returns

Promise<Conn>