Skip to content
This repository has been archived by the owner on Apr 3, 2019. It is now read-only.

Create compressed keys by default #98

Open
wants to merge 1 commit into
base: 1.0.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/privatekey.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ PrivateKey._transformBNBuffer = function(buf, network) {
var info = {};
info.network = Networks.get(network) || Networks.defaultNetwork;
info.bn = BN.fromBuffer(buf);
info.compressed = false;
info.compressed = true;
return info;
};

Expand Down
7 changes: 7 additions & 0 deletions test/privatekey.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,13 @@ describe('PrivateKey', function() {
should.exist(a.bn);
});

it('should create a private key from buffer and set as compressed', function() {
var a = new PrivateKey(new Buffer('ff51c873a0aa6e46b1bf7bf2b01999f31dc17b2e8e4f0f3ea7328a476ded7bfc', 'hex'));
should.exist(a);
should.exist(a.bn);
a.compressed.should.equal(true);
});

it('should create a private key from WIF buffer', function() {
var a = new PrivateKey(Base58Check.decode('L3T1s1TYP9oyhHpXgkyLoJFGniEgkv2Jhi138d7R2yJ9F4QdDU2m'));
should.exist(a);
Expand Down