I am using the email/password sign in method for Firebase. I would like to encrypt the data users save into the realtime database before sending it to the database. Firebase already handle the user password, but can I somehow use it to encrypt data which can't be decrypted by me only the client? It would be nice if I could achieve it with the client sdk.
So my flow would be something like this:
- User sign in with it's credentials (which is handled by firebase itself)
- User encrypt some data with some unique key, which can be generated only from the credentials or from some data available only for the user, but not me. (this key needs to be persistent between sessions, or after the user changed his password.)
- Data is saved into the database (I cant read it since its encrypted with the user credentials)
- User log in on a different device (the decryption key can be generated right away and data can be decrypted.)