Ejemplo n.º 1
0
def load_settings(
    label: str = None,
    use_passphrase: bool = None,
    homescreen: bytes = None,
    passphrase_source: int = None,
    display_rotation: int = None,
) -> None:
    if label is not None:
        common._set(_NAMESPACE, _LABEL, label.encode(), True)  # public
    if use_passphrase is not None:
        common._set_bool(_NAMESPACE, _USE_PASSPHRASE, use_passphrase)
    if homescreen is not None:
        if homescreen[:8] == b"TOIf\x90\x00\x90\x00":
            if len(homescreen) <= HOMESCREEN_MAXSIZE:
                common._set(_NAMESPACE, _HOMESCREEN, homescreen,
                            True)  # public
        else:
            common._set(_NAMESPACE, _HOMESCREEN, b"", True)  # public
    if passphrase_source is not None:
        if passphrase_source in (0, 1, 2):
            common._set(_NAMESPACE, _PASSPHRASE_SOURCE,
                        bytes([passphrase_source]))
    if display_rotation is not None:
        if display_rotation not in (0, 90, 180, 270):
            raise ValueError("Unsupported display rotation degrees: %d" %
                             display_rotation)
        else:
            common._set(_NAMESPACE, _ROTATION,
                        display_rotation.to_bytes(2, "big"), True)  # public
Ejemplo n.º 2
0
def set_in_progress(val: bool) -> None:
    common._set_bool(_NAMESPACE, _SLIP39_IN_PROGRESS, val)
Ejemplo n.º 3
0
def set_unfinished_backup(state: bool) -> None:
    common._set_bool(_NAMESPACE, _UNFINISHED_BACKUP, state)
Ejemplo n.º 4
0
def set_dry_run(val: bool) -> None:
    common._set_bool(_NAMESPACE, _DRY_RUN, val)