pub trait Token: Sized + Debug + Sync + Send {
    type Id: Sized + Debug + Sync + Send;

    // Required methods
    fn get_transport(&self) -> AuthenticatorTransport;
    fn transmit_raw<'life0, 'life1, 'life2, 'async_trait, U>(
        &'life0 mut self,
        cbor: &'life1 [u8],
        ui: &'life2 U
    ) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, WebauthnCError>> + Send + 'async_trait>>
       where U: UiCallback + 'async_trait,
             Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn cancel<'life0, 'async_trait>(
        &'life0 mut self
    ) -> Pin<Box<dyn Future<Output = Result<(), WebauthnCError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn init<'life0, 'async_trait>(
        &'life0 mut self
    ) -> Pin<Box<dyn Future<Output = Result<(), WebauthnCError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn close<'life0, 'async_trait>(
        &'life0 mut self
    ) -> Pin<Box<dyn Future<Output = Result<(), WebauthnCError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;

    // Provided methods
    fn has_button(&self) -> bool { ... }
    fn transmit<'a, 'life0, 'life1, 'async_trait, C, R, U>(
        &'life0 mut self,
        cmd: C,
        ui: &'life1 U
    ) -> Pin<Box<dyn Future<Output = Result<R, WebauthnCError>> + Send + 'async_trait>>
       where C: CBORCommand<Response = R> + 'async_trait,
             R: CBORResponse + 'async_trait,
             U: UiCallback + 'async_trait,
             Self: 'async_trait,
             'a: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
}
Available on crate feature ctap2 only.
Expand description

Represents a connection to a single FIDO token over a Transport.

This is a low level interface to FIDO tokens, passing raw messages. crate::ctap2 provides a higher level abstraction.

Required Associated Types§

Required Methods§

source

fn get_transport(&self) -> AuthenticatorTransport

Gets the transport layer used for communication with this token.

source

fn transmit_raw<'life0, 'life1, 'life2, 'async_trait, U>( &'life0 mut self, cbor: &'life1 [u8], ui: &'life2 U ) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, WebauthnCError>> + Send + 'async_trait>>
where U: UiCallback + 'async_trait, Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Transmits a command on the underlying transport.

cbor is a CBOR-encoded command.

Interfaces need to check for and return any transport-layer-specific error code WebauthnCError::Ctap, but don’t need to worry about deserialising CBOR.

source

fn cancel<'life0, 'async_trait>( &'life0 mut self ) -> Pin<Box<dyn Future<Output = Result<(), WebauthnCError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Cancels a pending request.

source

fn init<'life0, 'async_trait>( &'life0 mut self ) -> Pin<Box<dyn Future<Output = Result<(), WebauthnCError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Initializes the Token

source

fn close<'life0, 'async_trait>( &'life0 mut self ) -> Pin<Box<dyn Future<Output = Result<(), WebauthnCError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Closes the Token

Provided Methods§

source

fn has_button(&self) -> bool

source

fn transmit<'a, 'life0, 'life1, 'async_trait, C, R, U>( &'life0 mut self, cmd: C, ui: &'life1 U ) -> Pin<Box<dyn Future<Output = Result<R, WebauthnCError>> + Send + 'async_trait>>
where C: CBORCommand<Response = R> + 'async_trait, R: CBORResponse + 'async_trait, U: UiCallback + 'async_trait, Self: 'async_trait, 'a: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Transmit a CBOR message to a token, and deserialises the response.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl Token for AnyToken

§

type Id = AnyTokenId

source§

impl Token for BluetoothToken

Available on crate feature bluetooth only.
source§

impl Token for NFCCard

Available on crate feature nfc only.
§

type Id = CString

source§

impl Token for USBToken

Available on crate feature usb only.