From 8fa92228bb748bdc59e0fe003108dcaea0a18d10 Mon Sep 17 00:00:00 2001 From: Luca Casonato Date: Mon, 16 Sep 2024 14:35:55 +0200 Subject: fix(types): simplify mtls related types (#25658) Instead of two overloads for `Deno.connectTls` and `Deno.createHttpClient`, there is now just one. --- cli/tsc/dts/lib.deno.ns.d.ts | 30 ++++++++++++------------------ 1 file changed, 12 insertions(+), 18 deletions(-) (limited to 'cli/tsc') diff --git a/cli/tsc/dts/lib.deno.ns.d.ts b/cli/tsc/dts/lib.deno.ns.d.ts index 337baf4fe..d27fc380d 100644 --- a/cli/tsc/dts/lib.deno.ns.d.ts +++ b/cli/tsc/dts/lib.deno.ns.d.ts @@ -6107,7 +6107,12 @@ declare namespace Deno { /** Create a custom HttpClient to use with {@linkcode fetch}. This is an * extension of the web platform Fetch API which allows Deno to use custom - * TLS certificates and connect via a proxy while using `fetch()`. + * TLS CA certificates and connect via a proxy while using `fetch()`. + * + * The `cert` and `key` options can be used to specify a client certificate + * and key to use when connecting to a server that requires client + * authentication (mutual TLS or mTLS). The `cert` and `key` options must be + * provided in PEM format. * * @example ```ts * const caCert = await Deno.readTextFile("./ca.pem"); @@ -6122,29 +6127,18 @@ declare namespace Deno { * const response = await fetch("https://myserver.com", { client }); * ``` * - * @category Fetch - */ - export function createHttpClient( - options: CreateHttpClientOptions, - ): HttpClient; - - /** - * Create a custom HttpClient to use with {@linkcode fetch}. This is an - * extension of the web platform Fetch API which allows Deno to use custom - * TLS certificates and connect via a proxy while using `fetch()`. - * * @example ```ts - * const caCert = await Deno.readTextFile("./ca.pem"); - * // Load a client key and certificate that we'll use to connect - * const key = await Deno.readTextFile("./key.key"); - * const cert = await Deno.readTextFile("./cert.crt"); - * const client = Deno.createHttpClient({ caCerts: [ caCert ], key, cert }); + * const key = "----BEGIN PRIVATE KEY----..."; + * const cert = "----BEGIN CERTIFICATE----..."; + * const client = Deno.createHttpClient({ key, cert }); * const response = await fetch("https://myserver.com", { client }); * ``` * * @category Fetch */ export function createHttpClient( - options: CreateHttpClientOptions & TlsCertifiedKeyPem, + options: + | CreateHttpClientOptions + | (CreateHttpClientOptions & TlsCertifiedKeyPem), ): HttpClient; } -- cgit v1.2.3