Skip to main content

fetch_jwks

Function fetch_jwks 

Source
pub async fn fetch_jwks(
    url: &str,
    options: &CardFetchOptions,
) -> Result<Jwks, ClientError>
Available on crate feature signing only.
Expand description

Fetches the JWK Set at url, within options’ time budget and with the headers set for it with CardFetchOptions::with_jwks_header.

The headers set for the card (with_header) are not sent: the key server is another trust domain, and an Authorization or a Cookie for the agent does not belong there. Until 2026-11-06 they were sent.

url must be https://, or http:// to a loopback host (localhost, 127.0.0.1, [::1]) for local development: a key set fetched in the clear can be swapped in transit, which would make every signature it “verifies” worthless. HTTPS needs the tls-rustls feature.

§Errors

Returns an error for a URL that is neither, a transport failure or timeout, a non-success status, a body over MAX_JWKS_BODY_SIZE, or a body that is not a JWK Set.