Skip to main content

HwiCommand

Enum HwiCommand 

Source
pub enum HwiCommand {
Show 18 variants Enumerate, GetMasterXpub { addr_type: HwiAddressType, account: u32, }, SignTx { psbt: String, }, SignMessage { message: String, path: String, }, DisplayAddress(HwiDisplayAddressRequest), GetXpub { path: String, expert: bool, }, GetDescriptors { account: u32, }, GetKeypool { start: u32, end: u32, internal: bool, keypool: bool, account: u32, addr_type: HwiAddressType, all: bool, path: Option<String>, }, Backup { label: String, backup_passphrase: String, }, Setup { interactive: bool, label: String, backup_passphrase: String, }, Wipe, Restore { interactive: bool, word_count: i32, label: String, }, TogglePassphrase, PromptPin, SendPin { pin: String, }, UnsupportedDeviceAction(HwiUnsupportedDeviceAction), InstallUdevRules { location: PathBuf, }, Unsupported(String),
}
Expand description

An executable Python HWI-compatible operation.

Device support varies; unsupported operations return an HwiError in HwiResponse::Error rather than succeeding without performing the operation.

Variants§

§

Enumerate

Enumerates devices, including per-device errors and readiness information.

§

GetMasterXpub

Retrieves the extended public key for an account and address type.

Fields

§addr_type: HwiAddressType

The address type used to select the account’s derivation purpose.

§account: u32

The BIP44-style account number.

§

SignTx

Signs a PSBT, preparing Ledger policy contexts when required.

Fields

§psbt: String

The base64-encoded PSBT.

§

SignMessage

Signs a UTF-8 message at a BIP32 derivation path.

Fields

§message: String

The message text.

§path: String

The derivation path of the signing key.

§

DisplayAddress(HwiDisplayAddressRequest)

Retrieves an address and requests display on the device.

Tuple Fields

§0: HwiDisplayAddressRequest

The path or descriptor identifying the address.

§

GetXpub

Retrieves an extended public key at a BIP32 path.

Fields

§path: String

The derivation path of the extended public key.

§expert: bool

Whether to include the decoded extended-key fields in the response.

§

GetDescriptors

Retrieves receive and change descriptors for supported address types.

Fields

§account: u32

The BIP44-style account number.

§

GetKeypool

Retrieves ranged Bitcoin Core descriptor-import records.

Fields

§start: u32

The inclusive first child index.

§end: u32

The inclusive last child index, which must not precede start.

§internal: bool

Whether to select only change; otherwise both branches are returned without path.

§keypool: bool

The value for both keypool and active in the returned records.

§account: u32

The BIP44-style account number, ignored when path is supplied.

§addr_type: HwiAddressType

The address type to use unless all is true.

§all: bool

Whether to return every address type supported by the selected device.

§path: Option<String>

An optional derivation path starting with m/ and ending in /*.

§

Backup

Requests a BitBox02 mnemonic display or writes a Coldcard backup to a local file.

Fields

§label: String

A compatibility label, required to be empty for BitBox02 and unused by Coldcard.

§backup_passphrase: String

A compatibility password, required to be empty for BitBox02 and unused by Coldcard.

§

Setup

Initializes a BitBox02, Trezor, or KeepKey.

Fields

§interactive: bool

Whether interactive setup is allowed; false is rejected.

§label: String

The requested device label.

§backup_passphrase: String

A compatibility option rejected when nonempty for BitBox02 and unused by Trezor and KeepKey.

§

Wipe

Erases a supported device’s wallet.

§

Restore

Restores a BitBox02, Trezor, or KeepKey from a mnemonic.

Fields

§interactive: bool

Whether interactive recovery is allowed; false is rejected.

§word_count: i32

The requested mnemonic word count.

§label: String

The requested device label.

§

TogglePassphrase

Toggles passphrase protection on a supported device.

§

PromptPin

Requests PIN entry and prints keypad instructions to stderr.

§

SendPin

Sends scrambled keypad positions to a supported device waiting for a PIN.

Fields

§pin: String

A nonempty ASCII-digit position string, with no 1–9 range check.

§

UnsupportedDeviceAction(HwiUnsupportedDeviceAction)

Produces a device-specific unsupported-action error after selecting a device.

Tuple Fields

§0: HwiUnsupportedDeviceAction

The management action used to choose the error message.

§

InstallUdevRules

Installs all udev rules, updates the USB group, and reloads rules on Linux.

Fields

§location: PathBuf

The directory in which to write the udev rules.

§

Unsupported(String)

Reports an unsupported HWI command without selecting a device.

Tuple Fields

§0: String

The unrecognized command name.

Trait Implementations§

Source§

impl Clone for HwiCommand

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for HwiCommand

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for HwiCommand

Source§

impl PartialEq for HwiCommand

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for HwiCommand

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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