Skip to content

Commit c53c34c

Browse files
jeromecovingtonaddaleax
authored andcommitted
doc: reorder deprecated tls docs
In other api docs, it seems that deprecated classes and methods are listed along with others, and marked as deprecated. In tls docs, deprecations were listed at the bottom of the document. This commit reorders them to what seems to be the standard, and corrects some links in doc/api/deprecations.md PR-URL: #34687 Reviewed-By: Rich Trott <[email protected]>
1 parent edda492 commit c53c34c

File tree

2 files changed

+110
-112
lines changed

2 files changed

+110
-112
lines changed

doc/api/deprecations.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2664,9 +2664,9 @@ const moduleParents = Object.values(require.cache)
26642664
[`timeout.ref()`]: timers.html#timers_timeout_ref
26652665
[`timeout.refresh()`]: timers.html#timers_timeout_refresh
26662666
[`timeout.unref()`]: timers.html#timers_timeout_unref
2667-
[`tls.CryptoStream`]: tls.html#tls_class_cryptostream
2667+
[`tls.CryptoStream`]: tls.html#tls_class_tls_cryptostream
26682668
[`tls.SecureContext`]: tls.html#tls_tls_createsecurecontext_options
2669-
[`tls.SecurePair`]: tls.html#tls_class_securepair
2669+
[`tls.SecurePair`]: tls.html#tls_class_tls_securepair
26702670
[`tls.TLSSocket`]: tls.html#tls_class_tls_tlssocket
26712671
[`tls.checkServerIdentity()`]: tls.html#tls_tls_checkserveridentity_hostname_cert
26722672
[`tls.createSecureContext()`]: tls.html#tls_tls_createsecurecontext_options

doc/api/tls.md

Lines changed: 108 additions & 110 deletions
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,51 @@ The first 3 are enabled by default. The last 2 `CCM`-based suites are supported
370370
by TLSv1.3 because they may be more performant on constrained systems, but they
371371
are not enabled by default since they offer less security.
372372

