1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-07-12 09:38:08 +00:00
trezor-firmware/core/src/apps/management/wipe_device.py
matejcik 45606dd448 wip
2024-03-08 13:21:49 +01:00

42 lines
1.1 KiB
Python

from typing import TYPE_CHECKING
if TYPE_CHECKING:
from trezor.messages import Success, WipeDevice
async def wipe_device(msg: WipeDevice) -> Success:
import storage
from trezor import TR, translations
from trezor.enums import ButtonRequestType
from trezor.messages import Success
from trezor.ui.layouts import confirm_action
from trezor.ui.layouts.progress import progress
from apps.base import reload_settings_from_storage
await confirm_action(
"confirm_wipe",
TR.wipe__title,
TR.wipe__info,
TR.wipe__want_to_wipe,
reverse=True,
verb=TR.buttons__hold_to_confirm,
hold=True,
hold_danger=True,
br_code=ButtonRequestType.WipeDevice,
)
# start an empty progress screen so that the screen is not blank while waiting
progress(TR.progress__processing, description="").start()
# wipe storage
storage.wipe()
# erase translations
translations.deinit()
translations.erase()
# reload settings
reload_settings_from_storage()
return Success(message="Device wiped")