-
Notifications
You must be signed in to change notification settings - Fork 10
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
Incorrect public key derivation on react-native #3
Comments
Strangely, ethjs-account produces the wrong public key in react-native... ethjs/ethjs-account#3
Hey Alex, how are you using the module? Is it the prebuild or an install of the module?
That is crazy it derives improperly and super dangerous.
Tell me more
…Sent from my iPhone
On Aug 7, 2017, at 7:29 PM, Alex Miller ***@***.***> wrote:
Issue Type
Bug
Description
Given the private key:
0x4735f8b1af5002ce677ae96bbf8958d7213a858f76166047346f89e5597f964d
I can successfully derive the following (correct) information on my node (v8) console:
account.privateToPublic('0x4735f8b1af5002ce677ae96bbf8958d7213a858f76166047346f89e5597f964d').toString('hex')
> '253caada10d4ffc3ad90a8b20658a524df51b884ab0c213fce48b024f6dce4661539d81e2f776a4b087298b66fa4a46b020a2eb46046aeec171548539bcc679b'
account.publicToAddress(account.privateToPublic('0x4735f8b1af5002ce677ae96bbf8958d7213a858f76166047346f89e5597f964d')).toString('hex')
> '0x5C6a4899f99cd6A6c41a2aef0B3d355546e46F92'
However, when I run the following code in a utility function within React-Native:
let pub = account.privateToPublic(priv).toString('hex')
I get an incorrect public key:
04253caada10d4ffc3ad90a8b20658a524df51b884ab0c213fce48b024f6dce4661539d81e2f776a4b087298b66fa4a46b020a2eb46046aeec171548539bcc679b
Where priv is the 0x-prefixed private key specified above.
This is unfortunate because ethjs-account is the only account util I can find that doesn't error our in the RN environment.
react-native-cli: 2.0.1
react-native: 0.47.1
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
I was using an npm installation. I just imported |
I think this issue should perhaps stay open, since ethjs-account is using elliptic directly and not secp256k1 (which detects the presence of a binary addon, and if missing uses elliptic). That could have explained a difference, but the same underlying lib should have resulted in the same result. No? |
Hey Matt, any chance at a PR? This thing runs on smart individuals like yourself ;)
Would love sep256 and RN support.
…Sent from my iPhone
On Aug 7, 2017, at 9:19 PM, Alex Miller ***@***.***> wrote:
Reopened #3.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Issue Type
Bug
Description
Given the private key:
I can successfully derive the following (correct) information on my node (v8) console:
However, React-Native gives me an incorrect public key:
This is unfortunate because
ethjs-account
is the only account util I can find that doesn't error out in the RN environment.The text was updated successfully, but these errors were encountered: