Skip to content

Commit c697c14

Browse files
committed
tls: remove deprecated tls.createSecurePair
1 parent 27f98c3 commit c697c14

15 files changed

+5
-580
lines changed

benchmark/tls/secure-pair.js

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
const common = require('../common.js');
33
const bench = common.createBenchmark(main, {
44
dur: [5],
5-
securing: ['SecurePair', 'TLSSocket', 'clear'],
5+
securing: ['TLSSocket', 'clear'],
66
size: [100, 1024, 1024 * 1024],
77
}, {
88
flags: ['--no-warnings'],
@@ -68,9 +68,6 @@ function main({ dur, size, securing }) {
6868
function onProxyConnection(conn) {
6969
const client = net.connect(REDIRECT_PORT, () => {
7070
switch (securing) {
71-
case 'SecurePair':
72-
securePair(conn, client);
73-
break;
7471
case 'TLSSocket':
7572
secureTLSSocket(conn, client);
7673
break;
@@ -83,17 +80,6 @@ function main({ dur, size, securing }) {
8380
});
8481
}
8582

86-
function securePair(conn, client) {
87-
const serverCtx = tls.createSecureContext(options);
88-
const serverPair = tls.createSecurePair(serverCtx, true, true, false);
89-
conn.pipe(serverPair.encrypted);
90-
serverPair.encrypted.pipe(conn);
91-
serverPair.on('error', (error) => {
92-
throw new Error(`Pair error: ${error}`);
93-
});
94-
serverPair.cleartext.pipe(client);
95-
}
96-
9783
function secureTLSSocket(conn, client) {
9884
const serverSocket = new tls.TLSSocket(conn, options);
9985
serverSocket.on('error', (e) => {

doc/api/deprecations.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1488,6 +1488,9 @@ officially supported API.
14881488

14891489
<!-- YAML
14901490
changes:
1491+
- version: REPLACEME
1492+
pr-url: https://github.com/nodejs/node/pull/xxxxx
1493+
description: End-of-Life.
14911494
- version: v8.0.0
14921495
pr-url: https://github.com/nodejs/node/pull/11349
14931496
description: Runtime deprecation.
@@ -1507,7 +1510,7 @@ changes:
15071510
description: Runtime deprecation.
15081511
-->
15091512

1510-
Type: Runtime
1513+
Type: End-of-Life
15111514

15121515
The `tls.createSecurePair()` API was deprecated in documentation in Node.js
15131516
0.11.3. Users should use `tls.Socket` instead.

doc/api/tls.md

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -570,17 +570,6 @@ The `cryptoStream.bytesWritten` property returns the total number of bytes
570570
written to the underlying socket _including_ the bytes required for the
571571
implementation of the TLS protocol.
572572

573-
## Class: `tls.SecurePair`
574-
575-
<!-- YAML
576-
added: v0.3.2
577-
deprecated: v0.11.3
578-
-->
579-
580-
> Stability: 0 - Deprecated: Use [`tls.TLSSocket`][] instead.
581-
582-
Returned by [`tls.createSecurePair()`][].
583-
584573
### Event: `'secure'`
585574

586575
<!-- YAML
@@ -2556,7 +2545,6 @@ added:
25562545
[`tls.TLSSocket`]: #class-tlstlssocket
25572546
[`tls.connect()`]: #tlsconnectoptions-callback
25582547
[`tls.createSecureContext()`]: #tlscreatesecurecontextoptions
2559-
[`tls.createSecurePair()`]: #tlscreatesecurepaircontext-isserver-requestcert-rejectunauthorized-options
25602548
[`tls.createServer()`]: #tlscreateserveroptions-secureconnectionlistener
25612549
[`tls.getCACertificates()`]: #tlsgetcacertificatestype
25622550
[`tls.getCiphers()`]: #tlsgetciphers

lib/internal/tls/secure-pair.js

Lines changed: 0 additions & 87 deletions
This file was deleted.

lib/tls.js

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ const { Buffer } = require('buffer');
5757
const { canonicalizeIP } = internalBinding('cares_wrap');
5858
const _tls_common = require('_tls_common');
5959
const _tls_wrap = require('_tls_wrap');
60-
const { createSecurePair } = require('internal/tls/secure-pair');
6160
const { validateString } = require('internal/validators');
6261

6362
// Allow {CLIENT_RENEG_LIMIT} client-initiated session renegotiations
@@ -393,8 +392,3 @@ exports.TLSSocket = _tls_wrap.TLSSocket;
393392
exports.Server = _tls_wrap.Server;
394393
exports.createServer = _tls_wrap.createServer;
395394
exports.connect = _tls_wrap.connect;
396-
397-
exports.createSecurePair = internalUtil.deprecate(
398-
createSecurePair,
399-
'tls.createSecurePair() is deprecated. Please use ' +
400-
'tls.TLSSocket instead.', 'DEP0064');

test/parallel/test-tls-basic-validations.js

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -80,15 +80,6 @@ assert.throws(() => tls.createServer({ ticketKeys: Buffer.alloc(0) }), {
8080
message: /The property 'options\.ticketKeys' must be exactly 48 bytes/
8181
});
8282

83-
assert.throws(
84-
() => tls.createSecurePair({}),
85-
{
86-
message: 'context must be a SecureContext',
87-
code: 'ERR_TLS_INVALID_CONTEXT',
88-
name: 'TypeError',
89-
}
90-
);
91-
9283
{
9384
const buffer = Buffer.from('abcd');
9485
const out = {};

test/parallel/test-tls-external-accessor.js

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,3 @@ const tls = require('tls');
1414
assert.throws(() => cctx._external, TypeError);
1515
pctx._external; // eslint-disable-line no-unused-expressions
1616
}
17-
{
18-
const pctx = tls.createSecurePair().credentials.context;
19-
const cctx = { __proto__: pctx };
20-
assert.throws(() => cctx._external, TypeError);
21-
pctx._external; // eslint-disable-line no-unused-expressions
22-
}

test/parallel/test-tls-handshake-nohang.js

Lines changed: 0 additions & 32 deletions
This file was deleted.

test/parallel/test-tls-legacy-deprecated.js

Lines changed: 0 additions & 15 deletions
This file was deleted.

test/parallel/test-tls-securepair-fiftharg.js

Lines changed: 0 additions & 25 deletions
This file was deleted.

0 commit comments

Comments
 (0)