mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-23 07:58:09 +00:00
seed: add passphrase UI
This commit is contained in:
parent
c5dfcb53d1
commit
7a518e9fa4
15
src/apps/common/request_passphrase.py
Normal file
15
src/apps/common/request_passphrase.py
Normal 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
|
@ -40,6 +40,7 @@ async def get_seed(session_id: int) -> bytes:
|
|||||||
async def compute_seed(session_id):
|
async def compute_seed(session_id):
|
||||||
from trezor.crypto import bip39
|
from trezor.crypto import bip39
|
||||||
from trezor.messages.FailureType import PinInvalid, Other
|
from trezor.messages.FailureType import PinInvalid, Other
|
||||||
|
from .request_passphrase import request_passphrase
|
||||||
from .request_pin import request_pin
|
from .request_pin import request_pin
|
||||||
from . import storage
|
from . import storage
|
||||||
|
|
||||||
@ -52,10 +53,7 @@ async def compute_seed(session_id):
|
|||||||
raise wire.FailureError(PinInvalid, 'PIN is incorrect')
|
raise wire.FailureError(PinInvalid, 'PIN is incorrect')
|
||||||
|
|
||||||
if storage.is_protected_by_passphrase():
|
if storage.is_protected_by_passphrase():
|
||||||
from trezor.messages.PassphraseRequest import PassphraseRequest
|
passphrase = await request_passphrase(session_id)
|
||||||
from trezor.messages.wire_types import PassphraseAck
|
|
||||||
ack = await wire.reply_message(session_id, PassphraseRequest(), PassphraseAck)
|
|
||||||
passphrase = ack.passphrase
|
|
||||||
else:
|
else:
|
||||||
passphrase = ''
|
passphrase = ''
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user