refactor: set removal version for Deno.ListenTlsOptions.certFile, Deno.ListenTlsOptions.keyFile and Deno.ConnectTlsOptions.certFile (#22026)

This change:
1. Sets the removal version for `Deno.ListenTlsOptions.certFile`,
`Deno.ListenTlsOptions.keyFile` and `Deno.ConnectTlsOptions.certFile`
for Deno v2, in favour of the `cert`, `key` and `caCerts` options,
respectively.
2. Replaces use of the deprecated options with the new recommended
options.

Towards #22021
This commit is contained in:
Asher Gomez 2024-01-24 03:35:23 +11:00 committed by GitHub
parent b0febea47f
commit 18a235e608
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 64 additions and 34 deletions

View file

@ -174,13 +174,17 @@ declare namespace Deno {
* `--allow-read`.
*
* @tags allow-read
* @deprecated This option is deprecated and will be removed in Deno 2.0.
* @deprecated Pass the certificate file contents directly to the
* {@linkcode Deno.ListenTlsOptions.cert} option instead. This option will
* be removed in Deno 2.0.
*/
certFile?: string;
/** Server private key file. Requires `--allow-read`.
*
* @tags allow-read
* @deprecated This option is deprecated and will be removed in Deno 2.0.
* @deprecated Pass the key file contents directly to the
* {@linkcode Deno.ListenTlsOptions.key} option instead. This option will
* be removed in Deno 2.0.
*/
keyFile?: string;
@ -197,7 +201,11 @@ declare namespace Deno {
* security).
*
* ```ts
* const lstnr = Deno.listenTls({ port: 443, certFile: "./server.crt", keyFile: "./server.key" });
* using listener = Deno.listenTls({
* port: 443,
* cert: Deno.readTextFileSync("./server.crt"),
* key: Deno.readTextFileSync("./server.key"),
* });
* ```
*
* Requires `allow-net` permission.
@ -289,8 +297,9 @@ declare namespace Deno {
/**
* Server certificate file.
*
* @deprecated This option is deprecated and will be removed in a future
* release.
* @deprecated Pass the cert file contents directly to the
* {@linkcode Deno.ConnectTlsOptions.caCerts} option instead. This option
* will be removed in Deno 2.0.
*/
certFile?: string;
/** A list of root certificates that will be used in addition to the