Variant

validation-error

Validation error types.

variant validation-error {
  invalid-token,
  invalid-signature,
  invalid-ecdsa-key,
  invalid-rsa-key,
  rsa-failed-signing,
  invalid-algorithm-name,
  invalid-key-format,
  missing-required-claim,
  expired-signature,
  invalid-issuer,
  invalid-audience,
  invalid-subject,
  immature-signature,
  invalid-algorithm,
  missing-algorithm,
  base64,
  json,
  utf8,
  crypto,
  other(string),
}

Cases

CasePayloadDescription
invalid-token—

When a token doesn't have a valid JWT shape

invalid-signature—

When the signature doesn't match

invalid-ecdsa-key—

When the secret given is not a valid ECDSA key

invalid-rsa-key—

When the secret given is not a valid RSA key

rsa-failed-signing—

We could not sign with the given key

invalid-algorithm-name—

When the algorithm from string doesn't match the one passed to from_str

invalid-key-format—

When a key is provided with an invalid format

missing-required-claim—

Validation errors When a claim required by the validation is not present

expired-signature—

When a token’s exp claim indicates that it has expired

invalid-issuer—

When a token’s iss claim does not match the expected issuer

invalid-audience—

When a token’s aud claim does not match one of the expected audience values

invalid-subject—

When a token’s sub claim does not match one of the expected subject values

immature-signature—

When a token’s nbf claim represents a time in the future

invalid-algorithm—

When the algorithm in the header doesn't match the one passed to decode or the encoding/decoding key used doesn't match the alg requested

missing-algorithm—

When the Validation struct does not contain at least 1 algorithm

base64—

3rd party errors An error happened when decoding some base64 text

json—

An error happened while serializing/deserializing JSON

utf8—

Some of the text was invalid UTF-8

crypto—

Something unspecified went wrong with crypto

otherstring

Something unspecified went wrong