Crosswake. Audit. Ledger
(crosswake v0.1.2)
View Source
Defines the core Audit Ledger contract struct and HMAC anonymization helper.
Summary
Functions
Computes an HMAC-SHA256 of the given id using a secret.
Types
@type t() :: %Crosswake.Audit.Ledger{ actor_kind: String.t() | nil, actor_ref: String.t() | nil, correlation_id: String.t() | nil, event_class: String.t() | nil, event_type: String.t() | nil, idempotency_key: String.t() | nil, metadata: map() | nil, occurred_at: DateTime.t() | nil, outcome: String.t() | nil, prev_hash: String.t() | nil, provenance: String.t() | nil, recorded_at: DateTime.t() | nil, route_id: String.t() | nil, row_hash: String.t() | nil, thread_id: String.t() | nil }
Functions
Computes an HMAC-SHA256 of the given id using a secret.
If opts[:secret] is provided, it is used as the secret.
Otherwise, it falls back to Application.get_env(:crosswake, :audit_hmac_secret).
Raises ArgumentError if no secret is available.
Returns the HMAC as a lowercase base16 string.