mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-22 14:28:07 +00:00
refactor(core): move exclude list from wipe to wipe_cache
[no changelog]
This commit is contained in:
parent
517707a1c2
commit
e96b5e89ba
@ -58,7 +58,8 @@ async def recovery_process() -> Success:
|
||||
if recovery_type == RecoveryType.NormalRecovery:
|
||||
from trezor.wire.context import try_get_ctx_ids
|
||||
|
||||
storage.wipe(excluded=try_get_ctx_ids())
|
||||
storage.wipe(clear_cache=False)
|
||||
storage.wipe_cache(excluded=try_get_ctx_ids())
|
||||
raise wire.ActionCancelled
|
||||
|
||||
|
||||
|
@ -38,8 +38,13 @@ async def wipe_device(msg: WipeDevice) -> NoReturn:
|
||||
|
||||
# start an empty progress screen so that the screen is not blank while waiting
|
||||
render_empty_loader(config.StorageMessage.PROCESSING_MSG)
|
||||
|
||||
# wipe storage
|
||||
storage.wipe(excluded=try_get_ctx_ids())
|
||||
storage.wipe(clear_cache=False)
|
||||
|
||||
# clear cache - exclude current context
|
||||
storage.wipe_cache(excluded=try_get_ctx_ids())
|
||||
|
||||
# erase translations
|
||||
translations.deinit()
|
||||
translations.erase()
|
||||
|
@ -9,22 +9,23 @@ if TYPE_CHECKING:
|
||||
pass
|
||||
|
||||
|
||||
def wipe(excluded: Tuple[bytes, bytes] | None) -> None:
|
||||
def wipe(clear_cache: bool = True) -> None:
|
||||
"""
|
||||
TODO REPHRASE SO THAT IT IS TRUE! Wipes the storage. Using `exclude_protocol=False` destroys the THP communication channel.
|
||||
If the device should communicate after wipe, use `exclude_protocol=True` and clear cache manually later using
|
||||
Wipes the storage.
|
||||
If the device should communicate after wipe, use `clear_cache=False` and clear cache manually later using
|
||||
`wipe_cache()`.
|
||||
"""
|
||||
from trezor import config
|
||||
|
||||
config.wipe()
|
||||
if clear_cache:
|
||||
cache.clear_all()
|
||||
|
||||
|
||||
def wipe_cache(excluded: Tuple[bytes, bytes] | None = None) -> None:
|
||||
cache.clear_all(excluded)
|
||||
|
||||
|
||||
def wipe_cache() -> None:
|
||||
cache.clear_all()
|
||||
|
||||
|
||||
def init_unlocked() -> None:
|
||||
# Check for storage version upgrade.
|
||||
version = device.get_version()
|
||||
@ -42,7 +43,8 @@ def reset(excluded: Tuple[bytes, bytes] | None) -> None:
|
||||
Wipes storage but keeps the device id unchanged.
|
||||
"""
|
||||
device_id = device.get_device_id()
|
||||
wipe(excluded)
|
||||
wipe(clear_cache=False)
|
||||
wipe_cache(excluded)
|
||||
common.set(common.APP_DEVICE, device.DEVICE_ID, device_id.encode(), public=True)
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user