W3cubDocs

/Deno

Deno.startTls

Start TLS handshake from an existing connection using an optional list of CA certificates, and hostname (default is "127.0.0.1"). 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: "127.0.0.1" });
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>

Parameters

conn: Conn
options?: StartTlsOptions optional

Return Type

Promise<TlsConn>

© 2018–2021 the Deno authors
https://doc.deno.land/deno/stable/~/Deno.startTls