mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-30 03:18:20 +00:00
core/slip39: return ProcessError when mnemonic processing fails
This commit is contained in:
parent
a4039f9459
commit
4124ad3ccd
@ -10,6 +10,7 @@ from trezor.ui.mnemonic_slip39 import Slip39Keyboard
|
|||||||
from trezor.ui.text import Text
|
from trezor.ui.text import Text
|
||||||
from trezor.ui.word_select import WordSelector
|
from trezor.ui.word_select import WordSelector
|
||||||
from trezor.utils import format_ordinal
|
from trezor.utils import format_ordinal
|
||||||
|
from trezor.crypto import slip39
|
||||||
|
|
||||||
from apps.common import mnemonic, storage
|
from apps.common import mnemonic, storage
|
||||||
from apps.common.confirm import require_confirm
|
from apps.common.confirm import require_confirm
|
||||||
@ -69,7 +70,10 @@ async def recovery_device(ctx, msg):
|
|||||||
words = await request_mnemonic(
|
words = await request_mnemonic(
|
||||||
ctx, wordcount, mnemonic_module == mnemonic.slip39
|
ctx, wordcount, mnemonic_module == mnemonic.slip39
|
||||||
)
|
)
|
||||||
|
try:
|
||||||
secret = mnemonic_module.process_single(words)
|
secret = mnemonic_module.process_single(words)
|
||||||
|
except slip39.MnemonicError as e:
|
||||||
|
raise wire.ProcessError("Mnemonic is not valid: " + str(e))
|
||||||
# show a number of remaining mnemonics for SLIP39
|
# show a number of remaining mnemonics for SLIP39
|
||||||
if secret is None and mnemonic_module == mnemonic.slip39:
|
if secret is None and mnemonic_module == mnemonic.slip39:
|
||||||
await show_remaining_slip39_mnemonics(
|
await show_remaining_slip39_mnemonics(
|
||||||
|
Loading…
Reference in New Issue
Block a user