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>
impl<'rp_id, 'prf> DiscoverableAuthenticationClientState<'rp_id, 'prf>
Sourcepub const fn options(
&self,
) -> &DiscoverableCredentialRequestOptions<'rp_id, 'prf>
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>
impl<'rp_id, 'prf> Debug for DiscoverableAuthenticationClientState<'rp_id, 'prf>
Source§impl Serialize for DiscoverableAuthenticationClientState<'_, '_>
Available on crate feature serde only.
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,
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more