1
0
mirror of https://github.com/bitwarden/mobile synced 2025-12-18 17:23:18 +00:00

[PM-2713] set decrypt and set user key in login helper

This commit is contained in:
Jacob Fink
2023-07-19 21:19:16 -04:00
parent bedbca841d
commit a3183857b9
3 changed files with 21 additions and 23 deletions

View File

@@ -395,16 +395,15 @@ namespace Bit.Core.Services
await SetValueAsync(Constants.ProtectedPinKey(reconciledOptions.UserId), value, reconciledOptions);
}
// TODO(Jake): Does this need to be secure storage?
public async Task<EncString> GetUserKeyPinAsync(string userId = null)
{
return new EncString(await _storageMediatorService.GetAsync<string>(Constants.UserKeyPinKey(userId), false));
var key = await _storageMediatorService.GetAsync<string>(Constants.UserKeyPinKey(userId), false);
return key != null ? new EncString(key) : null;
}
// TODO(Jake): Does this need to be secure storage?
public async Task SetUserKeyPinAsync(EncString value, string userId = null)
{
await _storageMediatorService.SaveAsync(Constants.UserKeyPinKey(userId), value.EncryptedString, false);
await _storageMediatorService.SaveAsync(Constants.UserKeyPinKey(userId), value?.EncryptedString, false);
}
public async Task<EncString> GetUserKeyPinEphemeralAsync(string userId = null)