Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions core/src/apps/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -664,6 +664,7 @@ def get_pinlocked_handler(

async def wrapper(ctx: wire.Context, msg: wire.Msg) -> protobuf.MessageType:
await unlock_device(ctx)
storage.cache.start_session()
return await orig_handler(ctx, msg)

return wrapper
Expand Down Expand Up @@ -696,13 +697,8 @@ async def handle_GetPassphraseState(
from trezor.messages import PassphraseState
from apps.common import passphrase, paths

# Check if client supports attach pin
(
hasattr(msg, "allow_create_attach_pin")
and msg.allow_create_attach_pin is not None
)
if not device_is_unlocked():
await unlock_device(ctx, pin_use_type=2)
await unlock_device(ctx, pin_use_type=PinType.USER_AND_PASSPHRASE_PIN)
session_id = storage.cache.start_session()

from trezor.lvglui.scrs import fingerprints
Expand Down Expand Up @@ -759,13 +755,15 @@ async def handle_UnLockDevice(
) -> UnLockDeviceResponse:
"""Handle UnLockDevice message to unlock the device if needed."""
if not config.is_unlocked():
await unlock_device(ctx, pin_use_type=2)
await unlock_device(ctx, pin_use_type=PinType.USER_AND_PASSPHRASE_PIN)
storage.cache.start_session()

# Get current device state after unlock attempt
from apps.common import passphrase

unlocked = config.is_unlocked()
unlocked_attach_pin = passphrase.is_passphrase_pin_enabled() if unlocked else False

passphrase_protection = (
storage.device.is_passphrase_enabled() if unlocked else False
)
Expand Down
1 change: 1 addition & 0 deletions core/src/apps/homescreen/lockscreen.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ async def lockscreen() -> None:
# to an unlocked state.
try:
await unlock_device()
storage.cache.start_session()
except wire.PinCancelled:
pass

Expand Down
6 changes: 6 additions & 0 deletions core/src/apps/webauthn/fido2.py
Original file line number Diff line number Diff line change
Expand Up @@ -663,6 +663,9 @@ async def verify_user(keepalive_callback: KeepaliveCallback) -> bool:
trezor.pin.keepalive_callback = keepalive_callback

await unlock_device()
import storage.cache

storage.cache.start_session()
return True
except Exception:
return False
Expand Down Expand Up @@ -806,6 +809,9 @@ async def confirm_dialog(self) -> bool:

try:
await unlock_device()
import storage.cache

storage.cache.start_session()
return True
except Exception:
return False
Expand Down
3 changes: 2 additions & 1 deletion core/src/boot.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def clear() -> None:
io.fatfs.unlink(f"1:/res/wallpapers/{name}")


async def bootscreen() -> None:
async def () -> None:
from trezor.lvglui.scrs.bootscreen import BootScreen
from trezor.lvglui.scrs.lockscreen import LockScreen
from apps.common.request_pin import can_lock_device, verify_user_pin
Expand All @@ -36,6 +36,7 @@ async def bootscreen() -> None:
from apps.common.pin_constants import PinType

await verify_user_pin(pin_use_type=PinType.USER_AND_PASSPHRASE_PIN)
storage.cache.start_session()
storage.init_unlocked()
loop.close(lvgl_task)
return
Expand Down
6 changes: 6 additions & 0 deletions core/src/trezor/lvglui/scrs/lockscreen.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,9 @@ def eventhandler(self, event_obj: lv.event_t):
from apps.base import unlock_device

workflow.spawn(unlock_device())
import storage.cache

storage.cache.start_session()

def on_slide_up(self, event_obj: lv.event_t):
code = event_obj.code
Expand All @@ -203,6 +206,9 @@ def on_slide_up(self, event_obj: lv.event_t):
from apps.base import unlock_device

workflow.spawn(unlock_device())
import storage.cache

storage.cache.start_session()

def _load_scr(self, scr: "Screen", back: bool = False) -> None:
lv.scr_load(scr)
7 changes: 7 additions & 0 deletions core/src/trezor/uart.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,10 @@ async def handle_fingerprint():
if __debug__:
print(f"fingerprint unlock result {res}")
await base.unlock_device()
import storage.cache

storage.cache.start_session()

# await loop.sleep(2000)
return
else:
Expand Down Expand Up @@ -331,6 +335,9 @@ async def _deal_ble_pair(value):
if not base.device_is_unlocked():
try:
await base.unlock_device()
import storage.cache

storage.cache.start_session()
except Exception:
await safe_reloop()
workflow.spawn(utils.internal_reloop())
Expand Down
Loading