mirror of
https://github.com/bitwarden/android.git
synced 2025-12-10 09:56:45 -06:00
[PM-26420] FlightRecorder vault unlock method (#6084)
This commit is contained in:
parent
064a98f86b
commit
c0f8307361
@ -226,14 +226,15 @@ class VaultLockManagerImpl(
|
||||
userId = userId,
|
||||
)
|
||||
if (it is VaultUnlockResult.Success) {
|
||||
Timber.d(
|
||||
"[Auth] Vault unlocked, method: %s",
|
||||
initUserCryptoMethod.logTag,
|
||||
)
|
||||
clearInvalidUnlockCount(userId = userId)
|
||||
trustedDeviceManager
|
||||
.trustThisDeviceIfNecessary(userId = userId)
|
||||
updateKdfIfNeeded(initUserCryptoMethod)
|
||||
migratePinProtectedUserKeyIfNeeded(
|
||||
userId = userId,
|
||||
initUserCryptoMethod = initUserCryptoMethod,
|
||||
)
|
||||
migratePinProtectedUserKeyIfNeeded(userId = userId)
|
||||
setVaultToUnlocked(userId = userId)
|
||||
} else {
|
||||
incrementInvalidUnlockCount(userId = userId)
|
||||
@ -315,19 +316,15 @@ class VaultLockManagerImpl(
|
||||
* Optionally marks the envelope as in-memory only if the PIN-protected user key is not present.
|
||||
*
|
||||
* @param userId The ID of the user for whom to migrate the PIN-protected user key.
|
||||
* @param initUserCryptoMethod The method used to initialize the user's crypto.
|
||||
*/
|
||||
private suspend fun migratePinProtectedUserKeyIfNeeded(
|
||||
userId: String,
|
||||
initUserCryptoMethod: InitUserCryptoMethod,
|
||||
) {
|
||||
val encryptedPin = authDiskSource.getEncryptedPin(userId) ?: return
|
||||
if (authDiskSource.getPinProtectedUserKeyEnvelope(userId) != null) return
|
||||
|
||||
val inMemoryOnly = authDiskSource.getPinProtectedUserKey(userId) == null
|
||||
|
||||
Timber.d("[Auth] Vault unlocked, method: ${initUserCryptoMethod.logTag}")
|
||||
|
||||
vaultSdkSource.enrollPinWithEncryptedPin(userId, encryptedPin)
|
||||
.onSuccess { enrollPinResponse ->
|
||||
authDiskSource.storeEncryptedPin(
|
||||
|
||||
@ -546,6 +546,7 @@ class VaultRepositoryImpl(
|
||||
userId: String,
|
||||
initUserCryptoMethod: InitUserCryptoMethod,
|
||||
) {
|
||||
Timber.d("[Auth] Vault unlocked, method: ${initUserCryptoMethod.logTag}")
|
||||
val encryptedPin = authDiskSource.getEncryptedPin(userId = userId) ?: return
|
||||
val existingPinProtectedUserKeyEnvelope = authDiskSource
|
||||
.getPinProtectedUserKeyEnvelope(
|
||||
@ -553,8 +554,6 @@ class VaultRepositoryImpl(
|
||||
)
|
||||
if (existingPinProtectedUserKeyEnvelope != null) return
|
||||
|
||||
Timber.d("[Auth] Vault unlocked, method: ${initUserCryptoMethod.logTag}")
|
||||
|
||||
vaultSdkSource
|
||||
.enrollPinWithEncryptedPin(
|
||||
userId = userId,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user