mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-23 23:08:14 +00:00
core/slip39: modify wording on success screen
This commit is contained in:
parent
f78e75bc38
commit
5aa592a69a
@ -17,6 +17,8 @@ TYPES_WORD_COUNT = {12: bip39, 18: bip39, 24: bip39, 20: slip39, 33: slip39}
|
||||
def get() -> (bytes, int):
|
||||
mnemonic_secret = storage.get_mnemonic_secret()
|
||||
mnemonic_type = storage.get_mnemonic_type() or TYPE_BIP39
|
||||
if mnemonic_type not in (TYPE_BIP39, TYPE_SLIP39):
|
||||
raise RuntimeError("Invalid mnemonic type")
|
||||
return mnemonic_secret, mnemonic_type
|
||||
|
||||
|
||||
|
@ -12,18 +12,19 @@ async def backup_device(ctx, msg):
|
||||
if not storage.needs_backup():
|
||||
raise wire.ProcessError("Seed already backed up")
|
||||
|
||||
mnemonic_secret, mnemonic_type = mnemonic.get()
|
||||
slip39 = mnemonic_type == mnemonic.TYPE_SLIP39
|
||||
|
||||
# warn user about mnemonic safety
|
||||
await layout.show_backup_warning(ctx, "Back up your seed", "I understand")
|
||||
await layout.show_backup_warning(ctx, "Back up your seed", "I understand", slip39)
|
||||
|
||||
storage.set_unfinished_backup(True)
|
||||
storage.set_backed_up()
|
||||
|
||||
mnemonic_secret, mnemonic_type = mnemonic.get()
|
||||
if mnemonic_type == mnemonic.TYPE_BIP39:
|
||||
await layout.bip39_show_and_confirm_mnemonic(ctx, mnemonic_secret.decode())
|
||||
|
||||
elif mnemonic_type == mnemonic.TYPE_SLIP39:
|
||||
if slip39:
|
||||
await backup_slip39_wallet(ctx, mnemonic_secret)
|
||||
else:
|
||||
await layout.bip39_show_and_confirm_mnemonic(ctx, mnemonic_secret.decode())
|
||||
|
||||
storage.set_unfinished_backup(False)
|
||||
|
||||
|
@ -129,11 +129,16 @@ async def _confirm_word(ctx, share_index, numbered_share_words):
|
||||
return selected_word == checked_word
|
||||
|
||||
|
||||
async def _show_confirmation_success(ctx, share_index, num_of_shares=None):
|
||||
async def _show_confirmation_success(
|
||||
ctx, share_index, num_of_shares=None, slip39=False
|
||||
):
|
||||
if share_index is None or num_of_shares is None or share_index == num_of_shares - 1:
|
||||
text = Text("Recovery seed", ui.ICON_RESET)
|
||||
text.bold("You finished verifying")
|
||||
text.bold("your recovery shares.")
|
||||
if slip39:
|
||||
text.bold("your recovery shares.")
|
||||
else:
|
||||
text.bold("your recovery seed.")
|
||||
else:
|
||||
text = Text("Recovery share #%s" % (share_index + 1), ui.ICON_RESET)
|
||||
text.bold("Recovery share #%s" % (share_index + 1))
|
||||
@ -344,7 +349,9 @@ async def slip39_show_and_confirm_shares(ctx, shares):
|
||||
|
||||
# make the user confirm 2 words from the share
|
||||
if await _confirm_share_words(ctx, index, share_words):
|
||||
await _show_confirmation_success(ctx, index, len(shares))
|
||||
await _show_confirmation_success(
|
||||
ctx, index, num_of_shares=len(shares), slip39=True
|
||||
)
|
||||
break # this share is confirmed, go to next one
|
||||
else:
|
||||
await _show_confirmation_failure(ctx, index)
|
||||
|
Loading…
Reference in New Issue
Block a user