1//! Layer implementations used in RPC
23#![doc(
4 html_logo_url = "https://raw.githubusercontent.com/paradigmxyz/reth/main/assets/reth-docs.png",
5 html_favicon_url = "https://avatars0.githubusercontent.com/u/97369466?s=256",
6 issue_tracker_base_url = "https://github.com/paradigmxyz/reth/issues/"
7)]
8#![cfg_attr(not(test), warn(unused_crate_dependencies))]
9#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
1011use http::HeaderMap;
12use jsonrpsee_http_client::HttpResponse;
1314mod auth_client_layer;
15mod auth_layer;
16mod compression_layer;
17mod jwt_validator;
1819pub use auth_layer::{AuthService, ResponseFuture};
20pub use compression_layer::CompressionLayer;
2122// Export alloy JWT types
23pub use alloy_rpc_types_engine::{Claims, JwtError, JwtSecret};
2425pub use auth_client_layer::{secret_to_bearer_header, AuthClientLayer, AuthClientService};
26pub use auth_layer::AuthLayer;
27pub use jwt_validator::JwtAuthValidator;
2829/// General purpose trait to validate Http Authorization headers. It's supposed to be integrated as
30/// a validator trait into an [`AuthLayer`].
31pub trait AuthValidator {
32/// This function is invoked by the [`AuthLayer`] to perform validation on Http headers.
33 /// The result conveys validation errors in the form of an Http response.
34fn validate(&self, headers: &HeaderMap) -> Result<(), HttpResponse>;
35}