373+
## Class: `tls.CryptoStream`
374+
<!-- YAML
375+
added: v0.3.4
376+
deprecated: v0.11.3
377+
-->
378+
379+
> Stability: 0 - Deprecated: Use [`tls.TLSSocket`][] instead.
380+
381+
The `tls.CryptoStream` class represents a stream of encrypted data. This class
382+
is deprecated and should no longer be used.
383+
384+
### `cryptoStream.bytesWritten`
385+
<!-- YAML
386+
added: v0.3.4
387+
deprecated: v0.11.3
388+
-->
389+
390+
The `cryptoStream.bytesWritten` property returns the total number of bytes
391+
written to the underlying socket *including* the bytes required for the
392+
implementation of the TLS protocol.
393+
394+
## Class: `tls.SecurePair`
395+
<!-- YAML
396+
added: v0.3.2
397+
deprecated: v0.11.3
398+
-->
399+
400+
> Stability: 0 - Deprecated: Use [`tls.TLSSocket`][] instead.
401+
402+
Returned by [`tls.createSecurePair()`][].
403+
404+
### Event: `'secure'`
405+
<!-- YAML
406+
added: v0.3.2
407+
deprecated: v0.11.3
408+
-->
409+
410+
The `'secure'` event is emitted by the `SecurePair` object once a secure
411+
connection has been established.
412+
413+
As with checking for the server
414+
[`'secureConnection'`](#tls_event_secureconnection)
415+
event, `pair.cleartext.authorized` should be inspected to confirm whether the
416+
certificate used is properly authorized.
417+
373418
## Class: `tls.Server`
374419
<!-- YAML
375420
added: v0.3.2
@@ -1657,6 +1702,69 @@ A key is *required* for ciphers that make use of certificates. Either `key` or
16571702
If the `ca` option is not given, then Node.js will default to using
16581703
[Mozilla's publicly trusted list of CAs][].
16591704

1705+
## `tls.createSecurePair([context][, isServer][, requestCert][, rejectUnauthorized][, options])`
1706+
<!-- YAML
1707+
added: v0.3.2
1708+
deprecated: v0.11.3
1709+
changes:
1710+
- version: v5.0.0
1711+
pr-url: https://github.com/nodejs/node/pull/2564
1712+
description: ALPN options are supported now.
1713+
-->
1714+
1715+
> Stability: 0 - Deprecated: Use [`tls.TLSSocket`][] instead.
1716+
1717+
* `context` {Object} A secure context object as returned by
1718+
`tls.createSecureContext()`
1719+
* `isServer` {boolean} `true` to specify that this TLS connection should be
1720+
opened as a server.
1721+
* `requestCert` {boolean} `true` to specify whether a server should request a
1722+
certificate from a connecting client. Only applies when `isServer` is `true`.
1723+
* `rejectUnauthorized` {boolean} If not `false` a server automatically reject
1724+
clients with invalid certificates. Only applies when `isServer` is `true`.
1725+
* `options`
1726+
* `enableTrace`: See [`tls.createServer()`][]
1727+
* `secureContext`: A TLS context object from [`tls.createSecureContext()`][]
1728+
* `isServer`: If `true` the TLS socket will be instantiated in server-mode.
1729+
**Default:** `false`.
1730+
* `server` {net.Server} A [`net.Server`][] instance
1731+
* `requestCert`: See [`tls.createServer()`][]
1732+
* `rejectUnauthorized`: See [`tls.createServer()`][]
1733+
* `ALPNProtocols`: See [`tls.createServer()`][]
1734+
* `SNICallback`: See [`tls.createServer()`][]
1735+
* `session` {Buffer} A `Buffer` instance containing a TLS session.
1736+
* `requestOCSP` {boolean} If `true`, specifies that the OCSP status request
1737+
extension will be added to the client hello and an `'OCSPResponse'` event
1738+
will be emitted on the socket before establishing a secure communication.
1739+
1740+
Creates a new secure pair object with two streams, one of which reads and writes
1741+
the encrypted data and the other of which reads and writes the cleartext data.
1742+
Generally, the encrypted stream is piped to/from an incoming encrypted data
1743+
stream and the cleartext one is used as a replacement for the initial encrypted
1744+
stream.
1745+
1746+
`tls.createSecurePair()` returns a `tls.SecurePair` object with `cleartext` and
1747+
`encrypted` stream properties.
1748+
1749+
Using `cleartext` has the same API as [`tls.TLSSocket`][].
1750+
1751+
The `tls.createSecurePair()` method is now deprecated in favor of
1752+
`tls.TLSSocket()`. For example, the code:
1753+
1754+
```js
1755+
pair = tls.createSecurePair(/* ... */);
1756+
pair.encrypted.pipe(socket);
1757+
socket.pipe(pair.encrypted);
1758+
```
1759+
1760+
can be replaced by:
1761+
1762+
```js
1763+
secureSocket = tls.TLSSocket(socket, options);
1764+
```
1765+
1766+
where `secureSocket` has the same API as `pair.cleartext`.
1767+
16601768
## `tls.createServer([options][, secureConnectionListener])`
16611769
<!-- YAML
16621770
added: v0.3.2
@@ -1853,116 +1961,6 @@ added: v11.4.0
18531961
`'TLSv1.3'`. If multiple of the options are provided, the lowest minimum is
18541962
used.
18551963

1856-
## Deprecated APIs
1857-
1858-
### Class: `CryptoStream`
1859-
<!-- YAML
1860-
added: v0.3.4
1861-
deprecated: v0.11.3
1862-
-->
1863-
1864-
> Stability: 0 - Deprecated: Use [`tls.TLSSocket`][] instead.
1865-
1866-
The `tls.CryptoStream` class represents a stream of encrypted data. This class
1867-
is deprecated and should no longer be used.
1868-
1869-
#### `cryptoStream.bytesWritten`
1870-
<!-- YAML
1871-
added: v0.3.4
1872-
deprecated: v0.11.3
1873-
-->
1874-
1875-
The `cryptoStream.bytesWritten` property returns the total number of bytes
1876-
written to the underlying socket *including* the bytes required for the
1877-
implementation of the TLS protocol.
1878-
1879-
### Class: `SecurePair`
1880-
<!-- YAML
1881-
added: v0.3.2
1882-
deprecated: v0.11.3
1883-
-->
1884-
1885-
> Stability: 0 - Deprecated: Use [`tls.TLSSocket`][] instead.
1886-
1887-
Returned by [`tls.createSecurePair()`][].
1888-
1889-
#### Event: `'secure'`
1890-
<!-- YAML
1891-
added: v0.3.2
1892-
deprecated: v0.11.3
1893-
-->
1894-
1895-
The `'secure'` event is emitted by the `SecurePair` object once a secure
1896-
connection has been established.
1897-
1898-
As with checking for the server
1899-
[`'secureConnection'`](#tls_event_secureconnection)
1900-
event, `pair.cleartext.authorized` should be inspected to confirm whether the
1901-
certificate used is properly authorized.
1902-
1903-
### `tls.createSecurePair([context][, isServer][, requestCert][, rejectUnauthorized][, options])`
1904-
<!-- YAML
1905-
added: v0.3.2
1906-
deprecated: v0.11.3
1907-
changes:
1908-
- version: v5.0.0
1909-
pr-url: https://github.com/nodejs/node/pull/2564
1910-
description: ALPN options are supported now.
1911-
-->
1912-
1913-
> Stability: 0 - Deprecated: Use [`tls.TLSSocket`][] instead.
1914-
1915-
* `context` {Object} A secure context object as returned by
1916-
`tls.createSecureContext()`
1917-
* `isServer` {boolean} `true` to specify that this TLS connection should be
1918-
opened as a server.
1919-
* `requestCert` {boolean} `true` to specify whether a server should request a
1920-
certificate from a connecting client. Only applies when `isServer` is `true`.
1921-
* `rejectUnauthorized` {boolean} If not `false` a server automatically reject
1922-
clients with invalid certificates. Only applies when `isServer` is `true`.
1923-
* `options`
1924-
* `enableTrace`: See [`tls.createServer()`][]
1925-
* `secureContext`: A TLS context object from [`tls.createSecureContext()`][]
1926-
* `isServer`: If `true` the TLS socket will be instantiated in server-mode.
1927-
**Default:** `false`.
1928-
* `server` {net.Server} A [`net.Server`][] instance
1929-
* `requestCert`: See [`tls.createServer()`][]
1930-
* `rejectUnauthorized`: See [`tls.createServer()`][]
1931-
* `ALPNProtocols`: See [`tls.createServer()`][]
1932-
* `SNICallback`: See [`tls.createServer()`][]
1933-
* `session` {Buffer} A `Buffer` instance containing a TLS session.
1934-
* `requestOCSP` {boolean} If `true`, specifies that the OCSP status request
1935-
extension will be added to the client hello and an `'OCSPResponse'` event
1936-
will be emitted on the socket before establishing a secure communication.
1937-
1938-
Creates a new secure pair object with two streams, one of which reads and writes
1939-
the encrypted data and the other of which reads and writes the cleartext data.
1940-
Generally, the encrypted stream is piped to/from an incoming encrypted data
1941-
stream and the cleartext one is used as a replacement for the initial encrypted
1942-
stream.
1943-
1944-
`tls.createSecurePair()` returns a `tls.SecurePair` object with `cleartext` and
1945-
`encrypted` stream properties.
1946-
1947-
Using `cleartext` has the same API as [`tls.TLSSocket`][].
1948-
1949-
The `tls.createSecurePair()` method is now deprecated in favor of
1950-
`tls.TLSSocket()`. For example, the code:
1951-
1952-
```js
1953-
pair = tls.createSecurePair(/* ... */);
1954-
pair.encrypted.pipe(socket);
1955-
socket.pipe(pair.encrypted);
1956-
```
1957-
1958-
can be replaced by:
1959-
1960-
```js
1961-
secureSocket = tls.TLSSocket(socket, options);
1962-
```
1963-
1964-
where `secureSocket` has the same API as `pair.cleartext`.
1965-
19661964
[`'newSession'`]: #tls_event_newsession
19671965
[`'resumeSession'`]: #tls_event_resumesession
19681966
[`'secureConnect'`]: #tls_event_secureconnect

0 commit comments

Comments
 (0)