MCPcopy Create free account
hub / github.com/arun11299/cpp-jwt / alg_to_str

Function alg_to_str

include/jwt/algorithm.hpp:225–244  ·  view source on GitHub ↗

* Convert the algorithm enum class type to * its stringified form. */

Source from the content-addressed store, hash-verified

223 * its stringified form.
224 */
225inline jwt::string_view alg_to_str(SCOPED_ENUM algorithm alg) noexcept
226{
227 switch (alg) {
228 case algorithm::HS256: return "HS256";
229 case algorithm::HS384: return "HS384";
230 case algorithm::HS512: return "HS512";
231 case algorithm::RS256: return "RS256";
232 case algorithm::RS384: return "RS384";
233 case algorithm::RS512: return "RS512";
234 case algorithm::ES256: return "ES256";
235 case algorithm::ES384: return "ES384";
236 case algorithm::ES512: return "ES512";
237 case algorithm::TERM: return "TERM";
238 case algorithm::NONE: return "NONE";
239 case algorithm::UNKN: return "UNKN";
240 default: assert (0 && "Unknown Algorithm");
241 };
242 return "UNKN";
243 JWT_NOT_REACHED("Code not reached");
244}
245
246/**
247 * Convert stringified algorithm to enum class.

Callers 2

jwt_headerMethod · 0.85
algoMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected