This repository has been archived by the owner on Aug 22, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from dj8yfo/get_pub_key_get_wallet_id
feat: `display` p1 flag in `INS_GET_PUBLIC_KEY`, add `INS_GET_WALLET_ID`
- Loading branch information
Showing
8 changed files
with
93 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
use crate::app_ui::address; | ||
use crate::utils::crypto; | ||
use crate::AppSW; | ||
use ledger_device_sdk::io::Comm; | ||
|
||
|
||
pub fn handler(comm: &mut Comm) -> Result<(), AppSW> { | ||
let data = comm.get_data().map_err(|_| AppSW::WrongApduLength)?; | ||
let path = crypto::PathBip32::parse(data).map_err(|_| AppSW::Bip32PathParsingFail)?; | ||
|
||
#[cfg(feature = "speculos")] | ||
path.debug_print(); | ||
|
||
let pk = crypto::bip32_derive(&path.0) | ||
.public_key() | ||
.map_err(|_| AppSW::KeyDeriveFail)?; | ||
|
||
let pk = crypto::PublicKeyBe::from_little_endian(pk); | ||
|
||
#[cfg(feature = "speculos")] | ||
pk.debug_print()?; | ||
|
||
if !address::ui_display_hex(&pk)? { | ||
return Err(AppSW::Deny); | ||
} | ||
|
||
comm.append(&pk.0); | ||
|
||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters