pub struct LedgerSigner<T = Ledger> { /* private fields */ }Expand description
Ledger app wrapper that implements the Signer trait.
Implementations§
Source§impl LedgerSigner
impl LedgerSigner
Sourcepub async fn new(
derivation_path: DerivationPath,
) -> Result<LedgerSigner, LedgerError>
pub async fn new( derivation_path: DerivationPath, ) -> Result<LedgerSigner, LedgerError>
Initializes the Starknet Ledger app. Attempts to find and connect to a Ledger device. The device must be unlocked and have the Starknet app open.
The derivation_path passed in must follow EIP-2645, i.e. having 2645' as its “purpose”
level as per BIP-44, as the Ledger app does not allow other paths to be used.
The path must also be 6-level in length. An example path for Starknet would be:
m/2645'/1195502025'/1470455285'/0'/0'/0
where:
2645'is the EIP-2645 prefix1195502025', decimal for0x4741e9c9, is the 31 lowest bits forsha256(starknet)1470455285', decimal for0x57a55df5, is the 31 lowest bits forsha256(starkli)
Currently, the Ledger app only enforces the length and the first level of the path.
Source§impl<T> LedgerSigner<T>
impl<T> LedgerSigner<T>
Sourcepub fn new_with_app(
derivation_path: DerivationPath,
app: LedgerStarknetApp<T>,
) -> Result<LedgerSigner<T>, LedgerError>
pub fn new_with_app( derivation_path: DerivationPath, app: LedgerStarknetApp<T>, ) -> Result<LedgerSigner<T>, LedgerError>
Creates a Starknet Ledger signer with an already initialized Ledger app.
The derivation_path passed in must follow EIP-2645, i.e. having 2645' as its “purpose”
level as per BIP-44, as the Ledger app does not allow other paths to be used.
The path must also be 6-level in length. An example path for Starknet would be:
m/2645'/1195502025'/1470455285'/0'/0'/0
where:
2645'is the EIP-2645 prefix1195502025', decimal for0x4741e9c9, is the 31 lowest bits forsha256(starknet)1470455285', decimal for0x57a55df5, is the 31 lowest bits forsha256(starkli)
Currently, the Ledger app only enforces the length and the first level of the path.
Trait Implementations§
Source§impl<T> Debug for LedgerSigner<T>where
T: Debug,
impl<T> Debug for LedgerSigner<T>where
T: Debug,
Source§impl<T> Signer for LedgerSigner<T>where
T: LedgerAsync + Sync,
impl<T> Signer for LedgerSigner<T>where
T: LedgerAsync + Sync,
Source§type GetPublicKeyError = LedgerError
type GetPublicKeyError = LedgerError
get_public_key.Source§type SignError = LedgerError
type SignError = LedgerError
sign.Source§fn get_public_key<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<VerifyingKey, <LedgerSigner<T> as Signer>::GetPublicKeyError>> + Send + 'async_trait>>where
'life0: 'async_trait,
LedgerSigner<T>: 'async_trait,
fn get_public_key<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<VerifyingKey, <LedgerSigner<T> as Signer>::GetPublicKeyError>> + Send + 'async_trait>>where
'life0: 'async_trait,
LedgerSigner<T>: 'async_trait,
Source§fn sign_hash<'life0, 'life1, 'async_trait>(
&'life0 self,
hash: &'life1 Felt,
) -> Pin<Box<dyn Future<Output = Result<Signature, <LedgerSigner<T> as Signer>::SignError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
LedgerSigner<T>: 'async_trait,
fn sign_hash<'life0, 'life1, 'async_trait>(
&'life0 self,
hash: &'life1 Felt,
) -> Pin<Box<dyn Future<Output = Result<Signature, <LedgerSigner<T> as Signer>::SignError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
LedgerSigner<T>: 'async_trait,
Source§fn is_interactive(&self, _context: SignerInteractivityContext<'_>) -> bool
fn is_interactive(&self, _context: SignerInteractivityContext<'_>) -> bool
true if the signing operation is very expensive, even if not
strictly “interactive” as in requiring human input. Read more