cawfree / web3-react-native

⚛️ Web3 Native Modules for React Native.
MIT License
62 stars 9 forks source link

Extra feature #3

Open andylim0221 opened 4 years ago

andylim0221 commented 4 years ago

Wonder if we can consider to push features such as extracting private key from keystore available for this package?

cawfree commented 4 years ago

Hey @andylim0221,

Thanks for getting in touch! Sounds good to me. 🚀

Can you propose which existing Web3 APIs you think would be needed to achieve this? Then we'd be able to treat those as a reference. One thing to keep in mind is that this functionality of course might only be available if it is exposed by the native dependencies we're using in this project. But if this is standard behaviour, they should be there.

andylim0221 commented 4 years ago

In web3, there's web3.eth.accounts.decrypt(keystoreJsonV3, password) which takes keystoreJsonV3 and password as parameters. From my last project, we load the keystore file in and process decryption in native modules with web3j and web3swift respectively. I think it's worth to try out if you have any alternatives.

cawfree commented 4 years ago

Hey @andylim0221, sounds good to me!

It looks like we can get the private key on iOS. It might take a little more searching for a similar function in web3j on Android... I'm sure it must be there somewhere.

cawfree commented 4 years ago

This line seems to provide us with the equivalent key pair, so we should be able to retrieve the private key from here.