Closed louisinger closed 3 years ago
As per discussed offline, I think we should encrypt the whole Identity instance and whenever we need to interact with the wallet (either reading the addresses or signing) we will ask the password to decrypt.
In the end I think a custom restorer would be the cleanest solution, for initializing from a set of cached addresses @louisinger
This PR aims to replace all the Private key identity stuffs by the Mnemonic identity
TL;DR
walletAction
initializes the wallet using a mnemonic seed (or generate a random one).walletBalanceAction
fetches the balances of all the addresses derivated from the mnemonic identity.walletSendAction
uses all the mnemonic addresses to fetch utxos and use a new change address inbuildTx
.state
stores now the Identity object instead of a single address.Why store the identity instead of addresses ? We need the identity object to avoid restoration from the explorer each time we need to recreate the Identity object (when we sign the tx for example).
Why it is a problem ? The Identity object contains sensitive data and is not encrypted! Everybody can use it to sign the transactions even if the keystore type is encrypted.
What are the solutions ? first solution: encrypt all the state instead of just the private key. second solution: store a set of addresses instead of the identity itself and overwrite the IdentityRestorer to restore addresses from the state each time we recreate the Identity.
@tiero I need your opinion about that
it closes #1