/** * Lightweight helpers for detecting whether a PDF already contains a * signature placeholder (`/FT /Sig` widget reachable from `/AcroForm`). * * Used by: * - `sign_pdf` (Phase 3) to decide whether to call `addSignaturePlaceholder` * before signing when `autoInjectPlaceholder` is enabled. * - `inspect_pdf` (Phase 6) to expose `hasSignaturePlaceholder` to AI agents * so they can pick between "sign" and "re-sign" workflows. * * Implementation goes through pdfnative's hardened `openPdf()` reader so that * CWE-674 / CWE-400 mitigations are inherited automatically. */ import { type ParsedDict as PdfDict, type PdfReader } from 'pdfnative'; /** Resolve the `/AcroForm` dictionary, or `null` when absent / malformed. */ export declare function getAcroForm(reader: PdfReader): PdfDict | null; /** Count signature widgets (`/FT /Sig`) reachable from the AcroForm fields. */ export declare function countSignatureWidgets(reader: PdfReader): number; /** True when the PDF already exposes at least one signature widget. */ export declare function hasSignaturePlaceholder(reader: PdfReader): boolean; /** * Materialised view of a single signature widget useful to `verify_pdf`. * `contentsRaw` is the literal byte string parsed from `/Contents <...>` (one * JS-string char per byte — pdfnative stores PDF strings as Latin-1) and is * converted to a `Uint8Array` of the underlying CMS SignedData by * `signatureWidgetContentsBytes()`. */ export interface SignatureWidget { readonly fieldName: string | null; readonly byteRange: readonly [number, number, number, number] | null; readonly contentsRaw: string | null; readonly subFilter: string | null; readonly filter: string | null; readonly signingTimeRaw: string | null; readonly reason: string | null; readonly signerName: string | null; readonly location: string | null; readonly contactInfo: string | null; } /** Decode a `/Contents` literal byte-string into the underlying byte array. */ export declare function contentsToBytes(raw: string): Uint8Array; /** Enumerate every `/FT /Sig` widget, materialising its `/V` signature dict. */ export declare function collectSignatureWidgets(reader: PdfReader): SignatureWidget[]; //# sourceMappingURL=pdf-introspection.d.ts.map