Skip to main content

Module jwt

Module jwt 

Source
Expand description

Implements limited JSON Web Token functionality for our purposes.

Created to reduce dependencies, and more immediately fix for this bug in rust’s ring crate was not yet stable at the time of writing: https://github.com/briansmith/ring/issues/1299

Modules§

expecting
Some common FnOnce(Some(T))->Result<(),jwt::Error>s for calling Claims::check and co.

Structs§

Claims
Represents a set of claims made by a JWT.
HS256
Key for SHA256 based HMAC
Header 🔒
Represents a JWT header.
HeaderType 🔒
Used to check that the typ field of the jwt header equals JWT (modulo case).
IgnoreSignature
A VerifyingKey that neglects to check the signature and alg header.
JWT
Wrapper around String to indicate it should be interpretted as a JWT.
NumericDate
Represents the value of the iat, exp, nbf claims.
NumericDateVisitor 🔒
Visitor for the implementation of Deserialize for NumericDate.
OutOfRange
A value falls outside the NumericDate invariant range (before the unix epoch, or after the last second of year 9999). Returned by fallible, non-clamping operations such as the TryFrom<SystemTime> conversion.
RS256Sk
RS256 private key
RS256Vk
RS256 public key

Enums§

Error

Constants§

MAX_TIMESTAMP_SECS 🔒
Invariant upper bound of NumericDate (see its docs): 9999-12-31T23:59:59Z.

Traits§

Key
What SigningKey and VerifyingKey have in common.
SigningKey
Represents a key that can be used to sign a JWT.
VerifyingKey
Represents a key that can be used to verify the signature on a JWT.

Functions§

get_current_timestamp
Gets the number of seconds since the Unix epoch, which is an appropriate value for the “iat” field.
sign
Signs claims using key yielding a JWT.