diff --git a/src/FiscalOS.Core/Identity/User.cs b/src/FiscalOS.Core/Identity/User.cs index acd106c..fb44cb3 100644 --- a/src/FiscalOS.Core/Identity/User.cs +++ b/src/FiscalOS.Core/Identity/User.cs @@ -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 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, }; }