Reputation: 15615
The Story
I have an Android application which heavily relies on the Firebase Realtime Database. So far I do not have any problem using it.
But I need to store some highly sensitive data of the users in the database and I would not like to do that in plain text.
So, I have encrypted the data before storing them into the database. I can see the encrypted string in the Firebase Console.
The Problem
I need to check and verify how the data is internally represented by Firebase Database in my local device as I am storing the key for encryption in the database as well.
I have setPersistenceEnabled()
for my database and thus Firebase stores these data locally in the users device. It is nowhere mentioned how Firebase does this internally. Does it store it as a JSON file or a SQLite database (most probable).
My Attempt
To dig deeper into the problem, I tried to pull the databases from my app.
I used,
"adb -d shell "run-as com.yourpackge.name ls /data/data/com.yourpackge.name/databases/"
in my terminal to get a list of all database names for my app, and this is what I got,
app-debug-xxxx.firebaseio.com_default
app-debug-xxxx.firebaseio.com_default-journal
crash_reports
crash_reports-journal
So, these are my databases right? Are they regular SQLite databases? I was unable to read data from these files using the assumption that they are SQLite databases.
I personally think it is very important for us to know how the data is internally represented in Android so that we can make better decisions to store our data.
Any help will be highly appreciated?
Upvotes: 0
Views: 829
Reputation: 7720
After inspecting the file you mentioned, yes it's indeed a SQLite database file (app.firebaseio.com_default
).
The data is saved in serverCache
table and it contains 2 columns: path
(TEXT) and value
(BLOB). path
is the path to the data in firebase database, something like /users/-KOasdbcde
and the value
is the JSON value of that path.
EDIT
Here's the structure of that table
Upvotes: 4