pub struct WebAuthnGuard { /* private fields */ }Expand description
Scoped guard managing a virtual WebAuthn authenticator.
Created by BrowserSession::enable_webauthn. While this guard is
alive, a virtual authenticator is registered in the browser. Use
add_credential to provision credentials
for testing, and disable to remove it explicitly.
On drop, the virtual authenticator is removed and the WebAuthn domain is disabled (best-effort via a spawned task).
Implementations§
Source§impl WebAuthnGuard
impl WebAuthnGuard
Sourcepub fn authenticator_id(&self) -> &str
pub fn authenticator_id(&self) -> &str
Return the CDP authenticator ID for this virtual authenticator.
Sourcepub async fn add_credential(
&self,
credential_id: &str,
rp_id: &str,
user_handle: &str,
private_key_pem: &str,
sign_count: u32,
) -> BrowserResult<()>
pub async fn add_credential( &self, credential_id: &str, rp_id: &str, user_handle: &str, private_key_pem: &str, sign_count: u32, ) -> BrowserResult<()>
Add a resident credential to the virtual authenticator.
credential_id is an arbitrary identifier for the credential.
rp_id is the relying party ID (typically the domain).
user_handle is the user identifier associated with the credential.
private_key_pem must be a PEM-encoded private key.
sign_count is the initial signature counter value.
Sourcepub async fn disable(self) -> BrowserResult<()>
pub async fn disable(self) -> BrowserResult<()>
Remove the virtual authenticator and disable the WebAuthn domain.
After calling this, no further credential operations are possible. This is called automatically on drop, but explicit calls let you handle errors synchronously.
Trait Implementations§
Source§impl Drop for WebAuthnGuard
impl Drop for WebAuthnGuard
Auto Trait Implementations§
impl Freeze for WebAuthnGuard
impl RefUnwindSafe for WebAuthnGuard
impl Send for WebAuthnGuard
impl Sync for WebAuthnGuard
impl Unpin for WebAuthnGuard
impl UnsafeUnpin for WebAuthnGuard
impl UnwindSafe for WebAuthnGuard
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more