Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc, tls: deprecate createSecurePair #6063

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 19 additions & 2 deletions doc/api/tls.md
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,8 @@ the total bytes written to the socket, *including the TLS overhead*.

## Class: SecurePair

Stability: 0 - Deprecated: Use [`tls.TLSSocket`][] instead.

Returned by tls.createSecurePair.

### Event: 'secure'
Expand Down Expand Up @@ -379,9 +381,9 @@ Construct a new TLSSocket object from an existing TCP socket.

- `server`: An optional [`net.Server`][] instance

- `requestCert`: Optional, see [`tls.createSecurePair()`][]
- `requestCert`: Optional, see [`tls.createServer()`][]

- `rejectUnauthorized`: Optional, see [`tls.createSecurePair()`][]
- `rejectUnauthorized`: Optional, see [`tls.createServer()`][]

- `NPNProtocols`: Optional, see [`tls.createServer()`][]

Expand Down Expand Up @@ -745,6 +747,8 @@ publicly trusted list of CAs as given in

## tls.createSecurePair([context][, isServer][, requestCert][, rejectUnauthorized][, options])

Stability: 0 - Deprecated: Use [`tls.TLSSocket`][] instead.

Creates a new secure pair object with two streams, one of which reads and writes
the encrypted data and the other of which reads and writes the cleartext data.
Generally, the encrypted stream is piped to/from an incoming encrypted data
Expand All @@ -770,6 +774,19 @@ stream.

NOTE: `cleartext` has the same API as [`tls.TLSSocket`][]

**Deprecated** `tls.createSecurePair()` is now deprecated in favor of
`tls.TLSSocket()`. For example:
```
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style nit, can you add the js to the end of the three backticks and put a blank line before the examples

pair = tls.createSecurePair( ... );
pair.encrypted.pipe(socket);
socket.pipe(pair.encrypted);
```
can be replaced with:
```
secure_socket = tls.TLSSocket(socket, options);
```
where `secure_socket` has the same API as `pair.cleartext`.

## tls.createServer(options[, secureConnectionListener])

Creates a new [tls.Server][]. The `connectionListener` argument is
Expand Down