Verification¶
The core verification engine and FastAPI router. See Tutorial: Server-side verification for usage examples.
Public API¶
For gateway and runtime-session binding, call the package-root export rather than the private _verify module:
verify_manifest() is the supported high-level entry point. VerificationContext.trusted_keys maps an issuer key_id (the SHA-256 hex of the public key bytes) to its base64url-encoded Ed25519 public key, the form returned by Ed25519KeyPair.public_b64url(). A consumer that holds raw public key bytes must base64url-encode them before populating trusted_keys. Signers and verifiers share agent_manifest.signing_pre_image() for the exact RFC 8785 canonical byte sequence, including the hitl_record.approvals normalization, so a relying party never reconstructs the pre-image itself.
Core function¶
verify_manifest ¶
verify_manifest(manifest: dict[str, Any], context: VerificationContext, revocation_store: 'RevocationStore') -> VerificationResult
Core verification engine - hosting-model agnostic and fail-closed.
Checks version compatibility, signature, expiry, revocation, artifact hashes, delegation chain, and HITL. Returns a VerificationResult with per-field status and mismatch details.
Fail-closed semantics (spec 5.3 - VALID requires a valid signature):
- A manifest with an unsupported (or missing)
versionreturnsINCOMPATIBLE_VERSIONwithout further processing (spec 2.4). - A manifest without a
signatureblock returnsSIGNATURE_MISSING. - A signed manifest verified without any
trusted_keysin the context returnsUNVERIFIABLE- neverVALID. - A delegation chain that cannot be verified (no
delegation_public_keys) is markedUNVERIFIABLEand the overall result isUNVERIFIABLE(spec 3.4.1 / 5.2). enforce_hitl=Truewith nohitl_recordin the manifest is a failure (HitlResult.MISSINGand a non-VALID overall result).
Context¶
VerificationContext ¶
Bases: BaseModel
Runtime artifact hashes and keys provided by the trusted component.
Results¶
VerificationResult ¶
Bases: BaseModel
OverallResult ¶
Bases: str, Enum
FieldsVerified ¶
Bases: BaseModel
FieldResult ¶
Bases: str, Enum
DelegationResult ¶
Bases: str, Enum
HitlResult ¶
Bases: str, Enum
MismatchDetail ¶
Bases: BaseModel
EvidencePack is an optional reference (trace id, signer, hash, and URI) to an externally retained evidence pack that a verifier can record alongside a result.
EvidencePack ¶
Bases: BaseModel
Revocation¶
RevocationStore is the revocation lookup a verifier consults during verify_manifest(); the default is in-memory, and production deployments back it with a persistent store. RevocationRecord is a single revocation entry: which manifest was revoked, when, why, and by whom.
RevocationStore ¶
In-memory revocation store. Production should use a persistent backend.
RevocationRecord ¶
Bases: BaseModel
FastAPI router¶
create_router ¶
Return a FastAPI APIRouter with /verify and /revocation-status endpoints.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
manifest_store | dict[str, dict[str, Any]] | Dict mapping manifest_id -> manifest dict. | required |
revocation_store | RevocationStore | Revocation store instance. | required |