-
Notifications
You must be signed in to change notification settings - Fork 70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
propper uncompressed keys handling #40
Conversation
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. |
UPDATED @braydonf by test case you mean "unit test" or example? you can see example with issue to bitcore-lib |
Yeah, a unit test at https://github.com/bitpay/bitcore-ecies/blob/master/test/ecies.js |
@bitjson something like that? |
The new unit tests look great to me! But maybe you meant to ping @braydonf? :) |
var secret = 'test'; | ||
|
||
// test uncompressed | ||
var alicePrivateKey = new bitcore.PrivateKey.fromObject(new Buffer('1fa76f9c799ca3a51e2c7c901d3ba8e24f6d870beccf8df56faf30120b38f360', 'hex')); |
There was a problem hiding this comment.
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'
});
@axet Thanks for the test case |
ACK |
bitpay/bitcore-lib#88
Maybe better to add additional check inside first try/catch for public get over rest of the data?