1
0
mirror of https://github.com/bitwarden/mobile synced 2026-01-10 04:23:21 +00:00

[PM-2297] Remove reconciledOptions for deviceKey in state service

This commit is contained in:
André Bispo
2023-07-24 22:52:25 +01:00
parent eceee581c9
commit 52aabe8237
2 changed files with 6 additions and 8 deletions

View File

@@ -33,12 +33,14 @@ namespace Bit.Core.Services
public async Task<SymmetricCryptoKey> GetDeviceKeyAsync()
{
return await _stateService.GetDeviceKeyAsync();
var activeUserId = await _stateService.GetActiveUserIdAsync();
return await _stateService.GetDeviceKeyAsync(activeUserId);
}
private async Task SetDeviceKeyAsync(SymmetricCryptoKey deviceKey)
{
await _stateService.SetDeviceKeyAsync(deviceKey);
var activeUserId = await _stateService.GetActiveUserIdAsync();
await _stateService.SetDeviceKeyAsync(deviceKey, activeUserId);
}
public async Task<DeviceResponse> TrustDeviceAsync()

View File

@@ -515,9 +515,7 @@ namespace Bit.Core.Services
public async Task<SymmetricCryptoKey> GetDeviceKeyAsync(string userId = null)
{
var reconciledOptions = ReconcileOptions(new StorageOptions { UserId = userId },
await GetDefaultStorageOptionsAsync());
var deviceKeyB64 = await _storageMediatorService.GetAsync<string>(Constants.DeviceKeyKey(reconciledOptions.UserId), true);
var deviceKeyB64 = await _storageMediatorService.GetAsync<string>(Constants.DeviceKeyKey(userId), true);
if (string.IsNullOrEmpty(deviceKeyB64))
{
return null;
@@ -527,9 +525,7 @@ namespace Bit.Core.Services
public async Task SetDeviceKeyAsync(SymmetricCryptoKey value, string userId = null)
{
var reconciledOptions = ReconcileOptions(new StorageOptions { UserId = userId },
await GetDefaultStorageOptionsAsync());
await _storageMediatorService.SaveAsync(Constants.DeviceKeyKey(reconciledOptions.UserId), value.KeyB64, true);
await _storageMediatorService.SaveAsync(Constants.DeviceKeyKey(userId), value.KeyB64, true);
}
public async Task<List<string>> GetAutofillBlacklistedUrisAsync(string userId = null)