From 38c311bdd1823e3564fe5e7a238408e49d02fda2 Mon Sep 17 00:00:00 2001 From: Stevan Freeborn <65925598+StevanFreeborn@users.noreply.github.com> Date: Fri, 6 Feb 2026 06:44:24 -0600 Subject: [PATCH] feat(core): extend user model with encryption related properties --- src/FiscalOS.Core/Identity/User.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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, }; }