Expand description
Create and parses JWT (JSON Web Tokens)
Documentation: stable
Modules§
- crypto
 - Lower level functions, if you want to do something other than JWTs
The cryptography of the 
jsonwebtokencrate is decoupled behindJwtSignerandJwtVerifiertraits. These make use ofRustCrypto’sSignerandVerifiertraits respectively. - dangerous
 - Dangerous decoding functions that should be audited and used with extreme care.
 - errors
 - All the errors that can be encountered while encoding/decoding JWTs
 - jwk
 - This crate contains types only for working JWK and JWK Sets This is only meant to be used to deal with public JWK, not generate ones. Most of the code in this file is taken from https://github.com/lawliet89/biscuit but tweaked to remove the private bits as it’s not the goal for this crate currently.
 - jws
 - JSON Web Signatures data type.
 
Structs§
- Decoding
Key  - 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.
 - Encoding
Key  - 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.
 - Header
 - A basic JWT header, the alg defaults to HS256 and typ is automatically
set to 
JWT. All the other fields are optional. - Token
Data  - The return type of a successful call to decode.
 - Validation
 - Contains the various validations that are applied after decoding a JWT.
 
Enums§
- Algorithm
 - The algorithms supported for signing/verifying JWTs
 
Functions§
- decode
 - Decode and validate a JWT
 - decode_
header  - Decode a JWT without any signature verification/validations and return its Header.
 - encode
 - 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.
 - get_
current_ timestamp  - Gets the current timestamp in the format expected by JWTs.