Browse Source

add shouldVerifyPeer param to SecurePairs

v0.7.4-release
Ryan Dahl 14 years ago
parent
commit
855210ce0b
  1. 12
      lib/securepair.js

12
lib/securepair.js

@ -19,9 +19,9 @@ var SecureStream = null;
* Provides a pair of streams to do encrypted communication. * Provides a pair of streams to do encrypted communication.
*/ */
function SecurePair(credentials, isServer) { function SecurePair(credentials, isServer, shouldVerifyPeer) {
if (!(this instanceof SecurePair)) { if (!(this instanceof SecurePair)) {
return new SecurePair(credentials, isServer); return new SecurePair(credentials, isServer, shouldVerifyPeer);
} }
var self = this; var self = this;
@ -51,7 +51,7 @@ function SecurePair(credentials, isServer) {
if (!this._isServer) { if (!this._isServer) {
/* For clients, we will always have either a given ca list or be using default one */ /* For clients, we will always have either a given ca list or be using default one */
this.credentials.shouldVerify = true; shouldVerifyPeer = true;
} }
this._secureEstablished = false; this._secureEstablished = false;
@ -60,7 +60,7 @@ function SecurePair(credentials, isServer) {
this._ssl = new SecureStream(this.credentials.context, this._ssl = new SecureStream(this.credentials.context,
this._isServer ? true : false, this._isServer ? true : false,
this.credentials.shouldVerify); shouldVerifyPeer ? true : false);
/* Acts as a r/w stream to the cleartext side of the stream. */ /* Acts as a r/w stream to the cleartext side of the stream. */
@ -175,8 +175,8 @@ function SecurePair(credentials, isServer) {
util.inherits(SecurePair, events.EventEmitter); util.inherits(SecurePair, events.EventEmitter);
exports.createSecurePair = function (credentials, isServer) { exports.createSecurePair = function (credentials, isServer, shouldVerifyPeer) {
var pair = new SecurePair(credentials, isServer); var pair = new SecurePair(credentials, isServer, shouldVerifyPeer);
return pair; return pair;
}; };

Loading…
Cancel
Save