Struct jwt_signature

Struct Documentation

struct jwt_signature

Component class for representing JWT signature.

Provides APIs for: a) Encoding header and payload to JWS string parts. b) Verifying the signature by matching it with header and payload signature.

Public Functions

jwt_signature() = default

Default constructor.

inline jwt_signature(const jwt::string_view key)

Constructor which takes the key.

jwt_signature(const jwt_signature&) = default

Default copy and assignment operator.

jwt_signature &operator=(const jwt_signature&) = default
~jwt_signature() = default
inline std::string encode(const jwt_header &header, const jwt_payload &payload, std::error_code &ec)

Encodes the header and payload to get the three part JWS signature.

inline verify_result_t verify(const jwt_header &header, const jwt::string_view hdr_pld_sign, const jwt::string_view jwt_sign)

Verifies the JWS signature. Returns verify_result_t which is a pair of bool and error_code.