Browse Source

Key().fromPrivkey()

patch-2
Ryan X. Charles 11 years ago
parent
commit
faa7a81cac
  1. 6
      lib/key.js
  2. 8
      test/test.key.js

6
lib/key.js

@ -17,6 +17,12 @@ Key.prototype.set = function(obj) {
return this;
};
Key.prototype.fromPrivkey = function(privkey) {
this.privkey = privkey;
this.privkey2pubkey();
return this;
};
Key.prototype.fromRandom = function() {
this.privkey = Privkey().fromRandom();
this.privkey2pubkey();

8
test/test.key.js

@ -30,6 +30,14 @@ describe('Key', function() {
});
describe("#fromPrivkey", function() {
it('should make a new key from a privkey', function() {
should.exist(Key().fromPrivkey(Privkey().fromRandom()).pubkey);
});
});
describe("#fromRandom", function() {
it('should make a new priv and pub, should be compressed, mainnet', function() {

Loading…
Cancel
Save