Raxol. Privacy
(Raxol v2.6.0)
View Source
Privacy and GDPR compliance utilities for Raxol.
Provides functions for user data management in compliance with privacy regulations like GDPR.
Example
# Anonymize user data
Raxol.Privacy.anonymize_user(user_id)
# Export all user data (GDPR data portability)
{:ok, data} = Raxol.Privacy.export_user_data(user_id)
# Delete all user data (GDPR right to erasure)
:ok = Raxol.Privacy.delete_user_data(user_id)
Summary
Functions
Anonymize a user's personally identifiable information.
Check consent status for a user.
Delete all data associated with a user.
Export all data associated with a user.
Record user consent.
Get data retention policy.
Types
@type user_export() :: %{ user_id: String.t(), exported_at: DateTime.t(), format: atom(), data: map() }
Functions
@spec anonymize_user(String.t()) :: :ok
Anonymize a user's personally identifiable information.
Replaces PII with anonymized placeholders while preserving data structure for analytics.
Example
:ok = Raxol.Privacy.anonymize_user(user_id)
Check consent status for a user.
Example
case Raxol.Privacy.check_consent(user_id, :analytics) do
{:ok, true} -> track_analytics()
{:ok, false} -> skip_analytics()
end
Delete all data associated with a user.
Implements GDPR right to erasure (right to be forgotten).
Options
:soft_delete- Mark as deleted instead of removing (default: false):retain_audit- Keep anonymized audit logs (default: true)
Example
:ok = Raxol.Privacy.delete_user_data(user_id)
@spec export_user_data( String.t(), keyword() ) :: {:ok, user_export()}
Export all data associated with a user.
Returns a structured export of all user data for GDPR data portability compliance.
Options
:format- Export format (:json, :csv) (default: :json):include- List of data types to include (default: all)
Example
{:ok, data} = Raxol.Privacy.export_user_data(user_id)
Record user consent.
Example
:ok = Raxol.Privacy.record_consent(user_id, :analytics, true)
Get data retention policy.
Example
policy = Raxol.Privacy.retention_policy(:audit_logs)
# => %{retention_days: 90, anonymize_after: 30}