import type { RotatableDIDDocument } from '../../../types/passport.js';
/** Phase 4.1 / P12 — caller-supplied DID document resolver. */
export type AcpResolveDidDocument = (agentId: string) => Promise<RotatableDIDDocument | null>;
import type { OwnerConfirmation, V2Delegation } from '../../types.js';
import type { DenialReason as FoundationDenialReason } from '../types.js';
export { ACP_API_VERSION } from './types.js';
import type { AcpCheckoutSession, AcpCreateCheckoutSessionRequest, AcpDenial, AcpDenialReason, AcpErrorCode, AcpErrorType, AcpOp, AcpReceipt, AcpUpdateCheckoutSessionRequest, AcpVerifyResult } from './types.js';
/**
 * Deterministic mapping from an APS denial reason to the ACP error
 * envelope a merchant would have returned. This is the reverse of
 * the merchant's view: when APS gates an ACP call BEFORE it reaches
 * the merchant, we still emit the ACP-shaped error so the caller can
 * surface it identically to a real merchant response.
 */
export declare function apsToAcpError(reason: AcpDenialReason): {
    type: AcpErrorType;
    code: AcpErrorCode;
    /** Optional JSONPath into the ACP request body. */
    param?: string;
};
/**
 * Map an ACP-specific denial reason to the foundation Tier-1
 * DenialReason taxonomy. Generic gateways and audit-log consumers read
 * Tier 1; rail-aware clients can keep reading Tier 2.
 *
 * Mapping policy (also documented in
 * docs/governance/payment-rails-denial-vocabulary.md):
 *   - Direct carryovers stay as themselves
 *     (spend_limit_exceeded, wallet_revoked, no_commerce_scope)
 *   - delegation_expired → time_window_violation
 *     (foundation models all expiry as time-window failures)
 *   - merchant_not_allowed / currency_mismatch / idempotency_conflict
 *     / invalid_session_state / api_version_mismatch
 *     / requires_owner_confirmation → rail_error
 *     (no exact Tier-1 analog; Tier-2 carries the precise reason for
 *     ACP-aware consumers)
 */
export declare function mapAcpDenialToFoundation(reason: AcpDenialReason): FoundationDenialReason;
export interface AcpAllowedFromDelegation {
    /** Merchant identifiers (PSP merchant ids, domains, or platform ids). */
    allowed_merchants: string[];
    /** ISO 4217 lowercase. Empty = no currency constraint. */
    allowed_currencies: string[];
    /** Hard cap in minor units across all line items. null = no cap. */
    max_total: number | null;
    /** Token expiry — ISO 8601 of policy_context.valid_until if set. */
    valid_until?: string;
}
/**
 * Project a V2Delegation into the subset of ACP context it permits.
 * Used by preAuthorizeAcpCheckout and by callers that want to render
 * a delegation as a buyer-facing summary before initiating a session.
 *
 * Field sourcing (matches AP2 / MPP / Stripe-Issuing conventions):
 *   - max_total ← resolveSpendLimitCents(delegation)
 *     [walks resource_limits.spend_limit_cents → commerce.spend_limit
 *     alias → constraints.spend_limit_cents string]
 *   - allowed_merchants ← scope.constraints.allowed_merchants (CSV)
 *   - allowed_currencies ← scope.constraints.allowed_currencies (CSV)
 *   - valid_until ← policy_context.valid_until
 */
export declare function delegationToAcpAllowed(delegation: V2Delegation): AcpAllowedFromDelegation;
/**
 * One-way derivation: given a CheckoutSession the merchant returned,
 * compute the V2Delegation fields a downstream gateway could pin
 * against. Lossy by design — line-item content does not survive.
 */
export declare function acpSessionToDelegationHints(session: AcpCheckoutSession): {
    scope: {
        action_categories: string[];
        constraints: {
            allowed_merchants?: string[];
            allowed_currencies: string[];
            spend_limit_cents: number;
        };
    };
    notes: string[];
};
export type AcpPreAuthorizeResult = {
    allow: true;
} | {
    allow: false;
    reason: AcpDenialReason;
    detail?: string;
};
export interface AcpPreAuthorizeOptions {
    /** Owner-signed confirmation, when the delegation declares an
     *  escalation_requirement on action_class 'commerce' with
     *  requires_owner_confirmation: true. The gate runs the full
     *  verifyOwnerConfirmation() chain (signer = delegator, scope
     *  binding, expiry, signature). */
    owner_confirmation?: OwnerConfirmation;
    /** Per-action confirmation_scope binds details_hash. ACP defaults
     *  to hashing the canonical request body when omitted. */
    action_details?: Record<string, unknown>;
    /** session_id for 'per_session' confirmation scope. */
    session_id?: string | null;
    /** Caller-provided clock; defaults to Date.now() in tests/fixtures. */
    now?: Date;
}
/**
 * Decide whether a checkout-session request is permitted under a
 * delegation BEFORE the agent calls the merchant. Pure function;
 * no I/O, no side effects, no state. Intended to be the rail-side
 * hook that emits a signed receipt or denial after this returns.
 */
