mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-01-11 16:00:57 +00:00
apps: fix for change_pin and debug
This commit is contained in:
parent
e73ff1f3c2
commit
96ead03e03
@ -6,24 +6,32 @@ from trezor.messages.wire_types import \
|
||||
|
||||
async def dispatch_DebugLinkDecision(session_id, msg):
|
||||
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)
|
||||
|
||||
|
||||
async def dispatch_DebugLinkGetState(session_id, msg):
|
||||
from trezor.messages.DebugLinkState import DebugLinkState
|
||||
from ..common import storage, request_pin
|
||||
from apps.common import storage, request_pin
|
||||
|
||||
if request_pin.matrix:
|
||||
matrix = ''.join([str(d) for d in request_pin.matrix.digits])
|
||||
else:
|
||||
matrix = None
|
||||
|
||||
m = DebugLinkState()
|
||||
m.pin = storage.get_pin()
|
||||
m.mnemonic = storage.get_mnemonic()
|
||||
m.passphrase_protection = storage.is_protected_by_passphrase()
|
||||
m.matrix = matrix
|
||||
# TODO: do this differently
|
||||
locked = storage.is_locked()
|
||||
try:
|
||||
if locked:
|
||||
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:
|
||||
# f.reset_entropy = reset_get_internal_entropy()
|
||||
|
@ -50,4 +50,6 @@ async def layout_change_pin(session_id, msg):
|
||||
await confirm_set_pin(session_id)
|
||||
pin = await request_pin_twice(session_id)
|
||||
storage.load_settings(pin=pin)
|
||||
if pin:
|
||||
storage.lock()
|
||||
return Success(message='PIN changed')
|
||||
|
@ -30,6 +30,8 @@ for i in \
|
||||
test_msg_signmessage.py \
|
||||
test_msg_signtx.py \
|
||||
test_msg_verifymessage.py \
|
||||
test_msg_wipedevice.py \
|
||||
test_msg_changepin.py \
|
||||
; do
|
||||
if ! $PYTHON $i ; then
|
||||
error=1
|
||||
|
Loading…
Reference in New Issue
Block a user