49 std::function<std::optional<std::string>(
const std::string& url)>;
104 [[nodiscard]] std::optional<jwk_key>
get_key(
105 std::string_view kid)
const;
113 std::string_view alg)
const;
124 [[nodiscard]]
const std::vector<jwk_key>&
keys()
const;
jwks_fetch_callback fetcher_
std::vector< jwk_key > keys_
bool is_cache_expired() const
Check if the cache has expired.
std::chrono::steady_clock::time_point last_fetch_
bool load_from_json(std::string_view jwks_json)
Load keys from a JWKS JSON string.
const std::vector< jwk_key > & keys() const
Get all currently loaded keys.
std::optional< jwk_key > get_key(std::string_view kid) const
Get a key by Key ID (kid)
std::uint32_t cache_ttl_seconds_
void set_jwks_url(const std::string &url)
Set the JWKS endpoint URL for fetching.
void set_fetcher(jwks_fetch_callback fetcher)
Set a callback for fetching JWKS from a URL.
bool refresh()
Force refresh keys from the configured JWKS URL.
void set_cache_ttl(std::uint32_t seconds)
Set cache TTL in seconds (default: 3600)
std::optional< jwk_key > get_key_by_alg(std::string_view alg) const
Get the first key matching the given algorithm.
std::function< std::optional< std::string >(const std::string &url)> jwks_fetch_callback
Callback type for fetching JWKS JSON from a URL.
Represents a single JSON Web Key converted to PEM format.
std::string use
Key use (sig)
std::string alg
Algorithm (RS256, ES256)
std::string pem
PEM-encoded public key.
std::string kty
Key type (RSA, EC)