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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user