Key().fromPrivkey()

This commit is contained in:
Ryan X. Charles 2014-08-29 12:43:55 -07:00
parent 40e8dfec06
commit faa7a81cac
2 changed files with 14 additions and 0 deletions

View File

@ -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();

View File

@ -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() {