OpenAgentID documentation
Source referencesRust module referencearsenal-store

arsenal-store · consent_store

Declared module signatures, types, configuration, and source documentation.

Source: arsenal/crates/arsenal-store/src/consent_store.rs. SHA-256: 3c5a1606ecd36ea252f54a56d288b95864e895588b58701a11e1cf06c22ed07c.

This source reference follows declared modules and preserves feature attributes. It includes public declarations and implementation methods in those modules. Private-module exports and trait resolution still require the compiler; not every declaration is a crate-root import. Function bodies and constant values are omitted. Source comments describe their implementation context and are not a production deployment claim.

Result type for consent store operations

pub type ConsentStoreResult<T> = Result<T, SecretStoreError>;

Source line: 22.

Trait for consent record storage backends

pub trait ConsentStore: Send + Sync {
    /// Store a new consent record
    fn store_consent<'a>(
        &'a self,
        record: ConsentRecord,
    ) -> Pin<Box<dyn Future<Output = ConsentStoreResult<()>> + Send + 'a>>;

    /// Get a consent record by ID
    fn get_consent<'a>(
        &'a self,
        consent_id: &'a ConsentId,
    ) -> Pin<Box<dyn Future<Output = ConsentStoreResult<Option<ConsentRecord>>> + Send + 'a>>;

    /// Find a valid consent record for an agent and variable
    fn find_consent<'a>(
        &'a self,
        agent_did: &'a str,
        variable: &'a str,
    ) -> Pin<Box<dyn Future<Output = ConsentStoreResult<Option<ConsentRecord>>> + Send + 'a>>;

    /// Revoke a consent record
    fn revoke_consent<'a>(
        &'a self,
        consent_id: &'a ConsentId,
    ) -> Pin<Box<dyn Future<Output = ConsentStoreResult<()>> + Send + 'a>>;

    /// List all consent records for an agent
    fn list_consents<'a>(
        &'a self,
        agent_did: &'a str,
    ) -> Pin<Box<dyn Future<Output = ConsentStoreResult<Vec<ConsentRecord>>> + Send + 'a>>;

    /// Remove expired consent records, returning the count removed
    fn cleanup_expired<'a>(
        &'a self,
    ) -> Pin<Box<dyn Future<Output = ConsentStoreResult<u64>> + Send + 'a>>;
}

Source line: 25.

In-memory consent store for development and testing

#[derive(Debug, Clone)]
pub struct InMemoryConsentStore {

}

Source line: 65.

Create a new empty in-memory consent store

#[must_use]
pub fn new() -> Self;

Source line: 72.

SQL-backed consent store (Postgres/SQLite) using sqlx.

#[cfg(any(feature = "sqlite", feature = "postgres"))]
pub struct SqlConsentStore {

}

Source line: 180.

Create a new SQL-backed consent store and ensure schema exists.

Errors

Returns an error if the database cannot be reached or schema init fails.

#[cfg(any(feature = "sqlite", feature = "postgres"))]
pub async fn connect(
        database_url: &str,
        table: String,
        max_connections: u32,
        connect_timeout: std::time::Duration,
    ) -> ConsentStoreResult<Self>;

Source line: 242.

On this page