async def recovery_process(ctx: wire.GenericContext) -> Success:
    try:
        return await _continue_recovery_process(ctx)
    except recover.RecoveryAborted:
        dry_run = storage.recovery.is_dry_run()
        if dry_run:
            storage.recovery.end_progress()
        else:
            storage.wipe()
        raise wire.ActionCancelled("Cancelled")
Ejemplo n.º 2
0
async def recovery_process(ctx: wire.GenericContext) -> Success:
    wire.AVOID_RESTARTING_FOR = (MessageType.Initialize,
                                 MessageType.GetFeatures)
    try:
        return await _continue_recovery_process(ctx)
    except recover.RecoveryAborted:
        dry_run = storage.recovery.is_dry_run()
        if dry_run:
            storage.recovery.end_progress()
        else:
            storage.wipe()
        raise wire.ActionCancelled
async def wipe_device(ctx, msg):
    text = Text("Wipe device", ui.ICON_WIPE, ui.RED)
    text.normal("Do you really want to", "wipe the device?", "")
    text.bold("All data will be lost.")
    await require_hold_to_confirm(
        ctx,
        text,
        ButtonRequestType.WipeDevice,
        confirm_style=ButtonCancel,
        loader_style=LoaderDanger,
    )

    storage.wipe()

    return Success(message="Device wiped")
Ejemplo n.º 4
0
async def wipe_device(ctx, msg):
    await confirm_action(
        ctx,
        "confirm_wipe",
        title="Wipe device",
        description="Do you really want to\nwipe the device?\n",
        action="All data will be lost.",
        reverse=True,
        verb="Hold to confirm",
        hold=True,
        hold_danger=True,
        icon=ui.ICON_WIPE,
        icon_color=ui.RED,
        br_code=ButtonRequestType.WipeDevice,
    )

    storage.wipe()
    reload_settings_from_storage()

    return Success(message="Device wiped")