From ee0dcd23f5844b2c9e03985a65bca5abce4d6c08 Mon Sep 17 00:00:00 2001 From: Jacob Fink Date: Tue, 1 Aug 2023 20:08:41 -0400 Subject: [PATCH] rename account keys to be more descriptive --- src/Core/Constants.cs | 4 ++-- src/Core/Services/StateService.cs | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Core/Constants.cs b/src/Core/Constants.cs index b7a17e1b8..f4ddb10b1 100644 --- a/src/Core/Constants.cs +++ b/src/Core/Constants.cs @@ -81,7 +81,7 @@ namespace Bit.Core public static string VaultTimeoutKey(string userId) => $"vaultTimeout_{userId}"; public static string VaultTimeoutActionKey(string userId) => $"vaultTimeoutAction_{userId}"; - public static string UserKeyKey(string userId) => $"userKey_{userId}"; + public static string MasterKeyEncryptedUserKeyKey(string userId) => $"masterKeyEncryptedUserKey_{userId}"; public static string CiphersKey(string userId) => $"ciphers_{userId}"; public static string FoldersKey(string userId) => $"folders_{userId}"; public static string CollectionsKey(string userId) => $"collections_{userId}"; @@ -93,7 +93,7 @@ namespace Bit.Core public static string EncOrgKeysKey(string userId) => $"encOrgKeys_{userId}"; public static string EncPrivateKeyKey(string userId) => $"encPrivateKey_{userId}"; public static string KeyHashKey(string userId) => $"keyHash_{userId}"; - public static string UserKeyPinKey(string userId) => $"userKeyPin_{userId}"; + public static string PinKeyEncryptedUserKeyKey(string userId) => $"pinKeyEncryptedUserKey_{userId}"; public static string PassGenOptionsKey(string userId) => $"passwordGenerationOptions_{userId}"; public static string PassGenHistoryKey(string userId) => $"generatedPasswordHistory_{userId}"; public static string TwoFactorTokenKey(string email) => $"twoFactorToken_{email}"; diff --git a/src/Core/Services/StateService.cs b/src/Core/Services/StateService.cs index 27349421c..dbe57cf4b 100644 --- a/src/Core/Services/StateService.cs +++ b/src/Core/Services/StateService.cs @@ -336,12 +336,12 @@ namespace Bit.Core.Services public async Task GetMasterKeyEncryptedUserKeyAsync(string userId = null) { - return await _storageMediatorService.GetAsync(Constants.UserKeyKey(userId), false); + return await _storageMediatorService.GetAsync(Constants.MasterKeyEncryptedUserKeyKey(userId), false); } public async Task SetMasterKeyEncryptedUserKeyAsync(string value, string userId = null) { - await _storageMediatorService.SaveAsync(Constants.UserKeyKey(userId), value, false); + await _storageMediatorService.SaveAsync(Constants.MasterKeyEncryptedUserKeyKey(userId), value, false); } public async Task CanAccessPremiumAsync(string userId = null) @@ -397,13 +397,13 @@ namespace Bit.Core.Services public async Task GetPinKeyEncryptedUserKeyAsync(string userId = null) { - var key = await _storageMediatorService.GetAsync(Constants.UserKeyPinKey(userId), false); + var key = await _storageMediatorService.GetAsync(Constants.PinKeyEncryptedUserKeyKey(userId), false); return key != null ? new EncString(key) : null; } public async Task SetPinKeyEncryptedUserKeyAsync(EncString value, string userId = null) { - await _storageMediatorService.SaveAsync(Constants.UserKeyPinKey(userId), value?.EncryptedString, false); + await _storageMediatorService.SaveAsync(Constants.PinKeyEncryptedUserKeyKey(userId), value?.EncryptedString, false); } public async Task GetPinKeyEncryptedUserKeyEphemeralAsync(string userId = null)