Improve safety of update and delete database methods.

This commit is contained in:
Greyson Parrelli
2024-01-12 15:20:05 -05:00
parent e361795184
commit 750fd4efe1
22 changed files with 124 additions and 101 deletions

View File

@@ -216,7 +216,7 @@ class ChangeNumberRepository(
@WorkerThread
fun changeLocalNumber(e164: String, pni: PNI): Single<Unit> {
val oldStorageId: ByteArray? = Recipient.self().storageServiceId
SignalDatabase.recipients.updateSelfPhone(e164, pni)
SignalDatabase.recipients.updateSelfE164(e164, pni)
val newStorageId: ByteArray? = Recipient.self().storageServiceId
if (e164 != SignalStore.account().requireE164() && MessageDigest.isEqual(oldStorageId, newStorageId)) {