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 Username { get; init; } = string.Empty;
|
||||||
public string HashedPassword { 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;
|
public IEnumerable<RefreshToken> RefreshTokens => _refreshTokens;
|
||||||
|
|
||||||
@@ -18,12 +20,18 @@ public sealed class User : Entity
|
|||||||
return new();
|
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()
|
return new()
|
||||||
{
|
{
|
||||||
Username = username,
|
Username = username,
|
||||||
HashedPassword = hashedPassword,
|
HashedPassword = hashedPassword,
|
||||||
|
EncryptedDataKey = encryptedDataKey.EncryptedKey,
|
||||||
|
EncryptionKeyId = encryptedDataKey.KeyIdUsed,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user