/** * Visa Trusted Agent Protocol (TAP) Adapter * * Maps Bolyra's ZKP mutual handshake to Visa TAP's trust verification flow. * Instead of relying on Visa's centralized registry to vouch for an agent, * the agent proves — via zero-knowledge — that a human has authorized it * with a specific spend policy, without revealing the policy graph. * * TAP Flow (standard): * 1. Agent signs HTTP request with cryptographic key (RFC 9421) * 2. Merchant verifies signature against Visa's agent registry * 3. Visa's Payment Signals API matches agent request to consumer instructions * * Bolyra-enhanced Flow: * 1. Agent presents a ZKP proof of human authorization + spend policy * 2. Merchant verifies the proof locally (no Visa registry lookup needed) * 3. The payment signal includes the ZKP scope commitment for audit trail * * Privacy gain: the merchant learns "this agent is authorized to spend up to * tier X in category Y" without learning the exact limit, the human's identity, * or the full policy graph. * * @see https://developer.visa.com/capabilities/trusted-agent-protocol * @see https://github.com/visa/trusted-agent-protocol */ import type { HumanIdentity, AgentCredential, HandshakeResult } from '@bolyra/sdk'; import type { SpendPolicy, TAPVerificationRequest, TAPVerificationResult, PaymentVerificationConfig } from './types'; /** * Compute a TAP trust score (0-100) from a Bolyra handshake result and * the requested transaction. * * Scoring: * - 35 pts: Both ZKP proofs valid (human + agent) * - 25 pts: Spend policy covers the requested transaction * - 15 pts: Credential not expired * - 15 pts: Session nonce is fresh (within maxProofAge) * - 10 pts: Scope commitment is non-zero (delegation chain active) */ export declare function computeTAPScore(handshake: HandshakeResult, credential: AgentCredential, spendPolicy: SpendPolicy, request: TAPVerificationRequest, maxProofAge: number): { score: number; warnings: string[]; }; /** * Generate a TAP-compatible ZKP verification for an agent transaction. * * This is the primary entry point for the Visa TAP adapter. It: * 1. Runs a Bolyra mutual handshake (human proves they authorized the agent) * 2. Encodes the spend policy into the ZKP bitmask * 3. Verifies the proof (off-chain by default for high-throughput commerce) * 4. Maps the result to TAP's trust verification format * * @param human - The human operator's Bolyra identity * @param agent - The agent's Bolyra credential * @param spendPolicy - The human's spend policy for this agent * @param request - The TAP verification request (merchant + transaction details) * @param config - Adapter configuration * @returns TAP verification result with trust score and payment signal */ export declare function createVisaTAPVerification(human: HumanIdentity, agent: AgentCredential, spendPolicy: SpendPolicy, request: TAPVerificationRequest, config?: PaymentVerificationConfig): Promise; /** * Create a cached TAP verifier — reuses verification results within maxProofAge. * * For high-throughput merchant integrations where the same agent makes * multiple purchases within a short window. * * @param human - The human operator's identity * @param resolveCredential - Resolves agent DID to Bolyra credential + spend policy * @param config - Adapter configuration * @returns A function that verifies TAP requests with caching */ export declare function createCachedTAPVerifier(human: HumanIdentity, resolveCredential: (agentDid: string) => Promise<{ credential: AgentCredential; spendPolicy: SpendPolicy; } | null>, config?: PaymentVerificationConfig): (request: TAPVerificationRequest) => Promise;