From 28addfeb4380ef6fc1fa39d1cc118f6c33fda448 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andre=CC=81=20Bispo?= Date: Tue, 25 Jul 2023 17:39:57 +0100 Subject: [PATCH] [PM-2293] Remove userid params --- src/Core/Services/DeviceTrustCryptoService.cs | 6 ++---- src/Core/Services/StateService.cs | 8 ++++++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/Core/Services/DeviceTrustCryptoService.cs b/src/Core/Services/DeviceTrustCryptoService.cs index 0d9b81aa9..93ccb905e 100644 --- a/src/Core/Services/DeviceTrustCryptoService.cs +++ b/src/Core/Services/DeviceTrustCryptoService.cs @@ -33,14 +33,12 @@ namespace Bit.Core.Services public async Task GetDeviceKeyAsync() { - var activeUserId = await _stateService.GetActiveUserIdAsync(); - return await _stateService.GetDeviceKeyAsync(activeUserId); + return await _stateService.GetDeviceKeyAsync(); } private async Task SetDeviceKeyAsync(SymmetricCryptoKey deviceKey) { - var activeUserId = await _stateService.GetActiveUserIdAsync(); - await _stateService.SetDeviceKeyAsync(deviceKey, activeUserId); + await _stateService.SetDeviceKeyAsync(deviceKey); } public async Task TrustDeviceAsync() diff --git a/src/Core/Services/StateService.cs b/src/Core/Services/StateService.cs index 49a069ddf..480bacaaa 100644 --- a/src/Core/Services/StateService.cs +++ b/src/Core/Services/StateService.cs @@ -515,7 +515,9 @@ namespace Bit.Core.Services public async Task GetDeviceKeyAsync(string userId = null) { - var deviceKeyB64 = await _storageMediatorService.GetAsync(Constants.DeviceKeyKey(userId), true); + var reconciledOptions = ReconcileOptions(new StorageOptions { UserId = userId }, + await GetDefaultStorageOptionsAsync()); + var deviceKeyB64 = await _storageMediatorService.GetAsync(Constants.DeviceKeyKey(reconciledOptions.UserId), true); if (string.IsNullOrEmpty(deviceKeyB64)) { return null; @@ -525,7 +527,9 @@ namespace Bit.Core.Services public async Task SetDeviceKeyAsync(SymmetricCryptoKey value, string userId = null) { - await _storageMediatorService.SaveAsync(Constants.DeviceKeyKey(userId), value.KeyB64, true); + var reconciledOptions = ReconcileOptions(new StorageOptions { UserId = userId }, + await GetDefaultStorageOptionsAsync()); + await _storageMediatorService.SaveAsync(Constants.DeviceKeyKey(reconciledOptions.UserId), value.KeyB64, true); } public async Task> GetAutofillBlacklistedUrisAsync(string userId = null)