Trait jwt_compact_preview::Algorithm[][src]

pub trait Algorithm {
    type SigningKey;
    type VerifyingKey;
    type Signature: AlgorithmSignature;
    fn name(&self) -> Cow<'static, str>;
fn sign(
        &self,
        signing_key: &Self::SigningKey,
        message: &[u8]
    ) -> Self::Signature;
fn verify_signature(
        &self,
        signature: &Self::Signature,
        verifying_key: &Self::VerifyingKey,
        message: &[u8]
    ) -> bool; }

JWT signing algorithm.

Associated Types

type SigningKey[src]

Key used when issuing new tokens.

type VerifyingKey[src]

Key used when verifying tokens. May coincide with SigningKey for symmetric algorithms (e.g., HS*).

type Signature: AlgorithmSignature[src]

Signature produced by the algorithm.

Loading content...

Required methods

fn name(&self) -> Cow<'static, str>[src]

Returns the name of this algorithm, as mentioned in the alg field of the JWT header.

fn sign(
    &self,
    signing_key: &Self::SigningKey,
    message: &[u8]
) -> Self::Signature
[src]

Signs a message with the signing_key.

fn verify_signature(
    &self,
    signature: &Self::Signature,
    verifying_key: &Self::VerifyingKey,
    message: &[u8]
) -> bool
[src]

Verifies the message against the signature and verifying_key.

Loading content...

Implementors

impl Algorithm for Ed25519[src]

type SigningKey = Ed25519SigningKey

type VerifyingKey = Ed25519VerifyingKey

type Signature = Signature

impl Algorithm for Hs256[src]

type SigningKey = Hs256Key

type VerifyingKey = Hs256Key

type Signature = Output<Hmac<Sha256>>

impl Algorithm for Hs384[src]

type SigningKey = Hs384Key

type VerifyingKey = Hs384Key

type Signature = Output<Hmac<Sha384>>

impl Algorithm for Hs512[src]

type SigningKey = Hs512Key

type VerifyingKey = Hs512Key

type Signature = Output<Hmac<Sha512>>

impl<A: Algorithm> Algorithm for Renamed<A>[src]

type SigningKey = A::SigningKey

type VerifyingKey = A::VerifyingKey

type Signature = A::Signature

impl<D> Algorithm for Es256k<D> where
    D: Digest<OutputSize = U32> + Default
[src]

type SigningKey = Es256kSigningKey

type VerifyingKey = Es256kVerifyingKey

type Signature = Signature

impl<T: RsaVariant> Algorithm for T[src]

type SigningKey = RsaSigningKey

type VerifyingKey = RsaVerifyingKey

type Signature = Signature

Loading content...