Replies: 4 comments 3 replies
-
Encryption is the way to do but you should not store the whole cipher in the database. That means if anyone could get access to the mobile and access the database somehow it would be able to get the user seed. What usually everybody does is to add the user password (that he will have to add to unlock the wallet) to the cipher itself. This way the only way to regenerate the seed is with the user input and even if his phone got hacked it would still be secured. This also means don't regenerate the key on startup, there is no reason to, you should keep the seed in memory the least amount of time as possible and delete it as soon as possible. What I mean is, only regenerate the key when you are going to sign a transaction, when you are done signing and sent to the chain. Delete it again. You don't need the seed to show information in the UI / history or all other things, to fetch info you have the publicKey (that can be stored normally) and you should use the public key for everything unless you are going to sign the tx and in that way you would do what we said. |
Beta Was this translation helpful? Give feedback.
-
Yes I understand password encryption should not be store with encrypted data =) I mean I'm thinking about the easiest and more secure way to do with Dart. This is an example of what I could do with pointycastle package:
Where seedHex is the hexadecimal representation of the seed, and password a user input. would you have chosen another solution? And I want the user to be able to display their mnemonic whenever they want, just by entering their password. So, I'm thinking of storing the mnemonic in text form instead of the seedHex. |
Beta Was this translation helpful? Give feedback.
-
@poka-IT, sorry for the late reply. You are using Hive with secure storage, right? Even with secure storage is there no possibility of using Keychain and KeyStore for you to store the encrypted seed? That would be way safer as the data would not be available in the app for download. |
Beta Was this translation helpful? Give feedback.
-
So this is what I made: https://git.duniter.org/clients/polkadart-demo/-/blob/master/lib/encrypt_storage.dart If it can help others. |
Beta Was this translation helpful? Give feedback.
-
Do you provide a way to store an encrypted keyring with a password?
If not, do you recommend a way to do this?
I was using Hive with PointyCastle encryption to store the seed, but I think there is a better solution to avoid having to regenerate the keyring based on the seed at each startup.
Beta Was this translation helpful? Give feedback.
All reactions