Transform the single binary crate into a 9-crate workspace monorepo: - Root Cargo.toml as [workspace] manager with resolver = "2" - zesdex-entities: Domain entity types (session, settings, store, message, etc.) - zesdex-utils: Pure utility functions (error, logger, pagination, slug, clipboard) - zesdex-dto: Data Transfer Objects for LLM provider API communication - zesdex-ipc: Unix-socket IPC layer (client/server/framing/protocol) - zesdex-iam: Identity & Access Management (Clean Architecture: domain/application/infrastructure) - zesdex-cms: Content Management (Clean Architecture: domain/application/infrastructure) - zesdex-middleware: HTTP middleware (Auth, CORS, Rate Limiting) - zesdex-libs: Composition root (AppContext, DB init, JWT, Argon2) - zesdex-backend: Main binary entry point + seed/migrate binaries - DevOps: Dockerfile, docker-compose, Nix (flake/shell/default), CI/CD updates - Remove dead root src/ and src-misc/ directories All crate re-exports maintain backward compatibility with original crate::model::*, crate::dto::*, crate::ipc::* module paths. Feature crates enforce strict layer separation: domain -> application -> infrastructure with generic trait-based dependency injection.
45 lines
1.2 KiB
Rust
45 lines
1.2 KiB
Rust
#![allow(
|
|
clippy::cast_possible_truncation,
|
|
clippy::cast_sign_loss,
|
|
clippy::cast_precision_loss,
|
|
clippy::cast_possible_wrap
|
|
)]
|
|
//! Pure OAuth entities — no HTTP or persistence logic.
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
/// An OAuth 2.0 access token with optional refresh token and absolute
|
|
/// expiry time (epoch seconds).
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
pub struct OAuthToken {
|
|
pub access_token: String,
|
|
pub refresh_token: Option<String>,
|
|
pub expires_at: u64,
|
|
pub token_type: String,
|
|
}
|
|
|
|
/// Static configuration for an OAuth provider.
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
pub struct OAuthConfig {
|
|
pub auth_url: String,
|
|
pub token_url: String,
|
|
pub client_id: String,
|
|
pub client_secret: Option<String>,
|
|
pub scopes: Vec<String>,
|
|
}
|
|
|
|
impl Default for OAuthConfig {
|
|
fn default() -> Self {
|
|
OAuthConfig {
|
|
auth_url: String::new(),
|
|
token_url: String::new(),
|
|
client_id: String::new(),
|
|
client_secret: None,
|
|
scopes: vec![
|
|
"openid".to_string(),
|
|
"profile".to_string(),
|
|
"email".to_string(),
|
|
],
|
|
}
|
|
}
|
|
}
|