import type { MaybePromise } from "./types.js"; import type { CommittedDraw } from "./mandate.js"; /** The atomic result: committed, or rejected for a specific revocation/single-use/cap reason. */ export type CommitResult = { ok: true; } | { ok: false; reason: "revoked" | "consumed" | "over-total"; }; export interface RevocationStore { /** Is this grant (or its subject, via the kill-switch) revoked? */ isRevoked(intentId: string, subject?: string): MaybePromise; revoke(intentId: string): MaybePromise; /** Kill-switch: revoke every grant carrying this subject. */ revokeSubject(subject: string): MaybePromise; /** Committed draws for the intent (feeds checkDraw's cumulative + replay pre-checks). */ priorDraws(intentId: string): MaybePromise; /** Atomically commit a draw iff (a) the grant (and its `subject`) is NOT revoked, (b) its * pspTransactionId is unused for this intent, AND (c) committed-sum + amount ≤ `totalAmount`. * All three — kill-switch, single-use, cumulative cap — are decided HERE in one * check-and-append, so a revoke or concurrent draw landing after the seam's fast pre-checks * still refuses. `revoked` = grant/subject revoked; `consumed` = duplicate txid; * `over-total` = would breach the cap. */ commitDraw(intentId: string, draw: CommittedDraw, opts: { totalAmount: number; subject?: string; }): MaybePromise; } export declare class MemoryRevocationStore implements RevocationStore { private readonly revoked; private readonly revokedSubjects; private readonly draws; isRevoked(intentId: string, subject?: string): boolean; revoke(intentId: string): void; revokeSubject(subject: string): void; priorDraws(intentId: string): CommittedDraw[]; commitDraw(intentId: string, draw: CommittedDraw, opts: { totalAmount: number; subject?: string; }): CommitResult; }