Files
MatrixGW/matrixgw_backend/src/constants.rs

29 lines
849 B
Rust

use std::time::Duration;
/// Auth header
pub const API_AUTH_HEADER: &str = "x-client-auth";
/// Max token validity, in seconds
pub const API_TOKEN_JWT_MAX_DURATION: u64 = 15 * 60;
/// Length of generated tokens
pub const TOKENS_LEN: usize = 50;
/// Session-specific constants
pub mod sessions {
/// OpenID auth session state key
pub const OIDC_STATE_KEY: &str = "oidc-state";
/// OpenID auth remote IP address
pub const OIDC_REMOTE_IP: &str = "oidc-remote-ip";
/// Authenticated ID
pub const USER_ID: &str = "uid";
}
/// How often heartbeat pings are sent.
///
/// Should be half (or less) of the acceptable client timeout.
pub const WS_HEARTBEAT_INTERVAL: Duration = Duration::from_secs(5);
/// How long before lack of client response causes a timeout.
pub const WS_CLIENT_TIMEOUT: Duration = Duration::from_secs(10);