pub struct Trezor { /* private fields */ }
Expand description

A Trezor client.

Implementations§

source§

impl Trezor

source

pub fn get_public_key( &mut self, path: &DerivationPath, script_type: InputScriptType, network: Network, show_display: bool ) -> Result<TrezorResponse<'_, Xpub, PublicKey>>

Available on crate feature bitcoin only.
source

pub fn get_address( &mut self, path: &DerivationPath, script_type: InputScriptType, network: Network, show_display: bool ) -> Result<TrezorResponse<'_, Address, Address>>

Available on crate feature bitcoin only.
source

pub fn sign_tx( &mut self, psbt: &Psbt, network: Network ) -> Result<TrezorResponse<'_, SignTxProgress<'_>, TxRequest>>

Available on crate feature bitcoin only.
source

pub fn sign_message( &mut self, message: String, path: &DerivationPath, script_type: InputScriptType, network: Network ) -> Result<TrezorResponse<'_, (Address, RecoverableSignature), MessageSignature>>

Available on crate feature bitcoin only.
source§

impl Trezor

source

pub fn ethereum_get_address(&mut self, path: Vec<u32>) -> Result<String>

Available on crate feature ethereum only.
source

pub fn ethereum_sign_message( &mut self, message: Vec<u8>, path: Vec<u32> ) -> Result<Signature>

Available on crate feature ethereum only.
source

pub fn ethereum_sign_tx( &mut self, path: Vec<u32>, nonce: Vec<u8>, gas_price: Vec<u8>, gas_limit: Vec<u8>, to: String, value: Vec<u8>, data: Vec<u8>, chain_id: Option<u64> ) -> Result<Signature>

Available on crate feature ethereum only.
source

pub fn ethereum_sign_eip1559_tx( &mut self, path: Vec<u32>, nonce: Vec<u8>, gas_limit: Vec<u8>, to: String, value: Vec<u8>, data: Vec<u8>, chain_id: Option<u64>, max_gas_fee: Vec<u8>, max_priority_fee: Vec<u8>, access_list: Vec<AccessListItem> ) -> Result<Signature>

Available on crate feature ethereum only.
source§

impl Trezor

source

pub fn model(&self) -> Model

Get the model of the Trezor device.

source

pub fn features(&self) -> Option<&Features>

Get the features of the Trezor device.

source

pub fn call_raw<S: TrezorMessage>(&mut self, message: S) -> Result<ProtoMessage>

Sends a message and returns the raw ProtoMessage struct that was responded by the device. This method is only exported for users that want to expand the features of this library f.e. for supporting additional coins etc.

source

pub fn call<'a, T, S: TrezorMessage, R: TrezorMessage>( &'a mut self, message: S, result_handler: Box<ResultHandler<'a, T, R>> ) -> Result<TrezorResponse<'a, T, R>>

Sends a message and returns a TrezorResponse with either the expected response message, a failure or an interaction request. This method is only exported for users that want to expand the features of this library f.e. for supporting additional coins etc.

source

pub fn init_device(&mut self, session_id: Option<Vec<u8>>) -> Result<()>

source

pub fn initialize( &mut self, session_id: Option<Vec<u8>> ) -> Result<TrezorResponse<'_, Features, Features>>

source

pub fn ping(&mut self, message: &str) -> Result<TrezorResponse<'_, (), Success>>

source

pub fn change_pin( &mut self, remove: bool ) -> Result<TrezorResponse<'_, (), Success>>

source

pub fn wipe_device(&mut self) -> Result<TrezorResponse<'_, (), Success>>

source

pub fn recover_device( &mut self, word_count: WordCount, passphrase_protection: bool, pin_protection: bool, label: String, dry_run: bool ) -> Result<TrezorResponse<'_, (), Success>>

source

pub fn reset_device( &mut self, display_random: bool, strength: usize, passphrase_protection: bool, pin_protection: bool, label: String, skip_backup: bool, no_backup: bool ) -> Result<TrezorResponse<'_, EntropyRequest<'_>, EntropyRequest>>

source

pub fn backup(&mut self) -> Result<TrezorResponse<'_, (), Success>>

source

pub fn apply_settings( &mut self, label: Option<String>, use_passphrase: Option<bool>, homescreen: Option<Vec<u8>>, auto_lock_delay_ms: Option<usize> ) -> Result<TrezorResponse<'_, (), Success>>

source

pub fn sign_identity( &mut self, identity: IdentityType, digest: Vec<u8>, curve: String ) -> Result<TrezorResponse<'_, Vec<u8>, SignedIdentity>>

source

pub fn get_ecdh_session_key( &mut self, identity: IdentityType, peer_public_key: Vec<u8>, curve: String ) -> Result<TrezorResponse<'_, ECDHSessionKey, ECDHSessionKey>>

Auto Trait Implementations§

§

impl !RefUnwindSafe for Trezor

§

impl Send for Trezor

§

impl Sync for Trezor

§

impl Unpin for Trezor

§

impl !UnwindSafe for Trezor

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, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

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

§

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