1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-18 13:38:12 +00:00

chore(core): add an extra confirmation for non-1-of-1 Shamir backups

This commit is contained in:
Ioan Bizău 2024-04-24 18:03:24 +02:00 committed by Ioan Bizău
parent 4afe42a57e
commit 8ec9545b89
8 changed files with 38 additions and 5 deletions

View File

@ -397,6 +397,7 @@ static void _librust_qstrs(void) {
MP_QSTR_reset__check_share_title_template; MP_QSTR_reset__check_share_title_template;
MP_QSTR_reset__continue_with_next_share; MP_QSTR_reset__continue_with_next_share;
MP_QSTR_reset__continue_with_share_template; MP_QSTR_reset__continue_with_share_template;
MP_QSTR_reset__create_x_of_y_shamir_backup_template;
MP_QSTR_reset__finished_verifying_group_template; MP_QSTR_reset__finished_verifying_group_template;
MP_QSTR_reset__finished_verifying_seed; MP_QSTR_reset__finished_verifying_seed;
MP_QSTR_reset__finished_verifying_shares; MP_QSTR_reset__finished_verifying_shares;
@ -448,6 +449,7 @@ static void _librust_qstrs(void) {
MP_QSTR_reset__title_set_number_of_groups; MP_QSTR_reset__title_set_number_of_groups;
MP_QSTR_reset__title_set_number_of_shares; MP_QSTR_reset__title_set_number_of_shares;
MP_QSTR_reset__title_set_threshold; MP_QSTR_reset__title_set_threshold;
MP_QSTR_reset__title_shamir_backup;
MP_QSTR_reset__to_form_group_template; MP_QSTR_reset__to_form_group_template;
MP_QSTR_reset__tos_link; MP_QSTR_reset__tos_link;
MP_QSTR_reset__total_number_of_shares_in_group_template; MP_QSTR_reset__total_number_of_shares_in_group_template;

View File

@ -1237,6 +1237,8 @@ pub enum TranslatedString {
storage_msg__starting = 842, // "STARTING UP" storage_msg__starting = 842, // "STARTING UP"
storage_msg__verifying_pin = 843, // "VERIFYING PIN" storage_msg__verifying_pin = 843, // "VERIFYING PIN"
storage_msg__wrong_pin = 844, // "WRONG PIN" storage_msg__wrong_pin = 844, // "WRONG PIN"
reset__create_x_of_y_shamir_backup_template = 845, // "Do you want to create a {0} of {1} Shamir backup?"
reset__title_shamir_backup = 846, // "SHAMIR BACKUP"
} }
impl TranslatedString { impl TranslatedString {
@ -2469,6 +2471,8 @@ impl TranslatedString {
Self::storage_msg__starting => "STARTING UP", Self::storage_msg__starting => "STARTING UP",
Self::storage_msg__verifying_pin => "VERIFYING PIN", Self::storage_msg__verifying_pin => "VERIFYING PIN",
Self::storage_msg__wrong_pin => "WRONG PIN", Self::storage_msg__wrong_pin => "WRONG PIN",
Self::reset__create_x_of_y_shamir_backup_template => "Do you want to create a {0} of {1} Shamir backup?",
Self::reset__title_shamir_backup => "SHAMIR BACKUP",
} }
} }
@ -3702,6 +3706,8 @@ impl TranslatedString {
Qstr::MP_QSTR_storage_msg__starting => Some(Self::storage_msg__starting), Qstr::MP_QSTR_storage_msg__starting => Some(Self::storage_msg__starting),
Qstr::MP_QSTR_storage_msg__verifying_pin => Some(Self::storage_msg__verifying_pin), Qstr::MP_QSTR_storage_msg__verifying_pin => Some(Self::storage_msg__verifying_pin),
Qstr::MP_QSTR_storage_msg__wrong_pin => Some(Self::storage_msg__wrong_pin), Qstr::MP_QSTR_storage_msg__wrong_pin => Some(Self::storage_msg__wrong_pin),
Qstr::MP_QSTR_reset__create_x_of_y_shamir_backup_template => Some(Self::reset__create_x_of_y_shamir_backup_template),
Qstr::MP_QSTR_reset__title_shamir_backup => Some(Self::reset__title_shamir_backup),
_ => None, _ => None,
} }
} }

