* Convert the algorithm enum class type to * its stringified form. */
| 223 | * its stringified form. |
| 224 | */ |
| 225 | inline 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. |
no outgoing calls
no test coverage detected