kipuka_util/lib.rs
1//! Shared utilities for TLS, authentication, and network listeners.
2//!
3//! This crate provides reusable utilities that are shared across the
4//! `kipuka` binary and its internal crates:
5//! - [`auth`]: HTTP authentication header parsing (Basic, Bearer, Negotiate)
6//! - [`listen`]: TCP/Unix/systemd socket listeners with graceful shutdown
7//! - [`tls`]: TLS configuration, certificate loading, and NIAP CA PP compliance
8
9pub mod auth;
10pub mod listen;
11pub mod tls;
12
13pub use auth::{AuthCredential, AuthError, BasicChallenge, WWW_AUTHENTICATE_BASIC};
14pub use listen::{ListenConfig, Listener};
15pub use tls::{TlsConfig, TlsConfigBuilder};
16
17/// Returns the current Unix timestamp in seconds.
18pub fn unix_now() -> i64 {
19 std::time::SystemTime::now()
20 .duration_since(std::time::UNIX_EPOCH)
21 .unwrap_or_default()
22 .as_secs() as i64
23}