mirror of
https://github.com/bitwarden/android.git
synced 2024-12-25 02:18:27 +03:00
set FingerprintUnlockKey before setKey
This commit is contained in:
parent
b7819838b8
commit
0f451fd4b9
1 changed files with 8 additions and 7 deletions
|
@ -160,6 +160,12 @@ namespace Bit.App.Migration
|
|||
await tokenService.SetTokensAsync(oldToken, oldRefreshToken);
|
||||
await userService.SetInformationAsync(oldUserId, oldEmail, oldKdf, oldKdfIterations);
|
||||
|
||||
// Save fingerprint
|
||||
if(oldFingerprint)
|
||||
{
|
||||
await storageService.SaveAsync(Constants.FingerprintUnlockKey, true);
|
||||
}
|
||||
|
||||
var newKey = new Core.Models.Domain.SymmetricCryptoKey(oldKey.Key);
|
||||
await cryptoService.SetKeyAsync(newKey);
|
||||
// Key hash is unavailable in old version, store old key until we can move it to key hash
|
||||
|
@ -167,13 +173,8 @@ namespace Bit.App.Migration
|
|||
await cryptoService.SetEncKeyAsync(oldEncKey);
|
||||
await cryptoService.SetEncPrivateKeyAsync(oldEncPrivateKey);
|
||||
|
||||
// Save fingerprint/pin
|
||||
|
||||
if(oldFingerprint)
|
||||
{
|
||||
await storageService.SaveAsync(Constants.FingerprintUnlockKey, true);
|
||||
}
|
||||
else if(!string.IsNullOrWhiteSpace(oldPin))
|
||||
// Save pin
|
||||
if(!oldFingerprint && !string.IsNullOrWhiteSpace(oldPin))
|
||||
{
|
||||
var pinKey = await cryptoService.MakePinKeyAysnc(oldPin, oldEmail, oldKdf, oldKdfIterations);
|
||||
var pinProtectedKey = await cryptoService.EncryptAsync(oldKeyBytes, pinKey);
|
||||
|
|
Loading…
Reference in a new issue