Thalhammer / jwt-cpp

A header only library for creating and validating json web tokens in c++
https://thalhammer.github.io/jwt-cpp/
MIT License
855 stars 233 forks source link

a little change to make it more easy to use #304

Closed Derrity closed 1 year ago

Derrity commented 1 year ago

then we can use

auto decoded = jwt::decode(token)

and

bool verifile = jwt::verify()
Derrity commented 1 year ago
const bool verify(const decoded_jwt<json_traits>& jwt) const {
            try {
                std::error_code ec;
                verify(jwt, ec);
                error::throw_if_error(ec);
                return true;
            }catch(const std::exception&){
                return false;
            }
        }
prince-chrismc commented 1 year ago

A bool is not capable of transmitting all the various error states.

This would be a welcomed addition if you followed the existing std::error_code mechanism the library implemented