mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-02-23 04:52:01 +00:00
core: factor out the decision whether to lock the device
This commit is contained in:
parent
0600d87c8c
commit
9197623d83
@ -17,6 +17,11 @@ if __debug__:
|
||||
from apps.debug import input_signal
|
||||
|
||||
|
||||
def can_lock_device() -> bool:
|
||||
"""Return True if the device has a PIN set or SD-protect enabled."""
|
||||
return config.has_pin() or storage.sd_salt.is_enabled()
|
||||
|
||||
|
||||
async def request_pin(
|
||||
ctx: wire.GenericContext,
|
||||
prompt: str = "Enter your PIN",
|
||||
|
@ -4,14 +4,14 @@ import storage.sd_salt
|
||||
from trezor import config, log, loop, res, ui, utils, wire
|
||||
from trezor.pin import show_pin_timeout
|
||||
|
||||
from apps.common.request_pin import verify_user_pin
|
||||
from apps.common.request_pin import can_lock_device, verify_user_pin
|
||||
|
||||
|
||||
async def bootscreen() -> None:
|
||||
ui.display.orientation(storage.device.get_rotation())
|
||||
while True:
|
||||
try:
|
||||
if storage.sd_salt.is_enabled() or config.has_pin():
|
||||
if can_lock_device():
|
||||
await lockscreen()
|
||||
await verify_user_pin()
|
||||
storage.init_unlocked()
|
||||
|
Loading…
Reference in New Issue
Block a user