Skip to content
API Documentation
BastionGuard™
LeakAggregator.cpp
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#include "LeakAggregator.hpp"
22#include "LeakNormalizer.hpp"
23
25 std::unique_ptr<ILeakProvider> provider)
26{
27 providers.push_back(std::move(provider));
28}
29
30std::vector<LeakRecord>
31LeakAggregator::queryAll(const std::string& email)
32{
33 std::vector<LeakRecord> all;
34
35 for (auto& provider : providers) {
36 try {
37 auto res = provider->checkEmail(email);
38 all.insert(all.end(), res.begin(), res.end());
39 }
40 catch (const std::exception&) {
41 }
42 }
43
44 return LeakNormalizer::normalize(all);
45}
void addProvider(std::unique_ptr< ILeakProvider > provider)
std::vector< LeakRecord > queryAll(const std::string &email)
std::vector< std::unique_ptr< ILeakProvider > > providers
static std::vector< LeakRecord > normalize(const std::vector< LeakRecord > &input)