Files
blackwriter-server/doc/jsonwebtoken.md
PIVODEVAT 059fbda921 init
2025-12-13 22:28:05 +03:00

60 KiB
Raw Blame History

Crate Documentation

Version: 10.2.0

Format Version: 56

Module jsonwebtoken

Create and parses JWT (JSON Web Tokens)

Documentation: stable

Modules

Module dangerous

Dangerous decoding functions that should be audited and used with extreme care.

pub mod dangerous { /* ... */ }

Re-exports

Re-export insecure_decode

pub use super::decoding::insecure_decode;

Module crypto

Lower level functions, if you want to do something other than JWTs The cryptography of the jsonwebtoken crate is decoupled behind JwtSigner and JwtVerifier traits. These make use of RustCrypto's Signer and Verifier traits respectively.

pub mod crypto { /* ... */ }

Traits

Trait JwtSigner

Trait providing the functionality to sign a JWT.

Allows an arbitrary crypto backend to be provided.

pub trait JwtSigner: Signer<Vec<u8>> {
    /* Associated items */
}
Required Items
Required Methods
  • algorithm: Return the [Algorithm] corresponding to the signing module.

Trait JwtVerifier

Trait providing the functionality to verify a JWT.

Allows an arbitrary crypto backend to be provided.

pub trait JwtVerifier: Verifier<Vec<u8>> {
    /* Associated items */
}
Required Items
Required Methods
  • algorithm: Return the [Algorithm] corresponding to the signing module.

Functions

Function sign

Take the payload of a JWT, sign it using the algorithm given and return the base64 url safe encoded of the result.

If you just want to encode a JWT, use encode instead.

pub fn sign(message: &[u8], key: &crate::EncodingKey, algorithm: crate::algorithms::Algorithm) -> crate::errors::Result<String> { /* ... */ }

Function verify

Compares the signature given with a re-computed signature for HMAC or using the public key for RSA/EC.

If you just want to decode a JWT, use decode instead.

signature is the signature part of a jwt (text after the second '.')

message is base64(header) + "." + base64(claims)

pub fn verify(signature: &str, message: &[u8], key: &crate::DecodingKey, algorithm: crate::algorithms::Algorithm) -> crate::errors::Result<bool> { /* ... */ }

Module errors

All the errors that can be encountered while encoding/decoding JWTs

pub mod errors { /* ... */ }

Types

Type Alias Result

A type alias for Result<T, jsonwebtoken::errors::Error>.

pub type Result<T> = result::Result<T, Error>;

Struct Error

An error that can occur when encoding/decoding JWTs

pub struct Error(/* private field */);
Fields
Index Type Documentation
0 private Private field
Implementations
Methods
  • pub fn kind(self: &Self) -> &ErrorKind { /* ... */ }
    

    Return the specific type of this error.

  • pub fn into_kind(self: Self) -> ErrorKind { /* ... */ }
    

    Unwrap this error into its underlying type.

Trait Implementations
  • Any

    • fn type_id(self: &Self) -> TypeId { /* ... */ }
      
  • Borrow

    • fn borrow(self: &Self) -> &T { /* ... */ }
      
  • BorrowMut

    • fn borrow_mut(self: &mut Self) -> &mut T { /* ... */ }
      
  • Clone

    • fn clone(self: &Self) -> Error { /* ... */ }
      
  • CloneToUninit

    • unsafe fn clone_to_uninit(self: &Self, dest: *mut u8) { /* ... */ }
      
  • Debug

    • fn fmt(self: &Self, f: &mut $crate::fmt::Formatter<''_>) -> $crate::fmt::Result { /* ... */ }
      
  • Display

    • fn fmt(self: &Self, f: &mut fmt::Formatter<''_>) -> fmt::Result { /* ... */ }
      
  • Eq

  • Error

    • fn cause(self: &Self) -> Option<&dyn StdError> { /* ... */ }
      
  • Freeze

  • From

    • fn from(t: T) -> T { /* ... */ }
      

      Returns the argument unchanged.

    • fn from(err: base64::DecodeError) -> Error { /* ... */ }
      
    • fn from(err: serde_json::Error) -> Error { /* ... */ }
      
    • fn from(err: ::std::string::FromUtf8Error) -> Error { /* ... */ }
      
    • fn from(kind: ErrorKind) -> Error { /* ... */ }
      
  • Into

    • fn into(self: Self) -> U { /* ... */ }
      
      Calls U::from(self).
  • PartialEq

    • fn eq(self: &Self, other: &Error) -> bool { /* ... */ }
      
  • RefUnwindSafe

  • Same

  • Send

  • StructuralPartialEq

  • Sync

  • ToOwned

    • fn to_owned(self: &Self) -> T { /* ... */ }
      
    • fn clone_into(self: &Self, target: &mut T) { /* ... */ }
      
  • ToString

    • fn to_string(self: &Self) -> String { /* ... */ }
      
  • TryFrom

    • fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error> { /* ... */ }
      
  • TryInto

    • fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error> { /* ... */ }
      
  • Unpin

  • UnwindSafe

  • VZip

    • fn vzip(self: Self) -> V { /* ... */ }
      

Enum ErrorKind

Attributes:

  • NonExhaustive

The specific type of an error.

This enum may grow additional variants, the #[non_exhaustive] attribute makes sure clients don't count on exhaustive matching. (Otherwise, adding a new variant could break existing code.)

pub enum ErrorKind {
    InvalidToken,
    InvalidSignature,
    InvalidEcdsaKey,
    InvalidEddsaKey,
    InvalidRsaKey(String),
    RsaFailedSigning,
    InvalidAlgorithmName,
    InvalidKeyFormat,
    MissingRequiredClaim(String),
    ExpiredSignature,
    InvalidIssuer,
    InvalidAudience,
    InvalidSubject,
    ImmatureSignature,
    InvalidAlgorithm,
    MissingAlgorithm,
    Base64(base64::DecodeError),
    Json(std::sync::Arc<serde_json::Error>),
    Utf8(::std::string::FromUtf8Error),
}
Variants
InvalidToken

When a token doesn't have a valid JWT shape

InvalidSignature

When the signature doesn't match

InvalidEcdsaKey

When the secret given is not a valid ECDSA key

InvalidEddsaKey

When the secret given is not a valid EdDSA key

InvalidRsaKey

When the secret given is not a valid RSA key

Fields:

Index Type Documentation
0 String
RsaFailedSigning

We could not sign with the given key

InvalidAlgorithmName

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

InvalidKeyFormat

When a key is provided with an invalid format

MissingRequiredClaim

When a claim required by the validation is not present

Fields:

Index Type Documentation
0 String
ExpiredSignature

When a tokens exp claim indicates that it has expired

InvalidIssuer

When a tokens iss claim does not match the expected issuer

InvalidAudience

When a tokens aud claim does not match one of the expected audience values

InvalidSubject

When a tokens sub claim does not match one of the expected subject values

ImmatureSignature

When a tokens nbf claim represents a time in the future

InvalidAlgorithm

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

MissingAlgorithm

When the Validation struct does not contain at least 1 algorithm

Base64

An error happened when decoding some base64 text

Fields:

Index Type Documentation
0 base64::DecodeError
Json

An error happened while serializing/deserializing JSON

Fields:

Index Type Documentation
0 std::sync::Arc<serde_json::Error>
Utf8

Some of the text was invalid UTF-8

Fields:

Index Type Documentation
0 ::std::string::FromUtf8Error
Implementations
Trait Implementations
  • Any

    • fn type_id(self: &Self) -> TypeId { /* ... */ }
      
  • Borrow

    • fn borrow(self: &Self) -> &T { /* ... */ }
      
  • BorrowMut

    • fn borrow_mut(self: &mut Self) -> &mut T { /* ... */ }
      
  • Clone

    • fn clone(self: &Self) -> ErrorKind { /* ... */ }
      
  • CloneToUninit

    • unsafe fn clone_to_uninit(self: &Self, dest: *mut u8) { /* ... */ }
      
  • Debug

    • fn fmt(self: &Self, f: &mut $crate::fmt::Formatter<''_>) -> $crate::fmt::Result { /* ... */ }
      
  • Eq

  • Freeze

  • From

    • fn from(t: T) -> T { /* ... */ }
      

      Returns the argument unchanged.

    • fn from(kind: ErrorKind) -> Error { /* ... */ }
      
  • Into

    • fn into(self: Self) -> U { /* ... */ }
      
      Calls U::from(self).
  • PartialEq

    • fn eq(self: &Self, other: &Self) -> bool { /* ... */ }
      
  • RefUnwindSafe

  • Same

  • Send

  • Sync

  • ToOwned

    • fn to_owned(self: &Self) -> T { /* ... */ }
      
    • fn clone_into(self: &Self, target: &mut T) { /* ... */ }
      
  • TryFrom

    • fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error> { /* ... */ }
      
  • TryInto

    • fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error> { /* ... */ }
      
  • Unpin

  • UnwindSafe

  • VZip

    • fn vzip(self: Self) -> V { /* ... */ }
      

Module jwk

Attributes:

  • Other("#[allow(missing_docs)]")

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.

pub mod jwk { /* ... */ }

Types

Enum PublicKeyUse

The intended usage of the public KeyType. This enum is serialized untagged

pub enum PublicKeyUse {
    Signature,
    Encryption,
    Other(String),
}
Variants
Signature

Indicates a public key is meant for signature verification

Encryption

Indicates a public key is meant for encryption

Other

Other usage

Fields:

Index Type Documentation
0 String
Implementations
Trait Implementations
  • Any

    • fn type_id(self: &Self) -> TypeId { /* ... */ }
      
  • Borrow

    • fn borrow(self: &Self) -> &T { /* ... */ }
      
  • BorrowMut

    • fn borrow_mut(self: &mut Self) -> &mut T { /* ... */ }
      
  • Clone

    • fn clone(self: &Self) -> PublicKeyUse { /* ... */ }
      
  • CloneToUninit

    • unsafe fn clone_to_uninit(self: &Self, dest: *mut u8) { /* ... */ }
      
  • Debug

    • fn fmt(self: &Self, f: &mut $crate::fmt::Formatter<''_>) -> $crate::fmt::Result { /* ... */ }
      
  • Deserialize

    • fn deserialize<D>(deserializer: D) -> Result<Self, <D as >::Error>
      

where D: Deserializer<''de> { /* ... */ } ```

  • DeserializeOwned

  • Eq

  • Freeze

  • From

    • fn from(t: T) -> T { /* ... */ }
      
      Returns the argument unchanged.
  • Hash

    • fn hash<__H: $crate::hash::Hasher>(self: &Self, state: &mut __H) { /* ... */ }
      
  • Into

    • fn into(self: Self) -> U { /* ... */ }
      
      Calls U::from(self).
  • PartialEq

    • fn eq(self: &Self, other: &PublicKeyUse) -> bool { /* ... */ }
      
  • RefUnwindSafe

  • Same

  • Send

  • Serialize

    • fn serialize<S>(self: &Self, serializer: S) -> Result<<S as >::Ok, <S as >::Error>
      

where S: Serializer { /* ... */ } ```

  • StructuralPartialEq

  • Sync

  • ToOwned

    • fn to_owned(self: &Self) -> T { /* ... */ }
      
    • fn clone_into(self: &Self, target: &mut T) { /* ... */ }
      
  • TryFrom

    • fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error> { /* ... */ }
      
  • TryInto

    • fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error> { /* ... */ }
      
  • Unpin

  • UnwindSafe

  • VZip

    • fn vzip(self: Self) -> V { /* ... */ }
      

Enum KeyOperations

Operations that the key is intended to be used for. This enum is serialized untagged

pub enum KeyOperations {
    Sign,
    Verify,
    Encrypt,
    Decrypt,
    WrapKey,
    UnwrapKey,
    DeriveKey,
    DeriveBits,
    Other(String),
}
Variants
Sign

Computer digital signature or MAC

Verify

Verify digital signature or MAC

Encrypt

Encrypt content

Decrypt

Decrypt content and validate decryption, if applicable

WrapKey

Encrypt key

UnwrapKey

Decrypt key and validate decryption, if applicable

DeriveKey

Derive key

DeriveBits

Derive bits not to be used as a key

Other

Other operation

Fields:

Index Type Documentation
0 String
Implementations
Trait Implementations
  • Any

    • fn type_id(self: &Self) -> TypeId { /* ... */ }
      
  • Borrow

    • fn borrow(self: &Self) -> &T { /* ... */ }
      
  • BorrowMut

    • fn borrow_mut(self: &mut Self) -> &mut T { /* ... */ }
      
  • Clone

    • fn clone(self: &Self) -> KeyOperations { /* ... */ }
      
  • CloneToUninit

    • unsafe fn clone_to_uninit(self: &Self, dest: *mut u8) { /* ... */ }
      
  • Debug

    • fn fmt(self: &Self, f: &mut $crate::fmt::Formatter<''_>) -> $crate::fmt::Result { /* ... */ }
      
  • Deserialize

    • fn deserialize<D>(deserializer: D) -> Result<Self, <D as >::Error>
      

where D: Deserializer<''de> { /* ... */ } ```

  • DeserializeOwned

  • Eq

  • Freeze

  • From

    • fn from(t: T) -> T { /* ... */ }
      
      Returns the argument unchanged.
  • Hash

    • fn hash<__H: $crate::hash::Hasher>(self: &Self, state: &mut __H) { /* ... */ }
      
  • Into

    • fn into(self: Self) -> U { /* ... */ }
      
      Calls U::from(self).
  • PartialEq

    • fn eq(self: &Self, other: &KeyOperations) -> bool { /* ... */ }
      
  • RefUnwindSafe

  • Same

  • Send

  • Serialize

    • fn serialize<S>(self: &Self, serializer: S) -> Result<<S as >::Ok, <S as >::Error>
      

where S: Serializer { /* ... */ } ```

  • StructuralPartialEq

  • Sync

  • ToOwned

    • fn to_owned(self: &Self) -> T { /* ... */ }
      
    • fn clone_into(self: &Self, target: &mut T) { /* ... */ }
      
  • TryFrom

    • fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error> { /* ... */ }
      
  • TryInto

    • fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error> { /* ... */ }
      
  • Unpin

  • UnwindSafe

  • VZip

    • fn vzip(self: Self) -> V { /* ... */ }
      

Enum KeyAlgorithm

Attributes:

  • Other("#[allow(non_camel_case_types, clippy::upper_case_acronyms)]")

The algorithms of the keys

pub enum KeyAlgorithm {
    HS256,
    HS384,
    HS512,
    ES256,
    ES384,
    RS256,
    RS384,
    RS512,
    PS256,
    PS384,
    PS512,
    EdDSA,
    RSA1_5,
    RSA_OAEP,
    RSA_OAEP_256,
    UNKNOWN_ALGORITHM,
}
Variants
HS256

