|
| 1 | +"""AIP (Agentic Identity Protocol) — AIT verification (verifier role) + RFC 9421 signing. |
| 2 | +
|
| 3 | +This package is the AgentScore verifier for Agent Identity Tokens (AITs): a merchant gate |
| 4 | +hands a parsed request plus a trusted-issuer :class:`JwksCache` to the orchestrator and gets |
| 5 | +back the signature-checked, structurally-valid claims (or a typed failure mapped onto the AIP |
| 6 | +wire error taxonomy). It also exposes the RFC 9421 HTTP Message Signature primitives an agent |
| 7 | +uses to prove possession of its ``cnf``-bound key. |
| 8 | +
|
| 9 | +Submodules: |
| 10 | + agentscore_commerce.aip.types - AIT claim contract + structural validation |
| 11 | + agentscore_commerce.aip.http_signature - RFC 9421 sign / verify (the AIP subset) |
| 12 | + agentscore_commerce.aip.jwks - trusted-issuer enforcement + JWKS key discovery |
| 13 | + agentscore_commerce.aip.verify - the AIT verification pipeline (orchestrator) |
| 14 | + agentscore_commerce.aip.request - build a VerifyRequestContext from a framework request |
| 15 | + agentscore_commerce.aip.gate - framework-agnostic gate + RFC 9457 denial bodies |
| 16 | +
|
| 17 | +The public surface mirrors the reference top-level AIP exports; where the reference |
| 18 | +folds an input shape into an options interface (``VerifyAitOptions`` / ``SignMessageInput`` / |
| 19 | +``VerifyMessageSignatureInput`` / ``JwksCacheOptions``), Python passes keyword args and the |
| 20 | +corresponding concrete dataclasses (:class:`SignatureParams`, :class:`SignedMessage`, |
| 21 | +:class:`VerifyRequestContext`) are surfaced instead. |
| 22 | +""" |
| 23 | + |
| 24 | +from agentscore_commerce.aip.gate import ( |
| 25 | + AipErrorBody, |
| 26 | + AipErrorRequirements, |
| 27 | + AipGateEvaluation, |
| 28 | + AipGateOptions, |
| 29 | + AipGateResult, |
| 30 | + aip_error_code, |
| 31 | + aip_error_status, |
| 32 | + build_aip_error_body, |
| 33 | + build_aip_weak_auth_body, |
| 34 | + check_trust_requirements, |
| 35 | + evaluate_aip_parts, |
| 36 | + evaluate_aip_request, |
| 37 | + verify_ait_parts, |
| 38 | + verify_ait_request, |
| 39 | +) |
| 40 | +from agentscore_commerce.aip.http_signature import ( |
| 41 | + AIP_COVERED_COMPONENTS, |
| 42 | + AIP_SIGNATURE_TAG, |
| 43 | + MAX_POP_WINDOW_SECONDS, |
| 44 | + ParsedSignatureInput, |
| 45 | + SignatureParams, |
| 46 | + SignedMessage, |
| 47 | + VerifyFailureReason, |
| 48 | + VerifyMessageSignatureResult, |
| 49 | + build_signature_base, |
| 50 | + normalize_authority, |
| 51 | + parse_signature_input, |
| 52 | + parse_signature_value, |
| 53 | + sign_message, |
| 54 | + verify_message_signature, |
| 55 | +) |
| 56 | +from agentscore_commerce.aip.jwks import ( |
| 57 | + AGENTSCORE_CANONICAL_ISSUER, |
| 58 | + DEFAULT_CACHE_SECONDS, |
| 59 | + HARD_MAX_CACHE_SECONDS, |
| 60 | + JWKS_REFETCH_COOLDOWN_SECONDS, |
| 61 | + JWKS_WELL_KNOWN_PATH, |
| 62 | + FetchResponse, |
| 63 | + JwksCache, |
| 64 | + JwksLookupFailure, |
| 65 | + JwksLookupResult, |
| 66 | + canonicalize_issuer, |
| 67 | + resolve_cache_seconds, |
| 68 | +) |
| 69 | +from agentscore_commerce.aip.request import ( |
| 70 | + HeadersLike, |
| 71 | + RequestLike, |
| 72 | + VerifyContextParts, |
| 73 | + build_verify_context_from_parts, |
| 74 | + build_verify_context_from_request, |
| 75 | + has_agent_identity_header, |
| 76 | + has_agent_identity_header_parts, |
| 77 | +) |
| 78 | +from agentscore_commerce.aip.types import ( |
| 79 | + AitHeader, |
| 80 | + AitPayload, |
| 81 | + AitValidationResult, |
| 82 | + AmrValue, |
| 83 | + IdentityClaim, |
| 84 | + IntentClaim, |
| 85 | + TrustLevel, |
| 86 | + is_ait_shape, |
| 87 | + validate_ait_payload, |
| 88 | +) |
| 89 | +from agentscore_commerce.aip.verify import ( |
| 90 | + AGENT_IDENTITY_HEADER, |
| 91 | + AIT_SIGNING_ALGS, |
| 92 | + SignatureMaterial, |
| 93 | + VerifiedAit, |
| 94 | + VerifyAitFailure, |
| 95 | + VerifyAitFailureResult, |
| 96 | + VerifyAitResult, |
| 97 | + VerifyAitSuccess, |
| 98 | + VerifyRequestContext, |
| 99 | + verify_ait, |
| 100 | +) |
| 101 | + |
| 102 | +__all__ = [ |
| 103 | + "AGENTSCORE_CANONICAL_ISSUER", |
| 104 | + "AGENT_IDENTITY_HEADER", |
| 105 | + "AIP_COVERED_COMPONENTS", |
| 106 | + "AIP_SIGNATURE_TAG", |
| 107 | + "AIT_SIGNING_ALGS", |
| 108 | + "DEFAULT_CACHE_SECONDS", |
| 109 | + "HARD_MAX_CACHE_SECONDS", |
| 110 | + "JWKS_REFETCH_COOLDOWN_SECONDS", |
| 111 | + "JWKS_WELL_KNOWN_PATH", |
| 112 | + "MAX_POP_WINDOW_SECONDS", |
| 113 | + "AipErrorBody", |
| 114 | + "AipErrorRequirements", |
| 115 | + "AipGateEvaluation", |
| 116 | + "AipGateOptions", |
| 117 | + "AipGateResult", |
| 118 | + "AitHeader", |
| 119 | + "AitPayload", |
| 120 | + "AitValidationResult", |
| 121 | + "AmrValue", |
| 122 | + "FetchResponse", |
| 123 | + "HeadersLike", |
| 124 | + "IdentityClaim", |
| 125 | + "IntentClaim", |
| 126 | + "JwksCache", |
| 127 | + "JwksLookupFailure", |
| 128 | + "JwksLookupResult", |
| 129 | + "ParsedSignatureInput", |
| 130 | + "RequestLike", |
| 131 | + "SignatureMaterial", |
| 132 | + "SignatureParams", |
| 133 | + "SignedMessage", |
| 134 | + "TrustLevel", |
| 135 | + "VerifiedAit", |
| 136 | + "VerifyAitFailure", |
| 137 | + "VerifyAitFailureResult", |
| 138 | + "VerifyAitResult", |
| 139 | + "VerifyAitSuccess", |
| 140 | + "VerifyContextParts", |
| 141 | + "VerifyFailureReason", |
| 142 | + "VerifyMessageSignatureResult", |
| 143 | + "VerifyRequestContext", |
| 144 | + "aip_error_code", |
| 145 | + "aip_error_status", |
| 146 | + "build_aip_error_body", |
| 147 | + "build_aip_weak_auth_body", |
| 148 | + "build_signature_base", |
| 149 | + "build_verify_context_from_parts", |
| 150 | + "build_verify_context_from_request", |
| 151 | + "canonicalize_issuer", |
| 152 | + "check_trust_requirements", |
| 153 | + "evaluate_aip_parts", |
| 154 | + "evaluate_aip_request", |
| 155 | + "has_agent_identity_header", |
| 156 | + "has_agent_identity_header_parts", |
| 157 | + "is_ait_shape", |
| 158 | + "normalize_authority", |
| 159 | + "parse_signature_input", |
| 160 | + "parse_signature_value", |
| 161 | + "resolve_cache_seconds", |
| 162 | + "sign_message", |
| 163 | + "validate_ait_payload", |
| 164 | + "verify_ait", |
| 165 | + "verify_ait_parts", |
| 166 | + "verify_ait_request", |
| 167 | + "verify_message_signature", |
| 168 | +] |
0 commit comments