pub struct FidoDevice {
pub guest_key: Arc<Mutex<FidoGuestKey>>,
pub transaction_manager: Arc<Mutex<TransactionManager>>,
pub is_active: bool,
pub is_device_lost: bool,
event_loop: Arc<EventLoop>,
pub transfer_timer: PollTimer,
pub fd: Arc<Mutex<File>>,
}Expand description
A virtual representation of a FidoDevice emulated on the Host.
Fields§
§guest_key: Arc<Mutex<FidoGuestKey>>Guest representation of the virtual security key device
transaction_manager: Arc<Mutex<TransactionManager>>The TransactionManager which handles starting and stopping u2f transactions
is_active: boolMarks whether the current device is active in a transaction. If it is not active, the fd polling event loop does not handle the device fd monitoring.
is_device_lost: boolMarks whether the device has been lost. In case the FD stops being responsive we signal that the device is lost and any further transaction will return a failure.
event_loop: Arc<EventLoop>Backend provider event loop to attach/detach the monitored fd.
transfer_timer: PollTimerTimer to poll for active USB transfers
fd: Arc<Mutex<File>>fd of the actual hidraw device
Implementations§
Source§impl FidoDevice
impl FidoDevice
pub fn new(hidraw: File, event_loop: Arc<EventLoop>) -> Result<FidoDevice>
Sourcepub fn set_active(&mut self, active: bool)
pub fn set_active(&mut self, active: bool)
Sets the device active state. If the device becomes active, it toggles polling on the file descriptor for the host hid device. If the devices becomes inactive, it stops polling. In case of error, it’s not possible to recover so we just log the warning and continue.
Sourcepub fn start_transaction(&mut self, packet: &InitPacket) -> Result<()>
pub fn start_transaction(&mut self, packet: &InitPacket) -> Result<()>
Starts a new transaction from a given init packet.