HMAC using SHA-256

HS384

HMAC using SHA-384

HS512

HMAC using SHA-512

ES256

ECDSA using SHA-256

ES384

ECDSA using SHA-384

RS256

RSASSA-PKCS1-v1_5 using SHA-256

RS384

RSASSA-PKCS1-v1_5 using SHA-384

RS512

RSASSA-PKCS1-v1_5 using SHA-512

PS256

RSASSA-PSS using SHA-256

PS384

RSASSA-PSS using SHA-384

PS512

RSASSA-PSS using SHA-512

EdDSA

Edwards-curve Digital Signature Algorithm (EdDSA)

RSA1_5

RSAES-PKCS1-V1_5

RSA_OAEP

RSAES-OAEP using SHA-1

RSA_OAEP_256

RSAES-OAEP-256 using SHA-2

UNKNOWN_ALGORITHM

Catch-All for when the key algorithm can not be determined or is not supported

Implementations
Trait Implementations
  • Any

    • fn type_id(self: &Self) -> TypeId { /* ... */ }
      
  • Borrow

    • fn borrow(self: &Self) -> &T { /* ... */ }
      
  • BorrowMut

    • fn borrow_mut(self: &mut Self) -> &mut T { /* ... */ }
      
  • Clone

    • fn clone(self: &Self) -> KeyAlgorithm { /* ... */ }
      
  • CloneToUninit

    • unsafe fn clone_to_uninit(self: &Self, dest: *mut u8) { /* ... */ }
      
  • Copy

  • Debug

    • fn fmt(self: &Self, f: &mut $crate::fmt::Formatter<''_>) -> $crate::fmt::Result { /* ... */ }
      
  • Deserialize

    • fn deserialize<__D>(__deserializer: __D) -> _serde::__private228::Result<Self, <__D as >::Error>
      

where __D: _serde::Deserializer<''de> { /* ... */ } ```

  • DeserializeOwned

  • Display

    • fn fmt(self: &Self, f: &mut fmt::Formatter<''_>) -> fmt::Result { /* ... */ }
      
  • Eq

  • Freeze

  • From

    • fn from(t: T) -> T { /* ... */ }
      
      Returns the argument unchanged.
  • FromStr

    • fn from_str(s: &str) -> errors::Result<Self> { /* ... */ }
      
  • Hash

    • fn hash<__H: $crate::hash::Hasher>(self: &Self, state: &mut __H) { /* ... */ }
      
  • Into

    • fn into(self: Self) -> U { /* ... */ }
      
      Calls U::from(self).
  • PartialEq

    • fn eq(self: &Self, other: &KeyAlgorithm) -> bool { /* ... */ }
      
  • RefUnwindSafe

  • Same

  • Send

  • Serialize

    • fn serialize<__S>(self: &Self, __serializer: __S) -> _serde::__private228::Result<<__S as >::Ok, <__S as >::Error>
      

where __S: _serde::Serializer { /* ... */ } ```

  • StructuralPartialEq

  • Sync

  • ToOwned

    • fn to_owned(self: &Self) -> T { /* ... */ }
      
    • fn clone_into(self: &Self, target: &mut T) { /* ... */ }
      
  • ToString

    • fn to_string(self: &Self) -> String { /* ... */ }
      
  • TryFrom

    • fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error> { /* ... */ }
      
  • TryInto

    • fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error> { /* ... */ }
      
  • Unpin

  • UnwindSafe

  • VZip

    • fn vzip(self: Self) -> V { /* ... */ }
      

Struct CommonParameters

Common JWK parameters

pub struct CommonParameters {
    pub public_key_use: Option<PublicKeyUse>,
    pub key_operations: Option<Vec<KeyOperations>>,
    pub key_algorithm: Option<KeyAlgorithm>,
    pub key_id: Option<String>,
    pub x509_url: Option<String>,
    pub x509_chain: Option<Vec<String>>,
    pub x509_sha1_fingerprint: Option<String>,
    pub x509_sha256_fingerprint: Option<String>,
}
Fields
Name Type Documentation
public_key_use Option<PublicKeyUse> The intended use of the public key. Should not be specified with key_operations.
See sections 4.2 and 4.3 of RFC7517.
key_operations Option<Vec<KeyOperations>> The "key_ops" (key operations) parameter identifies the operation(s)
for which the key is intended to be used. The "key_ops" parameter is
intended for use cases in which public, private, or symmetric keys
may be present.
Should not be specified with public_key_use.
See sections 4.2 and 4.3 of RFC7517.
key_algorithm Option<KeyAlgorithm> The algorithm keys intended for use with the key.
key_id Option<String> The case sensitive Key ID for the key
x509_url Option<String> X.509 Public key certificate URL. This is currently not implemented (correctly).

Serialized to x5u.
x509_chain Option<Vec<String>> X.509 public key certificate chain. This is currently not implemented (correctly).

Serialized to x5c.
x509_sha1_fingerprint Option<String> X.509 Certificate SHA1 thumbprint. This is currently not implemented (correctly).

Serialized to x5t.
x509_sha256_fingerprint Option<String> X.509 Certificate SHA256 thumbprint. This is currently not implemented (correctly).

Serialized to x5t#S256.
Implementations
Trait Implementations
  • Any

    • fn type_id(self: &Self) -> TypeId { /* ... */ }
      
  • Borrow

    • fn borrow(self: &Self) -> &T { /* ... */ }
      
  • BorrowMut

    • fn borrow_mut(self: &mut Self) -> &mut T { /* ... */ }
      
  • Clone

    • fn clone(self: &Self) -> CommonParameters { /* ... */ }
      
  • CloneToUninit

    • unsafe fn clone_to_uninit(self: &Self, dest: *mut u8) { /* ... */ }
      
  • Debug

    • fn fmt(self: &Self, f: &mut $crate::fmt::Formatter<''_>) -> $crate::fmt::Result { /* ... */ }
      
  • Default

    • fn default() -> CommonParameters { /* ... */ }
      
  • Deserialize

    • fn deserialize<__D>(__deserializer: __D) -> _serde::__private228::Result<Self, <__D as >::Error>
      

where __D: _serde::Deserializer<''de> { /* ... */ } ```

  • DeserializeOwned

  • Eq

  • Freeze

  • From

    • fn from(t: T) -> T { /* ... */ }
      
      Returns the argument unchanged.
  • Hash

    • fn hash<__H: $crate::hash::Hasher>(self: &Self, state: &mut __H) { /* ... */ }
      
  • Into

    • fn into(self: Self) -> U { /* ... */ }
      
      Calls U::from(self).
  • PartialEq

    • fn eq(self: &Self, other: &CommonParameters) -> bool { /* ... */ }
      
  • RefUnwindSafe

  • Same

  • Send

  • Serialize

    • fn serialize<__S>(self: &Self, __serializer: __S) -> _serde::__private228::Result<<__S as >::Ok, <__S as >::Error>
      

where __S: _serde::Serializer { /* ... */ } ```

  • StructuralPartialEq

  • Sync

  • ToOwned

    • fn to_owned(self: &Self) -> T { /* ... */ }
      
    • fn clone_into(self: &Self, target: &mut T) { /* ... */ }
      
  • TryFrom

    • fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error> { /* ... */ }
      
  • TryInto

    • fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error> { /* ... */ }
      
  • Unpin

  • UnwindSafe

  • VZip

    • fn vzip(self: Self) -> V { /* ... */ }
      

Enum EllipticCurveKeyType

Key type value for an Elliptic Curve Key. This single value enum is a workaround for Rust not supporting associated constants.

