blob: 3129aa774f2d1c6dd3bc706468c85f251f634ff8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
use axum::{
extract::{Request, State},
middleware::Next,
response::Response,
};
use crate::{clock::RequestedAt, error::Internal, vapid::app::Vapid};
pub async fn middleware(
State(vapid): State<Vapid>,
RequestedAt(now): RequestedAt,
request: Request,
next: Next,
) -> Result<Response, Internal> {
vapid.refresh_key(&now).await?;
Ok(next.run(request).await)
}
|