Trait ledger_zondax_generic::AppExt

source ·
pub trait AppExt<E>: App
where E: Exchange + Send + Sync, E::Error: Error,
{ // Provided methods fn handle_response_error( response: &APDUAnswer<E::AnswerType> ) -> Result<(), LedgerAppError<E::Error>> { ... } fn handle_response_error_signature( response: &APDUAnswer<E::AnswerType> ) -> Result<(), LedgerAppError<E::Error>> { ... } fn get_device_info<'life0, 'async_trait>( transport: &'life0 E ) -> Pin<Box<dyn Future<Output = Result<DeviceInfo, LedgerAppError<E::Error>>> + Send + 'async_trait>> where 'life0: 'async_trait { ... } fn get_app_info<'life0, 'async_trait>( transport: &'life0 E ) -> Pin<Box<dyn Future<Output = Result<AppInfo, LedgerAppError<E::Error>>> + Send + 'async_trait>> where 'life0: 'async_trait { ... } fn get_version<'life0, 'async_trait>( transport: &'life0 E ) -> Pin<Box<dyn Future<Output = Result<Version, LedgerAppError<E::Error>>> + Send + 'async_trait>> where Self: Send + 'async_trait, 'life0: 'async_trait { ... } fn send_chunks<'life0, 'life1, 'async_trait, I>( transport: &'life0 E, command: APDUCommand<I>, message: &'life1 [u8] ) -> Pin<Box<dyn Future<Output = Result<APDUAnswer<E::AnswerType>, LedgerAppError<E::Error>>> + Send + 'async_trait>> where I: 'async_trait + Deref<Target = [u8]> + Send + Sync, Self: Send + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait { ... } }
Expand description

Common commands for any given APP

This trait is automatically implemented for any type that implements App

Provided Methods§

source

fn handle_response_error( response: &APDUAnswer<E::AnswerType> ) -> Result<(), LedgerAppError<E::Error>>

Handles the error response from APDU exchange.

§Arguments
  • response - The response from the APDU exchange.
§Returns

A result indicating success or containing a specific ledger application error.

source

fn handle_response_error_signature( response: &APDUAnswer<E::AnswerType> ) -> Result<(), LedgerAppError<E::Error>>

Handles the error response from APDU exchange.

§Arguments
  • response - The response from the APDU exchange.
§Returns

A result indicating success or containing a specific ledger application error.

source

fn get_device_info<'life0, 'async_trait>( transport: &'life0 E ) -> Pin<Box<dyn Future<Output = Result<DeviceInfo, LedgerAppError<E::Error>>> + Send + 'async_trait>>
where 'life0: 'async_trait,

Retrieve the device info

Works only in the dashboard

source

fn get_app_info<'life0, 'async_trait>( transport: &'life0 E ) -> Pin<Box<dyn Future<Output = Result<AppInfo, LedgerAppError<E::Error>>> + Send + 'async_trait>>
where 'life0: 'async_trait,

Retrieve the app info

Works only in app (TOOD: dashboard support)

source

fn get_version<'life0, 'async_trait>( transport: &'life0 E ) -> Pin<Box<dyn Future<Output = Result<Version, LedgerAppError<E::Error>>> + Send + 'async_trait>>
where Self: Send + 'async_trait, 'life0: 'async_trait,

Retrieve the app version

source

fn send_chunks<'life0, 'life1, 'async_trait, I>( transport: &'life0 E, command: APDUCommand<I>, message: &'life1 [u8] ) -> Pin<Box<dyn Future<Output = Result<APDUAnswer<E::AnswerType>, LedgerAppError<E::Error>>> + Send + 'async_trait>>
where I: 'async_trait + Deref<Target = [u8]> + Send + Sync, Self: Send + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Stream a long request in chunks, with an option to set P2 for all chunks. This method combines the functionality of sending chunks with or without P2 set for all chunks.

§Arguments
  • transport - The transport layer used for communication.
  • command - The initial APDU command.
  • message - The message to be sent in chunks.
  • set_p2_for_all - A boolean to determine if P2 should be set for all chunks.
§Returns

A result containing the final APDU answer or a ledger application error.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<T, E> AppExt<E> for T
where T: App, E: Exchange + Send + Sync, E::Error: Error,