feat(core): extend user model with encryption related properties

This commit is contained in:
Stevan Freeborn
2026-02-06 06:53:20 -06:00
parent e9b1bd11bb
commit 38c311bdd1
+9 -1
View File
@@ -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,
};
}