Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

crypto: naming anonymouse functions #8993

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 26 additions & 24 deletions lib/crypto.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,24 +59,24 @@ function Hash(algorithm, options) {

util.inherits(Hash, LazyTransform);

Hash.prototype._transform = function(chunk, encoding, callback) {
Hash.prototype._transform = function _transform(chunk, encoding, callback) {
this._handle.update(chunk, encoding);
callback();
};

Hash.prototype._flush = function(callback) {
Hash.prototype._flush = function _flush(callback) {
this.push(this._handle.digest());
callback();
};

Hash.prototype.update = function(data, encoding) {
Hash.prototype.update = function update(data, encoding) {
encoding = encoding || exports.DEFAULT_ENCODING;
this._handle.update(data, encoding);
return this;
};


Hash.prototype.digest = function(outputEncoding) {
Hash.prototype.digest = function digest(outputEncoding) {
outputEncoding = outputEncoding || exports.DEFAULT_ENCODING;
return this._handle.digest(outputEncoding);
};
Expand Down Expand Up @@ -122,12 +122,12 @@ function Cipher(cipher, password, options) {

util.inherits(Cipher, LazyTransform);

Cipher.prototype._transform = function(chunk, encoding, callback) {
Cipher.prototype._transform = function _transform(chunk, encoding, callback) {
this.push(this._handle.update(chunk, encoding));
callback();
};

Cipher.prototype._flush = function(callback) {
Cipher.prototype._flush = function _flush(callback) {
try {
this.push(this._handle.final());
} catch (e) {
Expand All @@ -137,7 +137,7 @@ Cipher.prototype._flush = function(callback) {
callback();
};

Cipher.prototype.update = function(data, inputEncoding, outputEncoding) {
Cipher.prototype.update = function update(data, inputEncoding, outputEncoding) {
inputEncoding = inputEncoding || exports.DEFAULT_ENCODING;
outputEncoding = outputEncoding || exports.DEFAULT_ENCODING;

Expand All @@ -152,7 +152,7 @@ Cipher.prototype.update = function(data, inputEncoding, outputEncoding) {
};


Cipher.prototype.final = function(outputEncoding) {
Cipher.prototype.final = function final(outputEncoding) {
outputEncoding = outputEncoding || exports.DEFAULT_ENCODING;
var ret = this._handle.final();

Expand All @@ -165,21 +165,21 @@ Cipher.prototype.final = function(outputEncoding) {
};


Cipher.prototype.setAutoPadding = function(ap) {
Cipher.prototype.setAutoPadding = function setAutoPadding(ap) {
this._handle.setAutoPadding(ap);
return this;
};

Cipher.prototype.getAuthTag = function() {
Cipher.prototype.getAuthTag = function getAuthTag() {
return this._handle.getAuthTag();
};


Cipher.prototype.setAuthTag = function(tagbuf) {
Cipher.prototype.setAuthTag = function setAuthTag(tagbuf) {
this._handle.setAuthTag(tagbuf);
};

Cipher.prototype.setAAD = function(aadbuf) {
Cipher.prototype.setAAD = function setAAD(aadbuf) {
this._handle.setAAD(aadbuf);
};

Expand Down Expand Up @@ -267,14 +267,14 @@ function Sign(algorithm, options) {

util.inherits(Sign, stream.Writable);

Sign.prototype._write = function(chunk, encoding, callback) {
Sign.prototype._write = function _write(chunk, encoding, callback) {
this._handle.update(chunk, encoding);
callback();
};

Sign.prototype.update = Hash.prototype.update;

Sign.prototype.sign = function(options, encoding) {
Sign.prototype.sign = function sign(options, encoding) {
if (!options)
throw new Error('No key provided to sign');

Expand Down Expand Up @@ -306,7 +306,7 @@ util.inherits(Verify, stream.Writable);
Verify.prototype._write = Sign.prototype._write;
Verify.prototype.update = Sign.prototype.update;

Verify.prototype.verify = function(object, signature, sigEncoding) {
Verify.prototype.verify = function verify(object, signature, sigEncoding) {
sigEncoding = sigEncoding || exports.DEFAULT_ENCODING;
return this._handle.verify(toBuf(object), toBuf(signature, sigEncoding));
};
Expand Down Expand Up @@ -474,14 +474,14 @@ function dhGetPrivateKey(encoding) {
}


DiffieHellman.prototype.setPublicKey = function(key, encoding) {
DiffieHellman.prototype.setPublicKey = function setPublicKey(key, encoding) {
encoding = encoding || exports.DEFAULT_ENCODING;
this._handle.setPublicKey(toBuf(key, encoding));
return this;
};


DiffieHellman.prototype.setPrivateKey = function(key, encoding) {
DiffieHellman.prototype.setPrivateKey = function setPrivateKey(key, encoding) {
encoding = encoding || exports.DEFAULT_ENCODING;
this._handle.setPrivateKey(toBuf(key, encoding));
return this;
Expand Down Expand Up @@ -599,19 +599,21 @@ function Certificate() {
}


Certificate.prototype.verifySpkac = function(object) {
Certificate.prototype.verifySpkac = function verifySpkac(object) {
return binding.certVerifySpkac(object);
};


Certificate.prototype.exportPublicKey = function(object, encoding) {
return binding.certExportPublicKey(toBuf(object, encoding));
};
Certificate.prototype.exportPublicKey =
function exportPublicKey(object, encoding) {
return binding.certExportPublicKey(toBuf(object, encoding));
};


Certificate.prototype.exportChallenge = function(object, encoding) {
return binding.certExportChallenge(toBuf(object, encoding));
};
Certificate.prototype.exportChallenge =
function exportChallenge(object, encoding) {
return binding.certExportChallenge(toBuf(object, encoding));
};


exports.setEngine = function setEngine(id, flags) {
Expand Down