Skip to content

Commit cbd3e58

Browse files
Italo A. Casasaddaleax
authored andcommitted
doc: add added: information for tls
Ref: nodejs#6578 PR-URL: nodejs#7018 Reviewed-By: Anna Henningsen <[email protected]>
1 parent 23a5164 commit cbd3e58

File tree

1 file changed

+106
-0
lines changed

1 file changed

+106
-0
lines changed

doc/api/tls.md

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,9 @@ used properly authorized.
184184

185185

186186
## Class: tls.Server
187+
<!-- YAML
188+
added: v0.3.2
189+
-->
187190

188191
This class is a subclass of `net.Server` and has the same methods on it.
189192
Instead of accepting just raw TCP connections, this accepts encrypted
@@ -199,6 +202,9 @@ established it will be forwarded here.
199202
`tlsSocket` is the [`tls.TLSSocket`][] that the error originated from.
200203

201204
### Event: 'newSession'
205+
<!-- YAML
206+
added: v0.9.2
207+
-->
202208

203209
`function (sessionId, sessionData, callback) { }`
204210

@@ -210,6 +216,9 @@ NOTE: adding this event listener will have an effect only on connections
210216
established after addition of event listener.
211217

212218
### Event: 'OCSPRequest'
219+
<!-- YAML
220+
added: v0.11.13
221+
-->
213222

214223
`function (certificate, issuer, callback) { }`
215224

@@ -248,6 +257,9 @@ NOTE: you may want to use some npm module like [asn1.js] to parse the
248257
certificates.
249258

250259
### Event: 'resumeSession'
260+
<!-- YAML
261+
added: v0.9.2
262+
-->
251263

252264
`function (sessionId, callback) { }`
253265

