1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-25 15:29:32 -05:00

FUTURE(ext/net): remove Deno.ListenTlsOptions.(keyFile|certFile) (#23271)

Towards #23089

---------

Signed-off-by: Asher Gomez <ashersaupingomez@gmail.com>
This commit is contained in:
Asher Gomez 2024-04-21 11:58:59 +10:00 committed by GitHub
parent a2bd1a724b
commit 98e2f6d50b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 21 additions and 0 deletions

View file

@ -153,6 +153,13 @@ function loadTlsKeyPair(api, {
keyFile, keyFile,
privateKey, privateKey,
}) { }) {
if (internals.future) {
certFile = undefined;
certChain = undefined;
keyFile = undefined;
privateKey = undefined;
}
// Check for "pem" format // Check for "pem" format
if (keyFormat !== undefined && keyFormat !== "pem") { if (keyFormat !== undefined && keyFormat !== "pem") {
throw new TypeError('If `keyFormat` is specified, it must be "pem"'); throw new TypeError('If `keyFormat` is specified, it must be "pem"');

View file

@ -92,6 +92,19 @@ try {
} }
} }
// Note: this could throw with a `Deno.errors.NotFound` error if `keyFile` and
// `certFile` were used.
try {
Deno.listenTls({ port: tlsPort, keyFile: "foo", certFile: "foo" });
} catch (error) {
if (
error instanceof Deno.errors.InvalidData &&
error.message ===
"Deno.listenTls requires a key: Error creating TLS certificate"
) {
console.log("Deno.ListenTlsOptions.(keyFile|certFile) do nothing");
}
}
console.log("Deno.customInspect is", Deno.customInspect); console.log("Deno.customInspect is", Deno.customInspect);
self.close(); self.close();

View file

@ -34,4 +34,5 @@ Deno.TlsListener.prototype.rid is undefined
Deno.TlsConn.prototype.rid is undefined Deno.TlsConn.prototype.rid is undefined
Deno.FsWatcher.prototype.rid is undefined Deno.FsWatcher.prototype.rid is undefined
Deno.FsFile constructor is illegal Deno.FsFile constructor is illegal
Deno.ListenTlsOptions.(keyFile|certFile) do nothing
Deno.customInspect is undefined Deno.customInspect is undefined