You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
trezor-firmware/core/src/apps/management/wipe_device.py

33 lines
857 B

from typing import TYPE_CHECKING
if TYPE_CHECKING:
from trezor.wire import GenericContext
from trezor.messages import WipeDevice, Success
async def wipe_device(ctx: GenericContext, msg: WipeDevice) -> Success:
import storage
from trezor.enums import ButtonRequestType
from trezor.messages import Success
from trezor.ui.layouts import confirm_action
from apps.base import reload_settings_from_storage
await confirm_action(
ctx,
"confirm_wipe",
"Wipe device",
"All data will be erased.",
"Do you really want to wipe the device?\n",
reverse=True,
verb="Hold to confirm",
hold=True,
hold_danger=True,
br_code=ButtonRequestType.WipeDevice,
)
storage.wipe()
reload_settings_from_storage()
return Success(message="Device wiped")