New blind-signing flow for LNSP/LNX

This commit is contained in:
Alexandre Paillier
2024-06-21 11:49:42 +02:00
parent fbd913bc33
commit 4770b55f46
10 changed files with 106 additions and 69 deletions

View File

@@ -13,7 +13,7 @@ void ui_idle(void) {
}
void ui_warning_contract_data(void) {
ux_flow_init(0, ux_warning_contract_data_flow, NULL);
ux_flow_init(0, ux_blind_signing_flow, NULL);
}
void ui_display_public_eth2(void) {

View File

@@ -2,6 +2,7 @@
#include "ui_callbacks.h"
#include "common_ui.h"
#include "common_utils.h"
#include "feature_signTx.h"
#define ENABLED_STR "Enabled"
#define DISABLED_STR "Disabled"
@@ -214,16 +215,63 @@ UX_STEP_CB(
"Blind signing must be enabled in Settings",
});
#else
UX_STEP_NOCB(
ux_blind_signing_warning_step,
pbb,
{
&C_icon_warning,
"This transaction",
"cannot be trusted",
});
UX_STEP_NOCB(
ux_blind_signing_text1_step,
nnnn,
{
"Your Ledger cannot",
"decode this",
"transaction. If you",
"sign it, you could",
});
UX_STEP_NOCB(
ux_blind_signing_text2_step,
nnnn,
{
"be authorizing",
"malicious actions",
"that can drain your",
"wallet.",
});
UX_STEP_NOCB(
ux_blind_signing_link_step,
nn,
{
"Learn more:",
"ledger.com/e8",
});
UX_STEP_CB(
ux_warning_contract_data_step,
pnn,
ui_idle(),
ux_blind_signing_accept_step,
pbb,
start_signature_flow(),
{
&C_icon_validate_14,
"Accept risk and",
"review transaction",
});
UX_STEP_CB(
ux_blind_signing_reject_step,
pb,
report_finalize_error(),
{
&C_icon_crossmark,
"Blind signing must be",
"enabled in Settings",
"Reject",
});
#endif
// clang-format on
UX_FLOW(ux_warning_contract_data_flow, &ux_warning_contract_data_step);
UX_FLOW(ux_blind_signing_flow,
&ux_blind_signing_warning_step,
&ux_blind_signing_text1_step,
&ux_blind_signing_text2_step,
&ux_blind_signing_link_step,
&ux_blind_signing_accept_step,
&ux_blind_signing_reject_step);

View File

@@ -8,7 +8,7 @@
extern const ux_flow_step_t* const ux_idle_flow[];
extern const ux_flow_step_t* const ux_warning_contract_data_flow[];
extern const ux_flow_step_t* const ux_blind_signing_flow[];
extern const ux_flow_step_t* const ux_settings_flow[];

View File

@@ -199,12 +199,12 @@ UX_STEP_NOCB(
.text = strings.common.nonce,
});
UX_STEP_NOCB(ux_approval_blind_signing_warning_step,
UX_STEP_NOCB(ux_approval_blind_signing_reminder_step,
pbb,
{
&C_icon_warning,
"Blind",
"Signing",
"You accepted",
"the risks",
});
// clang-format on
@@ -214,10 +214,6 @@ void ux_approve_tx(bool fromPlugin) {
int step = 0;
ux_approval_tx_flow[step++] = &ux_approval_review_step;
if (!fromPlugin && tmpContent.txContent.dataPresent && !N_storage.contractDetails) {
ux_approval_tx_flow[step++] = &ux_approval_blind_signing_warning_step;
}
if (fromPlugin) {
// Add the special dynamic display logic
ux_approval_tx_flow[step++] = &ux_plugin_approval_id_step;
@@ -260,6 +256,9 @@ void ux_approve_tx(bool fromPlugin) {
}
ux_approval_tx_flow[step++] = &ux_approval_fees_step;
if (!fromPlugin && tmpContent.txContent.dataPresent && !N_storage.contractDetails) {
ux_approval_tx_flow[step++] = &ux_approval_blind_signing_reminder_step;
}
ux_approval_tx_flow[step++] = &ux_approval_accept_step;
ux_approval_tx_flow[step++] = &ux_approval_reject_step;
ux_approval_tx_flow[step++] = FLOW_END_STEP;