mirror of
https://github.com/bitwarden/android.git
synced 2025-12-11 04:39:19 -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,
|
userId = userId,
|
||||||
)
|
)
|
||||||
if (it is VaultUnlockResult.Success) {
|
if (it is VaultUnlockResult.Success) {
|
||||||
|
Timber.d(
|
||||||
|
"[Auth] Vault unlocked, method: %s",
|
||||||
|
initUserCryptoMethod.logTag,
|
||||||
|
)
|
||||||
clearInvalidUnlockCount(userId = userId)
|
clearInvalidUnlockCount(userId = userId)
|
||||||
trustedDeviceManager
|
trustedDeviceManager
|
||||||
.trustThisDeviceIfNecessary(userId = userId)
|
.trustThisDeviceIfNecessary(userId = userId)
|
||||||
updateKdfIfNeeded(initUserCryptoMethod)
|
updateKdfIfNeeded(initUserCryptoMethod)
|
||||||
migratePinProtectedUserKeyIfNeeded(
|
migratePinProtectedUserKeyIfNeeded(userId = userId)
|
||||||
userId = userId,
|
|
||||||
initUserCryptoMethod = initUserCryptoMethod,
|
|
||||||
)
|
|
||||||
setVaultToUnlocked(userId = userId)
|
setVaultToUnlocked(userId = userId)
|
||||||
} else {
|
} else {
|
||||||
incrementInvalidUnlockCount(userId = userId)
|
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.
|
* 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 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(
|
private suspend fun migratePinProtectedUserKeyIfNeeded(
|
||||||
userId: String,
|
userId: String,
|
||||||
initUserCryptoMethod: InitUserCryptoMethod,
|
|
||||||
) {
|
) {
|
||||||
val encryptedPin = authDiskSource.getEncryptedPin(userId) ?: return
|
val encryptedPin = authDiskSource.getEncryptedPin(userId) ?: return
|
||||||
if (authDiskSource.getPinProtectedUserKeyEnvelope(userId) != null) return
|
if (authDiskSource.getPinProtectedUserKeyEnvelope(userId) != null) return
|
||||||
|
|
||||||
val inMemoryOnly = authDiskSource.getPinProtectedUserKey(userId) == null
|
val inMemoryOnly = authDiskSource.getPinProtectedUserKey(userId) == null
|
||||||
|
|
||||||
Timber.d("[Auth] Vault unlocked, method: ${initUserCryptoMethod.logTag}")
|
|
||||||
|
|
||||||
vaultSdkSource.enrollPinWithEncryptedPin(userId, encryptedPin)
|
vaultSdkSource.enrollPinWithEncryptedPin(userId, encryptedPin)
|
||||||
.onSuccess { enrollPinResponse ->
|
.onSuccess { enrollPinResponse ->
|
||||||
authDiskSource.storeEncryptedPin(
|
authDiskSource.storeEncryptedPin(
|
||||||
|
|||||||
@ -546,6 +546,7 @@ class VaultRepositoryImpl(
|
|||||||
userId: String,
|
userId: String,
|
||||||
initUserCryptoMethod: InitUserCryptoMethod,
|
initUserCryptoMethod: InitUserCryptoMethod,
|
||||||
) {
|
) {
|
||||||
|
Timber.d("[Auth] Vault unlocked, method: ${initUserCryptoMethod.logTag}")
|
||||||
val encryptedPin = authDiskSource.getEncryptedPin(userId = userId) ?: return
|
val encryptedPin = authDiskSource.getEncryptedPin(userId = userId) ?: return
|
||||||
val existingPinProtectedUserKeyEnvelope = authDiskSource
|
val existingPinProtectedUserKeyEnvelope = authDiskSource
|
||||||
.getPinProtectedUserKeyEnvelope(
|
.getPinProtectedUserKeyEnvelope(
|
||||||
@ -553,8 +554,6 @@ class VaultRepositoryImpl(
|
|||||||
)
|
)
|
||||||
if (existingPinProtectedUserKeyEnvelope != null) return
|
if (existingPinProtectedUserKeyEnvelope != null) return
|
||||||
|
|
||||||
Timber.d("[Auth] Vault unlocked, method: ${initUserCryptoMethod.logTag}")
|
|
||||||
|
|
||||||
vaultSdkSource
|
vaultSdkSource
|
||||||
.enrollPinWithEncryptedPin(
|
.enrollPinWithEncryptedPin(
|
||||||
userId = userId,
|
userId = userId,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user