import type { DcqlQuery, TrustLevel } from "./types.js"; export declare const ENVELOPE_VERSION: "credentagent.verification/v1"; export declare const ENVELOPE_SENTINEL: "verification_required"; /** Built-in credential kinds the envelope describes. */ export type BuiltinKind = "age" | "membership" | "payment"; /** * The age DCQL for a threshold, matching the reference verifier (ISO 18013-5 mDL + * EU PID). Mirrors the server's credential-gate/dcql.ts so the envelope describes the * request the wallet will actually receive. * * Every option we offer must be able to prove `age_over_${minAge}` — `age.over(N)` * verifies exactly that claim (invariant 5: an 18+ proof must never satisfy a 21+ * gate). Asking a doctype only for `age_over_18` while gating on 21 would let the * wallet match and then get refused at verify — a dead end. So both doctypes are * asked for the boolean at THIS threshold (plus the 18 bracket, mirroring * credential-gate/doc-spec.ts). A credential that lacks the threshold claim simply * won't match its option, which is the correct outcome. */ export declare function ageDcql(minAge?: number): DcqlQuery; export interface VerificationRequired { /** Sentinel an agent/client keys on to detect a consent handshake. */ _credentagent: typeof ENVELOPE_SENTINEL; version: typeof ENVELOPE_VERSION; order: { id: string; total: number; currency: string; }; reason: { gate: string; pass: false; detail: string; }; present: { credential: BuiltinKind; /** Age threshold, when the credential is `age`. */ min_age?: number; /** The DCQL the wallet will receive. */ request: DcqlQuery; /** Per-order link the buyer opens to prove the credential on their phone. */ approve_url: string; }; /** How the agent resumes once the buyer has proven the credential. */ resume: { tool: string; poll: string; }; trust_level: TrustLevel; } export interface BuildEnvelopeArgs { order: { id: string; total: number; currency: string; }; credential: BuiltinKind; request: DcqlQuery; approveUrl: string; detail: string; minAge?: number; gate?: string; resumeTool?: string; trustLevel?: TrustLevel; } /** Build the typed refusal an agent can drive. Pure — no I/O. */ export declare function buildVerificationRequired(args: BuildEnvelopeArgs): VerificationRequired; /** True if a tool result is a verification_required envelope (for agents/clients). */ export declare function isVerificationRequired(v: unknown): v is VerificationRequired; /** A one-line, agent-facing instruction string to carry alongside the envelope. */ export declare function envelopeInstruction(env: VerificationRequired): string;