pub enum EllipticCurveKeyType {
    EC,
}
Variants
EC

Key type value for an Elliptic Curve Key.

Implementations
Trait Implementations
  • Any

    • fn type_id(self: &Self) -> TypeId { /* ... */ }
      
  • Borrow

    • fn borrow(self: &Self) -> &T { /* ... */ }
      
  • BorrowMut

    • fn borrow_mut(self: &mut Self) -> &mut T { /* ... */ }
      
  • Clone

    • fn clone(self: &Self) -> EllipticCurveKeyType { /* ... */ }
      
  • CloneToUninit

    • unsafe fn clone_to_uninit(self: &Self, dest: *mut u8) { /* ... */ }
      
  • Copy

  • Debug

    • fn fmt(self: &Self, f: &mut $crate::fmt::Formatter<''_>) -> $crate::fmt::Result { /* ... */ }
      
  • Default

    • fn default() -> EllipticCurveKeyType { /* ... */ }
      
  • Deserialize

    • fn deserialize<__D>(__deserializer: __D) -> _serde::__private228::Result<Self, <__D as >::Error>
      

where __D: _serde::Deserializer<''de> { /* ... */ } ```

  • DeserializeOwned

  • Eq

  • Freeze

  • From

    • fn from(t: T) -> T { /* ... */ }
      
      Returns the argument unchanged.
  • Hash

    • fn hash<__H: $crate::hash::Hasher>(self: &Self, state: &mut __H) { /* ... */ }
      
  • Into

    • fn into(self: Self) -> U { /* ... */ }
      
      Calls U::from(self).
  • PartialEq

    • fn eq(self: &Self, other: &EllipticCurveKeyType) -> bool { /* ... */ }
      
  • RefUnwindSafe

  • Same

  • Send

  • Serialize

    • fn serialize<__S>(self: &Self, __serializer: __S) -> _serde::__private228::Result<<__S as >::Ok, <__S as >::Error>
      

where __S: _serde::Serializer { /* ... */ } ```

  • StructuralPartialEq

  • Sync

  • ToOwned

    • fn to_owned(self: &Self) -> T { /* ... */ }
      
    • fn clone_into(self: &Self, target: &mut T) { /* ... */ }
      
  • TryFrom

    • fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error> { /* ... */ }
      
  • TryInto

    • fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error> { /* ... */ }
      
  • Unpin

  • UnwindSafe

  • VZip

    • fn vzip(self: Self) -> V { /* ... */ }
      

Enum EllipticCurve

Type of cryptographic curve used by a key. This is defined in RFC 7518 #7.6

pub enum EllipticCurve {
    P256,
    P384,
    P521,
    Ed25519,
}
Variants
P256

P-256 curve

P384

P-384 curve

P521

P-521 curve -- unsupported by ring.

Ed25519

Ed25519 curve

Implementations
Trait Implementations
  • Any

    • fn type_id(self: &Self) -> TypeId { /* ... */ }
      
  • Borrow

    • fn borrow(self: &Self) -> &T { /* ... */ }
      
  • BorrowMut

    • fn borrow_mut(self: &mut Self) -> &mut T { /* ... */ }
      
  • Clone

    • fn clone(self: &Self) -> EllipticCurve { /* ... */ }
      
  • CloneToUninit

    • unsafe fn clone_to_uninit(self: &Self, dest: *mut u8) { /* ... */ }
      
  • Debug

    • fn fmt(self: &Self, f: &mut $crate::fmt::Formatter<''_>) -> $crate::fmt::Result { /* ... */ }
      
  • Default

    • fn default() -> EllipticCurve { /* ... */ }
      
  • Deserialize

    • fn deserialize<__D>(__deserializer: __D) -> _serde::__private228::Result<Self, <__D as >::Error>
      

where __D: _serde::Deserializer<''de> { /* ... */ } ```

  • DeserializeOwned

  • Eq

  • Freeze

  • From

    • fn from(t: T) -> T { /* ... */ }
      
      Returns the argument unchanged.
  • Hash

    • fn hash<__H: $crate::hash::Hasher>(self: &Self, state: &mut __H) { /* ... */ }
      
  • Into

    • fn into(self: Self) -> U { /* ... */ }
      
      Calls U::from(self).
  • PartialEq

    • fn eq(self: &Self, other: &EllipticCurve) -> bool { /* ... */ }
      
  • RefUnwindSafe

  • Same

  • Send

  • Serialize

    • fn serialize<__S>(self: &Self, __serializer: __S) -> _serde::__private228::Result<<__S as >::Ok, <__S as >::Error>
      

where __S: _serde::Serializer { /* ... */ } ```

  • StructuralPartialEq

  • Sync

  • ToOwned

    • fn to_owned(self: &Self) -> T { /* ... */ }
      
    • fn clone_into(self: &Self, target: &mut T) { /* ... */ }
      
  • TryFrom

    • fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error> { /* ... */ }
      
  • TryInto

    • fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error> { /* ... */ }
      
  • Unpin

  • UnwindSafe

  • VZip

    • fn vzip(self: Self) -> V { /* ... */ }
      

Struct EllipticCurveKeyParameters

Parameters for an Elliptic Curve Key

pub struct EllipticCurveKeyParameters {
    pub key_type: EllipticCurveKeyType,
    pub curve: EllipticCurve,
    pub x: String,
    pub y: String,
}
Fields
Name Type Documentation
key_type EllipticCurveKeyType Key type value for an Elliptic Curve Key.
curve EllipticCurve The "crv" (curve) parameter identifies the cryptographic curve used
with the key.
x String The "x" (x coordinate) parameter contains the x coordinate for the
Elliptic Curve point.
y String The "y" (y coordinate) parameter contains the y coordinate for the
Elliptic Curve point.
Implementations
Trait Implementations
  • Any

    • fn type_id(self: &Self) -> TypeId { /* ... */ }
      
  • Borrow

    • fn borrow(self: &Self) -> &T { /* ... */ }
      
  • BorrowMut

    • fn borrow_mut(self: &mut Self) -> &mut T { /* ... */ }
      
  • Clone

    • fn clone(self: &Self) -> EllipticCurveKeyParameters { /* ... */ }
      
  • CloneToUninit

    • unsafe fn clone_to_uninit(self: &Self, dest: *mut u8) { /* ... */ }
      
  • Debug

    • fn fmt(self: &Self, f: &mut $crate::fmt::Formatter<''_>) -> $crate::fmt::Result { /* ... */ }
      
  • Default

    • fn default() -> EllipticCurveKeyParameters { /* ... */ }
      
  • Deserialize

    • fn deserialize<__D>(__deserializer: __D) -> _serde::__private228::Result<Self, <__D as >::Error>
      

where __D: _serde::Deserializer<''de> { /* ... */ } ```

  • DeserializeOwned

  • Eq

  • Freeze

  • From

    • fn from(t: T) -> T { /* ... */ }
      
      Returns the argument unchanged.
  • Hash

    • fn hash<__H: $crate::hash::Hasher>(self: &Self, state: &mut __H) { /* ... */ }
      
  • Into

    • fn into(self: Self) -> U { /* ... */ }
      
      Calls U::from(self).
  • PartialEq

    • fn eq(self: &Self, other: &EllipticCurveKeyParameters) -> bool { /* ... */ }
      
  • RefUnwindSafe

  • Same

  • Send

  • Serialize

    • fn serialize<__S>(self: &Self, __serializer: __S) -> _serde::__private228::Result<<__S as >::Ok, <__S as >::Error>
      

where __S: _serde::Serializer { /* ... */ } ```

  • StructuralPartialEq

  • Sync

  • ToOwned

    • fn to_owned(self: &Self) -> T { /* ... */ }
      
    • fn clone_into(self: &Self, target: &mut T) { /* ... */ }
      
  • TryFrom

    • fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error> { /* ... */ }
      
  • TryInto

    • fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error> { /* ... */ }
      
  • Unpin

  • UnwindSafe

  • VZip

    • fn vzip(self: Self) -> V { /* ... */ }
      

Enum RSAKeyType

Key type value for an RSA Key. This single value enum is a workaround for Rust not supporting associated constants.

pub enum RSAKeyType {
    RSA,
}
Variants
RSA

Key type value for an RSA Key.

Implementations
Trait Implementations
  • Any

    • fn type_id(self: &Self) -> TypeId { /* ... */ }
      
  • Borrow

    • fn borrow(self: &Self) -> &T { /* ... */ }
      
  • BorrowMut

    • fn borrow_mut(self: &mut Self) -> &mut T { /* ... */ }
      
  • Clone

    • fn clone(self: &Self) -> RSAKeyType { /* ... */ }
      
  • CloneToUninit

    • unsafe fn clone_to_uninit(self: &Self, dest: *mut u8) { /* ... */ }
      
  • Copy

  • Debug

    • fn fmt(self: &Self, f: &mut $crate::fmt::Formatter<''_>) -> $crate::fmt::Result { /* ... */ }
      
  • Default

    • fn default() -> RSAKeyType { /* ... */ }
      
  • Deserialize

    • fn deserialize<__D>(__deserializer: __D) -> _serde::__private228::Result<Self, <__D as >::Error>
      

where __D: _serde::Deserializer<''de> { /* ... */ } ```

  • DeserializeOwned

  • Eq

  • Freeze

  • From

    • fn from(t: T) -> T { /* ... */ }
      
      Returns the argument unchanged.
  • Hash

    • fn hash<__H: $crate::hash::Hasher>(self: &Self, state: &mut __H) { /* ... */ }
      
  • Into

    • fn into(self: Self) -> U { /* ... */ }
      
      Calls U::from(self).
  • PartialEq

    • fn eq(self: &Self, other: &RSAKeyType) -> bool { /* ... */ }
      
  • RefUnwindSafe

  • Same

  • Send

  • Serialize

    • fn serialize<__S>(self: &Self, __serializer: __S) -> _serde::__private228::Result<<__S as >::Ok, <__S as >::Error>
      

where __S: _serde::Serializer { /* ... */ } ```

  • StructuralPartialEq

  • Sync

  • ToOwned

    • fn to_owned(self: &Self) -> T { /* ... */ }
      
    • fn clone_into(self: &Self, target: &mut T) { /* ... */ }
      
  • TryFrom

    • fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error> { /* ... */ }
      
  • TryInto

    • fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error> { /* ... */ }
      
  • Unpin

  • UnwindSafe

  • VZip

    • fn vzip(self: Self) -> V { /* ... */ }
      

Struct RSAKeyParameters

Parameters for a RSA Key

pub struct RSAKeyParameters {
    pub key_type: RSAKeyType,
    pub n: String,
    pub e: String,
}
Fields
Name Type Documentation
key_type RSAKeyType Key type value for a RSA Key
n String The "n" (modulus) parameter contains the modulus value for the RSA
public key.
e String The "e" (exponent) parameter contains the exponent value for the RSA
public key.
Implementations
Trait Implementations
  • Any

    • fn type_id(self: &Self) -> TypeId { /* ... */ }
      
  • Borrow

    • fn borrow(self: &Self) -> &T { /* ... */ }
      
  • BorrowMut

    • fn borrow_mut(self: &mut Self) -> &mut T { /* ... */ }
      
  • Clone

    • fn clone(self: &Self) -> RSAKeyParameters { /* ... */ }
      
  • CloneToUninit

    • unsafe fn clone_to_uninit(self: &Self, dest: *mut u8) { /* ... */ }
      
  • Debug

    • fn fmt(self: &Self, f: &mut $crate::fmt::Formatter<''_>) -> $crate::fmt::Result { /* ... */ }
      
  • Default

    • fn default() -> RSAKeyParameters { /* ... */ }
      
  • Deserialize

    • fn deserialize<__D>(__deserializer: __D) -> _serde::__private228::Result<Self, <__D as >::Error>
      

where __D: _serde::Deserializer<''de> { /* ... */ } ```

  • DeserializeOwned

  • Eq

  • Freeze

  • From

    • fn from(t: T) -> T { /* ... */ }
      
      Returns the argument unchanged.
  • Hash

    • fn hash<__H: $crate::hash::Hasher>(self: &Self, state: &mut __H) { /* ... */ }
      
  • Into

    • fn into(self: Self) -> U { /* ... */ }
      
      Calls U::from(self).
  • PartialEq

    • fn eq(self: &Self, other: &RSAKeyParameters) -> bool { /* ... */ }
      
  • RefUnwindSafe

  • Same

  • Send

  • Serialize

    • fn serialize<__S>(self: &Self, __serializer: __S) -> _serde::__private228::Result<<__S as >::Ok, <__S as >::Error>
      

where __S: _serde::Serializer { /* ... */ } ```

  • StructuralPartialEq

  • Sync

  • ToOwned

    • fn to_owned(self: &Self) -> T { /* ... */ }
      
    • fn clone_into(self: &Self, target: &mut T) { /* ... */ }
      
  • TryFrom

    • fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error> { /* ... */ }
      
  • TryInto

    • fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error> { /* ... */ }
      
  • Unpin

  • UnwindSafe

  • VZip

    • fn vzip(self: Self) -> V { /* ... */ }
      

Enum OctetKeyType

Key type value for an Octet symmetric key. This single value enum is a workaround for Rust not supporting associated constants.

pub enum OctetKeyType {
    Octet,
}
Variants
Octet

Key type value for an Octet symmetric key.

Implementations
Trait Implementations
  • Any

    • fn type_id(self: &Self) -> TypeId { /* ... */ }
      
  • Borrow

    • fn borrow(self: &Self) -> &T { /* ... */ }
      
  • BorrowMut

    • fn borrow_mut(self: &mut Self) -> &mut T { /* ... */ }
      
  • Clone

    • fn clone(self: &Self) -> OctetKeyType { /* ... */ }
      
  • CloneToUninit

    • unsafe fn clone_to_uninit(self: &Self, dest: *mut u8) { /* ... */ }
      
  • Copy

  • Debug

    • fn fmt(self: &Self, f: &mut $crate::fmt::Formatter<''_>) -> $crate::fmt::Result { /* ... */ }
      
  • Default

    • fn default() -> OctetKeyType { /* ... */ }
      
  • Deserialize

    • fn deserialize<__D>(__deserializer: __D) -> _serde::__private228::Result<Self, <__D as >::Error>
      

