Skip to content

Commit 304318d

Browse files
committed
Merge pull request #121 from ForbesLindesay/patch-3
Simplify reporting of un-implemented methods and add privateEncrypt/publicDecrypt
2 parents dbd16c6 + 2685e3e commit 304318d

File tree

1 file changed

+10
-17
lines changed

1 file changed

+10
-17
lines changed

index.js

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,10 @@
22

33
exports.randomBytes = exports.rng = exports.pseudoRandomBytes = exports.prng = require('randombytes')
44

5-
function error () {
6-
var m = [].slice.call(arguments).join(' ')
7-
throw new Error([
8-
m,
9-
'we accept pull requests',
10-
'http://github.com/dominictarr/crypto-browserify'
11-
].join('\n'))
12-
}
13-
145
exports.createHash = exports.Hash = require('create-hash')
156

167
exports.createHmac = exports.Hmac = require('create-hmac')
178

18-
function each(a, f) {
19-
for(var i in a)
20-
f(a[i], i)
21-
}
229
var hashes = ['sha1', 'sha224', 'sha256', 'sha384', 'sha512', 'md5', 'rmd160'].concat(Object.keys(require('browserify-sign/algos')))
2310
exports.getHashes = function () {
2411
return hashes;
@@ -60,10 +47,16 @@ require('create-ecdh/inject')(module.exports, exports);
6047
require('public-encrypt/inject')(module.exports, exports);
6148

6249
// the least I can do is make error messages for the rest of the node.js/crypto api.
63-
each([
64-
'createCredentials'
65-
], function (name) {
50+
[
51+
'createCredentials',
52+
'privateEncrypt',
53+
'publicDecrypt'
54+
].forEach(function (name) {
6655
exports[name] = function () {
67-
error('sorry,', name, 'is not implemented yet')
56+
throw new Error([
57+
'sorry, ' + name + ' is not implemented yet',
58+
'we accept pull requests',
59+
'https://github.com/crypto-browserify/crypto-browserify'
60+
].join('\n'));
6861
}
6962
})

0 commit comments

Comments
 (0)