Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Commit

Permalink
crypto: Pass options to ctor calls
Browse files Browse the repository at this point in the history
  • Loading branch information
isaacs committed Mar 29, 2013
1 parent 1d17ced commit 7af075e
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions lib/crypto.js
Expand Up @@ -59,7 +59,7 @@ var StringDecoder = require('string_decoder').StringDecoder;

function Credentials(secureProtocol, flags, context) {
if (!(this instanceof Credentials)) {
return new Credentials(secureProtocol);
return new Credentials(secureProtocol, flags, context);
}

if (!crypto) {
Expand Down Expand Up @@ -171,7 +171,7 @@ util.inherits(LazyTransform, stream.Transform);
exports.createHash = exports.Hash = Hash;
function Hash(algorithm, options) {
if (!(this instanceof Hash))
return new Hash(algorithm);
return new Hash(algorithm, options);
this._binding = new binding.Hash(algorithm);
LazyTransform.call(this, options);
}
Expand Down Expand Up @@ -209,7 +209,7 @@ exports.createHmac = exports.Hmac = Hmac;

function Hmac(hmac, key, options) {
if (!(this instanceof Hmac))
return new Hmac(hmac, key);
return new Hmac(hmac, key, options);
this._binding = new binding.Hmac();
this._binding.init(hmac, toBuf(key));
LazyTransform.call(this, options);
Expand All @@ -233,7 +233,7 @@ function getDecoder(decoder, encoding) {
exports.createCipher = exports.Cipher = Cipher;
function Cipher(cipher, password, options) {
if (!(this instanceof Cipher))
return new Cipher(cipher, password);
return new Cipher(cipher, password, options);
this._binding = new binding.Cipher;

this._binding.init(cipher, toBuf(password));
Expand Down Expand Up @@ -293,7 +293,7 @@ Cipher.prototype.setAutoPadding = function(ap) {
exports.createCipheriv = exports.Cipheriv = Cipheriv;
function Cipheriv(cipher, key, iv, options) {
if (!(this instanceof Cipheriv))
return new Cipheriv(cipher, key, iv);
return new Cipheriv(cipher, key, iv, options);
this._binding = new binding.Cipher();
this._binding.initiv(cipher, toBuf(key), toBuf(iv));
this._decoder = null;
Expand All @@ -314,7 +314,7 @@ Cipheriv.prototype.setAutoPadding = Cipher.prototype.setAutoPadding;
exports.createDecipher = exports.Decipher = Decipher;
function Decipher(cipher, password, options) {
if (!(this instanceof Decipher))
return new Decipher(cipher, password);
return new Decipher(cipher, password, options);

this._binding = new binding.Decipher;
this._binding.init(cipher, toBuf(password));
Expand All @@ -337,7 +337,7 @@ Decipher.prototype.setAutoPadding = Cipher.prototype.setAutoPadding;
exports.createDecipheriv = exports.Decipheriv = Decipheriv;
function Decipheriv(cipher, key, iv, options) {
if (!(this instanceof Decipheriv))
return new Decipheriv(cipher, key, iv);
return new Decipheriv(cipher, key, iv, options);

this._binding = new binding.Decipher;
this._binding.initiv(cipher, toBuf(key), toBuf(iv));
Expand All @@ -360,7 +360,7 @@ Decipheriv.prototype.setAutoPadding = Cipher.prototype.setAutoPadding;
exports.createSign = exports.Sign = Sign;
function Sign(algorithm, options) {
if (!(this instanceof Sign))
return new Sign(algorithm);
return new Sign(algorithm, options);
this._binding = new binding.Sign();
this._binding.init(algorithm);

Expand Down Expand Up @@ -391,7 +391,7 @@ Sign.prototype.sign = function(key, encoding) {
exports.createVerify = exports.Verify = Verify;
function Verify(algorithm, options) {
if (!(this instanceof Verify))
return new Verify(algorithm);
return new Verify(algorithm, options);

this._binding = new binding.Verify;
this._binding.init(algorithm);
Expand Down

0 comments on commit 7af075e

Please sign in to comment.