diff --git a/core/src/apps/common/cache.py b/core/src/apps/common/cache.py index d8102e40e..1f0a8635b 100644 --- a/core/src/apps/common/cache.py +++ b/core/src/apps/common/cache.py @@ -56,9 +56,7 @@ def set_passphrase(passphrase): _cached_passphrase_fprint = _compute_state(b"FPRINT", passphrase or "")[:4] -def clear(skip_passphrase: bool = False): +def clear(keep_passphrase: bool = False): set_seed(None) - if skip_passphrase: - set_passphrase("") - else: + if not keep_passphrase: set_passphrase(None) diff --git a/core/src/apps/homescreen/__init__.py b/core/src/apps/homescreen/__init__.py index 9e7c089ee..858795995 100644 --- a/core/src/apps/homescreen/__init__.py +++ b/core/src/apps/homescreen/__init__.py @@ -32,7 +32,9 @@ def get_features(): async def handle_Initialize(ctx, msg): if msg.state is None or msg.state != cache.get_state(prev_state=bytes(msg.state)): - cache.clear(msg.skip_passphrase) + cache.clear() + if msg.skip_passphrase: + cache.set_passphrase("") return get_features() @@ -45,7 +47,7 @@ async def handle_Cancel(ctx, msg): async def handle_ClearSession(ctx, msg): - cache.clear() + cache.clear(keep_passphrase=True) return Success(message="Session cleared")