PasswordImporter.hpp

1. Overview

The PasswordImporter.hpp file is a Browser password-import API in BastionGuard.

Defines imported credential records, browser-format detection, CSV import entry points, URL-to-domain normalization, and conversion into BastionGuard password entries.

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/PasswordImporter.hpp
  • Language: C++
  • Source type: .hpp
  • Line count: 60
  • SHA-256: 530778e2ec7e7150d9953c2a76cf7bdef2d1c91e37c33e70dc1078f3262078e5

3. Dependencies

The file declares the following compile-time dependencies:

Project

  • PasswordEntry.hpp

C/C++ Runtime

  • string
  • vector

4. Types and Public Contract

The file declares or implements the following principal types:

  • Struct: ImportedCredential
  • Class: BrowserFormat
  • Class: PasswordImporter
  • Enum: BrowserFormat

Declared Public Members

  • std::string name;
  • std::string url;
  • std::string username;
  • std::string password;
  • std::string notes;
  • static std::vector<ImportedCredential> importFromFile( const std::string& path, std::string& errorMsg );
  • static BrowserFormat detectFormat(const std::string& headerLine);
  • static PasswordEntry toPasswordEntry(const ImportedCredential& cred);
  • static std::string domainFromUrl(const std::string& url);

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

Supported Export Layouts

  • Chrome and Edge: name,url,username,password-style columns.
  • Firefox: detects headers containing httpRealm or formActionOrigin and imports URL, username, and password.
  • Safari: detects title/notes or OTP-related columns and imports optional notes.

CSV Handling

  • Removes an initial UTF-8 BOM and trailing carriage returns.
  • Supports quoted fields, commas inside quoted fields, and doubled-quote escaping.
  • Skips rows with neither URL nor username.
  • Derives a display name from the hostname when no explicit title is available.

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

The file contains no explicit worker-thread or callback-lifetime mechanism.


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.