diff --git a/src/deno_transport.ts b/src/deno_transport.ts index 7a7045d6..b30beeb0 100644 --- a/src/deno_transport.ts +++ b/src/deno_transport.ts @@ -30,7 +30,7 @@ import { } from "../nats-base-client/internal_mod.ts"; import type { TlsOptions } from "../nats-base-client/types.ts"; -const VERSION = "1.0.0-8"; +const VERSION = "1.0.0-9"; const LANG = "nats.deno"; // if trying to simply write to the connection for some reason diff --git a/tests/properties_test.ts b/tests/properties_test.ts index 7be10781..59b063bc 100644 --- a/tests/properties_test.ts +++ b/tests/properties_test.ts @@ -97,3 +97,27 @@ Deno.test("properties - configured user/pass options", async () => { assertEquals(cc.pass, opts.pass); assertEquals(cc.auth_token, undefined); }); + +Deno.test("properties - tls doesn't leak options", () => { + const tlsOptions = { + keyFile: "keyFile", + certFile: "certFile", + caFile: "caFile", + key: "key", + cert: "cert", + ca: "ca", + }; + + let opts = { tls: tlsOptions, cert: "another" }; + const auth = buildAuthenticator(opts); + opts = extend(opts, auth); + + const c = new Connect({ version: "1.2.3", lang: "test" }, opts); + const cc = JSON.parse(JSON.stringify(c)); + assertEquals(cc.tls_required, true); + assertEquals(cc.cert, undefined); + assertEquals(cc.keyFile, undefined); + assertEquals(cc.certFile, undefined); + assertEquals(cc.caFile, undefined); + assertEquals(cc.tls, undefined); +});