migrate old enc key (#2732)

This commit is contained in:
Jake Fink 2023-10-27 12:19:41 -04:00 committed by GitHub
parent 2e5fb414b5
commit 12c72b2833
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1088,6 +1088,12 @@ namespace Bit.Core.Services
{ {
await _stateService.SetUserKeyBiometricUnlockAsync(userKey, userId); await _stateService.SetUserKeyBiometricUnlockAsync(userKey, userId);
} }
// Clear old enc key only if we don't need to still migrate PIN
if (await _stateService.GetPinProtectedAsync() == null
&& await _stateService.GetPinProtectedKeyAsync() == null)
{
await _stateService.SetEncKeyEncryptedAsync(null, userId);
}
await _stateService.SetKeyEncryptedAsync(null, userId); await _stateService.SetKeyEncryptedAsync(null, userId);
// Set encrypted user key just in case the user locks without syncing // Set encrypted user key just in case the user locks without syncing