export declare function preAuthorizeAcpCheckout(request: AcpCreateCheckoutSessionRequest | AcpUpdateCheckoutSessionRequest, delegation: V2Delegation, 
/** Currency of the merchant's catalog; ACP carries this only on the response. */
expectedCurrency?: string, options?: AcpPreAuthorizeOptions): AcpPreAuthorizeResult;
/**
 * Final spend check, run when a session has been retrieved or
 * completed and authoritative totals are in hand. Separate from
 * preAuthorizeAcpCheckout because totals are a server-side property.
 */
export declare function checkAcpSessionUnderBudget(session: AcpCheckoutSession, delegation: V2Delegation): AcpPreAuthorizeResult;
export interface SignAcpReceiptInput {
    op: AcpOp;
    session_id: string;
    /** Raw ACP request body (will be canonicalized + digested). */
    request_body: unknown;
    /** Authoritative session state at receipt mint time. */
    session_state: AcpCheckoutSession;
    delegation_ref?: string;
    agent_id: string;
    /** Phase 4.1 / Q1: opt into the AccountabilityReceiptBase-aligned shape.
     *  When set (or scope_of_claim supplied), the receipt carries
     *  claim_type='rail.acp.v1', timestamp aliasing issued_at, and
     *  scope_of_claim. Default: legacy shape (no new fields). */
    accountability_shape?: boolean;
    /** Override the rail's default scope_of_claim. Setting this implies
     *  accountability_shape=true. */
    scope_of_claim?: import('../../accountability/types/base.js').ScopeOfClaim;
    /** Phase 4.1 / P12: when supplied alongside `issuer_key_ref`, the
     *  receipt's `signer` field becomes a DID URI of the form
     *  `${issuer_agent_id}#${issuer_key_ref}`. Verifiers resolve this
     *  against the agent's RotatableDIDDocument. When either is omitted,
     *  signer falls back to the legacy raw-hex pubkey form. */
    issuer_agent_id?: string;
    issuer_key_ref?: string;
    /** Phase 4.1 / Q2: link to the AttributionReceipt this op pays against. */
    attribution_receipt_id?: string;
    /** Phase 4.1 / Q2: link to the SettlementRecord whose payment_obligations
     *  declared this payment. */
    settlement_record_id?: string;
}
export declare function signAcpReceipt(input: SignAcpReceiptInput, signerPrivateKeyHex: string): AcpReceipt;
export interface VerifyAcpReceiptOptions {
    now?: Date;
    ttl_seconds?: number;
    expected_signer?: string;
    /** Phase 4.1 / P12: required when the receipt's `signer` is a DID URI.
     *  The async `verifyAcpReceiptWithDID()` / `verifyAcpDenialWithDID()`
     *  paths invoke this resolver; the sync `verifyAcpReceipt()` ignores it
     *  and returns DID_RESOLVER_MISSING for DID-URI signers. */
    resolveDidDocument?: AcpResolveDidDocument;
}
export declare function verifyAcpReceipt(receipt: AcpReceipt, options?: VerifyAcpReceiptOptions): AcpVerifyResult;
/**
 * Phase 4.1 / P12: async verifier that resolves DID URIs against the
 * caller-supplied DID document resolver. Falls back to the legacy
 * raw-hex path when receipt.signer doesn't start with 'did:'.
 */
export declare function verifyAcpReceiptWithDID(receipt: AcpReceipt, options?: VerifyAcpReceiptOptions): Promise<AcpVerifyResult>;
export interface SignAcpDenialInput {
    op: AcpOp;
    session_id?: string;
    request_body: unknown;
    reason: AcpDenialReason;
    delegation_ref?: string;
    agent_id: string;
    /** Phase 4.1 / P12: see SignAcpReceiptInput.issuer_agent_id. */
    issuer_agent_id?: string;
    issuer_key_ref?: string;
}
export declare function signAcpDenial(input: SignAcpDenialInput, signerPrivateKeyHex: string): AcpDenial;
export declare function verifyAcpDenial(denial: AcpDenial, options?: VerifyAcpReceiptOptions): AcpVerifyResult;
/**
 * Phase 4.1 / P12: async denial verifier with DID URI support.
 */
export declare function verifyAcpDenialWithDID(denial: AcpDenial, options?: VerifyAcpReceiptOptions): Promise<AcpVerifyResult>;
//# sourceMappingURL=index.d.ts.map