fix: initDecryptData #2105

This commit is contained in:
J-Jamet
2025-08-12 15:20:32 +02:00
parent fe526089d7
commit a680db9707

View File

@@ -196,15 +196,8 @@ class DeviceUnlockManager(private var appContext: Context) {
@Synchronized fun initDecryptData(
ivSpecValue: ByteArray,
firstLaunch: Boolean = true,
actionIfCypherInit: (cryptoPrompt: DeviceUnlockCryptoPrompt) -> Unit
) {
initDecryptData(ivSpecValue, actionIfCypherInit, true)
}
@Synchronized private fun initDecryptData(
ivSpecValue: ByteArray,
actionIfCypherInit: (cryptoPrompt: DeviceUnlockCryptoPrompt) -> Unit,
firstLaunch: Boolean
) {
try {
// important to restore spec here that was used for decryption
@@ -232,7 +225,7 @@ class DeviceUnlockManager(private var appContext: Context) {
Log.e(TAG, "Unable to initialize decrypt data", unrecoverableKeyException)
if (firstLaunch) {
deleteKeystoreKey()
initDecryptData(ivSpecValue, actionIfCypherInit, firstLaunch)
initDecryptData(ivSpecValue, false, actionIfCypherInit)
} else {
throw unrecoverableKeyException
}
@@ -240,7 +233,7 @@ class DeviceUnlockManager(private var appContext: Context) {
Log.e(TAG, "Unable to initialize decrypt data", invalidKeyException)
if (firstLaunch) {
deleteAllEntryKeysInKeystoreForBiometric(appContext)
initDecryptData(ivSpecValue, actionIfCypherInit, firstLaunch)
initDecryptData(ivSpecValue, false, actionIfCypherInit)
} else {
throw invalidKeyException
}