Skip to main content
Module

x/netzo/deno.d.ts>Deno.startTls

SDK for Netzo, the open Web platform to unify IoT devices, applications and services.
Go to Latest
function Deno.startTls
allow-net
import { Deno } from "https://deno.land/x/netzo@v0.1.10/deno.d.ts";
const { startTls } = Deno;

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.

Parameters

conn: Conn
optional
options: StartTlsOptions