Consensys / eth-lightwallet

Lightweight JS Wallet for Node and the browser
MIT License
1.47k stars 503 forks source link

Save global_keystore or ks to static memory #149

Open aemet93 opened 7 years ago

aemet93 commented 7 years ago

How ca I save ks object to use it after reloading page? I have treid any ways but ks lost prototype. Also I tried to stringify protorype, save it to indesedDB and localStorage, after that retrived prototype and set to ks object. Internal prototyp functions also lost. Is it possible to use library in this way or any ideas?

coder5876 commented 7 years ago

@itisBaga It sounds like you want to use the serialize function and save the serialized keystore to local storage:

https://github.com/ConsenSys/eth-lightwallet#keystoreserialize

Priya-Nets commented 7 years ago

How to use the saved serialised keystore for contract creation? I created a account using lightwallet and funded 1 ether on my private network. Now when I try to access the same keystore and deploy contract and set some values in contract doesn't seem to work. I cannot see values being set because when I try retrieving it, they hold the default values and not the updated one. Where am I going wrong? @itisBaga @christianlundkvist

aemet93 commented 7 years ago

@Priya-Nets you should use serialize function, then seva kesytore to your storage, and after that you should get ks object and deserialize it with .deserialize() method. It was my mistake also) Good luck.

sc0Vu commented 7 years ago

@itisBaga Right now I am using data:uri and a link to let user download keystore json file, I wonder is there any better way to do that? Thanks.

aemet93 commented 7 years ago

@sc0Vu I don't think so. You can generate file programmaticaly archive it and download like this, I think. Can I ask you, why you want let users to download ks object? Keeping phrase probably more user frendly way to backup walletm no?