pub struct VerifierConfig {
pub trusted_issuers: HashSet<String>,
pub allowed_algs: Vec<Algorithm>,
pub max_clock_skew: Duration,
pub max_signature_lifetime: Duration,
pub audience: String,
}Expand description
Static configuration for crate::verify.
alg never comes from either token — it is always looked up here. Symmetric algorithms
(HS256/HS384/HS512) must never appear in allowed_algs: VerifierConfig::new filters
them out defensively, and verify() also hard-rejects the whole HMAC family unconditionally
regardless of what a caller manages to put in allowed_algs. This scheme’s private key never
leaves the device, so there is no symmetric secret the verifier could ever legitimately share
with a signer — belt and braces, not a suggestion.
Fields§
§trusted_issuers: HashSet<String>Attestation iss values this verifier trusts.
allowed_algs: Vec<Algorithm>Algorithms accepted for both the request signature and the attestation. Must be asymmetric only — see the type-level docs above.
max_clock_skew: DurationClock skew tolerance applied to both the attestation’s and the signature’s freshness windows.
max_signature_lifetime: DurationUpper bound on sig.exp - sig.iat. Rejects long-lived signatures outright even if exp
itself is still in the future — a short-lived signing key policy is only meaningful if
the lifetime is bounded independently of the clock.
audience: StringThe audience this verifier expects requests to be signed for (sig.aud). Prevents a
signature captured for one service being replayed against another.
Implementations§
Source§impl VerifierConfig
impl VerifierConfig
Sourcepub fn new(
trusted_issuers: impl IntoIterator<Item = impl Into<String>>,
allowed_algs: impl IntoIterator<Item = Algorithm>,
max_clock_skew: Duration,
max_signature_lifetime: Duration,
audience: impl Into<String>,
) -> Self
pub fn new( trusted_issuers: impl IntoIterator<Item = impl Into<String>>, allowed_algs: impl IntoIterator<Item = Algorithm>, max_clock_skew: Duration, max_signature_lifetime: Duration, audience: impl Into<String>, ) -> Self
Builds a config, silently dropping any symmetric algorithm from allowed_algs.
Dropping rather than erroring keeps this ergonomic for the common case (a caller passes
[Algorithm::ES256] and never has to think about it) while still making the
“asymmetric only” rule impossible to defeat by misconfiguration — the algorithm-family
check inside verify() is the actual enforcement point either way.
Trait Implementations§
Source§impl Clone for VerifierConfig
impl Clone for VerifierConfig
Source§fn clone(&self) -> VerifierConfig
fn clone(&self) -> VerifierConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more