Skip to content

Commit 681984a

Browse files
committed
modularize publicEncrypt
1 parent 882de00 commit 681984a

File tree

3 files changed

+32
-11
lines changed

3 files changed

+32
-11
lines changed

index.js

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,22 @@ var dh = require('diffie-hellman');
4444

4545
require('browserify-sign/inject')(module.exports, exports);
4646

47-
exports.createECDH = require('create-ecdh');
47+
exports.createECDH = require('create-ecdh')
4848

4949
var publicEncrypt = require('public-encrypt');
5050

51-
// the least I can do is make error messages for the rest of the node.js/crypto api.
5251
[
53-
'createCredentials',
52+
'publicEncrypt',
5453
'privateEncrypt',
55-
'publicDecrypt'
54+
'publicDecrypt',
55+
'privateDecrypt'
56+
].forEach(function (key) {
57+
exports[key] = publicEncrypt[key];
58+
})
59+
60+
// the least I can do is make error messages for the rest of the node.js/crypto api.
61+
;[
62+
'createCredentials'
5663
].forEach(function (name) {
5764
exports[name] = function () {
5865
throw new Error([

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"diffie-hellman": "^3.0.1",
2525
"inherits": "^2.0.1",
2626
"pbkdf2-compat": "^3.0.1",
27-
"public-encrypt": "1.1.2",
27+
"public-encrypt": "^2.0.0",
2828
"randombytes": "^2.0.0"
2929
},
3030
"devDependencies": {

test/public-encrypt.js

Lines changed: 20 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)