@@ -32,7 +32,6 @@ const {
32
32
ArrayPrototypeSome,
33
33
ObjectDefineProperty,
34
34
ObjectFreeze,
35
- ReflectConstruct,
36
35
RegExpPrototypeTest,
37
36
StringFromCharCode,
38
37
StringPrototypeCharCodeAt,
@@ -50,19 +49,18 @@ const {
50
49
} = require ( 'internal/errors' ) . codes ;
51
50
const internalUtil = require ( 'internal/util' ) ;
52
51
internalUtil . assertCrypto ( ) ;
53
- const internalTLS = require ( 'internal/tls' ) ;
54
52
const { isArrayBufferView } = require ( 'internal/util/types' ) ;
55
53
56
54
const net = require ( 'net' ) ;
57
55
const { getOptionValue } = require ( 'internal/options' ) ;
58
56
const { getRootCertificates, getSSLCiphers } = internalBinding ( 'crypto' ) ;
59
57
const { Buffer } = require ( 'buffer' ) ;
60
- const EventEmitter = require ( 'events' ) ;
61
58
const { URL } = require ( 'internal/url' ) ;
62
- const DuplexPair = require ( 'internal/streams/duplexpair' ) ;
63
59
const { canonicalizeIP } = internalBinding ( 'cares_wrap' ) ;
64
60
const _tls_common = require ( '_tls_common' ) ;
65
61
const _tls_wrap = require ( '_tls_wrap' ) ;
62
+ const { createSecurePair } = require ( 'internal/tls/secure-pair' ) ;
63
+ const { parseCertString } = require ( 'internal/tls/parse-cert-string' ) ;
66
64
67
65
// Allow {CLIENT_RENEG_LIMIT} client-initiated session renegotiations
68
66
// every {CLIENT_RENEG_WINDOW} seconds. An error event is emitted if more
@@ -300,53 +298,20 @@ exports.checkServerIdentity = function checkServerIdentity(hostname, cert) {
300
298
}
301
299
} ;
302
300
303
-
304
- class SecurePair extends EventEmitter {
305
- constructor ( secureContext = exports . createSecureContext ( ) ,
306
- isServer = false ,
307
- requestCert = ! isServer ,
308
- rejectUnauthorized = false ,
309
- options = { } ) {
310
- super ( ) ;
311
- const { socket1, socket2 } = new DuplexPair ( ) ;
312
-
313
- this . server = options . server ;
314
- this . credentials = secureContext ;
315
-
316
- this . encrypted = socket1 ;
317
- this . cleartext = new exports . TLSSocket ( socket2 , {
318
- secureContext,
319
- isServer,
320
- requestCert,
321
- rejectUnauthorized,
322
- ...options
323
- } ) ;
324
- this . cleartext . once ( 'secure' , ( ) => this . emit ( 'secure' ) ) ;
325
- }
326
-
327
- destroy ( ) {
328
- this . cleartext . destroy ( ) ;
329
- this . encrypted . destroy ( ) ;
330
- }
331
- }
332
-
333
-
334
- exports . parseCertString = internalUtil . deprecate (
335
- internalTLS . parseCertString ,
336
- 'tls.parseCertString() is deprecated. ' +
337
- 'Please use querystring.parse() instead.' ,
338
- 'DEP0076' ) ;
339
-
340
301
exports . createSecureContext = _tls_common . createSecureContext ;
341
302
exports . SecureContext = _tls_common . SecureContext ;
342
303
exports . TLSSocket = _tls_wrap . TLSSocket ;
343
304
exports . Server = _tls_wrap . Server ;
344
305
exports . createServer = _tls_wrap . createServer ;
345
306
exports . connect = _tls_wrap . connect ;
346
307
308
+ exports . parseCertString = internalUtil . deprecate (
309
+ parseCertString ,
310
+ 'tls.parseCertString() is deprecated. ' +
311
+ 'Please use querystring.parse() instead.' ,
312
+ 'DEP0076' ) ;
313
+
347
314
exports . createSecurePair = internalUtil . deprecate (
348
- function createSecurePair ( ...args ) {
349
- return ReflectConstruct ( SecurePair , args ) ;
350
- } ,
315
+ createSecurePair ,
351
316
'tls.createSecurePair() is deprecated. Please use ' +
352
317
'tls.TLSSocket instead.' , 'DEP0064' ) ;
0 commit comments