reader
๐ค AI-Generated Content
This documentation was generated with AI assistance and is still being audited. Some, or potentially a lot, of this information may be inaccurate. Learn more.
flavor.psp.format_2025.reader
¶
PSPF 2025 Format Reader.
Classes¶
PSPFReader
¶
Read PSPF bundles with backend support.
Initialize reader with specified backend mode.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
bundle_path
|
Path | str
|
Path to PSPF bundle |
required |
mode
|
int
|
Backend mode (ACCESS_AUTO, ACCESS_MMAP, ACCESS_FILE, etc.) |
ACCESS_AUTO
|
Source code in flavor/psp/format_2025/reader.py
Functions¶
__del__
¶
Ensure backend is closed when object is garbage collected (important on Windows).
__enter__
¶
__exit__
¶
close
¶
extract_slot
¶
extraction_lock
¶
Acquire an extraction lock for a given directory.
Source code in flavor/psp/format_2025/reader.py
get_backend
¶
get_slot_view
¶
open
¶
read_index
¶
Read and verify index block.
Source code in flavor/psp/format_2025/reader.py
read_magic_trailer
¶
Read MagicTrailer and extract index data.
Source code in flavor/psp/format_2025/reader.py
read_metadata
¶
Read and parse metadata.
Source code in flavor/psp/format_2025/reader.py
read_slot
¶
Read a specific slot.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
slot_index
|
int
|
Index of the slot to read |
required |
Returns:
| Name | Type | Description |
|---|---|---|
bytes |
bytes
|
Decompressed slot data |
Raises:
| Type | Description |
|---|---|
ValueError
|
If slot index is invalid |
Source code in flavor/psp/format_2025/reader.py
read_slot_descriptors
¶
Read all slot descriptors.
Source code in flavor/psp/format_2025/reader.py
stream_slot
¶
use_mmap
¶
use_streaming
¶
Switch to streaming backend for large files.
verify_all_checksums
¶
verify_attestation_policy_hash
¶
Verify attestation_policy_hash in the index matches the package-declared policy.
If the index field is zero-filled (absent), this is a no-op. Raises ValueError on mismatch or if field is non-zero but no policy in metadata.
Source code in flavor/psp/format_2025/reader.py
verify_integrity
¶
Verify complete package integrity.
Returns:
| Name | Type | Description |
|---|---|---|
dict |
dict[str, Any]
|
Verification result with standard keys |
Source code in flavor/psp/format_2025/reader.py
verify_magic_trailer
¶
Verify MagicTrailer emoji bookends at end of file.
Source code in flavor/psp/format_2025/reader.py
verify_signature
¶
Verify bundle signature.
Per PSPF/2025 spec: signature covers the uncompressed JSON metadata.
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True if signature is valid |
Source code in flavor/psp/format_2025/reader.py
verify_slot_integrity
¶
Functions¶
read_bundle
¶
Open a bundle for reading.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
bundle_path
|
Path
|
Path to bundle |
required |
use_mmap
|
bool
|
Whether to use memory mapping |
True
|
Returns:
| Name | Type | Description |
|---|---|---|
PSPFReader |
PSPFReader
|
Reader instance |
Source code in flavor/psp/format_2025/reader.py
verify_bundle
¶
Verify a bundle's integrity.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
bundle_path
|
Path
|
Path to bundle |
required |
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True if bundle is valid |