1
0
mirror of https://github.com/bitwarden/mobile synced 2025-12-05 23:53:33 +00:00

[PM-2297] code format

This commit is contained in:
André Bispo
2023-07-24 09:39:42 +01:00
parent 661ff3da5c
commit dd2cd0d9df
2 changed files with 8 additions and 10 deletions

View File

@@ -490,7 +490,7 @@ namespace Bit.Core.Services
await _cryptoService.SetMasterKeyEncryptedUserKeyAsync(tokenResponse.Key);
var decryptOptions = await _stateService.GetAccountDecryptionOptions();
if (await _deviceTrustCryptoService.IsDeviceTrustedAsync() && decryptOptions?.TrustedDeviceOption != null)
if (decryptOptions?.TrustedDeviceOption != null)
{
var key = await _deviceTrustCryptoService.DecryptUserKeyWithDeviceKeyAsync(decryptOptions?.TrustedDeviceOption.EncryptedPrivateKey, decryptOptions?.TrustedDeviceOption.EncryptedUserKey);
if (key != null)
@@ -498,14 +498,12 @@ namespace Bit.Core.Services
await _cryptoService.SetUserKeyAsync(key);
}
}
else if (!string.IsNullOrEmpty(tokenResponse.KeyConnectorUrl) || !string.IsNullOrEmpty(decryptOptions?.KeyConnectorOption?.KeyConnectorUrl))
else if (masterKey != null &&
(!string.IsNullOrEmpty(tokenResponse.KeyConnectorUrl) || !string.IsNullOrEmpty(decryptOptions?.KeyConnectorOption?.KeyConnectorUrl)))
{
if (masterKey != null)
{
await _cryptoService.SetMasterKeyAsync(masterKey);
var userKey = await _cryptoService.DecryptUserKeyWithMasterKeyAsync(masterKey);
await _cryptoService.SetUserKeyAsync(userKey);
}
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.

View File

@@ -113,8 +113,8 @@ namespace Bit.Core.Services
if (existingDeviceKey == null)
{
// User doesn't have a device key anymore so device is untrusted
return null;
// User doesn't have a device key anymore so device is untrusted
return null;
}
// Attempt to decrypt encryptedDevicePrivateKey with device key