10
10
11
11
// Reuse the strings.common.fullAmount buffer for settings displaying.
12
12
// No risk of collision as this buffer is unused in the settings menu
13
- #define SETTING_VERBOSE_DOMAIN_NAME_STATE (strings.common.fullAmount + (BUF_INCREMENT * 0))
14
- #define SETTING_VERBOSE_EIP712_STATE (strings.common.fullAmount + (BUF_INCREMENT * 1))
13
+ #define SETTING_BLIND_SIGNING_STATE (strings.common.fullAmount + (BUF_INCREMENT * 0))
14
+ #define SETTING_VERBOSE_DOMAIN_NAME_STATE (strings.common.fullAmount + (BUF_INCREMENT * 1))
15
15
#define SETTING_DISPLAY_NONCE_STATE (strings.common.fullAmount + (BUF_INCREMENT * 2))
16
- #define SETTING_DISPLAY_DATA_STATE (strings.common.fullAmount + (BUF_INCREMENT * 3))
16
+ #define SETTING_VERBOSE_EIP712_STATE (strings.common.fullAmount + (BUF_INCREMENT * 3))
17
+ #define SETTING_DISPLAY_DATA_STATE (strings.common.fullAmount + (BUF_INCREMENT * 4))
17
18
18
19
#define BOOL_TO_STATE_STR (b ) (b ? ENABLED_STR : DISABLED_STR)
19
20
20
21
static void display_settings (const ux_flow_step_t * const start_step );
22
+ static void switch_settings_blind_signing (void );
23
+ #ifdef HAVE_DOMAIN_NAME
24
+ static void switch_settings_verbose_domain_name (void );
25
+ #endif // HAVE_DOMAIN_NAME
21
26
static void switch_settings_display_data (void );
22
27
static void switch_settings_display_nonce (void );
23
28
#ifdef HAVE_EIP712_FULL_SUPPORT
24
29
static void switch_settings_verbose_eip712 (void );
25
30
#endif // HAVE_EIP712_FULL_SUPPORT
26
- #ifdef HAVE_DOMAIN_NAME
27
- static void switch_settings_verbose_domain_name (void );
28
- #endif // HAVE_DOMAIN_NAME
29
31
30
32
//////////////////////////////////////////////////////////////////////
31
33
// clang-format off
@@ -70,6 +72,26 @@ UX_FLOW(ux_idle_flow,
70
72
FLOW_LOOP );
71
73
72
74
// clang-format off
75
+ UX_STEP_CB (
76
+ ux_settings_flow_blind_signing_step ,
77
+ #ifdef TARGET_NANOS
78
+ bnnn_paging ,
79
+ #else
80
+ bnnn ,
81
+ #endif
82
+ switch_settings_blind_signing (),
83
+ {
84
+ #ifdef TARGET_NANOS
85
+ .title = "Blind signing" ,
86
+ .text =
87
+ #else
88
+ "Blind signing" ,
89
+ "Enables transaction" ,
90
+ "blind signing" ,
91
+ #endif
92
+ SETTING_BLIND_SIGNING_STATE
93
+ });
94
+
73
95
#ifdef HAVE_DOMAIN_NAME
74
96
UX_STEP_CB (
75
97
ux_settings_flow_verbose_domain_name_step ,
@@ -83,19 +105,6 @@ UX_STEP_CB(
83
105
});
84
106
#endif // HAVE_DOMAIN_NAME
85
107
86
- #ifdef HAVE_EIP712_FULL_SUPPORT
87
- UX_STEP_CB (
88
- ux_settings_flow_verbose_eip712_step ,
89
- bnnn ,
90
- switch_settings_verbose_eip712 (),
91
- {
92
- "Raw messages" ,
93
- "Displays raw content" ,
94
- "from EIP712 messages" ,
95
- SETTING_VERBOSE_EIP712_STATE
96
- });
97
- #endif // HAVE_EIP712_FULL_SUPPORT
98
-
99
108
UX_STEP_CB (
100
109
ux_settings_flow_display_nonce_step ,
101
110
#ifdef TARGET_NANOS
@@ -116,6 +125,19 @@ UX_STEP_CB(
116
125
SETTING_DISPLAY_NONCE_STATE
117
126
});
118
127
128
+ #ifdef HAVE_EIP712_FULL_SUPPORT
129
+ UX_STEP_CB (
130
+ ux_settings_flow_verbose_eip712_step ,
131
+ bnnn ,
132
+ switch_settings_verbose_eip712 (),
133
+ {
134
+ "Raw messages" ,
135
+ "Displays raw content" ,
136
+ "from EIP712 messages" ,
137
+ SETTING_VERBOSE_EIP712_STATE
138
+ });
139
+ #endif // HAVE_EIP712_FULL_SUPPORT
140
+
119
141
UX_STEP_CB (
120
142
ux_settings_flow_display_data_step ,
121
143
#ifdef TARGET_NANOS
@@ -147,17 +169,19 @@ UX_STEP_CB(
147
169
// clang-format on
148
170
149
171
UX_FLOW (ux_settings_flow ,
172
+ & ux_settings_flow_blind_signing_step ,
150
173
#ifdef HAVE_DOMAIN_NAME
151
174
& ux_settings_flow_verbose_domain_name_step ,
152
175
#endif // HAVE_DOMAIN_NAME
176
+ & ux_settings_flow_display_nonce_step ,
153
177
#ifdef HAVE_EIP712_FULL_SUPPORT
154
178
& ux_settings_flow_verbose_eip712_step ,
155
179
#endif // HAVE_EIP712_FULL_SUPPORT
156
- & ux_settings_flow_display_nonce_step ,
157
180
& ux_settings_flow_display_data_step ,
158
181
& ux_settings_flow_back_step );
159
182
160
183
static void display_settings (const ux_flow_step_t * const start_step ) {
184
+ strlcpy (SETTING_BLIND_SIGNING_STATE , BOOL_TO_STATE_STR (N_storage .dataAllowed ), BUF_INCREMENT );
161
185
strlcpy (SETTING_DISPLAY_DATA_STATE ,
162
186
BOOL_TO_STATE_STR (N_storage .contractDetails ),
163
187
BUF_INCREMENT );
@@ -182,6 +206,10 @@ static void toggle_setting(volatile bool* setting, const ux_flow_step_t* ui_step
182
206
display_settings (ui_step );
183
207
}
184
208
209
+ static void switch_settings_blind_signing (void ) {
210
+ toggle_setting (& N_storage .dataAllowed , & ux_settings_flow_blind_signing_step );
211
+ }
212
+
185
213
static void switch_settings_display_data (void ) {
186
214
toggle_setting (& N_storage .contractDetails , & ux_settings_flow_display_data_step );
187
215
}
@@ -204,76 +232,46 @@ static void switch_settings_verbose_domain_name(void) {
204
232
205
233
//////////////////////////////////////////////////////////////////////
206
234
// clang-format off
207
- UX_STEP_NOCB (
208
- ux_blind_signing_warning_step ,
209
- pbb ,
210
- {
211
- & C_icon_warning ,
212
235
#ifdef TARGET_NANOS
213
- "Transaction" ,
214
- "not trusted" ,
215
- #else
216
- "This transaction" ,
217
- "cannot be trusted" ,
218
- #endif
219
- });
220
- #ifndef TARGET_NANOS
221
- UX_STEP_NOCB (
222
- ux_blind_signing_text1_step ,
223
- nnnn ,
236
+ UX_STEP_CB (
237
+ ux_error_blind_signing_step ,
238
+ bnnn_paging ,
239
+ ui_idle (),
224
240
{
225
- "Your Ledger cannot" ,
226
- "decode this" ,
227
- "transaction. If you" ,
228
- "sign it, you could" ,
241
+ "Error" ,
242
+ "Blind signing must be enabled in Settings" ,
229
243
});
230
- UX_STEP_NOCB (
231
- ux_blind_signing_text2_step ,
232
- nnnn ,
244
+ #else
245
+ UX_STEP_CB (
246
+ ux_error_blind_signing_step ,
247
+ pnn ,
248
+ ui_idle (),
233
249
{
234
- "be authorizing" ,
235
- "malicious actions" ,
236
- "that can drain your" ,
237
- "wallet." ,
250
+ & C_icon_crossmark ,
251
+ "Blind signing must be" ,
252
+ "enabled in Settings" ,
238
253
});
239
254
#endif
255
+
240
256
UX_STEP_NOCB (
241
- ux_blind_signing_link_step ,
242
- nn ,
243
- {
244
- "Learn more:" ,
245
- "ledger.com/e8" ,
246
- });
247
- UX_STEP_CB (
248
- ux_blind_signing_accept_step ,
257
+ ux_warning_blind_signing_warn_step ,
249
258
pbb ,
250
- start_signature_flow (),
251
259
{
252
- & C_icon_validate_14 ,
253
- #ifdef TARGET_NANOS
254
- "Accept risk" ,
255
- "and review" ,
256
- #else
257
- "Accept risk and" ,
258
- "review transaction" ,
259
- #endif
260
- });
261
- UX_STEP_CB (
262
- ux_blind_signing_reject_step ,
263
- pb ,
264
- report_finalize_error (),
265
- {
266
- & C_icon_crossmark ,
267
- "Reject" ,
260
+ & C_icon_warning ,
261
+ "Blind" ,
262
+ "signing" ,
268
263
});
264
+ UX_STEP_INIT (
265
+ ux_warning_blind_signing_jump_step ,
266
+ NULL ,
267
+ NULL ,
268
+ {
269
+ start_signature_flow ();
270
+ }
271
+ );
269
272
// clang-format on
270
273
271
- UX_FLOW (ux_blind_signing_flow ,
272
- & ux_blind_signing_warning_step ,
273
- #ifndef TARGET_NANOS
274
- & ux_blind_signing_text1_step ,
275
- & ux_blind_signing_text2_step ,
276
- #endif
277
- & ux_blind_signing_link_step ,
278
- & ux_blind_signing_accept_step ,
279
- & ux_blind_signing_reject_step );
274
+ UX_FLOW (ux_error_blind_signing_flow , & ux_error_blind_signing_step );
275
+ UX_FLOW (ux_warning_blind_signing_flow ,
276
+ & ux_warning_blind_signing_warn_step ,
277
+ & ux_warning_blind_signing_jump_step );
0 commit comments