diff --git a/src/App/Pages/Accounts/LockPageViewModel.cs b/src/App/Pages/Accounts/LockPageViewModel.cs index 2e85731b0..10cc3a162 100644 --- a/src/App/Pages/Accounts/LockPageViewModel.cs +++ b/src/App/Pages/Accounts/LockPageViewModel.cs @@ -297,7 +297,7 @@ namespace Bit.App.Pages { Pin = string.Empty; await AppHelpers.ResetInvalidUnlockAttemptsAsync(); - await SetKeyAndContinueAsync(userKey); + await SetUserKeyAndContinueAsync(userKey); } } catch @@ -364,7 +364,7 @@ namespace Bit.App.Pages var userKey = await _cryptoService.DecryptUserKeyWithMasterKeyAsync(masterKey); await _cryptoService.SetMasterKeyAsync(masterKey); - await SetKeyAndContinueAsync(userKey); + await SetUserKeyAndContinueAsync(userKey); // Re-enable biometrics if (BiometricEnabled & !BiometricIntegrityValid) @@ -462,11 +462,12 @@ namespace Bit.App.Pages await _stateService.SetBiometricLockedAsync(!success); if (success) { - await DoContinueAsync(); + var userKey = await _stateService.GetUserKeyBiometricUnlockAsync(); + await SetUserKeyAndContinueAsync(userKey); } } - private async Task SetKeyAndContinueAsync(UserKey key) + private async Task SetUserKeyAndContinueAsync(UserKey key) { var hasKey = await _cryptoService.HasUserKeyAsync(); if (!hasKey) diff --git a/src/Core/Services/CryptoService.cs b/src/Core/Services/CryptoService.cs index 425719d9c..aa7a37525 100644 --- a/src/Core/Services/CryptoService.cs +++ b/src/Core/Services/CryptoService.cs @@ -670,7 +670,7 @@ namespace Bit.Core.Services private async Task StoreAdditionalKeysAsync(UserKey userKey, string userId = null) { - // Refresh, set, or clear the pin key + // Set, refresh, or clear the pin key if (await _stateService.GetProtectedPinAsync(userId) != null) { await UpdatePinKeyAsync(userKey, userId); @@ -681,7 +681,7 @@ namespace Bit.Core.Services await _stateService.SetPinKeyEncryptedUserKeyEphemeralAsync(null, userId); } - // Refresh, set, or clear the auto key + // Set, refresh, or clear the auto unlock key if (await _stateService.GetVaultTimeoutAsync(userId) == null) { await _stateService.SetUserKeyAutoUnlockAsync(userKey, userId); @@ -690,6 +690,16 @@ namespace Bit.Core.Services { await _stateService.SetUserKeyAutoUnlockAsync(null, userId); } + + // Set, refresh, or clear the biometric unlock key + if ((await _stateService.GetBiometricUnlockAsync(userId)).GetValueOrDefault()) + { + await _stateService.SetUserKeyBiometricUnlockAsync(userKey, userId); + } + else + { + await _stateService.SetUserKeyBiometricUnlockAsync(null, userId); + } } private async Task UpdatePinKeyAsync(UserKey userKey, string userId = null)