Crate jsonwebtoken

source ·
Expand description

Create and parses JWT (JSON Web Tokens)

Documentation: stable

Modules§

  • Lower level functions, if you want to do something other than JWTs
  • All the errors that can be encountered while encoding/decoding JWTs

Structs§

  • All the different kind of keys we can use to decode a JWT. This key can be re-used so make sure you only initialize it once if you can for better performance.
  • A key to encode a JWT with. Can be a secret, a PEM-encoded key or a DER-encoded key. This key can be re-used so make sure you only initialize it once if you can for better performance.
  • A basic JWT header, the alg defaults to HS256 and typ is automatically set to JWT. All the other fields are optional.
  • The return type of a successful call to decode.
  • Contains the various validations that are applied after decoding a JWT.

Enums§

  • The algorithms supported for signing/verifying JWTs

Functions§

  • Decode and validate a JWT
  • Decode a JWT without any signature verification/validations and return its Header.
  • Encode the header and claims given and sign the payload using the algorithm from the header and the key. If the algorithm given is RSA or EC, the key needs to be in the PEM format.
  • Gets the current timestamp in the format expected by JWTs.