Skip to main content

hyperlane_plugin_auth/
lib.rs

1//! hyperlane-plugin-auth
2//!
3//! Pure-Rust high-performance authentication and RBAC plugin for Hyperlane
4//! with HS256 JWT (`kid` rotation, `exp`/`nbf`/`iss`/`aud`), API key and
5//! HTTP Basic authenticators, constant-time verification, and extensible
6//! async [`Authenticator`] traits.
7
8mod r#const;
9mod r#enum;
10mod r#fn;
11mod r#impl;
12mod r#static;
13mod r#struct;
14mod r#trait;
15mod r#type;
16
17#[cfg(test)]
18#[path = "../tests/mod.rs"]
19mod tests;
20
21pub use {r#const::*, r#enum::*, r#fn::*, r#struct::*, r#trait::*, r#type::*};
22
23pub(crate) use r#static::*;
24
25use std::{
26    borrow::Cow,
27    collections::HashMap,
28    error::Error,
29    fmt::{self, Display, Formatter},
30    future::Future,
31    io::{self, Write},
32    pin::Pin,
33    str::from_utf8,
34    sync::{Arc, OnceLock},
35    time::{Duration, SystemTime, UNIX_EPOCH},
36};
37
38use {
39    hyperlane::{
40        AUTHORIZATION, Context, HashMapXxHash3_64, HashSetXxHash3_64, HttpStatus, Request,
41        RequestHeadersValue, ResponseData, ResponseError, ServerHook, Status, Stream,
42        WWW_AUTHENTICATE, X_API_KEY, hash_map_xx_hash3_64, hash_set_xx_hash3_64,
43    },
44    lombok_macros::*,
45    serde::{Deserialize, Serialize},
46    serde_json::{Value, from_slice, to_vec, to_writer},
47};