View File

@ -557,6 +557,7 @@ class TR:
reset__check_share_title_template: str = "CHECK SHARE #{0}" reset__check_share_title_template: str = "CHECK SHARE #{0}"
reset__continue_with_next_share: str = "Continue with the next share." reset__continue_with_next_share: str = "Continue with the next share."
reset__continue_with_share_template: str = "Continue with share #{0}." reset__continue_with_share_template: str = "Continue with share #{0}."
reset__create_x_of_y_shamir_backup_template: str = "Do you want to create a {0} of {1} Shamir backup?"
reset__finished_verifying_group_template: str = "You have finished verifying your recovery shares for group {0}." reset__finished_verifying_group_template: str = "You have finished verifying your recovery shares for group {0}."
reset__finished_verifying_seed: str = "You have finished verifying your recovery seed." reset__finished_verifying_seed: str = "You have finished verifying your recovery seed."
reset__finished_verifying_shares: str = "You have finished verifying your recovery shares." reset__finished_verifying_shares: str = "You have finished verifying your recovery shares."
@ -608,6 +609,7 @@ class TR:
reset__title_set_number_of_groups: str = "SET NUMBER OF GROUPS" reset__title_set_number_of_groups: str = "SET NUMBER OF GROUPS"
reset__title_set_number_of_shares: str = "SET NUMBER OF SHARES" reset__title_set_number_of_shares: str = "SET NUMBER OF SHARES"
reset__title_set_threshold: str = "SET THRESHOLD" reset__title_set_threshold: str = "SET THRESHOLD"
reset__title_shamir_backup: str = "SHAMIR BACKUP"
reset__to_form_group_template: str = "to form Group {0}." reset__to_form_group_template: str = "to form Group {0}."
reset__tos_link: str = "trezor.io/tos" reset__tos_link: str = "trezor.io/tos"
reset__total_number_of_shares_in_group_template: str = "Set the total number of shares in Group {0}." reset__total_number_of_shares_in_group_template: str = "Set the total number of shares in Group {0}."

View File

@ -167,7 +167,14 @@ async def backup_slip39_custom(
# for a single 1-of-1 group, we use the same layouts as for BIP39 # for a single 1-of-1 group, we use the same layouts as for BIP39
await layout.show_and_confirm_mnemonic(mnemonics[0][0]) await layout.show_and_confirm_mnemonic(mnemonics[0][0])
else: else:
# TODO: a confirmation screen will be shown: "do you want to create a -of- Shamir backup?" await confirm_action(
"warning_shamir_backup",
TR.reset__title_shamir_backup,
description=TR.reset__create_x_of_y_shamir_backup_template.format(
groups[0][0], groups[0][1]
),
verb=TR.buttons__continue,
)
if len(groups) == 1: if len(groups) == 1:
await layout.slip39_basic_show_and_confirm_shares(mnemonics[0]) await layout.slip39_basic_show_and_confirm_shares(mnemonics[0])
else: else:

View File

