DiscoverableAuthenticationClientState

Struct DiscoverableAuthenticationClientState 

Source
pub struct DiscoverableAuthenticationClientState<'rp_id, 'prf>(/* private fields */);
Expand description

Container of a DiscoverableCredentialRequestOptions that has been used to start the authentication ceremony. This gets sent to the client ASAP.

Implementations§

Source§

impl<'rp_id, 'prf> DiscoverableAuthenticationClientState<'rp_id, 'prf>

Source

pub const fn options( &self, ) -> &DiscoverableCredentialRequestOptions<'rp_id, 'prf>

Returns the DiscoverableCredentialRequestOptions that was used to start an authentication ceremony.

Trait Implementations§

Source§

impl<'rp_id, 'prf> Debug for DiscoverableAuthenticationClientState<'rp_id, 'prf>

Source§

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

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

impl Serialize for DiscoverableAuthenticationClientState<'_, '_>

Available on crate feature serde only.
Source§

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

Serializes self to conform with PublicKeyCredentialRequestOptionsJSON.

§Examples
let rp_id = RpId::Domain(AsciiDomain::try_from("example.com".to_owned())?);
let mut options = DiscoverableCredentialRequestOptions::passkey(&rp_id);
options.0.hints = Hint::SecurityKey;
options.0.extensions = Extension {
    prf: Some(PrfInput {
        first: [0; 4].as_slice(),
        second: None,
        ext_info: ExtensionReq::Require,
    }),
};
let client_state = serde_json::to_string(&options.start_ceremony()?.1).unwrap();
let json = serde_json::json!({
    "challenge":"AAAAAAAAAAAAAAAAAAAAAA",
    "timeout":300000,
    "rpId":"example.com",
    "allowCredentials":[],
    "userVerification":"required",
    "hints":[
        "security-key"
    ],
    "extensions":{
        "prf":{
            "eval":{
                "first":"AAAAAA"
            },
        }
    }
}).to_string();
// Since `Challenge`s are randomly generated, we don't know what it will be; thus
// we test the JSON string for everything except it.
assert_eq!(client_state.get(..14), json.get(..14));
assert_eq!(client_state.get(36..), json.get(36..));

Auto Trait Implementations§

§

impl<'rp_id, 'prf> Freeze for DiscoverableAuthenticationClientState<'rp_id, 'prf>

§

impl<'rp_id, 'prf> RefUnwindSafe for DiscoverableAuthenticationClientState<'rp_id, 'prf>

§

impl<'rp_id, 'prf> Send for DiscoverableAuthenticationClientState<'rp_id, 'prf>

§

impl<'rp_id, 'prf> Sync for DiscoverableAuthenticationClientState<'rp_id, 'prf>

§

impl<'rp_id, 'prf> Unpin for DiscoverableAuthenticationClientState<'rp_id, 'prf>

§

impl<'rp_id, 'prf> UnwindSafe for DiscoverableAuthenticationClientState<'rp_id, 'prf>

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