1
0
mirror of https://github.com/bitwarden/server.git synced 2025-06-20 02:48:03 -05:00
This commit is contained in:
Bernd Schoolmann 2025-06-05 20:34:25 +02:00
parent 5ff9f856a2
commit 2428d64488
No known key found for this signature in database

View File

@ -18,12 +18,7 @@ public class UsersController(
public async Task<UserKeyResponseModel> GetPublicKeyAsync(string id)
{
var guidId = new Guid(id);
var key = await _userRepository.GetPublicKeyAsync(guidId);
if (key == null)
{
throw new NotFoundException();
}
var key = await _userRepository.GetPublicKeyAsync(guidId) ?? throw new NotFoundException();
return new UserKeyResponseModel(guidId, key);
}
@ -31,17 +26,8 @@ public class UsersController(
public async Task<PublicKeysResponseModel> GetAccountKeysAsync(string id)
{
var guidId = new Guid(id);
var user = await _userRepository.GetByIdAsync(guidId);
if (user == null)
{
throw new NotFoundException();
}
var accountKeys = await _userAccountKeysQuery.Run(user);
if (accountKeys == null)
{
throw new NotFoundException("User account keys not found.");
}
var user = await _userRepository.GetByIdAsync(guidId) ?? throw new NotFoundException();
var accountKeys = await _userAccountKeysQuery.Run(user) ?? throw new NotFoundException("User account keys not found.");
return new PublicKeysResponseModel(accountKeys);
}
}