should generate from hex added
This commit is contained in:
parent
d84dc652d9
commit
53eb98babc
|
@ -39,9 +39,8 @@ WalletKey.prototype.fromObj = function(obj) {
|
|||
this.privKey = new Key();
|
||||
if (obj.priv.length == 64) {
|
||||
this.privKey.private = new Buffer(obj.priv, 'hex');
|
||||
this.privKey.compressed = true;
|
||||
}
|
||||
else {
|
||||
this.privKey.compressed = typeof obj.compressed === 'undefined'? true: obj.compressed;
|
||||
} else {
|
||||
var priv = new PrivateKey(obj.priv);
|
||||
this.privKey.private = new Buffer(priv.payload());
|
||||
this.privKey.compressed = priv.compressed();
|
||||
|
|
|
@ -75,12 +75,13 @@ describe('Miscelaneous stuff', function() {
|
|||
if (meta.isPrivkey) {
|
||||
describe('base58 private key valid ' + b58, function() {
|
||||
var k;
|
||||
before(function() {
|
||||
k = new WalletKey({
|
||||
var opts = {
|
||||
network: network
|
||||
};
|
||||
before(function() {
|
||||
k = new WalletKey(opts);
|
||||
});
|
||||
});
|
||||
it('parse', function() {
|
||||
it('should generate correctly from WIF', function() {
|
||||
k.fromObj({
|
||||
priv: b58
|
||||
});
|
||||
|
@ -95,6 +96,14 @@ describe('Miscelaneous stuff', function() {
|
|||
it('should not be an Address', function() {
|
||||
new Address(b58).isValid().should.equal(false);
|
||||
});
|
||||
it('should generate correctly from hex', function() {
|
||||
var k2 = new WalletKey(opts);
|
||||
k2.fromObj({
|
||||
priv: hexPayload,
|
||||
compressed: meta.isCompressed
|
||||
});
|
||||
k2.storeObj().priv.should.equal(b58);
|
||||
});
|
||||
});
|
||||
} else {
|
||||
describe('base58 address valid ' + b58, function() {
|
||||
|
|
Loading…
Reference in New Issue