Expand description
Shared security primitives for Victauri’s localhost HTTP servers.
This module provides the pure-logic building blocks that both victauri-plugin
and victauri-browser use in their axum middleware stacks. Keeping them here
eliminates copy-paste drift between the two crates.
Structs§
- Rate
Limiter - Lock-free token-bucket rate limiter using monotonic timestamps for smooth refill.
Constants§
- DEFAULT_
RATE_ LIMIT - Default rate limit: 1 000 requests per second.
Functions§
- constant_
time_ eq - Constant-time byte comparison to prevent timing side-channel attacks on token validation.
- generate_
token - Generate a random UUID v4 token suitable for Bearer authentication.
- is_
allowed_ origin - Returns
trueiforigin(from the HTTPOriginheader) is a localhost origin, atauri://origin, or absent. - is_
localhost_ host - Returns
trueifhost(from the HTTPHostheader) resolves to a localhost address.