Skip to content

Conversation

@axet
Copy link
Contributor

@axet axet commented Sep 1, 2016

bitpay/bitcore-lib#88

Maybe better to add additional check inside first try/catch for public get over rest of the data?

@braydonf
Copy link
Contributor

braydonf commented Sep 1, 2016

The first byte of the public encoding indicates the format of the key: 0x04 for uncompressed, 0x03 and 0x02 for compressed. This could be used to determine the length that needs to be sliced.

A test case for this would be useful.

@axet
Copy link
Contributor Author

axet commented Sep 1, 2016

UPDATED

@braydonf by test case you mean "unit test" or example?

you can see example with issue to bitcore-lib

@braydonf
Copy link
Contributor

braydonf commented Sep 1, 2016

@axet
Copy link
Contributor Author

axet commented Sep 1, 2016

@bitjson something like that?

@bitjson
Copy link
Contributor

bitjson commented Sep 2, 2016

The new unit tests look great to me! But maybe you meant to ping @braydonf? :)

test/ecies.js Outdated
var secret = 'test';

// test uncompressed
var alicePrivateKey = new bitcore.PrivateKey.fromObject(new Buffer('1fa76f9c799ca3a51e2c7c901d3ba8e24f6d870beccf8df56faf30120b38f360', 'hex'));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instantiating the private key for compressed and uncompressed (line 139 and line 151 should be more clear with this:

var alicePrivateKey = new bitcore.PrivateKey.fromObject({
  bn: '1fa76f9c799ca3a51e2c7c901d3ba8e24f6d870beccf8df56faf30120b38f360',
  compressed: false,
  network: 'livenet'
});

@braydonf
Copy link
Contributor

braydonf commented Sep 2, 2016

@axet Thanks for the test case

@braydonf
Copy link
Contributor

braydonf commented Sep 2, 2016

ACK

@braydonf braydonf merged commit 4ce21cf into bitpay:master Sep 2, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants