From 9cae3f079443ccfb95b36a405fc8ad4a129a771a Mon Sep 17 00:00:00 2001 From: J-Jamet Date: Tue, 12 Aug 2025 15:33:35 +0200 Subject: [PATCH] fix: initDecryptData #2105 --- .../keepass/biometric/DeviceUnlockManager.kt | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/com/kunzisoft/keepass/biometric/DeviceUnlockManager.kt b/app/src/main/java/com/kunzisoft/keepass/biometric/DeviceUnlockManager.kt index 769838a8f..4c8ebc1f9 100644 --- a/app/src/main/java/com/kunzisoft/keepass/biometric/DeviceUnlockManager.kt +++ b/app/src/main/java/com/kunzisoft/keepass/biometric/DeviceUnlockManager.kt @@ -134,12 +134,12 @@ class DeviceUnlockManager(private var appContext: Context) { @Synchronized fun initEncryptData( actionIfCypherInit: (cryptoPrompt: DeviceUnlockCryptoPrompt) -> Unit ) { - initEncryptData(actionIfCypherInit, true) + initEncryptData(true, actionIfCypherInit) } @Synchronized private fun initEncryptData( - actionIfCypherInit: (cryptoPrompt: DeviceUnlockCryptoPrompt) -> Unit, - firstLaunch: Boolean + firstLaunch: Boolean, + actionIfCypherInit: (cryptoPrompt: DeviceUnlockCryptoPrompt) -> Unit ) { try { getSecretKey()?.let { secretKey -> @@ -168,7 +168,7 @@ class DeviceUnlockManager(private var appContext: Context) { Log.e(TAG, "Unable to initialize encrypt data", invalidKeyException) if (firstLaunch) { deleteAllEntryKeysInKeystoreForBiometric(appContext) - initEncryptData(actionIfCypherInit, false) + initEncryptData(false, actionIfCypherInit) } else { throw invalidKeyException } @@ -195,6 +195,13 @@ class DeviceUnlockManager(private var appContext: Context) { } @Synchronized fun initDecryptData( + ivSpecValue: ByteArray, + actionIfCypherInit: (cryptoPrompt: DeviceUnlockCryptoPrompt) -> Unit + ) { + initDecryptData(ivSpecValue, true, actionIfCypherInit) + } + + @Synchronized private fun initDecryptData( ivSpecValue: ByteArray, firstLaunch: Boolean = true, actionIfCypherInit: (cryptoPrompt: DeviceUnlockCryptoPrompt) -> Unit