1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-23 14:58:09 +00:00

src/apps/management: ask for mnemonic words twice in reset_device

This commit is contained in:
Pavol Rusnak 2018-02-06 19:40:02 +01:00
parent fedfde7e99
commit d5ae4d72b6
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D

View File

@ -177,6 +177,10 @@ async def show_mnemonic_page(page: int, page_count: int, pages: list):
@ui.layout @ui.layout
async def check_mnemonic(ctx, mnemonic: str) -> bool: async def check_mnemonic(ctx, mnemonic: str) -> bool:
words = mnemonic.split() words = mnemonic.split()
index = random.uniform(len(words)) index = random.uniform(len(words) // 2) # first half
result = await MnemonicKeyboard('Type %s. word' % (index + 1))
if result != words[index]:
return False
index = len(words) // 2 + random.uniform(len(words) // 2) # second half
result = await MnemonicKeyboard('Type %s. word' % (index + 1)) result = await MnemonicKeyboard('Type %s. word' % (index + 1))
return result == words[index] return result == words[index]