from __future__ import annotations from dataclasses import dataclass from pathlib import Path from typing import Optional, Tuple @dataclass(frozen=True) class DeviceCheckConfig: crypt_cnt_fields: Tuple[str, ...] secure_boot_field: str secure_boot_expected: Optional[bool] crypt_cnt_expect: Optional[str] flash_key_purpose_match: Optional[str] secure_boot_key_purpose_match: Optional[str] key_read_disable_field: str @dataclass(frozen=True) class FlashPrivateConfig: chip: str baud: str bin_dir: Path layout: list[Tuple[str, str]] app_bin_name: str app_partition_offset: str flash_args: dict device_check: DeviceCheckConfig ui: dict @dataclass(frozen=True) class FlashSource: offset: int path: Path name: str @dataclass class FlashEntryReport: name: str offset: int size: int sha256: str readback_sha256: Optional[str] verified: Optional[bool] @dataclass class FlashReport: entries: list[FlashEntryReport] readback_ok: bool readback_errors: list[str]