mirror of
https://github.com/bitwarden/mobile
synced 2025-12-15 07:43:37 +00:00
[PM-2713] add make user key method to crypto service
This commit is contained in:
@@ -12,6 +12,7 @@ namespace Bit.Core.Abstractions
|
|||||||
Task SetUserKeyAsync(UserKey userKey);
|
Task SetUserKeyAsync(UserKey userKey);
|
||||||
Task<UserKey> GetUserKeyAsync(string userId = null);
|
Task<UserKey> GetUserKeyAsync(string userId = null);
|
||||||
Task<bool> HasUserKeyAsync(string userId = null);
|
Task<bool> HasUserKeyAsync(string userId = null);
|
||||||
|
Task<UserKey> MakeUserKeyAsync();
|
||||||
Task ClearUserKeyAsync(string userId = null);
|
Task ClearUserKeyAsync(string userId = null);
|
||||||
Task SetMasterKeyEncryptedUserKeyAsync(string value, string userId = null);
|
Task SetMasterKeyEncryptedUserKeyAsync(string value, string userId = null);
|
||||||
Task SetMasterKeyAsync(MasterKey masterKey, string userId = null);
|
Task SetMasterKeyAsync(MasterKey masterKey, string userId = null);
|
||||||
|
|||||||
@@ -51,6 +51,11 @@ namespace Bit.Core.Services
|
|||||||
return await GetUserKeyAsync(userId) != null;
|
return await GetUserKeyAsync(userId) != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task<UserKey> MakeUserKeyAsync()
|
||||||
|
{
|
||||||
|
return new UserKey(await _cryptoFunctionService.RandomBytesAsync(64));
|
||||||
|
}
|
||||||
|
|
||||||
public async Task ClearUserKeyAsync(string userId = null)
|
public async Task ClearUserKeyAsync(string userId = null)
|
||||||
{
|
{
|
||||||
await _stateService.SetUserKeyAsync(null, userId);
|
await _stateService.SetUserKeyAsync(null, userId);
|
||||||
|
|||||||
Reference in New Issue
Block a user