import { EntryId } from '../interfaces/Entry.mjs'; import type { PasswordExtraDict } from '../interfaces/PasswordExtraDict.js'; import type FavaLibMediator from '../FavaLibMediator.mjs'; /** * Manages the export and import of entries in various formats. */ declare class ExportImportManager { private readonly mediator; private readonly passwordExtraDict; /** * Constructs a new instance of ExportImportManager. * @param mediator - The mediator for accessing other components. * @param passwordExtraDict - Additional words to be used for password strength evaluation. */ constructor(mediator: FavaLibMediator, passwordExtraDict: PasswordExtraDict); private get libraryLoader(); private get vaultDataManager(); private get vaultOperationsManager(); private get persistentStorageManager(); /** * Export entries in the specified format, optionally (when a password is provided) encrypted. * If the password is not provided, the user be warned about the dangers of exporting clear text. * @param format - The export format ('text' or 'html'). * @param password - Optional password for encryption. * @param userWasWarnedAboutExportingClearText - Whether the user was warned about exporting clear text. * @returns A promise that resolves to the exported data as a string. */ exportEntries(format: 'text' | 'html', password?: string, userWasWarnedAboutExportingClearText?: boolean): Promise; /** * Generates a QR code (as a data URL) encoding the otpauth:// URI for a single entry. * The resulting QR code can be scanned by any authenticator app to import the entry. * @param entryId - The id of the entry to generate a QR code for. * @returns A promise that resolves to a data URL (PNG) containing the QR code. */ generateQrCodeForEntry(entryId: EntryId): Promise; private generateTextExport; private generateHtmlExport; /** * Import entries from a text file, optionally (when a password is provided) decrypt first * @param fileContents - The contents of the text file. * @param password - Optional password for decryption. * @returns A promise that resolves to an array of objects, each containing the line number, * the EntryId or null if it was not a valid entry and the error if there was one. */ importFromTextFile(fileContents: string, password?: string): Promise<{ lineNr: number; entryId: EntryId | null; error: unknown; }[]>; /** * Import an entry from an OTP URI. * @param otpUri - The OTP URI to import * @returns A promise that resolves to the newly added EntryId. * @throws {ExportImportError} If the URI is invalid or contains unsupported OTP type. */ importFromUri(otpUri: string): Promise; /** * Import an entry from a QR code image. * @param imageInput - The image containing the QR code * @returns A promise that resolves to the newly added EntryId. * @throws {InvalidInputExportImportError} If the QR code is invalid or doesn't contain a valid OTP URI. */ importFromQRCode(imageInput: string | File | Uint8Array): Promise; } export default ExportImportManager;