Skip to main content

JwsContext

Struct JwsContext 

Source
pub struct JwsContext { /* private fields */ }

Implementations§

Source§

impl JwsContext

Source

pub fn new() -> Self

Source

pub fn is_acceptable_critical(&self, name: &str) -> bool

Test a critical header claim name is acceptable.

§Arguments
  • name - a critical header claim name
Source

pub fn add_acceptable_critical(&mut self, name: &str)

Add a acceptable critical header claim name

§Arguments
  • name - a acceptable critical header claim name
Source

pub fn remove_acceptable_critical(&mut self, name: &str)

Remove a acceptable critical header claim name

§Arguments
  • name - a acceptable critical header claim name
Source

pub fn serialize_compact( &self, payload: &[u8], header: &JwsHeader, signer: &dyn JwsSigner, ) -> Result<String, JoseError>

Return a representation of the data that is formatted by compact serialization.

§Arguments
  • payload - The payload data.
  • header - The JWS heaser claims.
  • signer - The JWS signer.
Source

pub fn serialize_compact_with_selector<'a, F>( &self, payload: &[u8], header: &JwsHeader, selector: F, ) -> Result<String, JoseError>
where F: Fn(&JwsHeader) -> Option<&'a dyn JwsSigner>,

Return a representation of the data that is formatted by compact serialization.

§Arguments
  • payload - The payload data.
  • header - The JWS heaser claims.
  • selector - a function for selecting the signing algorithm.
Source

pub fn serialize_general_json( &self, payload: &[u8], signers: &[(&JwsHeaderSet, &dyn JwsSigner)], ) -> Result<String, JoseError>

Return a representation of the data that is formatted by flattened json serialization.

§Arguments
  • protected - The JWS protected header claims.
  • header - The JWS unprotected header claims.
  • payload - The payload data.
  • signers - The JWS signer.
Source

pub fn serialize_general_json_with_selecter<'a, F>( &self, payload: &[u8], headers: &[&JwsHeaderSet], selector: F, ) -> Result<String, JoseError>
where F: Fn(usize, &JwsHeader) -> Option<&'a dyn JwsSigner>,

Return a representation of the data that is formatted by flattened json serialization.

§Arguments
  • payload - The payload data.
  • headers - The JWS headers.
  • selector - a function for selecting the signing algorithm.
Source

pub fn serialize_flattened_json( &self, payload: &[u8], header: &JwsHeaderSet, signer: &dyn JwsSigner, ) -> Result<String, JoseError>

Return a representation of the data that is formatted by flattened json serialization.

§Arguments
  • payload - The payload data.
  • header - The JWS protected and unprotected header claims.
  • signer - The JWS signer.
Source

pub fn serialize_flattened_json_with_selector<'a, F>( &self, payload: &[u8], header: &JwsHeaderSet, selector: F, ) -> Result<String, JoseError>
where F: Fn(&JwsHeader) -> Option<&'a dyn JwsSigner>,

Return a representation of the data that is formatted by flatted json serialization.

§Arguments
  • payload - The payload data.
  • header - The JWS protected and unprotected header claims.
  • selector - a function for selecting the signing algorithm.
Source

pub fn deserialize_compact( &self, input: impl AsRef<[u8]>, verifier: &dyn JwsVerifier, ) -> Result<(Vec<u8>, JwsHeader), JoseError>

Deserialize the input that is formatted by compact serialization.

§Arguments
  • input - The input data.
  • header - The decoded JWS header claims.
  • verifier - The JWS verifier.
Source

pub fn deserialize_compact_with_selector<'a, F>( &self, input: impl AsRef<[u8]>, selector: F, ) -> Result<(Vec<u8>, JwsHeader), JoseError>
where F: Fn(&JwsHeader) -> Result<Option<&'a dyn JwsVerifier>, JoseError>,

Deserialize the input that is formatted by compact serialization.

§Arguments
  • input - The input data.
  • header - The decoded JWS header claims.
  • selector - a function for selecting the verifying algorithm.
Source

pub fn deserialize_json<'a>( &self, input: impl AsRef<[u8]>, verifier: &'a dyn JwsVerifier, ) -> Result<(Vec<u8>, JwsHeader), JoseError>

Deserialize the input that is formatted by json serialization.

§Arguments
  • input - The input data.
  • header - The decoded JWS header claims.
  • verifier - The JWS verifier.
Source

pub fn deserialize_json_with_selector<'a, F>( &self, input: impl AsRef<[u8]>, selector: F, ) -> Result<(Vec<u8>, JwsHeader), JoseError>
where F: Fn(&JwsHeader) -> Result<Option<&'a dyn JwsVerifier>, JoseError>,

Deserialize the input that is formatted by json serialization.

§Arguments
  • input - The input data.
  • header - The decoded JWS header claims.
  • selector - a function for selecting the verifying algorithm.

Trait Implementations§

Source§

impl Clone for JwsContext

Source§

fn clone(&self) -> JwsContext

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for JwsContext

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for JwsContext

Source§

impl PartialEq for JwsContext

Source§

fn eq(&self, other: &JwsContext) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for JwsContext

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.