Node.js tls: TLS and SSL sockets
Answer: The node:tls module implements the TLS and SSL protocols on top of OpenSSL. Access it with import tls from "node:tls". Create a server with tls.createServer and open a client connection with tls.connect.
Examples
import tls from "node:tls";
console.log(typeof tls.createServer);
Rules
- The implementation is built on top of OpenSSL.
- Use
servername(SNI) when connecting to a named host.
See also
Claims
- id: C1 claim: node:tls implements TLS and SSL on top of OpenSSL. source: S1 evidence: "implementation of the Transport Layer Security"
- id: C2 claim: The module is imported from node:tls. source: S1 evidence: "import tls from 'node:tls'"
- id: C3 claim: The source docs describe the same TLS implementation. source: S2 evidence: "implementation of the Transport Layer Security"
Sources
- [S1] TLS (SSL). Node.js docs. https://nodejs.org/api/tls.html . License: MIT. Accessed 2026-11-18.
- [S2] tls.md. Node.js source docs. https://raw.githubusercontent.com/nodejs/node/main/doc/api/tls.md . License: MIT. Accessed 2026-11-18.
License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: Node.js docs, TLS (SSL); Node.js source docs, tls.md. MIT (https://raw.githubusercontent.com/nodejs/node/main/LICENSE). Copyright Node.js contributors. Text was condensed and changed from the originals.
License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: Node.js docs, TLS (SSL); Node.js source docs, tls.md. MIT (https://raw.githubusercontent.com/nodejs/node/main/LICENSE). Copyright Node.js contributors.
Cite this
iinventedlight. 2026. "Node.js tls: TLS and SSL sockets." iinventedlight Library, iil:note:sdm901xx, version of 2026-11-18. https://iinventedlight.com/library/notes/node-tls/. License: CC-BY-4.0.
@misc{iil_note_sdm901xx,
author = {{iinventedlight}},
title = {{Node.js tls: TLS and SSL sockets}},
howpublished = {iinventedlight Library},
year = {2026},
date = {2026-11-18},
url = {https://iinventedlight.com/library/notes/node-tls/},
note = {Permanent ID iil:note:sdm901xx. License: CC-BY-4.0.},
}
Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com. Or Report a correction (no account needed).
For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/node-tls.md.