Skip to content

Commit

Permalink
Changes to the blind-signing flow, now hides the amount but shows the…
Browse files Browse the repository at this point in the history
… TX hash
  • Loading branch information
apaillier-ledger committed Dec 11, 2024
1 parent ca54030 commit 22004b2
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 4 deletions.
24 changes: 23 additions & 1 deletion src_bagl/ui_flow_signTx.c
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,16 @@ UX_STEP_NOCB(ux_approval_review_step,
"Review",
"transaction",
});
UX_STEP_NOCB(ux_approval_tx_hash_step,
bnnn_paging,
{
#ifdef TARGET_NANOS
.title = "TX hash",
#else
.title = "Transaction hash",
#endif
.text = strings.common.fullAmount
});
UX_STEP_NOCB(
ux_approval_amount_step,
bnnn_paging,
Expand Down Expand Up @@ -237,11 +247,23 @@ void ux_approve_tx(bool fromPlugin) {
ux_approval_tx_flow[step++] = &ux_plugin_approval_display_step;
ux_approval_tx_flow[step++] = &ux_plugin_approval_after_step;
} else {
if (tmpContent.txContent.dataPresent) {
#pragma GCC diagnostic ignored "-Wformat"
snprintf(strings.common.fullAmount,
sizeof(strings.common.fullAmount),
"0x%.*h",
sizeof(tmpCtx.transactionContext.hash),
tmpCtx.transactionContext.hash);
#pragma GCC diagnostic warning "-Wformat"
ux_approval_tx_flow[step++] = &ux_approval_tx_hash_step;
}
// We're in a regular transaction, just show the amount and the address
if (strings.common.fromAddress[0] != 0) {
ux_approval_tx_flow[step++] = &ux_approval_from_step;
}
ux_approval_tx_flow[step++] = &ux_approval_amount_step;
if (!tmpContent.txContent.dataPresent) {
ux_approval_tx_flow[step++] = &ux_approval_amount_step;
}
#ifdef HAVE_TRUSTED_NAME
uint64_t chain_id = get_tx_chain_id();
e_name_type type = TYPE_ACCOUNT;
Expand Down
21 changes: 18 additions & 3 deletions src_nbgl/ui_approve_tx.c
Original file line number Diff line number Diff line change
Expand Up @@ -120,15 +120,30 @@ static uint8_t setTagValuePairs(void) {
pairs[nbPairs].value = strings.common.maxFee;
nbPairs++;
} else {
if (tmpContent.txContent.dataPresent) {
#pragma GCC diagnostic ignored "-Wformat"
snprintf(strings.common.fullAmount,
sizeof(strings.common.fullAmount),
"0x%.*h",
sizeof(tmpCtx.transactionContext.hash),
tmpCtx.transactionContext.hash);
#pragma GCC diagnostic warning "-Wformat"
pairs[nbPairs].item = "Transaction hash";
pairs[nbPairs].value = strings.common.fullAmount;
nbPairs++;
}

if (strings.common.fromAddress[0] != 0) {
pairs[nbPairs].item = "From";
pairs[nbPairs].value = strings.common.fromAddress;
nbPairs++;
}

pairs[nbPairs].item = "Amount";
pairs[nbPairs].value = strings.common.fullAmount;
nbPairs++;
if (!tmpContent.txContent.dataPresent) {
pairs[nbPairs].item = "Amount";
pairs[nbPairs].value = strings.common.fullAmount;
nbPairs++;
}

#ifdef HAVE_TRUSTED_NAME
uint64_t chain_id = get_tx_chain_id();
Expand Down

0 comments on commit 22004b2

Please sign in to comment.