DenoDDeno
Powered by
1girl, best quality1
Denoβ€’2y agoβ€’
1 reply
1girl, best quality

Is there an easy way to read tls certificate and key from a filesystem?

I do the following:
if (Deno.env.has("TLS_CERT_PATH") && Deno.env.has("TLS_PKEY_PATH")) {
  const tlsCert = Deno.readFileSync(Deno.env.get("TLS_CERT_PATH"));
  const tlsPkey = Deno.readFileSync(Deno.env.get("TLS_PKEY_PATH"));
  serverOptions = { cert: tlsCert, key: tlsPkey };
}
if (Deno.env.has("TLS_CERT_PATH") && Deno.env.has("TLS_PKEY_PATH")) {
  const tlsCert = Deno.readFileSync(Deno.env.get("TLS_CERT_PATH"));
  const tlsPkey = Deno.readFileSync(Deno.env.get("TLS_PKEY_PATH"));
  serverOptions = { cert: tlsCert, key: tlsPkey };
}

and it doesn't work because apparently it wants a string, not a uint8array. I don't know what's a good way to get a string from a uint8array or to read a string from fs.
Deno banner
DenoJoin
Chat about Deno, a modern runtime for JavaScript and TypeScript.
20,934Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Is there a way to specify a range and list from KV?
octo3.Oocto3. / help
2y ago
Is there a way to read the current raw options for stdin?
cowboydCcowboyd / help
17mo ago
Is there a way to copy an element and place it somewhere else?
SPACE DOGSSPACE DOG / help
3y ago