ark::crypt::JwtDecoderSet

Defined in header “ark/crypt/jwt.hh”.


This class allows you to handle validating and decoding JWT tokens from a set of public keys (such as from JWKS).

Methods

  • JwtDecoderSet()
    Constructor.

  • ~JwtDecoderSet()
    Destructor.

  • void add_public_key(const std::string & key_id, const std::string & public_key)
    Adds a new public key and KID to this validator. The KID (key id) is used to determine which public key to validate your token with.

    The public key is assumed to be PEM-encoded.

  • JwtClaims validate_jwt(const std::string & token)
    This simple API accepts an encoded JWT token, validates it (throwing if the token is invalid either structurally or from a signature), and then returns a parsed structure containing metadata within that token.