PasswordImportDialog.hpp

1. Overview

The PasswordImportDialog.hpp file is a Bulk password-import dialog interface in BastionGuard.

Declares the CSV file chooser, preview list, import progress controls, worker-thread state, and confirmed bulk-import signal.

The documentation below is generated from the supplied source and covers its API surface, runtime responsibilities, data flow, filesystem or command interactions, concurrency model, and security considerations.


2. Source Inventory

  • Original path: password_manager/PasswordImportDialog.hpp
  • Language: C++
  • Source type: .hpp
  • Line count: 79
  • SHA-256: b66320ff37c11fe369fe3ceb6431504c98176b0e1f3be92a218eb429d7ec64c2

3. Dependencies

The file declares the following compile-time dependencies:

Project

  • PasswordImporter.hpp
  • PasswordEntry.hpp

GTK/GLib

  • gtkmm.h

C/C++ Runtime

  • vector
  • thread
  • atomic
  • utility

4. Types and Public Contract

The file declares or implements the following principal types:

  • Class: PasswordImportDialog

Declared Public Members

  • explicit PasswordImportDialog(Gtk::Window& parent);
  • ~PasswordImportDialog();
  • void present();
  • void hide();
  • sigc::signal<void(std::vector<BulkItem>)> signal_import_confirmed();

5. API and Method Inventory

The file contains no out-of-line function implementation. Its behavior is supplied by declarations, inline functions, or associated implementation files.


6. Functional Architecture

Import Workflow

  • Selects browser-exported CSV files through a GTK file chooser.
  • Displays detected record count and a preview list before confirmation.
  • Converts imported credentials into vault entries and generates identifiers/timestamps before emission.
  • Reports worker progress using atomics and Glib::Dispatcher.

Concurrency

  • Maintains a dedicated import thread and joins it during destruction when necessary.
  • Keeps GTK operations on the main thread through dispatcher callbacks.
  • Prevents duplicate import starts through an atomic importing_ flag.

7. Operational Flow

  1. Select and read a browser-exported CSV file.
  2. Normalize encoding and line endings, then detect the browser format.
  3. Parse rows while honoring CSV quoting rules.
  4. Preview normalized credentials and convert them into vault entries.
  5. Emit or store the bulk records and report completion.

8. Filesystem and External Command Surface

No hard-coded absolute filesystem path is declared directly in this file.

Commands or Security Primitives Referenced

  • sh

9. Concurrency and Lifecycle

  • Uses worker threads for operations that could block the GTK main loop.
  • Uses atomic state for cross-thread progress, lock state, or lifecycle coordination.
  • Uses Glib::Dispatcher to marshal worker completion to GTK.

10. Security Considerations

  • Password metadata and encrypted secrets are separated, reducing accidental exposure through the index file.
  • Cleartext passwords exist in process memory while the vault is unlocked and during import/export workflows.
  • CSV import and export files are unencrypted and must be handled as sensitive data.
  • Background callbacks must not outlive their owning GTK objects.

11. Implementation Considerations

  • This header defines the public or private class contract; behavior is implemented by the matching .cpp file unless marked inline.

12. Licensing and Branding

The source is distributed under the GNU General Public License version 3.

The source header identifies BastionGuard™ as a trademark and states that the name and branding are not licensed under the GPL.

The software is provided without warranty, including implied warranties of merchantability or fitness for a particular purpose.