seshcookie 0.1.0

Stateless, encrypted, type-safe session cookies for Rust web applications.
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
#![doc = include_str!("../README.md")]

mod aead;
mod codec;
mod config;
mod envelope;
pub mod error;
mod extract;
mod keys;
mod layer;
mod state;

pub use config::{SameSite, SessionConfig};
pub use error::{BuildError, SessionRejection};
pub use extract::Session;
pub use keys::SessionKeys;
pub use layer::{SessionLayer, SessionService};

/// Test-only helpers reached by name from integration tests in `tests/`.
///
/// This module is `#[doc(hidden)]` and exported only to give integration
/// tests a way to construct cookie values without re-implementing the AEAD
/// pipeline. **It is not part of the public API**; the contents may change
/// without a SemVer bump and must never be used from application code.
#[doc(hidden)]
pub mod __testing {
    use std::time::SystemTime;

    use crate::SessionLayer;

    /// Encode a typed payload as a session cookie value, sealed under the
    /// primary key of `layer`. Used by `tests/axum_integration.rs` to
    /// build the per-task cookie values for the AC9.2 100-concurrent-
    /// requests test. See [`SessionLayer::__testing_encode_cookie`].
    pub fn encode_cookie_for_layer<T: serde::Serialize>(
        layer: &SessionLayer<T>,
        payload: &T,
        issued_at: SystemTime,
    ) -> String {
        layer.__testing_encode_cookie(payload, issued_at)
    }
}