pub struct Jwks {
pub keys: Vec<Jwk>,
}Expand description
JSON Web Key Set — collection of trusted public keys per RFC 7517 §5.
Equality + Clone derive enables ergonomic Arc-wrapping at the wiring site without polluting the public surface.
Fields§
§keys: Vec<Jwk>Implementations§
Source§impl Jwks
impl Jwks
Sourcepub fn from_ed25519_keys(keys: &[(&str, &[u8; 32])]) -> Self
pub fn from_ed25519_keys(keys: &[(&str, &[u8; 32])]) -> Self
Build a JWKS from a slice of (kid, 32-byte Ed25519 public key) tuples. Keys land in the order supplied — callers control which keys appear (typically: filter Revoked at the call site, supply Active + Retiring to the builder).
Sourcepub fn find_ed25519(&self, kid: &str) -> Option<[u8; 32]>
pub fn find_ed25519(&self, kid: &str) -> Option<[u8; 32]>
Find the key with the matching kid that satisfies use=sig.
Returns the 32-byte Ed25519 public key bytes when present and
well-formed; None for missing kid or wrong key type. Used by
consumer-side verification flows to bind a token’s kid header
to a trusted public key.
Sourcepub fn into_key_set(self) -> Result<KeySet, JwksError>
pub fn into_key_set(self) -> Result<KeySet, JwksError>
Convert the JWKS into the engine’s KeySet. Every well-formed
kty=OKP / crv=Ed25519 entry becomes a (kid, DecodingKey)
binding; entries with any other shape are silently skipped (the
engine cannot verify them anyway, and a future JWKS may legitimately
carry mixed key types — RSA for legacy clients, EC for some federated
IdP). The skip-or-fail tradeoff favours skip: a single malformed
entry must not break key rotation for the well-formed siblings.
Returns Err(JwksError::DuplicateKid) only if two entries share a
kid — that is a control-plane bug (every kid is supposed to be
globally unique), and admitting both would create non-determinism
in KeySet::get.