@@ -274,6 +286,9 @@ server.on('resumeSession', (id, cb) => {
274286
```
275287

276288
### Event: 'secureConnection'
289+
<!-- YAML
290+
added: v0.3.2
291+
-->
277292

278293
`function (tlsSocket) {}`
279294

@@ -292,34 +307,52 @@ server, you unauthorized connections may be accepted.
292307
SNI.
293308

294309
### server.addContext(hostname, context)
310+
<!-- YAML
311+
added: v0.5.3
312+
-->
295313

296314
Add secure context that will be used if client request's SNI hostname is
297315
matching passed `hostname` (wildcards can be used). `context` can contain
298316
`key`, `cert`, `ca` and/or any other properties from
299317
[`tls.createSecureContext()`][] `options` argument.
300318

301319
### server.address()
320+
<!-- YAML
321+
added: v0.6.0
322+
-->
302323

303324
Returns the bound address, the address family name and port of the
304325
server as reported by the operating system. See [`net.Server.address()`][] for
305326
more information.
306327

307328
### server.close([callback])
329+
<!-- YAML
330+
added: v0.3.2
331+
-->
308332

309333
Stops the server from accepting new connections. This function is
310334
asynchronous, the server is finally closed when the server emits a `'close'`
311335
event. Optionally, you can pass a callback to listen for the `'close'` event.
312336

313337
### server.connections
338+
<!-- YAML
339+
added: v0.3.2
340+
-->
314341

315342
The number of concurrent connections on the server.
316343

317344
### server.getTicketKeys()
345+
<!-- YAML
346+
added: v3.0.0
347+
-->
318348

319349
Returns `Buffer` instance holding the keys currently used for
320350
encryption/decryption of the [TLS Session Tickets][]
321351

322352
### server.listen(port[, hostname][, callback])
353+
<!-- YAML
354+
added: v0.3.2
355+
-->
323356

324357
Begin accepting connections on the specified `port` and `hostname`. If the
325358
`hostname` is omitted, the server will accept connections on any IPv6 address
@@ -337,6 +370,9 @@ Set this property to reject connections when the server's connection count
337370
gets high.
338371

339372
### server.setTicketKeys(keys)
373+
<!-- YAML
374+
added: v3.0.0
375+
-->
340376

341377
Updates the keys for encryption/decryption of the [TLS Session Tickets][].
342378

@@ -348,6 +384,9 @@ or currently pending server connections will use previous keys.
348384

349385

350386
## Class: tls.TLSSocket
387+
<!-- YAML
388+
added: v0.11.4
389+
-->
351390

352391
This is a wrapped version of [`net.Socket`][] that does transparent encryption
353392
of written data and all required TLS negotiation.
@@ -360,6 +399,9 @@ Methods that return TLS connection meta data (e.g.
360399
connection is open.
361400

362401
## new tls.TLSSocket(socket[, options])
402+
<!-- YAML
403+
added: v0.11.4
404+
-->
363405

364406
Construct a new TLSSocket object from existing TCP socket.
365407

@@ -390,6 +432,9 @@ Construct a new TLSSocket object from existing TCP socket.
390432
on the socket before establishing a secure communication
391433

392434
### Event: 'OCSPResponse'
435+
<!-- YAML
436+
added: v0.11.13
437+
-->
393438

394439
`function (response) { }`
395440

@@ -400,6 +445,9 @@ Traditionally, the `response` is a signed object from the server's CA that
400445
contains information about server's certificate revocation status.
401446

402447
### Event: 'secureConnect'
448+
<!-- YAML
449+
added: v0.11.4
450+
-->
403451

404452
This event is emitted after a new connection has been successfully handshaked.
405453
The listener will be called no matter if the server's certificate was
@@ -410,28 +458,44 @@ If `tlsSocket.authorized === false` then the error can be found in
410458
`tlsSocket.npnProtocol` for negotiated protocol.
411459

412460
### tlsSocket.address()
461+
<!-- YAML
462+
added: v0.11.4
463+
-->
413464

414465
Returns the bound address, the address family name and port of the
415466
underlying socket as reported by the operating system. Returns an
416467
object with three properties, e.g.
417468
`{ port: 12346, family: 'IPv4', address: '127.0.0.1' }`
418469

419470
### tlsSocket.authorized
471+
<!-- YAML
472+
added: v0.11.4
473+
-->
420474

421475
A boolean that is `true` if the peer certificate was signed by one of the
422476
specified CAs, otherwise `false`
423477

424478
### tlsSocket.authorizationError
479+
<!-- YAML
480+
added: v0.11.4
481+
-->
425482

426483
The reason why the peer's certificate has not been verified. This property
427484
becomes available only when `tlsSocket.authorized === false`.
428485

429486
### tlsSocket.encrypted
487+
<!-- YAML
488+
added: v0.11.4
489+
-->
430490

431491
Static boolean value, always `true`. May be used to distinguish TLS sockets
432492
from regular ones.
433493

434494
### tlsSocket.getCipher()
495+
<!-- YAML
496+
added: v0.11.4
497+
-->
498+
435499
Returns an object representing the cipher name and the SSL/TLS
436500
protocol version of the current connection.
437501

@@ -443,6 +507,9 @@ https://www.openssl.org/docs/ssl/ssl.html#DEALING-WITH-CIPHERS for more
443507
information.
444508

445509
### tlsSocket.getPeerCertificate([ detailed ])
510+
<!-- YAML
511+
added: v0.11.4
512+
-->
446513

447514
Returns an object representing the peer's certificate. The returned object has
448515
some properties corresponding to the field of the certificate. If `detailed`
@@ -479,39 +546,63 @@ If the peer does not provide a certificate, it returns `null` or an empty
479546
object.
480547

481548
### tlsSocket.getSession()
549+
<!-- YAML
550+
added: v0.11.4
551+
-->
482552

483553
Return ASN.1 encoded TLS session or `undefined` if none was negotiated. Could
484554
be used to speed up handshake establishment when reconnecting to the server.
485555

486556
### tlsSocket.getTLSTicket()
557+
<!-- YAML
558+
added: v0.11.4
559+
-->
487560

488561
NOTE: Works only with client TLS sockets. Useful only for debugging, for
489562
session reuse provide `session` option to [`tls.connect()`][].
490563

491564
Return TLS session ticket or `undefined` if none was negotiated.
492565

493566
### tlsSocket.localPort
567+
<!-- YAML
568+
added: v0.11.4
569+
-->
494570

495571
The numeric representation of the local port.
496572

497573
### tlsSocket.localAddress
574+
<!-- YAML
575+
added: v0.11.4
576+
-->
498577

499578
The string representation of the local IP address.
500579

501580
### tlsSocket.remoteAddress
581+
<!-- YAML
582+
added: v0.11.4
583+
-->
502584

503585
The string representation of the remote IP address. For example,
504586
`'74.125.127.100'` or `'2001:4860:a005::68'`.
505587

506588
### tlsSocket.remoteFamily
589+
<!-- YAML
590+
added: v0.11.4
591+
-->
507592

508593
The string representation of the remote IP family. `'IPv4'` or `'IPv6'`.
509594

510595
### tlsSocket.remotePort
596+
<!-- YAML
597+
added: v0.11.4
598+
-->
511599

512600
The numeric representation of the remote port. For example, `443`.
513601

514602
### tlsSocket.renegotiate(options, callback)
603+
<!-- YAML
604+
added: v0.11.8
605+
-->
515606

516607
Initiate TLS renegotiation process. The `options` may contain the following
517608
fields: `rejectUnauthorized`, `requestCert` (See [`tls.createServer()`][] for
@@ -525,6 +616,9 @@ ANOTHER NOTE: When running as the server, socket will be destroyed
525616
with an error after `handshakeTimeout` timeout.
526617

527618
### tlsSocket.setMaxSendFragment(size)
619+
<!-- YAML
620+
added: v0.11.11
621+
-->
528622

529623
Set maximum TLS fragment size (default and maximum value is: `16384`, minimum
530624
is: `512`). Returns `true` on success, `false` otherwise.
@@ -538,6 +632,9 @@ decrease overall server throughput.
538632

539633
## tls.connect(options[, callback])
540634
## tls.connect(port[, host][, options][, callback])
635+
<!-- YAML
636+
added: v0.11.3
637+
-->
541638

542639
Creates a new client connection to the given `port` and `host` (old API) or
543640
`options.port` and `options.host`. (If `host` is omitted, it defaults to
@@ -654,6 +751,9 @@ socket.on('end', () => {
654751
```
655752

656753
## tls.createSecureContext(details)
754+
<!-- YAML
755+
added: v0.11.13
756+
-->
657757

658758
Creates a credentials object, with the optional details being a
659759
dictionary with keys:
@@ -711,6 +811,9 @@ and the cleartext one is used as a replacement for the initial encrypted stream.
711811
NOTE: `cleartext` has the same APIs as [`tls.TLSSocket`][]
712812

713813
## tls.createServer(options[, secureConnectionListener])
814+
<!-- YAML
815+
added: v0.3.2
816+
-->
714817

715818
Creates a new [tls.Server][]. The `connectionListener` argument is
716819
automatically set as a listener for the [`'secureConnection'`][] event. The
@@ -901,6 +1004,9 @@ openssl s_client -connect 127.0.0.1:8000
9011004
```
9021005

9031006
## tls.getCiphers()
1007+
<!-- YAML
1008+
added: v0.10.2
1009+
-->
9041010

9051011
Returns an array with the names of the supported SSL ciphers.
9061012

0 commit comments

Comments
 (0)