Start TLS handshake from an existing connection using an optional list of CA certificates, and hostname (default is ""). Specifying CA certs is optional. By default the configured root certificates are used. Using this function requires that the other end of the connection is prepared for a TLS handshake.

const conn = await Deno.connect({ port: 80, hostname: "" });
const caCert = await Deno.readTextFile("./certs/my_custom_root_CA.pem");
const tlsConn = await Deno.startTls(conn, { caCerts: [caCert], hostname: "localhost" });

Requires allow-net permission.

function startTls(conn: Conn, options?: StartTlsOptions): Promise<TlsConn>;
startTls(conn: Conn, options?: StartTlsOptions): Promise<TlsConn>


options?: StartTlsOptions optional

§Return Type