autogenerated fromkeypair if not present
This commit is contained in:
parent
4a027e260a
commit
fbfa64582c
|
@ -11,6 +11,8 @@ var ECIES = function ECIES() {
|
|||
};
|
||||
|
||||
ECIES.encrypt = function(messagebuf, tokeypair, fromkeypair, ivbuf) {
|
||||
if (!fromkeypair)
|
||||
fromkeypair = Keypair().fromRandom();
|
||||
var r = fromkeypair.privkey.bn;
|
||||
var R = fromkeypair.pubkey.point;
|
||||
var Rpubkey = fromkeypair.pubkey;
|
||||
|
|
|
@ -26,6 +26,11 @@ describe('#ECIES', function() {
|
|||
Buffer.isBuffer(encbuf).should.equal(true);
|
||||
});
|
||||
|
||||
it('should return a buffer if fromkey is not present', function() {
|
||||
var encbuf = ECIES.encrypt(messagebuf, tokey);
|
||||
Buffer.isBuffer(encbuf).should.equal(true);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
describe('@decrypt', function() {
|
||||
|
|
Loading…
Reference in New Issue