Skip to content

Commit

Permalink
PM-5064 Fix lock interaction between biometrics and vault timeout never
Browse files Browse the repository at this point in the history
  • Loading branch information
fedemkr committed Dec 4, 2023
1 parent 11348e6 commit 172476f
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/Core/Services/VaultTimeoutService.cs
Expand Up @@ -63,12 +63,20 @@ public class VaultTimeoutService : IVaultTimeoutService
/// </param>
public async Task<bool> IsLockedAsync(string userId = null)
{
// If biometrics are used, we can use the flag to determine locked state taking into account the auto unlock key for vault timeout never.
var biometricSet = await IsBiometricLockSetAsync(userId);
var hasAutoUnlockKey = await _cryptoService.HasAutoUnlockKeyAsync(userId);
if (biometricSet && await _stateService.GetBiometricLockedAsync(userId) && !hasAutoUnlockKey)
{
return true;
}

if (!await _cryptoService.HasUserKeyAsync(userId))
{
try
{
// Filter out accounts without auto key
if (!await _cryptoService.HasAutoUnlockKeyAsync(userId))
if (!hasAutoUnlockKey)
{
return true;
}
Expand All @@ -84,7 +92,6 @@ public async Task<bool> IsLockedAsync(string userId = null)
// Legacy users must migrate on web vault before login
await LogOutAsync(false, userId);
}

}

// Check again to verify auto key was set
Expand Down

0 comments on commit 172476f

Please sign in to comment.