web3swift icon indicating copy to clipboard operation
web3swift copied to clipboard

Extract private key by importing keystore file and password

Open andylim0221 opened this issue 4 years ago • 20 comments

Is it possible to add in the feature stated above? Because for the UNSAFE method for extracting privateKey from the address, each time the app is reloaded, the address inside the keystore manager is undefined.

andylim0221 avatar Jun 28 '20 16:06 andylim0221

There is no such feature yet. I'd be more than happy to merge a PR adding this feature, it seems like it would be useful for sure 👍

skywinder avatar Aug 24 '20 16:08 skywinder

Sure. Will be working on this.

andylim0221 avatar Sep 15 '20 07:09 andylim0221

@andylim0221 great let me know about your progress. I can issue @gitcoin grant for this feature.

skywinder avatar Sep 21 '20 07:09 skywinder

@andylim0221 let me know if you are interested to implement this.

FYI:

https://github.com/matter-labs/web3swift/tree/develop/Documentation#design-decisions

Public function for private key export is exposed for user convenience but marked as UNSAFE_. Typical workflow takes care of EIP155 compatibility and proper clearing of private key data from memory

skywinder avatar Sep 23 '20 14:09 skywinder

@skywinder yes I am interested in implementing this. A little busy recently

andylim0221 avatar Sep 23 '20 15:09 andylim0221

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


This issue now has a funding of 12.0 DAI (12.0 USD @ $1.0/DAI) attached to it.

gitcoinbot avatar Sep 23 '20 16:09 gitcoinbot

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


Work for 12.0 DAI (12.0 USD @ $1.0/DAI) has been submitted by:


gitcoinbot avatar Sep 23 '20 20:09 gitcoinbot

Hello, @jordan69420 thanks for your contribution via Gitcoin. Unfortunately I can't accept it. the implementation should be written natively on swift. So this bounty keep open for submissions

skywinder avatar Sep 26 '20 08:09 skywinder

hmm... that would be more difficult. would a compiled file work or does it need to be purely in swift

jordan663994 avatar Sep 28 '20 19:09 jordan663994

if an executable would work, you can compile it using python to get a pyc file then in linux mark it as executable, that is how I got solidity to read python.

jordan663994 avatar Sep 28 '20 19:09 jordan663994

I left instructions in the colab notebook to turn it into an executable, then you just have to import it 😄

jordan663994 avatar Sep 28 '20 19:09 jordan663994

@andylim0221 please, have a look, if this solution will work for you. 👍

skywinder avatar Sep 29 '20 18:09 skywinder

It is possible. We can setup a bridge between python executable and swift. I would take that as an initiative to try out

andylim0221 avatar Oct 01 '20 16:10 andylim0221

@andylim0221 afaik it's not possible in native way. (That's why I can't accept solution by @jordan69420 )

skywinder avatar Oct 07 '20 16:10 skywinder

I use the keystore and do this. I also import the data from a database (NOT SAFE) and both methods work...

Is this still an issue? I'd like to help!!

dangell7 avatar Oct 21 '20 16:10 dangell7

Please welcome to contribute.

andylim0221 avatar Oct 22 '20 01:10 andylim0221

If you can give me more info I can contribute? What exactly do you want to do? Currently I store the keyData in the keystone on Ios encrypted. Then retrieve and add to web3. I also backup the keyData in a db, and retrieve and store in the iOS keystone.

You want to take it from a file on the phone? You want to store on the phone as json file and then retrieve?

I can do the above.... I think.

dangell7 avatar Nov 27 '20 17:11 dangell7

@jordan69420 Thanks for the help. Let me pay you this 12 DAI for the python notebook.

Please, make PR with it to this repository. (you can save it in separate folded named Utils as an example). In spite of fact that it's not native, I hope it would help others.

ANd thank for contributing. I'm glad that we have a chance to work together on a great project! 👍

skywinder avatar Dec 31 '20 07:12 skywinder

@dangell7 it would be great to write in in swift, rather than port Python. But it's not the priority for now. But thanks for your response and willingness to help!

skywinder avatar Dec 31 '20 07:12 skywinder

Has anyone made progress on this? I am looking at implementing something similar for the wallet I am building

pharms-eth avatar Mar 26 '22 22:03 pharms-eth