JwkSerialize

Struct JwkSerialize 

Source
pub struct JwkSerialize<'s, K: ToJwk> { /* private fields */ }
Expand description

A wrapper type for serializing a JWK using serde

Implementations§

Source§

impl<'s, K: ToJwk> JwkSerialize<'s, K>

Source

pub fn new(key: &'s K, mode: JwkEncoderMode) -> Self

Create a new instance

Source

pub fn as_public(key: &'s K) -> Self

Create a new instance for encoding a public key

Source

pub fn as_secret(key: &'s K) -> Self

Create a new instance for encoding a secret key

Source

pub fn as_thumbprint(key: &'s K) -> Self

Create a new instance for encoding a JWK thumbprint

Source

pub fn alg(self, alg: Option<KeyAlg>) -> Self

Set the key algorithm

Source

pub fn key_ops(self, key_ops: Option<KeyOpsSet>) -> Self

Set the key operations

Source

pub fn kid(self, kid: Option<&'s str>) -> Self

Set the key ID

Trait Implementations§

Source§

impl<'s, K: Debug + ToJwk> Debug for JwkSerialize<'s, K>

Source§

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

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

impl<K: ToJwk> Serialize for JwkSerialize<'_, K>

Source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

§

impl<'s, K> Freeze for JwkSerialize<'s, K>

§

impl<'s, K> RefUnwindSafe for JwkSerialize<'s, K>
where K: RefUnwindSafe,

§

impl<'s, K> Send for JwkSerialize<'s, K>
where K: Sync,

§

impl<'s, K> Sync for JwkSerialize<'s, K>
where K: Sync,

§

impl<'s, K> Unpin for JwkSerialize<'s, K>

§

impl<'s, K> UnwindSafe for JwkSerialize<'s, K>
where K: RefUnwindSafe,

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> 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> Same for T

Source§

type Output = T

Should always be Self
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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V