How to save encrypted String in Firebase with Dart Flutter and decrypt in app?

Issue

I am developing an application and I have a connection key for this application. I want to keep this key encrypted in Firebase and use the decrypted version in the app. So I’ll keep it encrypted in Firebase and decrypt it and use it in the app.

I am using Firestore.

You can think of it as a password control system. It is kept encrypted in Firebase, the encrypted password is decrypted in the login part and the password accuracy is checked.

Thanks in advance for the help.


enter image description here

Solution

Usually passwords are stored as hashed strings, not like encrypted data.

If you want to encrypt before uploading to database and decrypt in the app after fetching it, you can use any of the symmetric encryption algorithms

If you want to store passwords as hashed strings, you can hash the password with sha-256 before uploading to the database and when you need to check in the app if the given password is true at login, you can hash with the same hashing algorithm and compare with the hashed strings in the database.

Answered By – batuhand

Answer Checked By – Willingham (FlutterFixes Volunteer)

Leave a Reply

Your email address will not be published.