Struct passkey_client::RpIdVerifier
source · pub struct RpIdVerifier<P> { /* private fields */ }Expand description
Wrapper struct for verifying that a given RpId matches the request’s origin.
While most cases should not use this type directly and instead use Client, there are some
cases that warrant the need for checking an RpId in the same way that the client does, but without
the rest of pieces that the client needs.
Implementations§
source§impl<P> RpIdVerifier<P>where
P: EffectiveTLDProvider + Sync + 'static,
impl<P> RpIdVerifier<P>where
P: EffectiveTLDProvider + Sync + 'static,
sourcepub fn new(tld_provider: P) -> Self
pub fn new(tld_provider: P) -> Self
Create a new Verifier with a given TLD provider. Most cases should just use
public_suffix::DEFAULT_PROVIDER.
sourcepub fn allows_insecure_localhost(self, is_allowed: bool) -> Self
pub fn allows_insecure_localhost(self, is_allowed: bool) -> Self
Allows RpIdVerifier::assert_domain to pass through requests from localhost
sourcepub fn assert_domain<'a>(
&self,
origin: &'a Url,
rp_id: Option<&'a str>
) -> Result<&'a str, WebauthnError>
pub fn assert_domain<'a>( &self, origin: &'a Url, rp_id: Option<&'a str> ) -> Result<&'a str, WebauthnError>
Parse the given Relying Party Id and verify it against the origin url of the request.
This follows the steps defined in: https://html.spec.whatwg.org/multipage/browsers.html#is-a-registrable-domain-suffix-of-or-is-equal-to
Returns the effective domain on success or some WebauthnError