mirror of
https://github.com/bitwarden/android.git
synced 2025-01-12 11:17:30 +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 tokenService.SetTokensAsync(oldToken, oldRefreshToken);
|
||||||
await userService.SetInformationAsync(oldUserId, oldEmail, oldKdf, oldKdfIterations);
|
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);
|
var newKey = new Core.Models.Domain.SymmetricCryptoKey(oldKey.Key);
|
||||||
await cryptoService.SetKeyAsync(newKey);
|
await cryptoService.SetKeyAsync(newKey);
|
||||||
// Key hash is unavailable in old version, store old key until we can move it to key hash
|
// 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.SetEncKeyAsync(oldEncKey);
|
||||||
await cryptoService.SetEncPrivateKeyAsync(oldEncPrivateKey);
|
await cryptoService.SetEncPrivateKeyAsync(oldEncPrivateKey);
|
||||||
|
|
||||||
// Save fingerprint/pin
|
// Save pin
|
||||||
|
if(!oldFingerprint && !string.IsNullOrWhiteSpace(oldPin))
|
||||||
if(oldFingerprint)
|
|
||||||
{
|
|
||||||
await storageService.SaveAsync(Constants.FingerprintUnlockKey, true);
|
|
||||||
}
|
|
||||||
else if(!string.IsNullOrWhiteSpace(oldPin))
|
|
||||||
{
|
{
|
||||||
var pinKey = await cryptoService.MakePinKeyAysnc(oldPin, oldEmail, oldKdf, oldKdfIterations);
|
var pinKey = await cryptoService.MakePinKeyAysnc(oldPin, oldEmail, oldKdf, oldKdfIterations);
|
||||||
var pinProtectedKey = await cryptoService.EncryptAsync(oldKeyBytes, pinKey);
|
var pinProtectedKey = await cryptoService.EncryptAsync(oldKeyBytes, pinKey);
|
||||||
|
|
Loading…
Reference in a new issue