Skip to content

Commit f033d2a

Browse files
committed
doc: clarify that the ctx argument is optional
Clarify that the `ctx` argument of the `SNICallback` callback is optional. Fixes: nodejs#34085
1 parent f89530f commit f033d2a

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

doc/api/tls.md

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1696,12 +1696,16 @@ changes:
16961696
* `sessionTimeout` {number} The number of seconds after which a TLS session
16971697
created by the server will no longer be resumable. See
16981698
[Session Resumption][] for more information. **Default:** `300`.
1699-
* `SNICallback(servername, cb)` {Function} A function that will be called if
1700-
the client supports SNI TLS extension. Two arguments will be passed when
1701-
called: `servername` and `cb`. `SNICallback` should invoke `cb(null, ctx)`,
1702-
where `ctx` is a `SecureContext` instance. (`tls.createSecureContext(...)`
1703-
can be used to get a proper `SecureContext`.) If `SNICallback` wasn't
1704-
provided the default callback with high-level API will be used (see below).
1699+
* `SNICallback(servername, callback)` {Function} A function that will be
1700+
called if the client supports SNI TLS extension. Two arguments will be
1701+
passed when called: `servername` and `callback`. `callback` is an
1702+
error-first callback that must be called synchronously and takes two
1703+
optional arguments: `error` and `ctx`. `ctx`, if provided, is a
1704+
`SecureContext` instance. [`tls.createSecureContext()`][] can be used to get
1705+
a proper `SecureContext`. If `callback` is called with a falsy `ctx`
1706+
argument, the default secure context of the server will be used. If
1707+
`SNICallback` wasn't provided the default callback with high-level API will
1708+
be used (see below).
17051709
* `ticketKeys`: {Buffer} 48-bytes of cryptographically strong pseudo-random
17061710
data. See [Session Resumption][] for more information.
17071711
* `pskCallback` {Function}

0 commit comments

Comments
 (0)