Storing user data securely in Flutter and Dart

Viewed 3356

Suppose I have a notes app where I need to store user's notes securely. Can I store the notes in a plaintext format in an sqlite database? Or should they be encrypted locally as well?

Also should I encrypt it before I send it to the Firestore database? I've looked into the encrypt package but it's difficult to understand. Are there any good tutorials for this?

If I should encrypt, what type of encryption should I use?

3 Answers

Consider the usage of hive, which is a very popular NoSQL database for Dart and Flutter which automatically does a strong encryption of the data.

It's also used by the hydrated_bloc for example and other packages.


In general, you shouldn't implement encryption/decryption logic by yourself. Use well-known libraries (such as hive) which just does the work for you.

I dont think you need to encrpyt before you send it to firestore.. As long as you set your firestore rules well it would be ok

I guess including encryption depends on the type of data you're storing. Whether it is sensitive etc. same yada yada rules apply even in flutter. Like you should encrypt passwords etc. I you're going for encryption I highly suggest to encrypt the data even using dart before sending it to firebase or as some http request/response. Check out this package- flutter_string_encryption

xxtea

Related