Skip to content

audit

Functions


firma_sidecar::startup::audit::load_audit_event_builder

Section titled “firma_sidecar::startup::audit::load_audit_event_builder”

Function

Loads the ECDSA signing key PEM from the audit configuration and constructs an [audit::builder::EventBuilder].

The key is loaded from either signing_key_path (file) or signing_key_env (environment variable). Returns an error when neither is set.

Returns an error if the file cannot be read or the PEM is invalid.

fn load_audit_event_builder(config: &config::AuditConfig) -> anyhow::Result<audit::builder::EventBuilder>

firma_sidecar::startup::audit::spawn_audit_sink

Section titled “firma_sidecar::startup::audit::spawn_audit_sink”

Function

Spawns the audit sink pipeline.

The pipeline is a signing adapter that receives AuditPayloads, signs them into ExecutionEvents, and forwards to the concrete AuditSink.

Returns a [tokio::task::JoinHandle] that resolves when the sink shuts down.

Returns an error when the sink fails to initialize (invalid config, inability to connect to an external sink).

fn spawn_audit_sink(config: &config::AuditConfig, payload_rx: mpsc::Receiver<audit::AuditPayload>, event_builder: audit::builder::EventBuilder, exit: tokio_util::sync::CancellationToken) -> anyhow::Result<tokio::task::JoinHandle<Result<(), audit::AuditSinkError>>>