1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-01-09 23:11:10 +00:00

src/apps/management: add confirmation screens to Reset and Recovery

This commit is contained in:
Pavol Rusnak 2018-10-22 14:22:07 +02:00
parent e9995bf060
commit a0a195fdd3
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D
2 changed files with 16 additions and 1 deletions

View File

@ -1,7 +1,11 @@
from trezor import config, ui, wire from trezor import config, ui, wire
from trezor.crypto import bip39 from trezor.crypto import bip39
from trezor.messages.ButtonRequest import ButtonRequest from trezor.messages.ButtonRequest import ButtonRequest
from trezor.messages.ButtonRequestType import MnemonicInput, MnemonicWordCount from trezor.messages.ButtonRequestType import (
MnemonicInput,
MnemonicWordCount,
ProtectCall,
)
from trezor.messages.MessageType import ButtonAck from trezor.messages.MessageType import ButtonAck
from trezor.messages.Success import Success from trezor.messages.Success import Success
from trezor.pin import pin_to_int from trezor.pin import pin_to_int
@ -11,6 +15,7 @@ from trezor.ui.word_select import WordSelector
from trezor.utils import format_ordinal from trezor.utils import format_ordinal
from apps.common import storage from apps.common import storage
from apps.common.confirm import require_confirm
from apps.management.change_pin import request_pin_confirm from apps.management.change_pin import request_pin_confirm
@ -27,6 +32,11 @@ async def recovery_device(ctx, msg):
if not msg.dry_run and storage.is_initialized(): if not msg.dry_run and storage.is_initialized():
raise wire.UnexpectedMessage("Already initialized") raise wire.UnexpectedMessage("Already initialized")
text = Text("Device recovery", ui.ICON_RECOVERY)
text.normal("Do you really want to", "recover the device?", "")
await require_confirm(ctx, text, code=ProtectCall)
# ask for the number of words # ask for the number of words
wordcount = await request_wordcount(ctx) wordcount = await request_wordcount(ctx)

View File

@ -31,6 +31,11 @@ async def reset_device(ctx, msg):
if storage.is_initialized(): if storage.is_initialized():
raise wire.UnexpectedMessage("Already initialized") raise wire.UnexpectedMessage("Already initialized")
text = Text("Create a new wallet", ui.ICON_RESET)
text.normal("Do you really want to", "create a new wallet?", "")
await require_confirm(ctx, text, code=ButtonRequestType.ResetDevice)
# request new PIN # request new PIN
if msg.pin_protection: if msg.pin_protection:
newpin = await request_pin_confirm(ctx) newpin = await request_pin_confirm(ctx)