Skip to content

Commit a4518fa

Browse files
committed
style: Update auth wallet ui
1 parent fe2230a commit a4518fa

File tree

3 files changed

+45
-1
lines changed

3 files changed

+45
-1
lines changed

apps/inheritance_app/inheritance_auth_wallet.c

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,13 @@
1919

2020
#include "bip39.h"
2121
#include "card_fetch_data.h"
22+
#include "constant_texts.h"
2223
#include "inheritance/core.pb.h"
2324
#include "inheritance_api.h"
2425
#include "inheritance_priv.h"
2526
#include "reconstruct_wallet_flow.h"
2627
#include "status_api.h"
28+
#include "ui_core_confirm.h"
2729
#include "ui_delay.h"
2830

2931
/*****************************************************************************
@@ -130,6 +132,44 @@ static bool verify_auth_wallet_inputs() {
130132
return true;
131133
}
132134

135+
static bool check_which_request(const inheritance_query_t *query,
136+
pb_size_t which_request) {
137+
if (which_request != query->encrypt.which_request) {
138+
inheritance_send_error(ERROR_COMMON_ERROR_CORRUPT_DATA_TAG,
139+
ERROR_DATA_FLOW_INVALID_REQUEST);
140+
return false;
141+
}
142+
143+
return true;
144+
}
145+
146+
STATIC bool auth_wallet_handle_inititate_query(inheritance_query_t *query) {
147+
char wallet_name[NAME_SIZE] = "";
148+
char msg[100] = "";
149+
150+
if (!check_which_request(
151+
query, INHERITANCE_ENCRYPT_DATA_WITH_PIN_REQUEST_INITIATE_TAG) ||
152+
!get_wallet_name_by_id(query->encrypt.initiate.wallet_id,
153+
(uint8_t *)wallet_name,
154+
inheritance_send_error)) {
155+
// TODO: update this for nominee
156+
return false;
157+
}
158+
159+
snprintf(msg,
160+
sizeof(msg),
161+
ui_text_inheritance_wallet_auth_flow_confirmation,
162+
wallet_name);
163+
164+
if (!core_confirmation(msg, inheritance_send_error)) {
165+
return false;
166+
}
167+
168+
// TODO: update flow status here
169+
170+
return true;
171+
}
172+
133173
static bool auth_wallet_get_entropy() {
134174
if (auth->do_seed_based) {
135175
uint8_t seed[SIZE_SEED] = {0};
@@ -298,7 +338,8 @@ void inheritance_auth_wallet(inheritance_query_t *query) {
298338
auth->do_wallet_based = query->auth_wallet.initiate.do_wallet_based;
299339

300340
set_app_flow_status(INHERITANCE_AUTH_WALLET_STATUS_INIT);
301-
if (verify_auth_wallet_inputs() && auth_wallet_get_entropy() &&
341+
if (verify_auth_wallet_inputs() &&
342+
auth_wallet_handle_inititate_query(query) && auth_wallet_get_entropy() &&
302343
auth_wallet_get_pairs() && auth_wallet_get_signature() && send_result()) {
303344
delay_scr_init(ui_text_inheritance_wallet_auth_success, DELAY_TIME);
304345
}

src/constant_texts.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -530,6 +530,8 @@ const char *ui_critical_card_health_migrate_data =
530530
// App specific
531531

532532
// Inheritance
533+
const char *ui_text_inheritance_wallet_auth_flow_confirmation =
534+
"Start %s wallet authentication?";
533535
const char *ui_text_inheritance_wallet_authenticating =
534536
"Wallet\nauthenticating...";
535537
const char *ui_text_inheritance_wallet_auth_success =

src/constant_texts.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,7 @@ extern const char *ui_critical_card_health_migrate_data;
374374
// App specific
375375

376376
// Inheritance
377+
extern const char *ui_text_inheritance_wallet_auth_flow_confirmation;
377378
extern const char *ui_text_inheritance_wallet_authenticating;
378379
extern const char *ui_text_inheritance_wallet_auth_success;
379380
extern const char *ui_text_inheritance_wallet_auth_fail;

0 commit comments

Comments
 (0)