1
0
mirror of https://github.com/bitwarden/mobile synced 2025-12-17 16:53:26 +00:00

remeber two factor token

This commit is contained in:
Kyle Spearrin
2017-06-27 16:35:29 -04:00
parent 4116d95a3e
commit 37428c01dd
6 changed files with 46 additions and 1 deletions

View File

@@ -9,6 +9,7 @@ namespace Bit.App.Services
{
private const string TokenKey = "accessToken";
private const string RefreshTokenKey = "refreshToken";
private const string TwoFactorTokenKey = "twoFactorToken";
private const string AuthBearerKey = "token";
private readonly ISecureStorageService _secureStorage;
@@ -165,6 +166,32 @@ namespace Bit.App.Services
}
}
public string TwoFactorToken
{
get
{
var tokenBytes = _secureStorage.Retrieve(TwoFactorTokenKey);
if(tokenBytes == null)
{
return null;
}
return Encoding.UTF8.GetString(tokenBytes, 0, tokenBytes.Length);
}
set
{
if(value != null)
{
var tokenBytes = Encoding.UTF8.GetBytes(value);
_secureStorage.Store(TwoFactorTokenKey, tokenBytes);
}
else
{
_secureStorage.Delete(TwoFactorTokenKey);
}
}
}
public JObject DecodeToken()
{
if(_decodedToken != null)