Skip to content

Commit

Permalink
doc, tls: deprecate createSecurePair
Browse files Browse the repository at this point in the history
createSecurePair uses tls_legacy and the legacy Connection from
node_crypto.cc. Deprecate them in favor of TLSSocket.

PR-URL: #6063
Reviewed-By: James M Snell <[email protected]>
  • Loading branch information
jhamhader authored and jasnell committed Apr 26, 2016
1 parent 56b9478 commit 31de5cc
Showing 1 changed file with 23 additions and 2 deletions.
25 changes: 23 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,23 @@ stream.

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

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

```js
pair = tls.createSecurePair( ... );
pair.encrypted.pipe(socket);
socket.pipe(pair.encrypted);
```

can be replaced with:

```js
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

0 comments on commit 31de5cc

Please sign in to comment.