begin: PHI Column Encryption
This commit is contained in:
@@ -10,6 +10,9 @@ public class Patient
|
||||
public string? Allergies { get; set; }
|
||||
public string? EmergencyContactName { get; set; }
|
||||
public string? EmergencyContactPhone { get; set; }
|
||||
|
||||
/// <summary>HMAC token for name search. Not PHI — enables lookup without decrypting all rows.</summary>
|
||||
public string? NameSearchToken { get; set; }
|
||||
public string Status { get; set; } = "active";
|
||||
public DateTimeOffset CreatedAt { get; set; }
|
||||
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
public class PhiAccessLog
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
public PhiAccessType AccessType { get; set; }
|
||||
public Guid? PatientId { get; set; }
|
||||
public Guid UserId { get; set; }
|
||||
public string UserDisplayName { get; set; } = null!;
|
||||
public string ResourcePath { get; set; } = null!;
|
||||
public string? SearchQueryHash { get; set; }
|
||||
public int? ResultCount { get; set; }
|
||||
public string? IpAddress { get; set; }
|
||||
public string? CorrelationId { get; set; }
|
||||
public DateTimeOffset AccessedAt { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
public enum PhiAccessType
|
||||
{
|
||||
View,
|
||||
List,
|
||||
Search,
|
||||
Create,
|
||||
Update
|
||||
}
|
||||
|
||||
public static class PhiAccessTypeExtensions
|
||||
{
|
||||
public static string ToDbString(this PhiAccessType t) => t switch
|
||||
{
|
||||
PhiAccessType.View => "VIEW",
|
||||
PhiAccessType.List => "LIST",
|
||||
PhiAccessType.Search => "SEARCH",
|
||||
PhiAccessType.Create => "CREATE",
|
||||
PhiAccessType.Update => "UPDATE",
|
||||
_ => throw new ArgumentOutOfRangeException(nameof(t))
|
||||
};
|
||||
|
||||
public static PhiAccessType FromDbString(string v) => v switch
|
||||
{
|
||||
"VIEW" => PhiAccessType.View,
|
||||
"LIST" => PhiAccessType.List,
|
||||
"SEARCH" => PhiAccessType.Search,
|
||||
"CREATE" => PhiAccessType.Create,
|
||||
"UPDATE" => PhiAccessType.Update,
|
||||
_ => throw new ArgumentOutOfRangeException(nameof(v))
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user