mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-13 02:58:57 +00:00
reset/recovery: refactor last commit
This commit is contained in:
parent
14efc70f82
commit
3f1d7b09f1
@ -213,13 +213,6 @@ void fsm_msgResetDevice(const ResetDevice *msg)
|
||||
|
||||
CHECK_PARAM(!msg->has_strength || msg->strength == 128 || msg->strength == 192 || msg->strength == 256, _("Invalid seed strength"));
|
||||
|
||||
layoutDialogSwipe(&bmp_icon_question, _("Cancel"), _("Confirm"), NULL, _("Do you really want to"), _("create a new wallet?"), NULL, NULL, NULL, NULL);
|
||||
if (!protectButton(ButtonRequestType_ButtonRequest_ProtectCall, false)) {
|
||||
fsm_sendFailure(FailureType_Failure_ActionCancelled, NULL);
|
||||
layoutHome();
|
||||
return;
|
||||
}
|
||||
|
||||
reset_init(
|
||||
msg->has_display_random && msg->display_random,
|
||||
msg->has_strength ? msg->strength : 128,
|
||||
@ -357,15 +350,6 @@ void fsm_msgRecoveryDevice(const RecoveryDevice *msg)
|
||||
|
||||
CHECK_PARAM(!msg->has_word_count || msg->word_count == 12 || msg->word_count == 18 || msg->word_count == 24, _("Invalid word count"));
|
||||
|
||||
if (!dry_run) {
|
||||
layoutDialogSwipe(&bmp_icon_question, _("Cancel"), _("Confirm"), NULL, _("Do you really want to"), _("recover the device?"), NULL, NULL, NULL, NULL);
|
||||
if (!protectButton(ButtonRequestType_ButtonRequest_ProtectCall, false)) {
|
||||
fsm_sendFailure(FailureType_Failure_ActionCancelled, NULL);
|
||||
layoutHome();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
recovery_init(
|
||||
msg->has_word_count ? msg->word_count : 12,
|
||||
msg->has_passphrase_protection && msg->passphrase_protection,
|
||||
|
@ -456,6 +456,15 @@ void recovery_init(uint32_t _word_count, bool passphrase_protection, bool pin_pr
|
||||
enforce_wordlist = _enforce_wordlist;
|
||||
dry_run = _dry_run;
|
||||
|
||||
if (!dry_run) {
|
||||
layoutDialogSwipe(&bmp_icon_question, _("Cancel"), _("Confirm"), NULL, _("Do you really want to"), _("recover the device?"), NULL, NULL, NULL, NULL);
|
||||
if (!protectButton(ButtonRequestType_ButtonRequest_ProtectCall, false)) {
|
||||
fsm_sendFailure(FailureType_Failure_ActionCancelled, NULL);
|
||||
layoutHome();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (!dry_run) {
|
||||
if (pin_protection && !protectChangePin()) {
|
||||
fsm_sendFailure(FailureType_Failure_PinMismatch, NULL);
|
||||
|
@ -50,6 +50,13 @@ void reset_init(bool display_random, uint32_t _strength, bool passphrase_protect
|
||||
return;
|
||||
}
|
||||
|
||||
layoutDialogSwipe(&bmp_icon_question, _("Cancel"), _("Confirm"), NULL, _("Do you really want to"), _("create a new wallet?"), NULL, NULL, NULL, NULL);
|
||||
if (!protectButton(ButtonRequestType_ButtonRequest_ProtectCall, false)) {
|
||||
fsm_sendFailure(FailureType_Failure_ActionCancelled, NULL);
|
||||
layoutHome();
|
||||
return;
|
||||
}
|
||||
|
||||
random_buffer(int_entropy, 32);
|
||||
|
||||
char ent_str[4][17];
|
||||
|
Loading…
Reference in New Issue
Block a user