pub struct PublicKeyCredentialDescriptor {
    pub ty: PublicKeyCredentialType,
    pub id: Bytes,
    pub transports: Option<Vec<AuthenticatorTransport>>,
}
Expand description

Identifies a specific public key credential. It is used in PublicKeyCredentialCreationOptions::exclude_credentials to prevent creating duplicate credentials on the same authenticator, and in PublicKeyCredentialRequestOptions::allow_credentials to determine if and how the credential can currently be reached by the client. It mirrors some fields of the PublicKeyCredential object returned by the create() and get() operations.

It is recommended to ignore any credential whose type is PublicKeyCredentialType::Unknown

https://w3c.github.io/webauthn/#dictdef-publickeycredentialdescriptor

Fields§

§ty: PublicKeyCredentialType

This member contains the type of the public key credential the caller is referring to. The value SHOULD be a member of PublicKeyCredentialType but client platforms MUST ignore any PublicKeyCredentialDescriptor with an PublicKeyCredentialType::Unknown type.

This mirrors the PublicKeyCredential::ty field.

§id: Bytes

This member contains the credential ID of the public key credential the caller is referring to.

This mirrors the PublicKeyCredential::raw_id field.

§transports: Option<Vec<AuthenticatorTransport>>

This OPTIONAL member contains a hint as to how the client might communicate with the managing authenticator of the PublicKeyCredential the caller is referring to. The values SHOULD be members of AuthenticatorTransport but client platforms MUST ignore unknown values.

This mirrors the AuthenticatorAttestationResponse::transports field of a PublicKeyCredential::response structure created by a create() operation. When registering a new credential, the Relying Party SHOULD store the value returned from AuthenticatorAttestationResponse::transports. When creating a PublicKeyCredentialDescriptor for that credential, the Relying Party SHOULD retrieve that stored value and set it as the value of the transports member.

Implementations§

source§

impl PublicKeyCredentialDescriptor

source

pub fn is_known(&self) -> bool

Checks whether Self::ty is not of value PublicKeyCredentialType::Unknown. This should be used for filtering a list of PublicKeyCredentialDescriptors that are not of a known type.

Trait Implementations§

source§

impl Debug for PublicKeyCredentialDescriptor

source§

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

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

impl<'de> Deserialize<'de> for PublicKeyCredentialDescriptor

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 From<&Passkey> for PublicKeyCredentialDescriptor

source§

fn from(value: &Passkey) -> Self

Converts to this type from the input type.
source§

impl From<Passkey> for PublicKeyCredentialDescriptor

source§

fn from(value: Passkey) -> Self

Converts to this type from the input type.
source§

impl Serialize for PublicKeyCredentialDescriptor

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§

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

§

type Output = T

Should always be Self
source§

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

§

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>,

§

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

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

§

fn vzip(self) -> V

source§

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