CollectedClientData

Struct CollectedClientData 

Source
pub struct CollectedClientData<E = ()>
where E: Clone + Serialize,
{ pub ty: ClientDataType, pub challenge: String, pub origin: String, pub cross_origin: Option<bool>, pub extra_data: E, pub unknown_keys: IndexMap<String, Value>, }
Expand description

The client data represents the contextual bindings of both the Relying Party and the client. It is a key-value mapping whose keys are strings. Values can be any type that has a valid encoding in JSON.

Note: The CollectedClientData may be extended in the future. Therefore it’s critical when parsing to be tolerant of unknown keys and of any reordering of the keys

This struct conforms to the JSON byte serialization format expected of CollectedClientData, detailed in section 5.8.1.1 Serialization of the WebAuthn spec. Namely the following requirements:

  • type, challenge, origin, crossOrigin must always be present in the serialized format in that order.
  • Any extra parameters must keep the order in which they were used in the signature, hence the use of IndexMap.

https://w3c.github.io/webauthn/#dictionary-client-data

Fields§

§ty: ClientDataType

This member contains the value ClientDataType::Create when creating new credentials, and ClientDataType::Get when getting an assertion from an existing credential. The purpose of this member is to prevent certain types of signature confusion attacks (where an attacker substitutes one legitimate signature for another).

§challenge: String

This member contains the base64url encoding of the challenge provided by the Relying Party. See the Cryptographic Challenges security consideration.

§origin: String

This member contains the fully qualified origin of the requester, as provided to the authenticator by the client, in the syntax defined by RFC6454.

§cross_origin: Option<bool>

This OPTIONAL member contains the inverse of the sameOriginWithAncestors argument value that was passed into the internal method

§extra_data: E

CollectedClientData can be extended by the user of this library, this accounts for keys that are unknown to the library, but may be known to the user.

§unknown_keys: IndexMap<String, Value>

CollectedClientData can be extended in the future, this accounts for unknown keys Uses an IndexMap to preserve order of keys for JSON byte serialization

Trait Implementations§

Source§

impl<E> Clone for CollectedClientData<E>
where E: Clone + Serialize + Clone,

Source§

fn clone(&self) -> CollectedClientData<E>

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<E> Debug for CollectedClientData<E>
where E: Clone + Serialize + Debug,

Source§

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

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

impl<'de, E> Deserialize<'de> for CollectedClientData<E>
where E: Clone + Serialize + Deserialize<'de>,

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl<E> Serialize for CollectedClientData<E>
where E: Clone + Serialize + Serialize,

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<E> Freeze for CollectedClientData<E>
where E: Freeze,

§

impl<E> RefUnwindSafe for CollectedClientData<E>
where E: RefUnwindSafe,

§

impl<E> Send for CollectedClientData<E>
where E: Send,

§

impl<E> Sync for CollectedClientData<E>
where E: Sync,

§

impl<E> Unpin for CollectedClientData<E>
where E: Unpin,

§

impl<E> UnwindSafe for CollectedClientData<E>
where E: UnwindSafe,

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<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> 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.
Source§

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

Source§

fn vzip(self) -> V

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,