1
0
mirror of https://github.com/bitwarden/mobile synced 2025-12-17 08:43:21 +00:00

Added GetOrDeriveMasterKey to UserVerificationService (#2808)

This commit is contained in:
aj-rosado
2023-10-03 12:54:22 +01:00
committed by GitHub
parent 685e0f407a
commit f2be840a7d
4 changed files with 16 additions and 8 deletions

View File

@@ -719,6 +719,17 @@ namespace Bit.Core.Services
await _stateService.GetActiveUserCustomDataAsync(a => new KdfConfig(a?.Profile)));
}
public async Task UpdateMasterKeyAndUserKeyAsync(MasterKey masterKey)
{
var userKey = await DecryptUserKeyWithMasterKeyAsync(masterKey);
await SetMasterKeyAsync(masterKey);
var hasKey = await HasUserKeyAsync();
if (!hasKey)
{
await SetUserKeyAsync(userKey);
}
}
// --HELPER METHODS--
private async Task StoreAdditionalKeysAsync(UserKey userKey, string userId = null)