Key().fromPrivkey()
This commit is contained in:
parent
40e8dfec06
commit
faa7a81cac
|
@ -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();
|
||||
|
|
|
@ -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…
Reference in New Issue