Prevent safety number changes during quick restore flow.

This commit is contained in:
Cody Henthorne
2025-05-20 15:14:29 -04:00
committed by GitHub
parent 58e462de06
commit 14dbaa7d05
8 changed files with 82 additions and 4 deletions

View File

@@ -337,6 +337,22 @@ class AccountValues internal constructor(store: KeyValueStore, context: Context)
}
}
/**
* Only to be used as part of Quick Restore, DO NOT USE OTHERWISE.
*/
fun resetAciAndPniIdentityKeysAfterFailedRestore() {
synchronized(this) {
Log.i(TAG, "Resetting ACI and PNI identity keys after failed quick registration and restore")
store.beginWrite()
.remove(KEY_ACI_IDENTITY_PUBLIC_KEY)
.remove(KEY_ACI_IDENTITY_PRIVATE_KEY)
.remove(KEY_PNI_IDENTITY_PUBLIC_KEY)
.remove(KEY_PNI_IDENTITY_PRIVATE_KEY)
.commit()
}
}
/** Only to be used when restoring an identity public key from an old backup */
fun restoreLegacyIdentityPublicKeyFromBackup(base64: String) {
Log.w(TAG, "Restoring legacy identity public key from backup.")