示例#1
0
def _migrate_from_version_01() -> None:
    # Make the U2F counter public and writable even when storage is locked.
    # U2F counter wasn't public, so we are intentionally not using storage.device module.
    counter = common.get(common.APP_DEVICE, device.U2F_COUNTER)
    if counter is not None:
        device.set_u2f_counter(int.from_bytes(counter, "big"))
        # Delete the old, non-public U2F_COUNTER.
        common.delete(common.APP_DEVICE, device.U2F_COUNTER)
    set_current_version()
示例#2
0
def set_sd_salt_auth_key(auth_key: Optional[bytes]) -> None:
    """
    The key used to check the authenticity of the SD card salt.
    """
    if auth_key is not None:
        if len(auth_key) != SD_SALT_AUTH_KEY_LEN_BYTES:
            raise ValueError
        return common.set(_NAMESPACE, _SD_SALT_AUTH_KEY, auth_key, public=True)
    else:
        return common.delete(_NAMESPACE, _SD_SALT_AUTH_KEY, public=True)
示例#3
0
def set_backed_up() -> None:
    common.delete(_NAMESPACE, _NEEDS_BACKUP)
示例#4
0
def erase_resident_credential(index: int) -> bool:
    if not (0 <= index < _MAX_RESIDENT_CREDENTIALS):
        return False
    common.delete(common.APP_WEBAUTHN, index + _RESIDENT_CREDENTIAL_START_KEY)
    return True
示例#5
0
def erase_resident_credentials() -> None:
    for i in range(_MAX_RESIDENT_CREDENTIALS):
        common.delete(common.APP_WEBAUTHN, i + _RESIDENT_CREDENTIAL_START_KEY)
示例#6
0
def delete() -> None:
    for index in range(0, slip39.MAX_SHARE_COUNT):
        common.delete(common.APP_RECOVERY_SHARES, index)
示例#7
0
def end_progress() -> None:
    _require_progress()
    common.delete(_NAMESPACE, _IN_PROGRESS)
    common.delete(_NAMESPACE, _DRY_RUN)
    common.delete(_NAMESPACE, _SLIP39_IDENTIFIER)
    common.delete(_NAMESPACE, _SLIP39_THRESHOLD)
    common.delete(_NAMESPACE, _REMAINING)
    common.delete(_NAMESPACE, _SLIP39_ITERATION_EXPONENT)
    common.delete(_NAMESPACE, _SLIP39_GROUP_COUNT)
    recovery_shares.delete()