capy-auth 0.10.0

Optional database-backed browser sessions and explicit authorization for Capy.
Documentation
//! Authentication transaction events. No credentials are included. External delivery
//! must use transactional Jobs/outboxes; a database commit can still fail afterward.
//! All events below may intentionally reject using `capy_core::EventRejection`.
//! The owning transition rolls back; logout/reset vetoes leave previous credentials
//! and sessions intact. There is no rejecting reset-request event (existence safety).
use crate::UserResponse;
use capy_core::Event;

/// A new user and authenticated session have been inserted, before commit.
#[derive(Clone)]
pub struct UserRegistered {
    /// Safe public user data. Includes PII; do not log the event value.
    pub user: UserResponse,
}
impl Event for UserRegistered {}
/// The first transition from unverified to verified, before commit.
/// Replay does not emit another event. Verification proof is application-owned.
#[derive(Clone)]
pub struct EmailVerified {
    /// Verified user ID; no email/token is carried.
    pub user_id: i64,
}
impl Event for EmailVerified {}
/// Password verification succeeded and a session was rotated, before commit.
#[derive(Clone)]
pub struct LoginSucceeded {
    /// Authenticated user ID.
    pub user_id: i64,
}
impl Event for LoginSucceeded {}
/// An authenticated session was actually deleted, before commit.
#[derive(Clone)]
pub struct LoggedOut {
    /// User whose session was removed.
    pub user_id: i64,
}
impl Event for LoggedOut {}
/// A reset token was consumed, password changed and sessions revoked, before commit.
#[derive(Clone)]
pub struct PasswordResetCompleted {
    /// User whose credentials changed.
    pub user_id: i64,
}
impl Event for PasswordResetCompleted {}