mirror of
https://github.com/bitwarden/android.git
synced 2024-12-18 15:21:53 +03:00
null check on key retrievals
This commit is contained in:
parent
8cf25d3602
commit
0d9ba92db4
1 changed files with 13 additions and 5 deletions
|
@ -39,9 +39,13 @@ namespace Bit.App.Services
|
|||
{
|
||||
get
|
||||
{
|
||||
if(_key == null)
|
||||
if(_key == null && _secureStorage.Contains(KeyKey))
|
||||
{
|
||||
_key = new CryptoKey(_secureStorage.Retrieve(KeyKey));
|
||||
var keyBytes = _secureStorage.Retrieve(KeyKey);
|
||||
if(keyBytes != null)
|
||||
{
|
||||
_key = new CryptoKey(keyBytes);
|
||||
}
|
||||
}
|
||||
|
||||
return _key;
|
||||
|
@ -66,9 +70,13 @@ namespace Bit.App.Services
|
|||
{
|
||||
get
|
||||
{
|
||||
if(_previousKey == null)
|
||||
if(_previousKey == null && _secureStorage.Contains(PreviousKeyKey))
|
||||
{
|
||||
_previousKey = new CryptoKey(_secureStorage.Retrieve(PreviousKeyKey));
|
||||
var keyBytes = _secureStorage.Retrieve(PreviousKeyKey);
|
||||
if(keyBytes != null)
|
||||
{
|
||||
_previousKey = new CryptoKey(keyBytes);
|
||||
}
|
||||
}
|
||||
|
||||
return _previousKey;
|
||||
|
@ -105,7 +113,7 @@ namespace Bit.App.Services
|
|||
{
|
||||
get
|
||||
{
|
||||
if(_privateKey == null)
|
||||
if(_privateKey == null && _secureStorage.Contains(PrivateKeyKey))
|
||||
{
|
||||
_privateKey = _secureStorage.Retrieve(PrivateKeyKey);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue