mirror of
https://github.com/signalapp/Signal-Android.git
synced 2025-12-24 21:15:48 +00:00
Reset backupV2 credentials on 403.
This commit is contained in:
committed by
Nicholas Tinsley
parent
227a279131
commit
d0340d39db
@@ -65,9 +65,15 @@ object BackupRepository {
|
||||
private const val VERSION = 1L
|
||||
|
||||
private val resetInitializedStateErrorAction: StatusCodeErrorAction = { error ->
|
||||
if (error.code == 401) {
|
||||
Log.i(TAG, "Resetting initialized state due to 401.")
|
||||
SignalStore.backup().backupsInitialized = false
|
||||
when (error.code) {
|
||||
401 -> {
|
||||
Log.i(TAG, "Resetting initialized state due to 401.")
|
||||
SignalStore.backup().backupsInitialized = false
|
||||
}
|
||||
403 -> {
|
||||
Log.i(TAG, "Bad auth credential. Clearing stored credentials.")
|
||||
SignalStore.backup().clearAllCredentials()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -152,6 +152,10 @@ internal class BackupValues(store: KeyValueStore) : SignalStoreValues(store) {
|
||||
putString(KEY_CREDENTIALS, JsonUtil.toJson(SerializedCredentials(updated)))
|
||||
}
|
||||
|
||||
fun clearAllCredentials() {
|
||||
putString(KEY_CREDENTIALS, null)
|
||||
}
|
||||
|
||||
class SerializedCredentials(
|
||||
@JsonProperty
|
||||
val credentialsByDay: Map<Long, ArchiveServiceCredential>
|
||||
|
||||
Reference in New Issue
Block a user