CDC Badge OS
Firmware for the CDC Badge v1.0 hardware security key
Loading...
Searching...
No Matches
BackupManager.h
Go to the documentation of this file.
1#pragma once
2
3#include <cstdint>
4
5namespace cdc::os_ui {
6
11 bool ok = false;
12 uint16_t imported = 0;
13 uint16_t failed = 0;
14 uint8_t modules = 0;
15 uint8_t skipped = 0;
16 bool system = false;
17};
18
36class BackupManager {
37public:
41 static BackupManager& instance();
42
52 bool exportTo(const char* passphrase);
53
64 BackupSummary importFrom(const char* passphrase);
65
69 bool backupExists() const;
70
75 bool deleteBackup();
76
77private:
78 BackupManager() = default;
79 BackupManager(const BackupManager&) = delete;
80 BackupManager& operator=(const BackupManager&) = delete;
81};
82
83} // namespace cdc::os_ui
bool exportTo(const char *passphrase)
Exports all module sections into one encrypted backup file.
BackupSummary importFrom(const char *passphrase)
Restores from the on-device backup file (best-effort).
bool backupExists() const
Reports whether a backup file is present on the device.
bool deleteBackup()
Deletes the on-device backup file.
static BackupManager & instance()
Returns the process-wide singleton.
Aggregated outcome of a restore across all modules.
uint16_t failed
Total records skipped due to errors.
bool ok
Container decrypted and parsed successfully.
bool system
System/NVS settings section was present and applied.
uint8_t modules
Number of module sections that were applied.
uint16_t imported
Total records restored (modules + system section).
uint8_t skipped
Module sections with no matching module on-device.