confium_daemon/methods/audit.rs
1//! Audit subscription methods.
2//!
3//! `audit_subscribe` registers the caller's connection as a recipient
4//! of audit events. The server pushes [`AuditNotification`] messages
5//! to subscribed connections whenever the core audit logger emits an
6//! event.
7//!
8//! The skeleton returns `{"subscribed": true}` and relies on the
9//! server loop to route notifications to the connection. A real
10//! implementation would install a broadcast channel receiver on the
11//! daemon-wide audit sink.
12
13use serde_json::{Value, json};
14
15use crate::error::RpcError;
16use crate::server::SharedConfium;
17
18/// `audit_subscribe({})` → `{"subscribed": true}`
19///
20/// No params today. The server loop inspects the result and, on
21/// success, marks the connection as subscribed so subsequent audit
22/// events are forwarded as JSON-RPC notifications.
23pub async fn audit_subscribe(
24 _cfm: SharedConfium,
25 _params: Value,
26) -> std::result::Result<Value, RpcError> {
27 Ok(json!({ "subscribed": true }))
28}