import { ReactNode } from 'react'; /** * Viewer for a server-produced redacted document. Renders text inline and each * redacted span as a masked chip; clicking a chip asks the server to reveal that * one span. The original plaintext is NEVER in the document the client holds — * the chip carries only an id + kind; `onReveal` round-trips to the server, where * `@tangle-network/agent-app/redact`'s `revealSpan` runs the authorization check * and writes the audit trail. So authz + audit are server-truth; this is display. * * Structural types (no `@tangle-network/agent-app` dependency) — the viewer needs * only `{ id, kind }` per span; the cipher stays server-side. */ type RedactedDocSegment = { type: "text"; text: string; } | { type: "redacted"; id: string; kind: string; }; interface RedactedDocumentData { segments: RedactedDocSegment[]; } interface RevealResult { ok: boolean; value?: string; /** e.g. `forbidden` | `not_found` when `ok` is false. */ reason?: string; } interface RedactedDocumentProps { document: RedactedDocumentData; /** Reveal one span by id. Wire to a server route that calls agent-app's * `revealSpan` (authz + audit happen there). Resolves with the original. */ onReveal: (spanId: string) => Promise; /** Display label for a redaction kind (default: the kind, upper-cased). */ labelForKind?: (kind: string) => string; className?: string; } declare function RedactedDocument({ document, onReveal, labelForKind, className, }: RedactedDocumentProps): ReactNode; export { type RedactedDocSegment, RedactedDocument, type RedactedDocumentData, type RedactedDocumentProps, type RevealResult };