mirror of
https://seed.radicle.dev/rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5.git
synced 2026-11-04 03:00:32 +08:00
26 lines
723 B
Rust
26 lines
723 B
Rust
use radicle::crypto::PublicKey;
|
|
use serde::{Deserialize, Serialize};
|
|
use time::serde::timestamp;
|
|
use time::{Duration, OffsetDateTime};
|
|
|
|
pub const UNAUTHORIZED_SESSIONS_EXPIRATION: Duration = Duration::seconds(60);
|
|
pub const AUTHORIZED_SESSIONS_EXPIRATION: Duration = Duration::weeks(1);
|
|
|
|
#[derive(Clone, Debug, Deserialize, Serialize, PartialEq)]
|
|
#[serde(rename_all = "lowercase")]
|
|
pub enum AuthState {
|
|
Authorized,
|
|
Unauthorized,
|
|
}
|
|
|
|
#[derive(Clone, Deserialize)]
|
|
#[serde(rename_all = "camelCase")]
|
|
pub struct Session {
|
|
pub status: AuthState,
|
|
pub public_key: PublicKey,
|
|
#[serde(with = "timestamp")]
|
|
pub issued_at: OffsetDateTime,
|
|
#[serde(with = "timestamp")]
|
|
pub expires_at: OffsetDateTime,
|
|
}
|