import { type HybridSignature, type ProofBundle, type SessionToken, type TransactionReceipt, type TransactionReceiptResult, type VerifyOptions, type VerifyReceiptOptions, type VerifyResult } from "./types.js"; /** * Validate a ProofBundle against the Ratify Protocol. * * Checks in order: * 1. Structural: non-empty chain, chain depth ≤ MAX_DELEGATION_CHAIN_DEPTH, * challenge present, agent hybrid pubkey component sizes correct. * 2. Agent binding: bundle.agent_pub_key / agent_id match the leaf cert's * subject_pub_key / subject_id. * 3. For each cert in chain: * a. version == PROTOCOL_VERSION * b. now ∈ [issued_at, expires_at] * c. not revoked (per opts.is_revoked) * d. hybrid signature valid — BOTH Ed25519 and ML-DSA-65 components * verify against declared issuer_pub_key * e. chain linkage: cert[i].issuer_{id,pub_key} == cert[i+1].subject_{id,pub_key} * 4. Challenge freshness: challenge age ∈ [0, CHALLENGE_WINDOW_SECONDS]. * 5. Challenge signature: hybrid signature valid against agent_pub_key. * 6. Effective scope: required_scope ∈ intersectScopes(all cert scopes). * * Single-component failure fails the whole signature (fail-closed). */ export declare function verifyBundle(bundle: ProofBundle, opts?: VerifyOptions): Promise; /** * The presentation-side inputs of one streamed turn: the fresh challenge * the agent signed and the bindings it signed it under (SPEC §6.4.2). * Presented values, distinct from the verifier-side expectations carried * in VerifyOptions. */ export interface StreamedTurn { challenge: Uint8Array; challenge_at: number; challenge_sig: HybridSignature; /** Presented session binding (absent = unbound; otherwise 32 bytes). */ session_context?: Uint8Array; /** Presented stream binding (absent = unbound; otherwise 32 bytes + seq >= 1). */ stream_id?: Uint8Array; stream_seq?: number; } /** * The verifier-side controls that apply to a streamed-turn presentation * (SPEC §5.13). Deliberately NOT the full VerifyOptions: a streamed turn * re-verifies liveness and bindings, not the chain, so revocation, policy, * constraint, audit, and anchor options have no field here and can never * be passed and silently ignored. Callers who need fresh revocation or * policy semantics — including high-value operations the spec directs to * force_revocation_check — MUST run full verifyBundle instead. */ export interface StreamedVerifyOptions { /** * Must be present in token.granted_scope for the turn to be valid; * absent skips the check. The token stores the verified chain's * effective scope lex-sorted for exactly this check. */ required_scope?: string; /** * Makes the per-turn challenge single-use: consulted (without * consuming) after the session token's HMAC authenticates the * presentation and before the per-turn hybrid challenge signature is * verified; the challenge is atomically consumed after that signature * verifies — before the scope check. All store failures normalize to * the canonical unknown_challenge result. */ challenge_store?: import("./challenge_store.js").ChallengeStore; /** * Verifier-side session binding; when set, the turn's presented * session_context must match byte-for-byte (same statuses as the full * verifier). */ session_context?: Uint8Array; /** * Verifier-side stream state (stream_id match; stream_seq must be * exactly last_seen_seq+1, else stream_seq_replay / stream_seq_skip). * * This is a caller-owned SNAPSHOT: the verifier only reads it and never * advances it. Two concurrent turns carrying distinct valid challenges * and the same stream_seq will BOTH verify against the same snapshot. * Concurrency-safe sequence enforcement is the caller's responsibility: * atomically compare-and-advance your tracked last-seen sequence to * turn.stream_seq when (and only when) verification succeeds, and build * the snapshot from that tracked state. */ stream?: import("./types.js").StreamContext; /** Clock override (unix seconds); absent uses Date.now(). */ now?: number; } /** * Options-object form of the streamed fast path (SPEC §5.13): verifies one * turn against a previously issued SessionToken and enforces the * verifier-side controls in StreamedVerifyOptions — required scope against * the token's cached effective scope, single-use challenges, and * session/stream binding checks. * * Passing a full VerifyOptions (or any object carrying full-verifier-only * fields such as revocation, policy, or force_revocation_check) is * rejected at runtime, fail-closed — those options do not apply to a * token presentation and MUST NOT be silently ignored. Run verifyBundle * for their semantics. */ export declare function verifyStreamedTurnWithOptions(token: SessionToken, sessionSecret: Uint8Array, turn: StreamedTurn, opts?: StreamedVerifyOptions): Promise; /** * Fast-path verifier for streamed turns that present a SessionToken in place * of the full cert chain. Checks the HMAC, token validity window, challenge * freshness, and hybrid challenge signature against the token's agent pubkey. * The chain is NOT re-verified — that's the point of the token. * * @deprecated Presentation checks only — this form cannot enforce a * required scope, single-use challenges, or verifier-side session/stream * checks, so a token holder passes it for any protected action. Use * verifyStreamedTurnWithOptions. Retained for compatibility through the * v1.0.0-* releases. */ export declare function verifyStreamedTurn(token: SessionToken, sessionSecret: Uint8Array, challenge: Uint8Array, challengeAt: number, challengeSig: HybridSignature, sessionContext: Uint8Array | undefined, streamID: Uint8Array | undefined, streamSeq: number | undefined, now: number): Promise; /** * Verify a TransactionReceipt's envelope: version, structural checks, * party uniqueness, signature coverage, per-party ProofBundle verification, * agent_id/pubkey consistency, and party signature verification over the * canonical signable. Atomic: any single failure fails the whole receipt. */ export declare function verifyTransactionReceipt(receipt: TransactionReceipt, opts?: VerifyReceiptOptions): Promise; //# sourceMappingURL=verify.d.ts.map