MARS documentation
Rust librariesmars-serverAuth

mars-server · auth::challenge_store

Public declarations and documentation for mars-server::auth::challenge_store.

Package: mars-server · Workspace version: 0.1.0 · Module: auth::challenge_store

This reference follows declared modules and public syntax, including public implementation methods. Function bodies and constant values are omitted. Feature conditions are retained. Private-module re-exports and trait resolution require the compiler; not every declaration is a root import.

auth::challenge_store::ChallengeRecord

Provider challenge stored before credential verification.

#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct ChallengeRecord {
pub request_id: String,
pub scheme: String,
pub payload: serde_json::Value,
pub issued_at_ms: i64,
pub expires_at_ms: i64
}

Source line: 25.

auth::challenge_store::AuthChallengeStore

Async durable boundary for issue, single-use consume, and cleanup.

#[async_trait]
pub trait AuthChallengeStore: Send + Sync {
    async fn insert(&self, challenge: ChallengeRecord) -> Result<(), AuthError>;

    /// Atomically consume an unexpired challenge.
    ///
    /// `None` covers unknown, already-consumed, and expired records so callers
    /// reveal no replay oracle.
    async fn consume(
        &self,
        request_id: &str,
        now_ms: i64,
    ) -> Result<Option<ChallengeRecord>, AuthError>;

    async fn cleanup(&self, now_ms: i64) -> Result<u64, AuthError>;

    fn is_durable(&self) -> bool;
}

Source line: 35.

auth::challenge_store::InMemoryChallengeStore

Process-local challenge store for tests and explicitly opted-in development.

#[derive(Debug, Default)]
pub struct InMemoryChallengeStore {

}

Source line: 55.

auth::challenge_store::InMemoryChallengeStore::new

pub fn new() -> Self;

Source line: 60.

auth::challenge_store::PostgresChallengeStore

Production PostgreSQL authentication challenge store.

#[cfg(feature = "postgres")]
#[derive(Debug, Clone)]
pub struct PostgresChallengeStore {

}

Source line: 113.

auth::challenge_store::PostgresChallengeStore::new

#[cfg(feature = "postgres")]
pub fn new(pool: PgPool) -> Self;

Source line: 119.

Source provenance

Source: mars-server/src/auth/challenge_store.rs · SHA-256 fc6cb8f3763237c394834f4400a835424077ada942a2969bf92f1c88f5679be2. Package overview.

On this page