/** * Protected local file primitives shared by durable stores. * * Records are stored as exact RFC 8785 canonical bytes, keyed with HMAC-SHA256, * kept in owner-only directories, and published with exclusive hard links so a * destination is written at most once. Nothing here knows about any caller's * lifecycle or error taxonomy: callers supply their own error factories. * * This module must not import from `src/decision/**`. */ /** Creates the error a caller throws. Keeps each store's error class and message unchanged. */ export type ProtectedFileErrorFactory = (message?: string) => Error; /** Opaque by default: callers learn only that stored bytes failed verification. */ export declare class ProtectedFileIntegrityError extends Error { constructor(); } export declare function requireIntegrityKey(key: unknown, label: string): Buffer; export declare function keyedName(key: Buffer, domain: string, parts: string[]): string; export declare function macFor(key: Buffer, domain: string, value: unknown): string; export declare function macMatches(key: Buffer, domain: string, value: unknown, mac: unknown): boolean; /** Stored bytes must be exactly the canonical serialization, so no byte can change unnoticed. */ export declare function serialized(value: unknown): string; /** Parse stored bytes, refusing anything that is not exactly its canonical serialization. */ export declare function parseCanonical(raw: string, integrityError?: ProtectedFileErrorFactory): unknown; /** Create (if needed) and require an owner-only directory. Any group or other permission bit is refused. */ export declare function ensurePrivateDirectory(directory: string, message: string, error?: ProtectedFileErrorFactory): Promise; export declare function syncDirectory(directory: string): Promise; export declare function exists(path: string): Promise; /** Exclusive hard-link publication. Returns false when the destination already exists. */ export declare function publishExclusive(directory: string, destination: string, contents: string, temporaryPrefix: string): Promise; /** * Publish a body-free tombstone record in canonical form. An existing tombstone * already has the same effect, so publication is idempotent. */ export declare function publishTombstone(directory: string, path: string, record: Record, temporaryPrefix: string): Promise; //# sourceMappingURL=protected-files.d.ts.map