pub struct Authenticator<C: AuthenticatorCallbacks> { /* private fields */ }Expand description
High-level FIDO2 authenticator
Provides a thread-safe authenticator that processes CTAP commands via callbacks.
Implementations§
Source§impl<C: AuthenticatorCallbacks> Authenticator<C>
impl<C: AuthenticatorCallbacks> Authenticator<C>
Sourcepub fn set_pin_hash(pin_hash: &[u8])
pub fn set_pin_hash(pin_hash: &[u8])
Set the PIN hash for the authenticator (must be called before creating instance)
The PIN hash will be applied to the next authenticator instance created. This is useful for testing scenarios where you want to simulate a PIN being set.
§Arguments
pin_hash- SHA-256 hash of the PIN (32 bytes)
Sourcepub fn new(callbacks: C) -> Result<Self>where
C: 'static,
pub fn new(callbacks: C) -> Result<Self>where
C: 'static,
Create a new authenticator with default configuration
Sourcepub fn with_config(callbacks: C, config: AuthenticatorConfig) -> Result<Self>where
C: 'static,
pub fn with_config(callbacks: C, config: AuthenticatorConfig) -> Result<Self>where
C: 'static,
Create a new authenticator with custom configuration
Sourcepub fn with_config_and_pin_storage<P>(
callbacks: C,
config: AuthenticatorConfig,
pin_storage: P,
) -> Result<Self>
pub fn with_config_and_pin_storage<P>( callbacks: C, config: AuthenticatorConfig, pin_storage: P, ) -> Result<Self>
Create a new authenticator with custom configuration and persistent PIN storage
Sourcepub fn register_custom_command<F>(&mut self, command: u8, handler: F)
pub fn register_custom_command<F>(&mut self, command: u8, handler: F)
Register a custom CTAP command handler
This allows registering vendor-specific commands in the 0x40-0xFF range.
§Example
let callbacks = MyCallbacks;
let mut auth = Authenticator::new(callbacks).unwrap();
// Register custom command 0x41
auth.register_custom_command(0x41, |request| {
// Process custom command
Ok(vec![0x01, 0x02, 0x03])
});Auto Trait Implementations§
impl<C> Freeze for Authenticator<C>
impl<C> RefUnwindSafe for Authenticator<C>
impl<C> Send for Authenticator<C>
impl<C> Sync for Authenticator<C>
impl<C> Unpin for Authenticator<C>
impl<C> UnwindSafe for Authenticator<C>
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