Skip to content

doc: document secure use of new tls.TLSSocket() - #65208

Open
zeexzeex wants to merge 1 commit into
nodejs:mainfrom
zeexzeex:doc/tls-socket-secure-usage
Open

doc: document secure use of new tls.TLSSocket()#65208
zeexzeex wants to merge 1 commit into
nodejs:mainfrom
zeexzeex:doc/tls-socket-secure-usage

Conversation

@zeexzeex

@zeexzeex zeexzeex commented Aug 11, 2026

Copy link
Copy Markdown

Fixes #43994

Document that constructing a tls.TLSSocket directly does not authenticate
the peer the way tls.connect() does.

Changes in doc/api/tls.md:

  • Warn that callers must manage the socket lifetime and validate the peer
    certificate and identity
  • Clarify that 'secureConnect', authorized, and authorizationError are
    not set for direct construction
  • Document tlsSocket.ssl.verifyError() and show how to check the certificate
    chain and host identity on the 'secure' event

This matches the checks performed in the tls.connect() path and the pattern
already used in test/parallel/test-tls-socket-default-options.js.

Explain that constructing TLSSocket directly does not authenticate
the peer. Document ssl.verifyError() and show how to validate
certificates and identity on the 'secure' event.

Fixes: nodejs#43994

Signed-off-by: Avocado <ujubongbong@gmail.com>
@nodejs-github-bot nodejs-github-bot added doc Issues and PRs related to the documentations. tls Issues and PRs related to the tls subsystem. labels Aug 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

doc Issues and PRs related to the documentations. tls Issues and PRs related to the tls subsystem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

How to use new tls.TLSSocket(...) to establish a secure connection?

2 participants