1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-05-29 12:18:51 +00:00

apps: fix for change_pin and debug

This commit is contained in:
Jan Pochyla 2016-12-17 13:20:57 +01:00
parent e73ff1f3c2
commit 96ead03e03
3 changed files with 19 additions and 7 deletions

View File

@ -6,24 +6,32 @@ from trezor.messages.wire_types import \
async def dispatch_DebugLinkDecision(session_id, msg): async def dispatch_DebugLinkDecision(session_id, msg):
from trezor.ui.confirm import CONFIRMED, CANCELLED from trezor.ui.confirm import CONFIRMED, CANCELLED
from ..common.confirm import signal from apps.common.confirm import signal
signal.send(CONFIRMED if msg.yes_no else CANCELLED) signal.send(CONFIRMED if msg.yes_no else CANCELLED)
async def dispatch_DebugLinkGetState(session_id, msg): async def dispatch_DebugLinkGetState(session_id, msg):
from trezor.messages.DebugLinkState import DebugLinkState from trezor.messages.DebugLinkState import DebugLinkState
from ..common import storage, request_pin from apps.common import storage, request_pin
if request_pin.matrix: if request_pin.matrix:
matrix = ''.join([str(d) for d in request_pin.matrix.digits]) matrix = ''.join([str(d) for d in request_pin.matrix.digits])
else: else:
matrix = None matrix = None
m = DebugLinkState() # TODO: do this differently
m.pin = storage.get_pin() locked = storage.is_locked()
m.mnemonic = storage.get_mnemonic() try:
m.passphrase_protection = storage.is_protected_by_passphrase() if locked:
m.matrix = matrix storage.unlock(storage.get_pin())
m = DebugLinkState()
m.pin = storage.get_pin()
m.mnemonic = storage.get_mnemonic()
m.passphrase_protection = storage.is_protected_by_passphrase()
m.matrix = matrix
finally:
if locked:
storage.lock()
# TODO: handle other fields: # TODO: handle other fields:
# f.reset_entropy = reset_get_internal_entropy() # f.reset_entropy = reset_get_internal_entropy()

View File

@ -50,4 +50,6 @@ async def layout_change_pin(session_id, msg):
await confirm_set_pin(session_id) await confirm_set_pin(session_id)
pin = await request_pin_twice(session_id) pin = await request_pin_twice(session_id)
storage.load_settings(pin=pin) storage.load_settings(pin=pin)
if pin:
storage.lock()
return Success(message='PIN changed') return Success(message='PIN changed')

View File

@ -30,6 +30,8 @@ for i in \
test_msg_signmessage.py \ test_msg_signmessage.py \
test_msg_signtx.py \ test_msg_signtx.py \
test_msg_verifymessage.py \ test_msg_verifymessage.py \
test_msg_wipedevice.py \
test_msg_changepin.py \
; do ; do
if ! $PYTHON $i ; then if ! $PYTHON $i ; then
error=1 error=1