From 10574a7117b67356485c37a752d8516a194a005a Mon Sep 17 00:00:00 2001 From: Jacob Fink Date: Thu, 20 Jul 2023 16:17:30 -0400 Subject: [PATCH] [PM-2713] remove broken casting --- src/Core/Services/CryptoService.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Core/Services/CryptoService.cs b/src/Core/Services/CryptoService.cs index 04e3b9bfd..3ba541210 100644 --- a/src/Core/Services/CryptoService.cs +++ b/src/Core/Services/CryptoService.cs @@ -85,7 +85,7 @@ namespace Bit.Core.Services // Legacy support: encryption used to be done with the master key (derived from master password). // Users who have not migrated will have a null user key and must use the master key instead. - return (SymmetricCryptoKey)await GetMasterKeyAsync() as UserKey; + return new UserKey((await GetMasterKeyAsync()).Key); } public async Task HasUserKeyAsync(string userId = null) @@ -124,7 +124,7 @@ namespace Bit.Core.Services if (masterKey == null) { // Migration support - masterKey = await _stateService.GetKeyDecryptedAsync(userId) as MasterKey; + masterKey = new MasterKey((await _stateService.GetKeyDecryptedAsync(userId)).Key); if (masterKey != null) { await SetMasterKeyAsync(masterKey, userId);