diff options
Diffstat (limited to 'cli/js/tls.ts')
-rw-r--r-- | cli/js/tls.ts | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/cli/js/tls.ts b/cli/js/tls.ts index ef87b5aa1..f60eb24cb 100644 --- a/cli/js/tls.ts +++ b/cli/js/tls.ts @@ -57,3 +57,20 @@ export function listenTLS({ }); return new TLSListenerImpl(res.rid, res.localAddr); } + +interface StartTLSOptions { + hostname?: string; + certFile?: string; +} + +export async function startTLS( + conn: Conn, + { hostname = "127.0.0.1", certFile = undefined }: StartTLSOptions = {} +): Promise<Conn> { + const res = await tlsOps.startTLS({ + rid: conn.rid, + hostname, + certFile, + }); + return new ConnImpl(res.rid, res.remoteAddr!, res.localAddr!); +} |