diff --git a/src/ui/nbgl_hash.c b/src/ui/nbgl_hash.c index 527281d8..8d583371 100644 --- a/src/ui/nbgl_hash.c +++ b/src/ui/nbgl_hash.c @@ -39,15 +39,12 @@ static void ui_action_validate_transaction(bool choice) { // Globals static char str_values[TAG_VAL_LST_PAIR_NB][DETAIL_VALUE_MAX_LENGTH]; -static nbgl_pageInfoLongPress_t info_long_press; static nbgl_layoutTagValue_t caption_value_pairs[TAG_VAL_LST_PAIR_NB]; static nbgl_layoutTagValueList_t pair_list; // Static functions declarations static void review_start(void); -static void review_continue(void); -static void reject_confirmation(void); -static void reject_choice(void); +static void review_choice(bool confirm); static void warning_choice2(bool confirm); static void warning_choice1(bool confirm); @@ -63,50 +60,31 @@ static void prepare_page(void) { return; } caption_value_pairs[0].value = str_values[0]; -} - -static void reject_confirmation(void) { - nbgl_useCaseStatus("Hash rejected", false, ui_menu_main); - ui_action_validate_transaction(false); -} -static void reject_choice(void) { - nbgl_useCaseConfirm("Reject hash?", - NULL, - "Yes, reject", - "Go back to hash", - reject_confirmation); + pair_list.pairs = caption_value_pairs; + pair_list.nbPairs = TAG_VAL_LST_PAIR_NB; } static void review_choice(bool confirm) { + // Answer, display a status page and go back to main if (confirm) { nbgl_useCaseStatus("Hash signed", true, ui_menu_main); - ui_action_validate_transaction(true); } else { - reject_choice(); + nbgl_useCaseStatus("Hash rejected", false, ui_menu_main); } + validate_transaction(confirm); } static void review_start(void) { - nbgl_useCaseReviewStart(&C_icon_stellar_64px, - "Review hash signing", - NULL, - "Reject hash", - review_continue, - reject_choice); -} - -static void review_continue(void) { - pair_list.pairs = caption_value_pairs; - pair_list.nbPairs = TAG_VAL_LST_PAIR_NB; - - info_long_press.text = "Sign hash?"; - info_long_press.icon = &C_icon_stellar_64px; - info_long_press.longPressText = "Hold to sign"; - info_long_press.longPressToken = 0; - info_long_press.tuneId = TUNE_TAP_CASUAL; - - nbgl_useCaseStaticReview(&pair_list, &info_long_press, "Reject hash", review_choice); + nbgl_operationType_t op_type = TYPE_TRANSACTION; + op_type |= BLIND_OPERATION; + nbgl_useCaseReview(op_type, + &pair_list, + &C_icon_stellar_64px, + "Review hash signing", + NULL, + "Sign hash?", + review_choice); } static void warning_choice2(bool confirm) { @@ -125,10 +103,10 @@ static void warning_choice1(bool confirm) { NULL, "The hash cannot be trusted", "Your Ledger cannot verify the integrity of this hash. If you sign it, you could be " - "authorizing malicious actions that can drain your wallet.\n\nLearn more: " + "authorizing malicious actions that can drain your wallet.\nLearn more: " "ledger.com/e8", "I accept the risk", - "Reject transaction", + "Reject hash", warning_choice2); } } diff --git a/src/ui/nbgl_transaction.c b/src/ui/nbgl_transaction.c index 3aefeb4b..eaee1962 100644 --- a/src/ui/nbgl_transaction.c +++ b/src/ui/nbgl_transaction.c @@ -374,7 +374,7 @@ static void warning_choice_tx1(bool confirm) { NULL, "The transaction cannot be trusted", "Unverified contracts may not be displayed in a readable form on your Ledger, so you " - "need to examine them very carefully before sign them.", + "need to examine them very carefully before sign them.\nLearn more: ledger.com/e8", "I accept the risk", "Reject transaction", warning_choice_tx2); @@ -398,9 +398,9 @@ static void warning_choice_auth1(bool confirm) { NULL, "The Soroban Authorization cannot be trusted", "Unverified contracts may not be displayed in a readable form on your Ledger, so you " - "need to examine them very carefully before sign them.", + "need to examine them very carefully before sign them.\nLearn more: ledger.com/e8", "I accept the risk", - "Reject transaction", + "Reject Soroban Auth", warning_choice_auth2); } } diff --git a/tests_zemu/snapshots/flex-hash-signing-approve/00000.png b/tests_zemu/snapshots/flex-hash-signing-approve/00000.png new file mode 100644 index 00000000..f575d8fd Binary files /dev/null and b/tests_zemu/snapshots/flex-hash-signing-approve/00000.png differ diff --git a/tests_zemu/snapshots/flex-hash-signing-approve/00001.png b/tests_zemu/snapshots/flex-hash-signing-approve/00001.png new file mode 100644 index 00000000..4c81819a Binary files /dev/null and b/tests_zemu/snapshots/flex-hash-signing-approve/00001.png differ diff --git a/tests_zemu/snapshots/flex-hash-signing-approve/00002.png b/tests_zemu/snapshots/flex-hash-signing-approve/00002.png new file mode 100644 index 00000000..09197a71 Binary files /dev/null and b/tests_zemu/snapshots/flex-hash-signing-approve/00002.png differ diff --git a/tests_zemu/snapshots/flex-hash-signing-approve/00003.png b/tests_zemu/snapshots/flex-hash-signing-approve/00003.png new file mode 100644 index 00000000..4f91dfce Binary files /dev/null and b/tests_zemu/snapshots/flex-hash-signing-approve/00003.png differ diff --git a/tests_zemu/snapshots/flex-hash-signing-reject/00000.png b/tests_zemu/snapshots/flex-hash-signing-reject/00000.png new file mode 100644 index 00000000..f575d8fd Binary files /dev/null and b/tests_zemu/snapshots/flex-hash-signing-reject/00000.png differ diff --git a/tests_zemu/snapshots/flex-hash-signing-reject/00001.png b/tests_zemu/snapshots/flex-hash-signing-reject/00001.png new file mode 100644 index 00000000..4c81819a Binary files /dev/null and b/tests_zemu/snapshots/flex-hash-signing-reject/00001.png differ diff --git a/tests_zemu/snapshots/flex-hash-signing-reject/00002.png b/tests_zemu/snapshots/flex-hash-signing-reject/00002.png new file mode 100644 index 00000000..09197a71 Binary files /dev/null and b/tests_zemu/snapshots/flex-hash-signing-reject/00002.png differ diff --git a/tests_zemu/snapshots/flex-hash-signing-reject/00003.png b/tests_zemu/snapshots/flex-hash-signing-reject/00003.png new file mode 100644 index 00000000..6a11e118 Binary files /dev/null and b/tests_zemu/snapshots/flex-hash-signing-reject/00003.png differ diff --git a/tests_zemu/snapshots/stax-hash-signing-approve/00000.png b/tests_zemu/snapshots/stax-hash-signing-approve/00000.png index c08a6203..af953b9a 100644 Binary files a/tests_zemu/snapshots/stax-hash-signing-approve/00000.png and b/tests_zemu/snapshots/stax-hash-signing-approve/00000.png differ diff --git a/tests_zemu/snapshots/stax-hash-signing-approve/00001.png b/tests_zemu/snapshots/stax-hash-signing-approve/00001.png index 7d64d406..73878500 100644 Binary files a/tests_zemu/snapshots/stax-hash-signing-approve/00001.png and b/tests_zemu/snapshots/stax-hash-signing-approve/00001.png differ diff --git a/tests_zemu/snapshots/stax-hash-signing-approve/00002.png b/tests_zemu/snapshots/stax-hash-signing-approve/00002.png index b1f95b29..591d9031 100644 Binary files a/tests_zemu/snapshots/stax-hash-signing-approve/00002.png and b/tests_zemu/snapshots/stax-hash-signing-approve/00002.png differ diff --git a/tests_zemu/snapshots/stax-hash-signing-reject/00000.png b/tests_zemu/snapshots/stax-hash-signing-reject/00000.png index c08a6203..af953b9a 100644 Binary files a/tests_zemu/snapshots/stax-hash-signing-reject/00000.png and b/tests_zemu/snapshots/stax-hash-signing-reject/00000.png differ diff --git a/tests_zemu/snapshots/stax-hash-signing-reject/00001.png b/tests_zemu/snapshots/stax-hash-signing-reject/00001.png index 7d64d406..73878500 100644 Binary files a/tests_zemu/snapshots/stax-hash-signing-reject/00001.png and b/tests_zemu/snapshots/stax-hash-signing-reject/00001.png differ diff --git a/tests_zemu/snapshots/stax-hash-signing-reject/00002.png b/tests_zemu/snapshots/stax-hash-signing-reject/00002.png index b1f95b29..591d9031 100644 Binary files a/tests_zemu/snapshots/stax-hash-signing-reject/00002.png and b/tests_zemu/snapshots/stax-hash-signing-reject/00002.png differ diff --git a/tests_zemu/snapshots/stax-hash-signing-reject/00003.png b/tests_zemu/snapshots/stax-hash-signing-reject/00003.png index dbffb392..abc9677f 100644 Binary files a/tests_zemu/snapshots/stax-hash-signing-reject/00003.png and b/tests_zemu/snapshots/stax-hash-signing-reject/00003.png differ diff --git a/tests_zemu/tests/main.test.ts b/tests_zemu/tests/main.test.ts index 35f76f79..a2c0ce64 100644 --- a/tests_zemu/tests/main.test.ts +++ b/tests_zemu/tests/main.test.ts @@ -89,7 +89,7 @@ describe("get public key", () => { describe("hash signing", () => { // TODO: skip for now, see https://github.com/LedgerHQ/ledger-secure-sdk/issues/737 - test.concurrent.each(models.filter(({ dev }) => dev.name !== "flex" && dev.name !== "stax"))("approve ($dev.name)", async ({ dev, startText }) => { + test.concurrent.each(models)("approve ($dev.name)", async ({ dev, startText }) => { const sim = new Zemu(dev.path); const testCaseName = `${dev.prefix.toLowerCase()}-hash-signing-approve`; try { @@ -115,7 +115,7 @@ describe("hash signing", () => { }); // TODO: skip for now, see https://github.com/LedgerHQ/ledger-secure-sdk/issues/737 - test.concurrent.each(models.filter(({ dev }) => dev.name !== "flex" && dev.name !== "stax"))("reject ($dev.name)", async ({ dev, startText }) => { + test.concurrent.each(models)("reject ($dev.name)", async ({ dev, startText }) => { const sim = new Zemu(dev.path); const testCaseName = `${dev.prefix.toLowerCase()}-hash-signing-reject`; try {