where __D: _serde::Deserializer<''de> { /* ... */ } ```

  • DeserializeOwned

  • Eq

  • Freeze

  • From

    • fn from(t: T) -> T { /* ... */ }
      
      Returns the argument unchanged.
  • Hash

    • fn hash<__H: $crate::hash::Hasher>(self: &Self, state: &mut __H) { /* ... */ }
      
  • Into

    • fn into(self: Self) -> U { /* ... */ }
      
      Calls U::from(self).
  • PartialEq

    • fn eq(self: &Self, other: &OctetKeyType) -> bool { /* ... */ }
      
  • RefUnwindSafe

  • Same

  • Send

  • Serialize

    • fn serialize<__S>(self: &Self, __serializer: __S) -> _serde::__private228::Result<<__S as >::Ok, <__S as >::Error>
      

where __S: _serde::Serializer { /* ... */ } ```

  • StructuralPartialEq

  • Sync

  • ToOwned

    • fn to_owned(self: &Self) -> T { /* ... */ }
      
    • fn clone_into(self: &Self, target: &mut T) { /* ... */ }
      
  • TryFrom

    • fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error> { /* ... */ }
      
  • TryInto

    • fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error> { /* ... */ }
      
  • Unpin

  • UnwindSafe

  • VZip

    • fn vzip(self: Self) -> V { /* ... */ }
      

Struct OctetKeyParameters

Parameters for an Octet Key

pub struct OctetKeyParameters {
    pub key_type: OctetKeyType,
    pub value: String,
}
Fields
Name Type Documentation
key_type OctetKeyType Key type value for an Octet Key
value String The octet key value
Implementations
Trait Implementations
  • Any

    • fn type_id(self: &Self) -> TypeId { /* ... */ }
      
  • Borrow

    • fn borrow(self: &Self) -> &T { /* ... */ }
      
  • BorrowMut

    • fn borrow_mut(self: &mut Self) -> &mut T { /* ... */ }
      
  • Clone

    • fn clone(self: &Self) -> OctetKeyParameters { /* ... */ }
      
  • CloneToUninit

    • unsafe fn clone_to_uninit(self: &Self, dest: *mut u8) { /* ... */ }
      
  • Debug

    • fn fmt(self: &Self, f: &mut $crate::fmt::Formatter<''_>) -> $crate::fmt::Result { /* ... */ }
      
  • Default

    • fn default() -> OctetKeyParameters { /* ... */ }
      
  • Deserialize

    • fn deserialize<__D>(__deserializer: __D) -> _serde::__private228::Result<Self, <__D as >::Error>
      

where __D: _serde::Deserializer<''de> { /* ... */ } ```

  • DeserializeOwned

  • Eq

  • Freeze

  • From

    • fn from(t: T) -> T { /* ... */ }
      
      Returns the argument unchanged.
  • Hash

    • fn hash<__H: $crate::hash::Hasher>(self: &Self, state: &mut __H) { /* ... */ }
      
  • Into

    • fn into(self: Self) -> U { /* ... */ }
      
      Calls U::from(self).
  • PartialEq

    • fn eq(self: &Self, other: &OctetKeyParameters) -> bool { /* ... */ }
      
  • RefUnwindSafe

  • Same

  • Send

  • Serialize

    • fn serialize<__S>(self: &Self, __serializer: __S) -> _serde::__private228::Result<<__S as >::Ok, <__S as >::Error>
      

where __S: _serde::Serializer { /* ... */ } ```

  • StructuralPartialEq

  • Sync

  • ToOwned

    • fn to_owned(self: &Self) -> T { /* ... */ }
      
    • fn clone_into(self: &Self, target: &mut T) { /* ... */ }
      
  • TryFrom

    • fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error> { /* ... */ }
      
  • TryInto

    • fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error> { /* ... */ }
      
  • Unpin

  • UnwindSafe

  • VZip

    • fn vzip(self: Self) -> V { /* ... */ }
      

Enum OctetKeyPairType

Key type value for an Octet Key Pair. This single value enum is a workaround for Rust not supporting associated constants.

pub enum OctetKeyPairType {
    OctetKeyPair,
}
Variants
OctetKeyPair

Key type value for an Octet Key Pair.

Implementations
Trait Implementations
  • Any

    • fn type_id(self: &Self) -> TypeId { /* ... */ }
      
  • Borrow

    • fn borrow(self: &Self) -> &T { /* ... */ }
      
  • BorrowMut

    • fn borrow_mut(self: &mut Self) -> &mut T { /* ... */ }
      
  • Clone

    • fn clone(self: &Self) -> OctetKeyPairType { /* ... */ }
      
  • CloneToUninit

    • unsafe fn clone_to_uninit(self: &Self, dest: *mut u8) { /* ... */ }
      
  • Copy

  • Debug

    • fn fmt(self: &Self, f: &mut $crate::fmt::Formatter<''_>) -> $crate::fmt::Result { /* ... */ }
      
  • Default

    • fn default() -> OctetKeyPairType { /* ... */ }
      
  • Deserialize

    • fn deserialize<__D>(__deserializer: __D) -> _serde::__private228::Result<Self, <__D as >::Error>
      

where __D: _serde::Deserializer<''de> { /* ... */ } ```

  • DeserializeOwned

  • Eq

  • Freeze

  • From

    • fn from(t: T) -> T { /* ... */ }
      
      Returns the argument unchanged.
  • Hash

    • fn hash<__H: $crate::hash::Hasher>(self: &Self, state: &mut __H) { /* ... */ }
      
  • Into

    • fn into(self: Self) -> U { /* ... */ }
      
      Calls U::from(self).
  • PartialEq

    • fn eq(self: &Self, other: &OctetKeyPairType) -> bool { /* ... */ }
      
  • RefUnwindSafe

  • Same

  • Send

  • Serialize

    • fn serialize<__S>(self: &Self, __serializer: __S) -> _serde::__private228::Result<<__S as >::Ok, <__S as >::Error>
      

where __S: _serde::Serializer { /* ... */ } ```

  • StructuralPartialEq

  • Sync

  • ToOwned

    • fn to_owned(self: &Self) -> T { /* ... */ }
      
    • fn clone_into(self: &Self, target: &mut T) { /* ... */ }
      
  • TryFrom

    • fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error> { /* ... */ }
      
  • TryInto

    • fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error> { /* ... */ }
      
  • Unpin

  • UnwindSafe

  • VZip

    • fn vzip(self: Self) -> V { /* ... */ }
      

Struct OctetKeyPairParameters

Parameters for an Octet Key Pair

pub struct OctetKeyPairParameters {
    pub key_type: OctetKeyPairType,
    pub curve: EllipticCurve,
    pub x: String,
}
Fields
Name Type Documentation
key_type OctetKeyPairType Key type value for an Octet Key Pair
curve EllipticCurve The "crv" (curve) parameter identifies the cryptographic curve used
with the key.
x String The "x" parameter contains the base64 encoded public key
Implementations
Trait Implementations
  • Any

    • fn type_id(self: &Self) -> TypeId { /* ... */ }
      
  • Borrow

    • fn borrow(self: &Self) -> &T { /* ... */ }
      
  • BorrowMut

    • fn borrow_mut(self: &mut Self) -> &mut T { /* ... */ }
      
  • Clone

    • fn clone(self: &Self) -> OctetKeyPairParameters { /* ... */ }
      
  • CloneToUninit

    • unsafe fn clone_to_uninit(self: &Self, dest: *mut u8) { /* ... */ }
      
  • Debug

    • fn fmt(self: &Self, f: &mut $crate::fmt::Formatter<''_>) -> $crate::fmt::Result { /* ... */ }
      
  • Default

    • fn default() -> OctetKeyPairParameters { /* ... */ }
      
  • Deserialize

    • fn deserialize<__D>(__deserializer: __D) -> _serde::__private228::Result<Self, <__D as >::Error>
      

