pub trait Link: Send + Sync {
// Required methods
fn state(&self) -> LinkState;
fn usb_host(&self) -> bool;
fn reach(&self) -> Reach;
fn transceive(&self, command: &[u8]) -> Result<Vec<u8>, LinkError>;
fn wait(&self, timeout: Duration);
fn want(&self, wanted: bool);
}Expand description
What carries APDUs between Sioul and a key held to the phone: the app’s, over Android’s NFC; a stand-in in tests.
Required Methods§
Sourcefn usb_host(&self) -> bool
fn usb_host(&self) -> bool
Whether the phone takes a key plugged into its USB-C port (USB host).
Sourcefn transceive(&self, command: &[u8]) -> Result<Vec<u8>, LinkError>
fn transceive(&self, command: &[u8]) -> Result<Vec<u8>, LinkError>
One APDU to the key held; its answer, status words included.
Sourcefn want(&self, wanted: bool)
fn want(&self, wanted: bool)
A key is wanted now, or no longer: while it is, the phone reads keys in reader mode, ahead of other apps, and asks Android, once for each time it is plugged in, to let Sioul use a key plugged in; no longer, the key held is let go (Android hands it to no other app until it leaves the field), reader mode ends, and the key plugged in is powered off and given back.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".