Skip to content
API Documentation
BastionGuard™
PasswordImporter.hpp
Go to the documentation of this file.
1/*
2 * BastionGuard™
3 * Copyright (C) 2025–2026 Calogero Scarnà
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, version 3.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <https://www.gnu.org/licenses/>.
16 *
17 * BastionGuard™ is a trademark of Calogero Scarnà.
18 * The BastionGuard™ name and branding are not licensed under the GPL.
19 */
20
21#pragma once
22
23#include <string>
24#include <vector>
25#include "PasswordEntry.hpp"
26
28 std::string name;
29 std::string url;
30 std::string username;
31 std::string password;
32 std::string notes;
33};
34
42
44public:
45 static std::vector<ImportedCredential> importFromFile(
46 const std::string& path,
47 std::string& errorMsg
48 );
49
50 static BrowserFormat detectFormat(const std::string& headerLine);
52 static std::string domainFromUrl(const std::string& url);
53
54private:
55 static std::vector<ImportedCredential> parseChrome(const std::vector<std::string>& lines);
56 static std::vector<ImportedCredential> parseFirefox(const std::vector<std::string>& lines);
57 static std::vector<ImportedCredential> parseSafari(const std::vector<std::string>& lines);
58 static std::vector<std::string> splitCsvLine(const std::string& line);
59 static std::string unquoteCsv(const std::string& field);
60};
BrowserFormat
static std::string unquoteCsv(const std::string &field)
static std::string domainFromUrl(const std::string &url)
static BrowserFormat detectFormat(const std::string &headerLine)
static std::vector< ImportedCredential > importFromFile(const std::string &path, std::string &errorMsg)
static std::vector< ImportedCredential > parseChrome(const std::vector< std::string > &lines)
static std::vector< ImportedCredential > parseFirefox(const std::vector< std::string > &lines)
static std::vector< std::string > splitCsvLine(const std::string &line)
static PasswordEntry toPasswordEntry(const ImportedCredential &cred)
static std::vector< ImportedCredential > parseSafari(const std::vector< std::string > &lines)