where __D: _serde::Deserializer<''de> { /* ... */ } ```

  • DeserializeOwned

  • Eq

  • Freeze

  • From

    • fn from(t: T) -> T { /* ... */ }
      
      Returns the argument unchanged.
  • Hash

    • fn hash<__H: $crate::hash::Hasher>(self: &Self, state: &mut __H) { /* ... */ }
      
  • Into

    • fn into(self: Self) -> U { /* ... */ }
      
      Calls U::from(self).
  • PartialEq

    • fn eq(self: &Self, other: &OctetKeyPairParameters) -> bool { /* ... */ }
      
  • RefUnwindSafe

  • Same

  • Send

  • Serialize

    • fn serialize<__S>(self: &Self, __serializer: __S) -> _serde::__private228::Result<<__S as >::Ok, <__S as >::Error>
      

where __S: _serde::Serializer { /* ... */ } ```

  • StructuralPartialEq

  • Sync

  • ToOwned

    • fn to_owned(self: &Self) -> T { /* ... */ }
      
    • fn clone_into(self: &Self, target: &mut T) { /* ... */ }
      
  • TryFrom

    • fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error> { /* ... */ }
      
  • TryInto

    • fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error> { /* ... */ }
      
  • Unpin

  • UnwindSafe

  • VZip

    • fn vzip(self: Self) -> V { /* ... */ }
      

Enum AlgorithmParameters

Attributes:

  • Other("#[serde(untagged)]")

Algorithm specific parameters

pub enum AlgorithmParameters {
    EllipticCurve(EllipticCurveKeyParameters),
    RSA(RSAKeyParameters),
    OctetKey(OctetKeyParameters),
    OctetKeyPair(OctetKeyPairParameters),
}
Variants
EllipticCurve

Fields:

Index Type Documentation
0 EllipticCurveKeyParameters
RSA

Fields:

Index Type Documentation
0 RSAKeyParameters
OctetKey

Fields:

Index Type Documentation
0 OctetKeyParameters
OctetKeyPair

Fields:

Index Type Documentation
0 OctetKeyPairParameters
Implementations
Trait Implementations
  • Any

    • fn type_id(self: &Self) -> TypeId { /* ... */ }
      
  • Borrow

    • fn borrow(self: &Self) -> &T { /* ... */ }
      
  • BorrowMut

    • fn borrow_mut(self: &mut Self) -> &mut T { /* ... */ }
      
  • Clone

    • fn clone(self: &Self) -> AlgorithmParameters { /* ... */ }
      
  • CloneToUninit

    • unsafe fn clone_to_uninit(self: &Self, dest: *mut u8) { /* ... */ }
      
  • Debug

    • fn fmt(self: &Self, f: &mut $crate::fmt::Formatter<''_>) -> $crate::fmt::Result { /* ... */ }
      
  • Deserialize

    • fn deserialize<__D>(__deserializer: __D) -> _serde::__private228::Result<Self, <__D as >::Error>
      

where __D: _serde::Deserializer<''de> { /* ... */ } ```

  • DeserializeOwned

  • Eq

  • Freeze

  • From

    • fn from(t: T) -> T { /* ... */ }
      
      Returns the argument unchanged.
  • Hash

    • fn hash<__H: $crate::hash::Hasher>(self: &Self, state: &mut __H) { /* ... */ }
      
  • Into

    • fn into(self: Self) -> U { /* ... */ }
      
      Calls U::from(self).
  • PartialEq

    • fn eq(self: &Self, other: &AlgorithmParameters) -> bool { /* ... */ }
      
  • RefUnwindSafe

  • Same

  • Send

  • Serialize

    • fn serialize<__S>(self: &Self, __serializer: __S) -> _serde::__private228::Result<<__S as >::Ok, <__S as >::Error>
      

where __S: _serde::Serializer { /* ... */ } ```

  • StructuralPartialEq

  • Sync

  • ToOwned

    • fn to_owned(self: &Self) -> T { /* ... */ }
      
    • fn clone_into(self: &Self, target: &mut T) { /* ... */ }
      
  • TryFrom

    • fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error> { /* ... */ }
      
  • TryInto

    • fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error> { /* ... */ }
      
  • Unpin

  • UnwindSafe

  • VZip

    • fn vzip(self: Self) -> V { /* ... */ }
      

Enum ThumbprintHash

The function to use to hash the intermediate thumbprint data.

pub enum ThumbprintHash {
    SHA256,
    SHA384,
    SHA512,
}
Variants
SHA256
SHA384
SHA512
Implementations
Trait Implementations
  • Any

    • fn type_id(self: &Self) -> TypeId { /* ... */ }
      
  • Borrow

    • fn borrow(self: &Self) -> &T { /* ... */ }
      
  • BorrowMut

    • fn borrow_mut(self: &mut Self) -> &mut T { /* ... */ }
      
  • Clone

    • fn clone(self: &Self) -> ThumbprintHash { /* ... */ }
      
  • CloneToUninit

    • unsafe fn clone_to_uninit(self: &Self, dest: *mut u8) { /* ... */ }
      
  • Debug

    • fn fmt(self: &Self, f: &mut $crate::fmt::Formatter<''_>) -> $crate::fmt::Result { /* ... */ }
      
  • Eq

  • Freeze

  • From

    • fn from(t: T) -> T { /* ... */ }
      
      Returns the argument unchanged.
  • Into

    • fn into(self: Self) -> U { /* ... */ }
      
      Calls U::from(self).
  • PartialEq

    • fn eq(self: &Self, other: &ThumbprintHash) -> bool { /* ... */ }
      
  • RefUnwindSafe

  • Same

  • Send

  • StructuralPartialEq

  • Sync

  • ToOwned

    • fn to_owned(self: &Self) -> T { /* ... */ }
      
    • fn clone_into(self: &Self, target: &mut T) { /* ... */ }
      
  • TryFrom

    • fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error> { /* ... */ }
      
  • TryInto

    • fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error> { /* ... */ }
      
  • Unpin

  • UnwindSafe

  • VZip

    • fn vzip(self: Self) -> V { /* ... */ }
      

Struct Jwk

pub struct Jwk {
    pub common: CommonParameters,
    pub algorithm: AlgorithmParameters,
}
Fields
Name Type Documentation
common CommonParameters
algorithm AlgorithmParameters Key algorithm specific parameters
Implementations
Methods
  • pub fn is_supported(self: &Self) -> bool { /* ... */ }
    

    Find whether the Algorithm is implemented and supported

  • pub fn from_encoding_key(key: &EncodingKey, alg: Algorithm) -> crate::errors::Result<Self> { /* ... */ }
    
  • pub fn thumbprint(self: &Self, hash_function: ThumbprintHash) -> String { /* ... */ }
    

    Compute the thumbprint of the JWK.

Trait Implementations
  • Any

    • fn type_id(self: &Self) -> TypeId { /* ... */ }
      
  • Borrow

    • fn borrow(self: &Self) -> &T { /* ... */ }
      
  • BorrowMut

    • fn borrow_mut(self: &mut Self) -> &mut T { /* ... */ }
      
  • Clone

    • fn clone(self: &Self) -> Jwk { /* ... */ }
      
  • CloneToUninit

    • unsafe fn clone_to_uninit(self: &Self, dest: *mut u8) { /* ... */ }
      
  • Debug

    • fn fmt(self: &Self, f: &mut $crate::fmt::Formatter<''_>) -> $crate::fmt::Result { /* ... */ }
      
  • Deserialize

    • fn deserialize<__D>(__deserializer: __D) -> _serde::__private228::Result<Self, <__D as >::Error>
      

