LeakAggregator.hpp

1. Overview

The LeakAggregator.hpp header defines the LeakAggregator class, a coordination component responsible for aggregating and normalizing data breach and identity leak results obtained from multiple external providers.

This module acts as an orchestration layer between independent leak detection services and the BastionGuard identity protection subsystem, providing a unified query interface.

Functionally, LeakAggregator provides:

  • Centralized management of multiple leak data providers
  • Unified querying of heterogeneous breach databases
  • Normalization of provider-specific response formats
  • Aggregation and deduplication of leak records
  • Scalable integration of new data sources
  • Decoupling between UI and external breach services

2. Dependencies and Includes

#include "../providers/ILeakProvider.hpp"
#include "../model/LeakRecord.hpp"

#include <memory>
#include <vector>
#include <string>
  • ILeakProvider.hpp – abstract interface for breach data providers
  • LeakRecord.hpp – standardized data model for leak results
  • <memory> – smart pointer ownership management
  • <vector> – container for registered providers and results
  • <string> – email identifiers and query parameters

3. Class Declaration and Scope

class LeakAggregator

The class follows a composition-based design pattern, owning a collection of provider implementations through std::unique_ptr.

This ensures strict ownership, deterministic lifetime management, and prevention of resource leaks.


4. Public Interface

4.1 Provider Registration

void addProvider(std::unique_ptr<ILeakProvider> provider);

Registers a new leak data provider with the aggregator. Ownership of the provider instance is transferred to the LeakAggregator.

  • provider – concrete implementation of ILeakProvider

After registration, the provider becomes part of all subsequent query operations.


4.2 Unified Query Interface

std::vector<LeakRecord>
queryAll(const std::string& email);

Executes a breach lookup request against all registered providers using the supplied email address as the query key.

  • email – email address to be checked for exposure
  • Return value – list of normalized LeakRecord entries

The returned vector represents the aggregated view of all detected leaks across providers.


5. UI Components

This module does not implement user interface elements. It is designed as a backend aggregation service consumed by presentation layers.


6. Internal State and Data Model

std::vector<std::unique_ptr<ILeakProvider>> providers;

The aggregator maintains exclusive ownership of all registered providers in an internal container.

  • Providers are invoked sequentially or in parallel (implementation-dependent)
  • Lifetime is tied to the LeakAggregator instance
  • No global or static state is used

7. Internal Logic

A typical aggregation workflow includes:

  • Iterating over all registered providers
  • Invoking provider-specific query methods
  • Collecting returned LeakRecord objects
  • Normalizing and validating records
  • Removing duplicates and inconsistencies
  • Merging results into a unified response

Implementations may optionally use concurrency to reduce query latency.


8. Integration with Identity Protection Subsystem

LeakAggregator is a core component of the identity leak detection workflow and is typically integrated with:

  • IdentityLeakPage UI modules
  • Background privacy monitoring services
  • Cloud-based breach intelligence providers
  • User notification and alert systems

9. Auto-Update (Scheduled Refresh)

This component does not implement scheduling. Periodic or automatic checks are managed by higher-level services.


10. Settings Storage

Provider configuration (API keys, endpoints, limits) is typically managed by external configuration or credential storage systems.


11. Extensibility and Maintainability

  • Provider abstraction: new services can be added by implementing ILeakProvider.
  • Loose coupling: aggregation logic remains independent of provider internals.
  • Testability: mock providers can be injected for unit testing.
  • Scalability: supports incremental expansion without architectural changes.

12. Runtime and Security Considerations

  • Privacy protection: email addresses must be handled in compliance with data protection regulations (GDPR, etc.).
  • Transport security: provider queries should use secure channels (TLS).
  • Rate limiting: aggregation should respect provider usage quotas.
  • Error isolation: failure of one provider must not block results from others.
  • Data integrity: responses should be validated to prevent injection of malformed records.
  • Auditability: sensitive queries should be logged in a privacy-preserving manner.