sova_session/events.rs
1//! Domain events emitted on the app [`EventBus`](sova_core::EventBus).
2
3use sova_core::Event;
4
5/// Fired when [`crate::Session::regenerate`] issues a new session id.
6#[derive(Debug, Clone)]
7pub struct SessionRegenerated {
8 pub had_user: bool,
9}
10
11impl Event for SessionRegenerated {
12 fn name(&self) -> &'static str {
13 "session.regenerated"
14 }
15}
16
17/// Fired after [`crate::SessionExt::logout_all_sessions`] destroys sessions.
18#[derive(Debug, Clone)]
19pub struct SessionLogoutAll {
20 pub user_id: String,
21 pub count: u64,
22}
23
24impl Event for SessionLogoutAll {
25 fn name(&self) -> &'static str {
26 "session.logout_all"
27 }
28}