mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-22 18:00:02 +01:00
Update sad paths around manual backup key restore.
This commit is contained in:
committed by
Greyson Parrelli
parent
b5f323d4af
commit
139b62e469
@@ -85,6 +85,7 @@ class AccountValues internal constructor(store: KeyValueStore, context: Context)
|
||||
private const val KEY_HAS_LINKED_DEVICES = "account.has_linked_devices"
|
||||
|
||||
private const val KEY_ACCOUNT_ENTROPY_POOL = "account.account_entropy_pool"
|
||||
private const val KEY_RESTORED_ACCOUNT_ENTROPY_KEY = "account.restored_account_entropy_pool"
|
||||
|
||||
private val AEP_LOCK = ReentrantLock()
|
||||
}
|
||||
@@ -140,16 +141,28 @@ class AccountValues internal constructor(store: KeyValueStore, context: Context)
|
||||
|
||||
fun restoreAccountEntropyPool(aep: AccountEntropyPool) {
|
||||
AEP_LOCK.withLock {
|
||||
store.beginWrite().putString(KEY_ACCOUNT_ENTROPY_POOL, aep.value).commit()
|
||||
store
|
||||
.beginWrite()
|
||||
.putString(KEY_ACCOUNT_ENTROPY_POOL, aep.value)
|
||||
.putBoolean(KEY_RESTORED_ACCOUNT_ENTROPY_KEY, true)
|
||||
.commit()
|
||||
}
|
||||
}
|
||||
|
||||
fun resetAccountEntropyPool() {
|
||||
AEP_LOCK.withLock {
|
||||
store.beginWrite().putString(KEY_ACCOUNT_ENTROPY_POOL, null).commit()
|
||||
Log.i(TAG, "Resetting Account Entropy Pool (AEP)", Throwable())
|
||||
store
|
||||
.beginWrite()
|
||||
.putString(KEY_ACCOUNT_ENTROPY_POOL, null)
|
||||
.putBoolean(KEY_RESTORED_ACCOUNT_ENTROPY_KEY, false)
|
||||
.commit()
|
||||
}
|
||||
}
|
||||
|
||||
@get:Synchronized
|
||||
val restoredAccountEntropyPool by booleanValue(KEY_RESTORED_ACCOUNT_ENTROPY_KEY, false)
|
||||
|
||||
/** The local user's [ACI]. */
|
||||
val aci: ACI?
|
||||
get() = ACI.parseOrNull(getString(KEY_ACI, null))
|
||||
|
||||
@@ -19,7 +19,6 @@ class SvrValues internal constructor(store: KeyValueStore) : SignalStoreValues(s
|
||||
private const val SVR2_AUTH_TOKENS = "kbs.kbs_auth_tokens"
|
||||
private const val SVR_LAST_AUTH_REFRESH_TIMESTAMP = "kbs.kbs_auth_tokens.last_refresh_timestamp"
|
||||
private const val SVR3_AUTH_TOKENS = "kbs.svr3_auth_tokens"
|
||||
private const val RESTORED_VIA_ACCOUNT_ENTROPY_KEY = "kbs.restore_via_account_entropy_pool"
|
||||
private const val INITIAL_RESTORE_MASTER_KEY = "kbs.initialRestoreMasterKey"
|
||||
}
|
||||
|
||||
@@ -145,7 +144,7 @@ class SvrValues internal constructor(store: KeyValueStore) : SignalStoreValues(s
|
||||
|
||||
@Synchronized
|
||||
fun hasOptedInWithAccess(): Boolean {
|
||||
return hasPin() || restoredViaAccountEntropyPool
|
||||
return hasPin() || SignalStore.account.restoredAccountEntropyPool
|
||||
}
|
||||
|
||||
@Synchronized
|
||||
@@ -153,9 +152,6 @@ class SvrValues internal constructor(store: KeyValueStore) : SignalStoreValues(s
|
||||
return localPinHash != null
|
||||
}
|
||||
|
||||
@get:Synchronized
|
||||
val restoredViaAccountEntropyPool by booleanValue(RESTORED_VIA_ACCOUNT_ENTROPY_KEY, false)
|
||||
|
||||
@get:Synchronized
|
||||
@set:Synchronized
|
||||
var isPinForgottenOrSkipped: Boolean by booleanValue(PIN_FORGOTTEN_OR_SKIPPED, false)
|
||||
@@ -242,7 +238,6 @@ class SvrValues internal constructor(store: KeyValueStore) : SignalStoreValues(s
|
||||
.putBoolean(OPTED_OUT, true)
|
||||
.remove(LOCK_LOCAL_PIN_HASH)
|
||||
.remove(PIN)
|
||||
.remove(RESTORED_VIA_ACCOUNT_ENTROPY_KEY)
|
||||
.putLong(LAST_CREATE_FAILED_TIMESTAMP, -1)
|
||||
.commit()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user