httk.core.records¶
Deterministic filesystem records for signed manifests and seals.
A record list is the canonical description of what a directory tree contained at one moment: one entry per file, symlink, and directory, sorted by path, with a file’s size, SHA-256, and owner-execute bit. It never follows symlinks, so a symlink is recorded by its target rather than by what it points at. The same record list underlies both the signed project manifest and every seal, so a covered byte cannot change without a later verification noticing.
Functions¶
|
Return the sorted, deterministic records of the tree rooted at root. |
Module Contents¶
- httk.core.records.file_records(root, *, exclusions=(), skip=None)[source]¶
Return the sorted, deterministic records of the tree rooted at root.
Symlinks are never followed: a symlink is recorded as its target text and a directory is recorded as its own entry before its contents. A file record carries its
size,sha256, andexecutable(the owner-execute bit). Two seams keep out what a record list must not cover: exclusions arefnmatchpatterns matched case-sensitively against each entry’s posix relpath, and skip, when given, is a predicate on the absolute path of each entry — an entry it accepts is left out entirely, and a directory it accepts is not descended into.- Parameters:
root (str | os.PathLike[str]) – The directory tree to describe.
exclusions (collections.abc.Sequence[str]) –
fnmatchpatterns on posix relpaths to leave out.skip (collections.abc.Callable[[pathlib.Path], bool] | None) – A predicate on absolute paths; a truthy result omits the entry.
- Returns:
The record dictionaries, sorted by posix relpath.
- Raises:
ValueError – If the tree holds a special filesystem entry.
- Return type: