/** * The revocation feed client (PRD G-6). * * It takes a snapshot of everything currently revoked, then follows the live * stream, so `enforce()` can deny a call on a grant that was revoked seconds * ago without a network round trip per call. * * The important part is what happens when it cannot keep up. The feed records * when it last heard from the auth service; if that is longer ago than * `staleAfterMs`, it reports itself stale and `enforce()` denies rather than * allowing calls on information it knows may be out of date. */ import type { HttpClient } from '../http.js'; import { type CredentialRef, type RevocationMatch } from './set.js'; export interface RevocationFeedOptions { /** * How long the feed may go without hearing from the auth service before it * is stale and calls fail closed. Default 5000 ms. */ staleAfterMs?: number; /** Delay before reconnecting a dropped stream. Default 500 ms. */ reconnectDelayMs?: number; /** `stream` (Server-Sent Events) or `poll` (long polling). Default `stream`, falling back to `poll`. */ transport?: 'stream' | 'poll'; } export type FeedUnavailableReason = 'disabled' | 'not_ready' | 'unauthorized' | 'network'; export interface RevocationFeedState { /** A snapshot has been read at least once. */ synced: boolean; /** * When the feed last heard from the auth service, on a monotonic clock * (0 if never). Comparable with `performance.now()`, not with `Date.now()`. */ freshAt: number; /** Feed position of the last entry applied. */ cursor: number; /** Identifiers currently known to be revoked or suspended. */ known: number; /** Why the feed is not usable, if it is not. */ unavailable: FeedUnavailableReason | null; } export declare class RevocationFeed { #private; constructor(http: HttpClient, options?: RevocationFeedOptions); get staleAfterMs(): number; state(): RevocationFeedState; /** Synced recently enough to be trusted. */ isFresh(now?: number): boolean; /** Why this credential must not be used, according to what the feed knows. */ match(ref: CredentialRef, now?: number): RevocationMatch | null; /** Start following the feed. Idempotent. */ start(): void; /** Stop following, and forget what was known (a restarted feed re-reads the snapshot). */ stop(): Promise; /** * Wait until the feed is fresh, or the timeout passes. Returns whether it is * fresh: `false` means callers must fail closed. */ ready(timeoutMs?: number): Promise; } //# sourceMappingURL=feed.d.ts.map