Skip to main content

DeviceManager

Struct DeviceManager 

Source
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

Source

pub fn password_given(&self) -> bool

Returns whether a password argument was supplied, including an empty one.

Source

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>>§

Source

pub async fn list( &self, ) -> Result<Vec<DeviceCandidate>, <S as DeviceSource>::Error>

Lists candidates using the selector, potentially probing emulators.

Source

pub async fn open( &self, candidate: &DeviceCandidate, ) -> Result<Device, <S as DeviceSource>::Error>

Opens a candidate using the selector and configured callbacks.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Trait Implementations§

Source§

impl AddressOutput for DeviceManager

Source§

fn get_address<'life0, 'async_trait>( &'life0 self, target: AddressTarget, ) -> Pin<Box<dyn Future<Output = Result<()>> + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Retrieves an address and prints it to stdout. Read more
Source§

impl Deref for DeviceManager

Source§

type Target = DeviceManager<NativeSource>

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl DescriptorOutput for DeviceManager

Source§

fn get_keypool<'life0, 'async_trait>( &'life0 self, options: GetKeypoolOptions, format: Option<OutputFormat>, ) -> Pin<Box<dyn Future<Output = Result<()>> + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Derives and prints one ranged keypool descriptor. Read more
Source§

fn get_pubkey_descriptors<'life0, 'async_trait>( &'life0 self, account: Option<u32>, format: Option<OutputFormat>, ) -> Pin<Box<dyn Future<Output = Result<()>> + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Derives and prints receive and change descriptors for supported address types. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more