Trait MACLike

Source
pub trait MACLike {
Show 13 methods // Required methods fn jwt_alg_name() -> &'static str; fn key(&self) -> &HMACKey; fn key_id(&self) -> &Option<String>; fn set_key_id(&mut self, key_id: String); fn metadata(&self) -> &Option<KeyMetadata>; fn attach_metadata(&mut self, metadata: KeyMetadata) -> Result<(), Error>; fn authentication_tag(&self, authenticated: &[u8]) -> Vec<u8> ; // Provided methods fn salt(&self) -> Salt { ... } fn verifier_salt(&self) -> Result<Salt, Error> { ... } fn attach_salt(&mut self, salt: Salt) -> Result<(), Error> { ... } fn authenticate<CustomClaims: Serialize + DeserializeOwned>( &self, claims: JWTClaims<CustomClaims>, ) -> Result<String, Error> { ... } fn verify_token<CustomClaims: Serialize + DeserializeOwned>( &self, token: &str, options: Option<VerificationOptions>, ) -> Result<JWTClaims<CustomClaims>, Error> { ... } fn create_key_id(&mut self) -> &str { ... }
}

Required Methods§

Source

fn jwt_alg_name() -> &'static str

Source

fn key(&self) -> &HMACKey

Source

fn key_id(&self) -> &Option<String>

Source

fn set_key_id(&mut self, key_id: String)

Source

fn metadata(&self) -> &Option<KeyMetadata>

Source

fn attach_metadata(&mut self, metadata: KeyMetadata) -> Result<(), Error>

Source

fn authentication_tag(&self, authenticated: &[u8]) -> Vec<u8>

Provided Methods§

Source

fn salt(&self) -> Salt

Get the salt associated with the key.

Source

fn verifier_salt(&self) -> Result<Salt, Error>

Compute the salt to be used for verification, given a signer salt.

Source

fn attach_salt(&mut self, salt: Salt) -> Result<(), Error>

Attach a salt to the key.

Source

fn authenticate<CustomClaims: Serialize + DeserializeOwned>( &self, claims: JWTClaims<CustomClaims>, ) -> Result<String, Error>

Authenticate a token.

Source

fn verify_token<CustomClaims: Serialize + DeserializeOwned>( &self, token: &str, options: Option<VerificationOptions>, ) -> Result<JWTClaims<CustomClaims>, Error>

Verify a token.

Source

fn create_key_id(&mut self) -> &str

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§