1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
//! # Authentication
//!
//! Authentication and encryption library for the Chronix time-series database.
//!
//! ## Features
//!
//! - **API key authentication** — Argon2-hashed keys with optional expiry
//! - **JWT/OIDC authentication** — RS256/HS256 token validation with configurable claims
//! - **mTLS authentication** — Client certificate identity extraction
//! - **Encryption at rest** — AES-256-GCM authenticated encryption with key rotation
//! - **Unified auth context** — Common `AuthContext` across all methods
//!
//! ## Architecture
//!
//! ```text
//! Request → AuthMiddleware → [mTLS → JWT → API Key] → AuthContext
//! ├── principal
//! ├── method
//! └── claims
//! ```
/// Fill `dest` from the operating system's random source.
///
/// One definition for every secret this crate generates — nonces, data keys,
/// API keys and password salts. `rand` 0.10 renamed the OS generator to
/// `SysRng` and made it fallible, and a failure here means the kernel has no
/// entropy source: there is no safe fallback, so it panics rather than
/// returning a key nobody should trust.
pub
pub use ApiKeyStore;
pub use ;
pub use AuthError;
pub use JwtValidator;
pub use ;
pub use MtlsValidator;
pub use ;
pub use ;