pub struct HIPAACompliance { /* private fields */ }Expand description
HIPAA compliance manager
Implementations§
Source§impl HIPAACompliance
impl HIPAACompliance
Sourcepub fn new(pool: PgPool, config: HIPAAConfig) -> Self
pub fn new(pool: PgPool, config: HIPAAConfig) -> Self
Create a new HIPAA compliance manager
Sourcepub async fn initialize(&self) -> Result<()>
pub async fn initialize(&self) -> Result<()>
Initialize HIPAA compliance tables
Sourcepub async fn log_audit(&self, entry: AuditLogEntry) -> Result<()>
pub async fn log_audit(&self, entry: AuditLogEntry) -> Result<()>
Log an audit entry
Sourcepub async fn enforce_retention_policy(&self) -> Result<usize>
pub async fn enforce_retention_policy(&self) -> Result<usize>
Purge old records per retention policy
Sourcepub async fn get_audit_log(
&self,
actor_id: Option<Uuid>,
limit: usize,
) -> Result<Vec<AuditLogEntry>>
pub async fn get_audit_log( &self, actor_id: Option<Uuid>, limit: usize, ) -> Result<Vec<AuditLogEntry>>
Get audit log entries
Sourcepub fn encrypt_phi(&self, data: &str) -> Result<String>
pub fn encrypt_phi(&self, data: &str) -> Result<String>
Encrypt Protected Health Information (PHI) using AES-256-GCM
This provides HIPAA-compliant encryption at rest for sensitive medical data. The encryption uses:
- AES-256-GCM for authenticated encryption
- Argon2 for key derivation
- Random salt and nonce per encryption
§Errors
Returns an error if encryption is not properly configured (missing key)
Sourcepub fn decrypt_phi(&self, encrypted: &str) -> Result<String>
pub fn decrypt_phi(&self, encrypted: &str) -> Result<String>
Decrypt Protected Health Information (PHI)
Decrypts data that was encrypted with encrypt_phi.
§Errors
- Returns error if decryption key is not configured
- Returns error if data was tampered with (authentication failure)
- Returns error if wrong key is used
Sourcepub fn config(&self) -> &HIPAAConfig
pub fn config(&self) -> &HIPAAConfig
Get the configuration
Source§impl HIPAACompliance
Extension trait for HIPAACompliance to add PII storage hooks
impl HIPAACompliance
Extension trait for HIPAACompliance to add PII storage hooks
Sourcepub fn create_protected_record(
&self,
text: &str,
entity_id: Uuid,
agent_id: Uuid,
room_id: Uuid,
storage_hook: &PIIStorageHook,
) -> Result<ProtectedDataRecord>
pub fn create_protected_record( &self, text: &str, entity_id: Uuid, agent_id: Uuid, room_id: Uuid, storage_hook: &PIIStorageHook, ) -> Result<ProtectedDataRecord>
Create a protected data record with PII detection
Sourcepub async fn initialize_protected_storage(&self) -> Result<()>
pub async fn initialize_protected_storage(&self) -> Result<()>
Initialize protected data storage table
Sourcepub async fn store_protected_data(
&self,
record: &ProtectedDataRecord,
) -> Result<Uuid>
pub async fn store_protected_data( &self, record: &ProtectedDataRecord, ) -> Result<Uuid>
Store a protected data record
Sourcepub async fn get_protected_data(
&self,
id: Uuid,
accessor_id: Uuid,
access_level: AccessLevel,
) -> Result<Option<(String, PIIDetectionResult)>>
pub async fn get_protected_data( &self, id: Uuid, accessor_id: Uuid, access_level: AccessLevel, ) -> Result<Option<(String, PIIDetectionResult)>>
Retrieve protected data with access control
Auto Trait Implementations§
impl Freeze for HIPAACompliance
impl !RefUnwindSafe for HIPAACompliance
impl Send for HIPAACompliance
impl Sync for HIPAACompliance
impl Unpin for HIPAACompliance
impl !UnwindSafe for HIPAACompliance
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more