/** * Backup path formatting and pre-import backup file writer. * * Split out of `lib/storage.ts` in RC-2. `createTimestampedBackupPath` is a * pure path builder that every backup caller can use without taking a * dependency on the import pipeline. `writePreImportBackupFile` is the * bounded-time writer used inside `importAccounts` to snapshot the existing * accounts file before apply. * * Every file written here holds live refresh tokens, so the writer is the one * place that owns the 0600 mode, the bounded write time, and the temp+rename * swap. `writeBackupFileContent` exists so a caller that already has the exact * bytes it wants preserved — the pre-write credential snapshotter, which * copies the previous file verbatim rather than re-serializing it — does not * hand-roll a second writer with weaker guarantees. */ import type { AccountStorageV3 } from "./migrations.js"; /** * The `backups/` directory that belongs to one accounts file. * * Every backup kind shares it: pre-import backups, keychain migration * artefacts, pre-global-migration directories, and credential snapshots. A * caller that prunes must therefore scope its deletes by its own filename * prefix rather than by this directory. */ export declare function getBackupDirectory(storagePath: string): string; /** * Timestamped backup path beside an explicitly named accounts file. * * Callers that write a backup for a path other than the currently active one — * the global-storage migration writes to the global file while a project path * is active — must use this rather than {@link createTimestampedBackupPath}, * so the backup lands next to the file it describes. */ export declare function createTimestampedBackupPathFor(storagePath: string, prefix?: string): string; export declare function createTimestampedBackupPath(prefix?: string): string; /** * Write one backup file atomically, with a bounded write time and mode 0600. * * `content` is written verbatim. Temp+rename keeps a half-written backup from * ever being visible under its final name, and the timeout keeps a stuck disk * from blocking the operation the backup precedes. */ export declare function writeBackupFileContent(backupPath: string, content: string): Promise; export declare function writePreImportBackupFile(backupPath: string, snapshot: AccountStorageV3): Promise; //# sourceMappingURL=backup.d.ts.map