1
0
mirror of https://github.com/bitwarden/mobile synced 2025-12-15 07:43:37 +00:00

biometrics cleanup (#964)

This commit is contained in:
Matt Portune
2020-06-08 08:25:13 -04:00
committed by GitHub
parent ec7d87e757
commit 5da2f3279b
18 changed files with 117 additions and 257 deletions

View File

@@ -49,15 +49,15 @@ namespace Bit.Core.Services
}
public CipherString PinProtectedKey { get; set; } = null;
public bool FingerprintLocked { get; set; } = true;
public bool BiometricLocked { get; set; } = true;
public async Task<bool> IsLockedAsync()
{
var hasKey = await _cryptoService.HasKeyAsync();
if (hasKey)
{
var fingerprintSet = await IsFingerprintLockSetAsync();
if (fingerprintSet && FingerprintLocked)
var biometricSet = await IsBiometricLockSetAsync();
if (biometricSet && BiometricLocked)
{
return true;
}
@@ -120,8 +120,8 @@ namespace Bit.Core.Services
}
if (allowSoftLock)
{
FingerprintLocked = await IsFingerprintLockSetAsync();
if (FingerprintLocked)
BiometricLocked = await IsBiometricLockSetAsync();
if (BiometricLocked)
{
_messagingService.Send("locked", userInitiated);
_lockedCallback?.Invoke(userInitiated);
@@ -165,10 +165,10 @@ namespace Bit.Core.Services
return new Tuple<bool, bool>(protectedPin != null, pinProtectedKey != null);
}
public async Task<bool> IsFingerprintLockSetAsync()
public async Task<bool> IsBiometricLockSetAsync()
{
var fingerprintLock = await _storageService.GetAsync<bool?>(Constants.FingerprintUnlockKey);
return fingerprintLock.GetValueOrDefault();
var biometricLock = await _storageService.GetAsync<bool?>(Constants.BiometricUnlockKey);
return biometricLock.GetValueOrDefault();
}
public async Task ClearAsync()