1
0
mirror of https://github.com/bitwarden/mobile synced 2025-12-15 15:53:44 +00:00

store previous key and userid so we can determine if stored crypto is usable before a sync

This commit is contained in:
Kyle Spearrin
2016-08-05 21:59:25 -04:00
parent 2d0bfe1a92
commit d96a94b478
5 changed files with 63 additions and 1 deletions

View File

@@ -12,6 +12,7 @@ namespace Bit.App.Services
private const string TokenKey = "token";
private const string EmailKey = "email";
private const string UserIdKey = "userId";
private const string PreviousUserIdKey = "previousUserId";
private const string PinKey = "pin";
private readonly ISecureStorageService _secureStorage;
@@ -22,6 +23,7 @@ namespace Bit.App.Services
private string _token;
private string _email;
private string _userId;
private string _previousUserId;
private string _pin;
public AuthService(
@@ -90,6 +92,7 @@ namespace Bit.App.Services
}
else
{
PreviousUserId = _userId;
_settings.Remove(UserIdKey);
}
@@ -97,6 +100,30 @@ namespace Bit.App.Services
}
}
public string PreviousUserId
{
get
{
if(_previousUserId != null)
{
return _previousUserId;
}
_previousUserId = _settings.GetValueOrDefault<string>(PreviousUserIdKey);
return _previousUserId;
}
private set
{
if(value != null)
{
_settings.AddOrUpdateValue(PreviousUserIdKey, value);
_previousUserId = value;
}
}
}
public bool UserIdChanged => PreviousUserId != UserId;
public string Email
{
get