Crate passport

Source
Expand description

passport-rs

A library for generating JWT passports following RFC-8225

Usage:

let passport_builder =
    passport::PassportBuilder::new(String::from("https://cert.example.org/passport.cer"), passport::Identity::URI(String::from("https://matrix.to/#/@alice:example.org")))
        .add_destination(passport::Identity::URI(String::from("https://matrix.to/#/@bob:example.org")))
        .set_expires_in(Some(512));

let jwt = passport_builder.encode(
    &passport::EncodingKey::from_secret(b"test_secret"),
    passport::Algorithm::HS512,
).unwrap();

Modules§

config
Structs for representing and parsing JWT data from configuration files

Structs§

EncodingKey
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.
MediaKey
Represents the Media Key claim
PassportBuilder
Factory for building passports
PassportClaims
Extended JWT Claims for passports

Enums§

Algorithm
The algorithms supported for signing/verifying JWTs
Error
Wrapper for both JWT and Serde errors
Identity
Represents and holds the different forms of identification
IdentityForms
Ways of repsenting identities

Functions§

make_decoding_key
Given the key and an algorithm it will return a DecodingKey
make_encoding_key
Given the key and an algorithm it will return an EncodingKey