From 4a6926d8ff0d5f371291472efee05cb1fcccd761 Mon Sep 17 00:00:00 2001 From: Thoralf-M <46689931+Thoralf-M@users.noreply.github.com> Date: Thu, 5 Sep 2024 11:00:57 +0200 Subject: [PATCH] Revert "fix!: don't display sender address as it would crash the app" (#19) * Revert "fix!: don't display sender address as it would crash the app" This reverts commit 2d801488c28526973790f3a57d7763eb87ea5e07. * Update test --------- Co-authored-by: Thibault Martinez --- rust-app/src/implementation.rs | 21 +++++++++++++++++++++ ts-tests/signing-tests.ts | 5 +++++ 2 files changed, 26 insertions(+) diff --git a/rust-app/src/implementation.rs b/rust-app/src/implementation.rs index e832d8e..32564d1 100644 --- a/rust-app/src/implementation.rs +++ b/rust-app/src/implementation.rs @@ -716,6 +716,27 @@ pub async fn sign_apdu(io: HostIO, settings: Settings) { if scroller("Transfer", |w| Ok(write!(w, "IOTA")?)).is_none() { reject::<()>(StatusWords::UserCancelled as u16).await; }; + { + let mut bs = input[1].clone(); + NoinlineFut(async move { + let path = BIP_PATH_PARSER.parse(&mut bs).await; + if !is_bip_prefix_valid(&path) { + reject::<()>(SyscallError::InvalidParameter as u16).await; + } + if with_public_keys(&path, true, |_, address: &IotaPubKeyAddress| { + try_option(|| -> Option<()> { + scroller_paginated("From", |w| Ok(write!(w, "{address}")?))?; + Some(()) + }()) + }) + .ok() + .is_none() + { + reject::<()>(StatusWords::UserCancelled as u16).await; + } + }) + .await + }; { let mut txn = input[0].clone(); diff --git a/ts-tests/signing-tests.ts b/ts-tests/signing-tests.ts index 776b33b..80f9bab 100644 --- a/ts-tests/signing-tests.ts +++ b/ts-tests/signing-tests.ts @@ -46,6 +46,11 @@ describe("Signing tests", function () { "header": "Transfer", "prompt": "", }, + { + "header": "From", + "prompt": "0x1b3669e321893ee49c387a08fc251dbfff37cd2a981e6c473a5b2afde19d363e", + "paginate": true + }, { "header": "To", "prompt": "0x4f2370b2a4810ad6c8e1cfd92cc8c8818fef8f59e3a80cea17871f78d850ba4b",