33require ( 'internal/util' ) . assertCrypto ( ) ;
44
55const assert = require ( 'assert' ) ;
6+ const Buffer = require ( 'buffer' ) . Buffer ;
7+ const common = require ( '_tls_common' ) ;
8+ const Connection = process . binding ( 'crypto' ) . Connection ;
69const EventEmitter = require ( 'events' ) ;
10+ const internalUtil = require ( 'internal/util' ) ;
711const stream = require ( 'stream' ) ;
12+ const Timer = process . binding ( 'timer_wrap' ) . Timer ;
813const tls = require ( 'tls' ) ;
914const util = require ( 'util' ) ;
10- const common = require ( '_tls_common' ) ;
15+
1116const debug = util . debuglog ( 'tls-legacy' ) ;
12- const Buffer = require ( 'buffer' ) . Buffer ;
13- const Timer = process . binding ( 'timer_wrap' ) . Timer ;
14- const Connection = process . binding ( 'crypto' ) . Connection ;
1517
1618function SlabBuffer ( ) {
1719 this . create ( ) ;
@@ -787,18 +789,11 @@ function securePairNT(self, options) {
787789}
788790
789791
790- exports . createSecurePair = function ( context ,
791- isServer ,
792- requestCert ,
793- rejectUnauthorized ,
794- options ) {
795- var pair = new SecurePair ( context ,
796- isServer ,
797- requestCert ,
798- rejectUnauthorized ,
799- options ) ;
800- return pair ;
801- } ;
792+ function createSecurePair ( context , isServer , requestCert ,
793+ rejectUnauthorized , options ) {
794+ return new SecurePair ( context , isServer , requestCert ,
795+ rejectUnauthorized , options ) ;
796+ }
802797
803798
804799SecurePair . prototype . maybeInitFinished = function ( ) {
@@ -868,7 +863,7 @@ SecurePair.prototype.error = function(returnOnly) {
868863} ;
869864
870865
871- exports . pipe = function pipe ( pair , socket ) {
866+ function pipe ( pair , socket ) {
872867 pair . encrypted . pipe ( socket ) ;
873868 socket . pipe ( pair . encrypted ) ;
874869
@@ -918,7 +913,7 @@ exports.pipe = function pipe(pair, socket) {
918913 socket . on ( 'timeout' , ontimeout ) ;
919914
920915 return cleartext ;
921- } ;
916+ }
922917
923918
924919function pipeCloseNT ( pair , socket ) {
@@ -927,3 +922,11 @@ function pipeCloseNT(pair, socket) {
927922 pair . encrypted . unpipe ( socket ) ;
928923 socket . destroySoon ( ) ;
929924}
925+
926+ module . exports = {
927+ createSecurePair :
928+ internalUtil . deprecate ( createSecurePair ,
929+ 'tls.createSecurePair() is deprecated. Please use ' +
930+ 'tls.Socket instead.' , 'DEP0064' ) ,
931+ pipe
932+ } ;
0 commit comments