Signal backup database schema


I have a Signal for Android backup (from around 2020) that I wanted to extract messages from. I used signal_for_android_decryption to decrypt that backup and extra an SQLite database from it. These are my notes from trying to reverse-engineer the database schema, which is not well-documented, to extract the messages I wanted.

In retrospect, I didn't have to "reverse engineer" the schema since the source code for Signal for Android is publicly available but (1) I didn't think of that at the time and (2) I'm not confident in my Java / Kotlin skills anyway. See also signalapp/Signal-Android#7586.

If I ever revisit this (which I probably will), I'll probably take a look at the source code and update these notes. (I wrote this in a hurry, so don't take this as gospel.)