@ -559,6 +559,7 @@
"reset__check_share_title_template": "CHECK SHARE #{0}", "reset__check_share_title_template": "CHECK SHARE #{0}",
"reset__continue_with_next_share": "Continue with the next share.", "reset__continue_with_next_share": "Continue with the next share.",
"reset__continue_with_share_template": "Continue with share #{0}.", "reset__continue_with_share_template": "Continue with share #{0}.",
"reset__create_x_of_y_shamir_backup_template": "Do you want to create a {0} of {1} Shamir backup?",
"reset__finished_verifying_group_template": "You have finished verifying your recovery shares for group {0}.", "reset__finished_verifying_group_template": "You have finished verifying your recovery shares for group {0}.",
"reset__finished_verifying_seed": "You have finished verifying your recovery seed.", "reset__finished_verifying_seed": "You have finished verifying your recovery seed.",
"reset__finished_verifying_shares": "You have finished verifying your recovery shares.", "reset__finished_verifying_shares": "You have finished verifying your recovery shares.",
@ -610,6 +611,7 @@
"reset__title_set_number_of_groups": "SET NUMBER OF GROUPS", "reset__title_set_number_of_groups": "SET NUMBER OF GROUPS",
"reset__title_set_number_of_shares": "SET NUMBER OF SHARES", "reset__title_set_number_of_shares": "SET NUMBER OF SHARES",
"reset__title_set_threshold": "SET THRESHOLD", "reset__title_set_threshold": "SET THRESHOLD",
"reset__title_shamir_backup": "SHAMIR BACKUP",
"reset__to_form_group_template": "to form Group {0}.", "reset__to_form_group_template": "to form Group {0}.",
"reset__tos_link": "trezor.io/tos", "reset__tos_link": "trezor.io/tos",
"reset__total_number_of_shares_in_group_template": "Set the total number of shares in Group {0}.", "reset__total_number_of_shares_in_group_template": "Set the total number of shares in Group {0}.",

View File

@ -843,5 +843,7 @@
"841": "ethereum__staking_unstake_intro", "841": "ethereum__staking_unstake_intro",
"842": "storage_msg__starting", "842": "storage_msg__starting",
"843": "storage_msg__verifying_pin", "843": "storage_msg__verifying_pin",
"844": "storage_msg__wrong_pin" "844": "storage_msg__wrong_pin",
"845": "reset__create_x_of_y_shamir_backup_template",
"846": "reset__title_shamir_backup"
} }

View File

@ -1,8 +1,8 @@
{ {
"current": { "current": {
"merkle_root": "83f62541670df59f347bfdf577f36c1ef504f769fd8a498c0f76aa78f9021cda", "merkle_root": "fe1f2942f8723f3f65fe7972de93e1dcdd214cc14be8251c44b7047808c10e11",
"datetime": "2024-03-30T11:28:31.004037", "datetime": "2024-04-24T15:46:21.632186",
"commit": "1c36c0927c33fd05b4eff4b3a020940e33074b54" "commit": "c52db3a8deae36eb2becc96f4917ea7164656f76"
}, },
"history": [ "history": [
{ {

View File

@ -1390,6 +1390,10 @@ class InputFlowSlip39CustomBackup(InputFlowBase):
self.share_count = share_count self.share_count = share_count
def input_flow_tt(self) -> BRGeneratorType: def input_flow_tt(self) -> BRGeneratorType:
if self.share_count > 1:
yield # Checklist
self.debug.press_yes()
yield # Confirm show seeds yield # Confirm show seeds
self.debug.press_yes() self.debug.press_yes()
@ -1401,6 +1405,10 @@ class InputFlowSlip39CustomBackup(InputFlowBase):
self.debug.press_yes() self.debug.press_yes()
def input_flow_tr(self) -> BRGeneratorType: def input_flow_tr(self) -> BRGeneratorType:
if self.share_count > 1:
yield # Checklist
self.debug.press_yes()
yield # Confirm show seeds yield # Confirm show seeds
self.debug.press_yes() self.debug.press_yes()
@ -1412,6 +1420,10 @@ class InputFlowSlip39CustomBackup(InputFlowBase):
self.debug.press_yes() self.debug.press_yes()
def input_flow_t3t1(self) -> BRGeneratorType: def input_flow_t3t1(self) -> BRGeneratorType:
if self.share_count > 1:
yield # Checklist
self.debug.press_yes()
yield # Confirm show seeds yield # Confirm show seeds
self.debug.press_yes() self.debug.press_yes()