where __D: _serde::Deserializer<''de> { /* ... */ } ```

  • DeserializeOwned

  • Eq

  • Freeze

  • From

    • fn from(t: T) -> T { /* ... */ }
      
      Returns the argument unchanged.
  • Hash

    • fn hash<__H: $crate::hash::Hasher>(self: &Self, state: &mut __H) { /* ... */ }
      
  • Into

    • fn into(self: Self) -> U { /* ... */ }
      
      Calls U::from(self).
  • PartialEq

    • fn eq(self: &Self, other: &Jwk) -> bool { /* ... */ }
      
  • RefUnwindSafe

  • Same

  • Send

  • Serialize

    • fn serialize<__S>(self: &Self, __serializer: __S) -> _serde::__private228::Result<<__S as >::Ok, <__S as >::Error>
      

where __S: _serde::Serializer { /* ... */ } ```

  • StructuralPartialEq

  • Sync

  • ToOwned

    • fn to_owned(self: &Self) -> T { /* ... */ }
      
    • fn clone_into(self: &Self, target: &mut T) { /* ... */ }
      
  • TryFrom

    • fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error> { /* ... */ }
      
    • fn try_from(jwk: &Jwk) -> Result<Self> { /* ... */ }
      
  • TryInto

    • fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error> { /* ... */ }
      
  • Unpin

  • UnwindSafe

  • VZip

    • fn vzip(self: Self) -> V { /* ... */ }
      

Struct JwkSet

A JWK set

pub struct JwkSet {
    pub keys: Vec<Jwk>,
}
Fields
Name Type Documentation
keys Vec<Jwk>
Implementations
Methods
  • pub fn find(self: &Self, kid: &str) -> Option<&Jwk> { /* ... */ }
    
    Find the key in the set that matches the given key id, if any.
Trait Implementations
  • Any

    • fn type_id(self: &Self) -> TypeId { /* ... */ }
      
  • Borrow

    • fn borrow(self: &Self) -> &T { /* ... */ }
      
  • BorrowMut

    • fn borrow_mut(self: &mut Self) -> &mut T { /* ... */ }
      
  • Clone

    • fn clone(self: &Self) -> JwkSet { /* ... */ }
      
  • CloneToUninit

    • unsafe fn clone_to_uninit(self: &Self, dest: *mut u8) { /* ... */ }
      
  • Debug

    • fn fmt(self: &Self, f: &mut $crate::fmt::Formatter<''_>) -> $crate::fmt::Result { /* ... */ }
      
  • Deserialize

    • fn deserialize<__D>(__deserializer: __D) -> _serde::__private228::Result<Self, <__D as >::Error>
      

where __D: _serde::Deserializer<''de> { /* ... */ } ```

  • DeserializeOwned

  • Eq

  • Freeze

  • From

    • fn from(t: T) -> T { /* ... */ }
      
      Returns the argument unchanged.
  • Hash

    • fn hash<__H: $crate::hash::Hasher>(self: &Self, state: &mut __H) { /* ... */ }
      
  • Into

    • fn into(self: Self) -> U { /* ... */ }
      
      Calls U::from(self).
  • PartialEq

    • fn eq(self: &Self, other: &JwkSet) -> bool { /* ... */ }
      
  • RefUnwindSafe

  • Same

  • Send

  • Serialize

    • fn serialize<__S>(self: &Self, __serializer: __S) -> _serde::__private228::Result<<__S as >::Ok, <__S as >::Error>
      

where __S: _serde::Serializer { /* ... */ } ```

  • StructuralPartialEq

  • Sync

  • ToOwned

    • fn to_owned(self: &Self) -> T { /* ... */ }
      
    • fn clone_into(self: &Self, target: &mut T) { /* ... */ }
      
  • TryFrom

    • fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error> { /* ... */ }
      
  • TryInto

    • fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error> { /* ... */ }
      
  • Unpin

  • UnwindSafe

  • VZip

    • fn vzip(self: Self) -> V { /* ... */ }
      

Module jws

JSON Web Signatures data type.

pub mod jws { /* ... */ }

Types

Struct Jws

This is a serde-compatible JSON Web Signature structure.

pub struct Jws<C> {
    pub protected: String,
    pub payload: String,
    pub signature: String,
    pub _pd: std::marker::PhantomData<C>,
}
Fields
Name Type Documentation
protected String The base64 encoded header data.

Defined in RFC7515#3.2.
payload String The base64 encoded claims data.

Defined in RFC7515#3.2.
signature String The signature on the other fields.

Defined in RFC7515#3.2.
_pd std::marker::PhantomData<C> Unused, for associating type metadata.
Implementations
Trait Implementations
  • Any

    • fn type_id(self: &Self) -> TypeId { /* ... */ }
      
  • Borrow

    • fn borrow(self: &Self) -> &T { /* ... */ }
      
  • BorrowMut

    • fn borrow_mut(self: &mut Self) -> &mut T { /* ... */ }
      
  • Clone

    • fn clone(self: &Self) -> Jws<C> { /* ... */ }
      
  • CloneToUninit

    • unsafe fn clone_to_uninit(self: &Self, dest: *mut u8) { /* ... */ }
      
  • Debug

    • fn fmt(self: &Self, f: &mut $crate::fmt::Formatter<''_>) -> $crate::fmt::Result { /* ... */ }
      
  • Deserialize

    • fn deserialize<__D>(__deserializer: __D) -> _serde::__private228::Result<Self, <__D as >::Error>
      

where __D: _serde::Deserializer<''de> { /* ... */ } ```

  • DeserializeOwned

  • Freeze

  • From

    • fn from(t: T) -> T { /* ... */ }
      
      Returns the argument unchanged.
  • Into

    • fn into(self: Self) -> U { /* ... */ }
      
      Calls U::from(self).
  • RefUnwindSafe

  • Same

  • Send

  • Serialize

    • fn serialize<__S>(self: &Self, __serializer: __S) -> _serde::__private228::Result<<__S as >::Ok, <__S as >::Error>
      

where __S: _serde::Serializer { /* ... */ } ```

  • Sync

  • ToOwned

    • fn to_owned(self: &Self) -> T { /* ... */ }
      
    • fn clone_into(self: &Self, target: &mut T) { /* ... */ }
      
  • TryFrom

    • fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error> { /* ... */ }
      
  • TryInto

    • fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error> { /* ... */ }
      
  • Unpin

  • UnwindSafe

  • VZip

    • fn vzip(self: Self) -> V { /* ... */ }
      

Functions

Function 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. This produces a JWS instead of a JWT -- usage is similar to encode, see that for more details.

pub fn encode<T: Serialize>(header: &crate::Header, claims: Option<&T>, key: &crate::EncodingKey) -> crate::errors::Result<Jws<T>> { /* ... */ }

Function decode

Validate a received JWS and decode into the header and claims.

pub fn decode<T: DeserializeOwned>(jws: &Jws<T>, key: &crate::DecodingKey, validation: &crate::Validation) -> crate::errors::Result<crate::TokenData<T>> { /* ... */ }

Re-exports

Re-export Algorithm

pub use algorithms::Algorithm;

Re-export DecodingKey

pub use decoding::DecodingKey;

Re-export TokenData

pub use decoding::TokenData;

Re-export decode

pub use decoding::decode;

Re-export decode_header

pub use decoding::decode_header;

Re-export EncodingKey

pub use encoding::EncodingKey;

Re-export encode

pub use encoding::encode;

Re-export Header

pub use header::Header;

Re-export Validation

pub use validation::Validation;

Re-export get_current_timestamp

pub use validation::get_current_timestamp;