pub struct DeviceManager { /* private fields */ }Expand description
A native device manager with CLI pairing and host-interaction prompts.
Remembers whether -p was given, since the selector only keeps the password
when Trezor or KeepKey is built in.
Implementations§
Source§impl DeviceManager
impl DeviceManager
Sourcepub fn password_given(&self) -> bool
pub fn password_given(&self) -> bool
Returns whether a password argument was supplied, including an empty one.
Sourcepub fn refuse_password(
&self,
device_type: DeviceType,
) -> Result<(), SelectError<NativeError>>
pub fn refuse_password( &self, device_type: DeviceType, ) -> Result<(), SelectError<NativeError>>
Rejects a supplied host password for BitBox02, which requires on-device entry.
Methods from Deref<Target = DeviceManager<NativeSource>>§
Sourcepub async fn list(
&self,
) -> Result<Vec<DeviceCandidate>, <S as DeviceSource>::Error>
pub async fn list( &self, ) -> Result<Vec<DeviceCandidate>, <S as DeviceSource>::Error>
Lists candidates using the selector, potentially probing emulators.
Sourcepub async fn open(
&self,
candidate: &DeviceCandidate,
) -> Result<Device, <S as DeviceSource>::Error>
pub async fn open( &self, candidate: &DeviceCandidate, ) -> Result<Device, <S as DeviceSource>::Error>
Opens a candidate using the selector and configured callbacks.
Sourcepub async fn enumerate(&self) -> Result<DeviceScan, <S as DeviceSource>::Error>
pub async fn enumerate(&self) -> Result<DeviceScan, <S as DeviceSource>::Error>
Opens listed candidates without additional unlock or metadata requests.
Source-specific opening may still send wallet commands, such as native
Specter’s fingerprint probe. Opening errors are collected in
DeviceScan::skipped.
Sourcepub async fn select(
&self,
) -> Result<(Option<Device>, Vec<SkippedDevice>), SelectError<<S as DeviceSource>::Error>>
pub async fn select( &self, ) -> Result<(Option<Device>, Vec<SkippedDevice>), SelectError<<S as DeviceSource>::Error>>
Opens candidates and runs their unlock handshake until the optional fingerprint matches.
Successful Trezor or KeepKey initialization can leave the wallet PIN-locked.
A common bhwi::common::ErrorKind::UserCancelled from unlock or fingerprint
queries aborts selection. Without a fingerprint filter, any unlock failure
is returned rather than silently selecting another wallet. Other failures
are collected as skipped devices. Trezor and KeepKey device-side cancellations
become authentication refusals and may be skipped when filtering by fingerprint.
Sourcepub async fn scan(
&self,
) -> Result<DeviceScan, SelectError<<S as DeviceSource>::Error>>
pub async fn scan( &self, ) -> Result<DeviceScan, SelectError<<S as DeviceSource>::Error>>
Opens and probes candidates, caching information and initialized-wallet fingerprints.
A common bhwi::common::ErrorKind::UserCancelled from unlock or probe commands
aborts the scan. Other per-device failures, including Trezor and KeepKey
device-side cancellations mapped to authentication refusals, are collected
as skipped devices.
Sourcepub async fn get_device_with_fingerprint(
&self,
) -> Result<Option<Device>, SelectError<<S as DeviceSource>::Error>>
pub async fn get_device_with_fingerprint( &self, ) -> Result<Option<Device>, SelectError<<S as DeviceSource>::Error>>
Selects a wallet, returning an error if all candidates were skipped.
With no fingerprint filter, the first successful unlock handshake is accepted;
Trezor and KeepKey may still require a PIN. Uses the rules of Self::select.
Sourcepub async fn get_device_without_contacting(
&self,
) -> Result<Option<Device>, SelectError<<S as DeviceSource>::Error>>
pub async fn get_device_without_contacting( &self, ) -> Result<Option<Device>, SelectError<<S as DeviceSource>::Error>>
Returns the first usable candidate from Self::enumerate.
The manager makes no additional unlock or metadata request. Discovery and source-specific opening may still perform protocol I/O, including native Specter’s fingerprint probe.