mirror of
https://github.com/bitwarden/android.git
synced 2024-12-25 18:38:27 +03:00
don't clear key needed for bio/auto migration in pin migration (#2721)
This commit is contained in:
parent
9c7ff853d7
commit
819aabb330
1 changed files with 9 additions and 2 deletions
|
@ -1011,6 +1011,10 @@ namespace Bit.Core.Services
|
||||||
// Decrypt
|
// Decrypt
|
||||||
var masterKey = new MasterKey(Convert.FromBase64String(oldKey));
|
var masterKey = new MasterKey(Convert.FromBase64String(oldKey));
|
||||||
var encryptedUserKey = await _stateService.GetEncKeyEncryptedAsync(userId);
|
var encryptedUserKey = await _stateService.GetEncKeyEncryptedAsync(userId);
|
||||||
|
if (encryptedUserKey == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
var userKey = await DecryptUserKeyWithMasterKeyAsync(
|
var userKey = await DecryptUserKeyWithMasterKeyAsync(
|
||||||
masterKey,
|
masterKey,
|
||||||
new EncString(encryptedUserKey),
|
new EncString(encryptedUserKey),
|
||||||
|
@ -1070,8 +1074,11 @@ namespace Bit.Core.Services
|
||||||
var encPin = await EncryptAsync(pin, userKey);
|
var encPin = await EncryptAsync(pin, userKey);
|
||||||
await _stateService.SetProtectedPinAsync(encPin.EncryptedString);
|
await _stateService.SetProtectedPinAsync(encPin.EncryptedString);
|
||||||
}
|
}
|
||||||
// Clear old key
|
// Clear old key only if not needed for bio/auto migration
|
||||||
await _stateService.SetEncKeyEncryptedAsync(null);
|
if (await _stateService.GetKeyEncryptedAsync() != null)
|
||||||
|
{
|
||||||
|
await _stateService.SetEncKeyEncryptedAsync(null);
|
||||||
|
}
|
||||||
return userKey;
|
return userKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue