Verifier
๐ค 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.
provide.foundation.tools.verifier
¶
Verifier Tool for Foundation.
Provides CLI commands for verifying checksums and digital signatures. Also provides ToolVerifier class for programmatic checksum verification.
Classes¶
ToolVerifier
¶
Verify tool artifacts using checksums.
Provides checksum verification for downloaded tool artifacts, ensuring integrity before installation.
Functions¶
verify_checksum
¶
Verify file checksum.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_path
|
Path
|
Path to file to verify. |
required |
expected
|
str
|
Expected checksum in format "algorithm:hash" or just "hash" (defaults to sha256). |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True if checksum matches, False otherwise. |
Raises:
| Type | Description |
|---|---|
FileNotFoundError
|
If file doesn't exist. |
ValueError
|
If checksum format is invalid. |
Source code in provide/foundation/tools/verifier.py
VerificationError
¶
VerificationError(
message: str,
*,
code: str | None = None,
context: dict[str, Any] | None = None,
cause: Exception | None = None,
**extra_context: Any,
)
Bases: FoundationError
Raised when verification fails.
Source code in provide/foundation/errors/base.py
Functions¶
verify_checksum_command
¶
verify_checksum_command(
hash: Annotated[
str,
"The expected checksum hash (e.g., 'sha256:...')",
],
file: Annotated[
Path | None,
"Path to the file to verify (reads from stdin if not provided)",
] = None,
algorithm: Annotated[
str | None,
"Explicitly specify the hash algorithm (e.g., 'sha256')",
] = None,
) -> None
Verify a file or stdin against a checksum.
Source code in provide/foundation/tools/verifier.py
verify_checksum_with_hash
¶
Verify data against a given hash string.
Raises:
| Type | Description |
|---|---|
VerificationError
|
If algorithm is invalid or verification fails due to error conditions |
Source code in provide/foundation/tools/verifier.py
verify_signature_command
¶
verify_signature_command(
signature: Annotated[
str, "The base64-encoded signature to verify"
],
key: Annotated[
str,
"The base64-encoded public key for verification",
],
file: Annotated[
Path | None,
"Path to the file to verify (reads from stdin if not provided)",
] = None,
) -> None
Verify a digital signature for a file or stdin.
Source code in provide/foundation/tools/verifier.py
verify_signature_with_key
¶
Verify a signature using a public key.