feat(core): extend user model with encryption related properties
This commit is contained in:
@@ -6,6 +6,8 @@ public sealed class User : Entity
|
||||
|
||||
public string Username { get; init; } = string.Empty;
|
||||
public string HashedPassword { get; init; } = string.Empty;
|
||||
public string EncryptionKeyId { get; init; } = string.Empty;
|
||||
public string EncryptedDataKey { get; init; } = string.Empty;
|
||||
|
||||
public IEnumerable<RefreshToken> RefreshTokens => _refreshTokens;
|
||||
|
||||
@@ -18,12 +20,18 @@ public sealed class User : Entity
|
||||
return new();
|
||||
}
|
||||
|
||||
public static User From(string username, string hashedPassword)
|
||||
public static User From(string username, string hashedPassword, EncryptedDataKey encryptedDataKey)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(username);
|
||||
ArgumentNullException.ThrowIfNull(hashedPassword);
|
||||
ArgumentNullException.ThrowIfNull(encryptedDataKey);
|
||||
|
||||
return new()
|
||||
{
|
||||
Username = username,
|
||||
HashedPassword = hashedPassword,
|
||||
EncryptedDataKey = encryptedDataKey.EncryptedKey,
|
||||
EncryptionKeyId = encryptedDataKey.KeyIdUsed,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user