Git¶
Verify commits and discover identity layouts.
CommitResult
dataclass
¶
CommitResult(commit_sha: str, is_valid: bool, signer: str | None = None, error: str | None = None, error_code: str | None = None)
Result of verifying a single commit's SSH signature.
VerifyResult
dataclass
¶
VerifyResult(commits: list[CommitResult], passed: bool, mode: str, summary: str)
Wrapper around commit verification results.
LayoutInfo
dataclass
¶
Resolved location of Auths identity data in a repository.
LayoutError
¶
Bases: Exception
Raised when Auths identity data cannot be found in the repo.
ErrorCode
¶
Stable error codes for commit verification failures.
generate_allowed_signers
¶
Generate an allowed_signers file content from live Auths storage.
Reads device attestations from the Git-backed identity store and
formats them for gpg.ssh.allowedSignersFile. Revoked attestations
and devices with undecodable keys are silently skipped.
Parameters:
-
repo_path(str, default:'~/.auths') –Path to the Auths identity repository.
Returns:
-
str–Formatted allowed_signers file content, or an empty string if no
-
str–attestations are found. Write this to a file or pass to
-
str–verify_commit_range.
Examples:
discover_layout
¶
discover_layout(repo_root: str = '.') -> LayoutInfo
Try to find Auths identity data in the repo.
Checks .auths/identity-bundle.json then refs/auths/*.
Raises :class:LayoutError if missing.
verify_commit_range
¶
verify_commit_range(commit_range: str, identity_bundle: str | None = None, allowed_signers: str = '.auths/allowed_signers', mode: str = 'enforce') -> VerifyResult
Verify SSH signatures for every commit in commit_range.
Parameters:
-
commit_range(str) –A git revision range (e.g.
origin/main..HEAD). -
identity_bundle(str | None, default:None) –Path to an Auths identity-bundle JSON file.
-
allowed_signers(str, default:'.auths/allowed_signers') –Path to an ssh-keygen allowed_signers file.
-
mode(str, default:'enforce') –"enforce"or"warn".
Returns:
-
VerifyResult–VerifyResult with per-commit results and a pass/fail decision.
verify_commits
¶
verify_commits(shas: list[str], identity_bundle: str | None = None, allowed_signers: str = '.auths/allowed_signers', mode: str = 'enforce') -> VerifyResult
Verify SSH signatures for an explicit list of commit SHAs.
Parameters:
-
shas(list[str]) –List of commit SHA strings.
-
identity_bundle(str | None, default:None) –Path to an Auths identity-bundle JSON file.
-
allowed_signers(str, default:'.auths/allowed_signers') –Path to an ssh-keygen allowed_signers file.
-
mode(str, default:'enforce') –"enforce"or"warn".
Returns:
-
VerifyResult–VerifyResult with per-commit results and a pass/fail decision.