Skip to content

Commit

Permalink
bugfix: empty b39 pwd number selection causes type error
Browse files Browse the repository at this point in the history
(cherry picked from commit 0fa8c8b)
  • Loading branch information
scgbckbone authored and doc-hex committed Jun 20, 2023
1 parent 15005d3 commit 3cd47cd
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
7 changes: 5 additions & 2 deletions shared/seed.py
Original file line number Diff line number Diff line change
Expand Up @@ -821,12 +821,15 @@ async def word_menu(self, *a):

async def add_numbers(self, *a):
global pp_sofar
pp_sofar = await ux_input_numbers(pp_sofar, self.check_length)
pw = await ux_input_numbers(pp_sofar, self.check_length)
if pw is not None:
pp_sofar = pw
self.check_length()

async def empty_phrase(self, *a):
global pp_sofar

if pp_sofar and len(pp_sofar) >= 3:
if len(pp_sofar) >= 3:
if not await ux_confirm("Press OK to clear passphrase. X to cancel."):
return

Expand Down
12 changes: 12 additions & 0 deletions testing/test_bip39pw.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,18 @@ def test_b39p_refused(dev, need_keypress, pw='testing 123'):
done = dev.send_recv(CCProtocolPacker.get_passphrase_done(), timeout=None)


def test_cancel_on_empty_added_numbers(pick_menu_item, goto_home, need_keypress, cap_menu):
goto_home()
pick_menu_item('Passphrase')
need_keypress("y") # intro story
pick_menu_item('Add Numbers')
need_keypress("x") # do not add any numbers and cancel with x
pick_menu_item('CANCEL')
time.sleep(0.1)
m = cap_menu()
assert m[0] == "Ready To Sign"


@pytest.mark.parametrize('haz', [ False, True ])
def test_lockdown(dev, haz, cap_menu, pick_menu_item, set_bip39_pw, goto_home, cap_story, need_keypress, sim_exec, sim_eval, get_settings, reset_seed_words, get_setting):
# test UX and operation of the 'seed lockdown' option
Expand Down

0 comments on commit 3cd47cd

Please sign in to comment.