1
0
mirror of https://github.com/bitwarden/mobile.git synced 2024-11-22 11:35:21 +01:00

Force logout if user has old keyHash stored

This commit is contained in:
Thomas Rittson 2021-06-10 09:53:57 +10:00
parent 35aebaa3e0
commit 497d4928fa
3 changed files with 17 additions and 1 deletions

View File

@ -121,6 +121,13 @@ namespace Bit.App.Pages
public async Task InitAsync(bool autoPromptBiometric)
{
var useLocalHash = await _storageService.GetAsync<bool>("useLocalHash");
if (useLocalHash != true)
{
_messagingService.Send("logout");
return;
}
_pinSet = await _vaultTimeoutService.IsPinLockSetAsync();
PinLock = (_pinSet.Item1 && _vaultTimeoutService.PinProtectedKey != null) || _pinSet.Item2;
BiometricLock = await _vaultTimeoutService.IsBiometricLockSetAsync() && await _cryptoService.HasKeyAsync();

View File

@ -33,6 +33,7 @@ namespace Bit.Core.Services
private const string Keys_EncPrivateKey = "encPrivateKey";
private const string Keys_EncKey = "encKey";
private const string Keys_KeyHash = "keyHash";
private const string Keys_UseLocalHash = "useLocalHash";
public CryptoService(
IStorageService storageService,
@ -61,6 +62,7 @@ namespace Bit.Core.Services
{
_keyHash = keyHash;
await _storageService.SaveAsync(Keys_KeyHash, keyHash);
await _storageService.SaveAsync(Keys_UseLocalHash, true);
}
public async Task SetEncKeyAsync(string encKey)

View File

@ -44,7 +44,7 @@ namespace Bit.iOS.Core.Controllers
public string BiometricIntegrityKey { get; set; }
public override void ViewDidLoad()
public async override void ViewDidLoad()
{
_vaultTimeoutService = ServiceContainer.Resolve<IVaultTimeoutService>("vaultTimeoutService");
_cryptoService = ServiceContainer.Resolve<ICryptoService>("cryptoService");
@ -88,6 +88,13 @@ namespace Bit.iOS.Core.Controllers
base.ViewDidLoad();
var useLocalHash = await _storageService.GetAsync<bool>("useLocalHash");
if (useLocalHash != true)
{
await LogOutAsync();
return;
}
if (_biometricLock)
{
if (!_biometricIntegrityValid)