1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-22 23:48:12 +00:00

seed: add passphrase UI

This commit is contained in:
Jan Pochyla 2016-10-20 15:04:54 +02:00
parent c5dfcb53d1
commit 7a518e9fa4
2 changed files with 17 additions and 4 deletions

View File

@ -0,0 +1,15 @@
from trezor import ui, wire
async def request_passphrase(session_id):
from trezor.messages.PassphraseRequest import PassphraseRequest
from trezor.messages.wire_types import PassphraseAck
from trezor.ui.text import Text
ui.display.clear()
text = Text('Enter passphrase', ui.ICON_RESET,
'Please enter passphrase', 'on your computer.')
text.render()
ack = await wire.reply_message(session_id, PassphraseRequest(), PassphraseAck)
return ack.passphrase

View File

@ -40,6 +40,7 @@ async def get_seed(session_id: int) -> bytes:
async def compute_seed(session_id):
from trezor.crypto import bip39
from trezor.messages.FailureType import PinInvalid, Other
from .request_passphrase import request_passphrase
from .request_pin import request_pin
from . import storage
@ -52,10 +53,7 @@ async def compute_seed(session_id):
raise wire.FailureError(PinInvalid, 'PIN is incorrect')
if storage.is_protected_by_passphrase():
from trezor.messages.PassphraseRequest import PassphraseRequest
from trezor.messages.wire_types import PassphraseAck
ack = await wire.reply_message(session_id, PassphraseRequest(), PassphraseAck)
passphrase = ack.passphrase
passphrase = await request_passphrase(session_id)
else:
passphrase = ''