Skip to main content

ironflow_auth/
lib.rs

1//! # ironflow-auth
2//!
3//! Authentication library for the **ironflow** workflow engine.
4//!
5//! - JWT access + refresh tokens (HS256)
6//! - Argon2id password hashing
7//! - HttpOnly cookie management
8//! - Axum `AuthenticatedUser` extractor
9//!
10//! # Quick start
11//!
12//! ```no_run
13//! use ironflow_auth::jwt::{JwtConfig, AccessToken, RefreshToken};
14//! use ironflow_auth::password;
15//! use uuid::Uuid;
16//!
17//! # fn example() -> Result<(), ironflow_auth::error::AuthError> {
18//! let config = JwtConfig {
19//!     secret: "my-secret".to_string(),
20//!     access_token_ttl_secs: 900,
21//!     refresh_token_ttl_secs: 604800,
22//!     cookie_domain: None,
23//!     cookie_secure: false,
24//! };
25//!
26//! let hash = password::hash("hunter2")?;
27//! assert!(password::verify("hunter2", &hash)?);
28//!
29//! let user_id = Uuid::now_v7();
30//! let access = AccessToken::for_user(user_id, "alice", false, &config)?;
31//! let claims = AccessToken::decode(&access.0, &config)?;
32//! assert_eq!(claims.user_id, user_id);
33//! # Ok(())
34//! # }
35//! ```
36
37pub mod cookies;
38pub mod error;
39pub mod extractor;
40pub mod jwt;
41pub mod middleware;
42pub mod password;