modo/auth/session/jwt/tokens.rs
1//! Token pair returned by JWT session lifecycle methods.
2
3use serde::{Deserialize, Serialize};
4
5/// A pair of JWT tokens issued on successful authentication or rotation.
6///
7/// The `access_token` is short-lived and used to authenticate API requests.
8/// The `refresh_token` is long-lived and used to obtain a new token pair via
9/// the rotate endpoint. Both `*_expires_at` fields are Unix timestamps in seconds.
10#[derive(Debug, Clone, Serialize, Deserialize)]
11pub struct TokenPair {
12 /// Short-lived token used to authenticate API requests.
13 pub access_token: String,
14 /// Long-lived token used to rotate the pair without re-authenticating.
15 pub refresh_token: String,
16 /// Unix timestamp (seconds) when the access token expires.
17 pub access_expires_at: u64,
18 /// Unix timestamp (seconds) when the refresh token expires.
19 pub refresh_expires_at: u64,
20}