Skip to content

Commit

Permalink
fix: crypto each exports, close #473 (#830)
Browse files Browse the repository at this point in the history
Co-authored-by: 饶培泽 <peizerao@gmail.com>
  • Loading branch information
weiyie and PeterRao committed Jul 14, 2020
1 parent 03ddedb commit 1cf7231
Showing 1 changed file with 27 additions and 19 deletions.
46 changes: 27 additions & 19 deletions shims/crypto/crypto.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,22 +67,30 @@ function error () {
exports.createHash = function (alg) { return hash(alg) };
exports.createHmac = function (alg, key) { return hash(alg, key) };

function each(a, f) {
for(var i in a)
f(a[i], i)
}

// the least I can do is make error messages for the rest of the node.js/crypto api.
each(['createCredentials'
, 'createCipher'
, 'createCipheriv'
, 'createDecipher'
, 'createDecipheriv'
, 'createSign'
, 'createVerify'
, 'createDiffieHellman'
, 'pbkdf2'], function (name) {
exports[name] = function () {
error('sorry,', name, 'is not implemented yet')
}
});
exports.createCredentials = () => {
error('sorry,createCredentials is not implemented yet');
};
exports.createCipher = () => {
error('sorry,createCipher is not implemented yet');
};
exports.createCipheriv = () => {
error('sorry,createCipheriv is not implemented yet');
};
exports.createDecipher = () => {
error('sorry,createDecipher is not implemented yet');
};
exports.createDecipheriv = () => {
error('sorry,createDecipheriv is not implemented yet');
};
exports.createSign = () => {
error('sorry,createSign is not implemented yet');
};
exports.createVerify = () => {
error('sorry,createVerify is not implemented yet');
};
exports.createDiffieHellman = () => {
error('sorry,createDiffieHellman is not implemented yet');
};
exports.pbkdf2 = () => {
error('sorry,pbkdf2 is not implemented yet');
};

0 comments on commit 1cf7231

Please sign in to comment.