1
0
mirror of https://github.com/bitwarden/mobile synced 2025-12-19 01:33:22 +00:00

[PM-2713] set decrypt and set user key in login helper

This commit is contained in:
Jacob Fink
2023-07-19 21:19:16 -04:00
parent bedbca841d
commit a3183857b9
3 changed files with 21 additions and 23 deletions

View File

@@ -470,10 +470,6 @@ namespace Bit.Core.Services
_messagingService.Send("accountAdded");
if (_setCryptoKeys)
{
if (masterKey != null)
{
await _cryptoService.SetMasterKeyAsync(masterKey);
}
if (localHashedPassword != null)
{
@@ -489,6 +485,13 @@ namespace Bit.Core.Services
await _cryptoService.SetMasterKeyEncryptedUserKeyAsync(tokenResponse.Key);
if (masterKey != null)
{
await _cryptoService.SetMasterKeyAsync(masterKey);
var userKey = await _cryptoService.DecryptUserKeyWithMasterKeyAsync(masterKey);
await _cryptoService.SetUserKeyAsync(userKey);
}
// User doesn't have a key pair yet (old account), let's generate one for them.
if (tokenResponse.PrivateKey == null)
{