bepaald / signalbackup-tools

Tool to work with Signal Backup files.
GNU General Public License v3.0
790 stars 38 forks source link

Ability to delete a contact #114

Closed julianfairfax closed 1 year ago

julianfairfax commented 1 year ago

https://community.signalusers.org/t/allow-deletion-of-contacts/15892/260

bepaald commented 1 year ago

It is understandable that the Signal team is hesitant implementing this. Once a contact is in the database, their id can be referenced in a large number of places. When the app comes across such an id, which then doesn't reference any existing contact, it will crash.

Simply deleting a contact with this program is trivial. Find the id of the contact with signalbackup-tools [input] [passphrase] --listrecipients, and then delete it

signalbackup-tools [input] [passphrase] --runsqlquery "DELETE FROM recipient WHERE _id = N" -o [output]

Where N is the id found before. But the resulting backup may make Signal crash (if foreign_key_constraint violations even allow the program to output the new backup).

There is also the --findrecipient [N] option which will do a simple scan for the recipient in the database, but note that even if this function gives no output, the recipient might still be referenced somewhere. I will in the future try to make this scan more complete, but I'm not sure if I can ever make it 100% foolproof.