Kiosk: System Name storage, validation, sync, and sent on license validation
Adds local System Name persistence (trimmed, 1-40) in system_kv, an
injectable sync module with conflict/invalid revert and a pending-sync
flag, a background SystemNameSync worker (retries on boot and on a timer),
and api_client support for PUT /licenses/{key}/system-name plus the
additive systemName field/systemNameStatus on license validation. The
license service sends the stored name and applies the status. Covers
validation, pending retry, and conflict revert with a faked HTTP layer.
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
#include "db/database_manager.h"
|
||||
#include "network/api_client.h"
|
||||
#include <functional>
|
||||
#include <string>
|
||||
|
||||
namespace radiantwave::license {
|
||||
@@ -28,6 +30,16 @@ constexpr long long GRACE_PERIOD_SECONDS = 7LL * 24 * 60 * 60;
|
||||
Result validateStoredLicense(radiantwave::db::DatabaseManager& db,
|
||||
std::string* outErrorMessage = nullptr);
|
||||
|
||||
// Injectable core of validateStoredLicense: performs the given validation call
|
||||
// instead of the live portal. On success it stamps "last verified" and applies
|
||||
// any advisory `systemNameStatus` to the local System Name state.
|
||||
using ValidateFn = std::function<api::LicenseResult(
|
||||
const std::string& key, const std::string& email, const std::string& systemName)>;
|
||||
|
||||
Result validateStoredLicenseWith(radiantwave::db::DatabaseManager& db,
|
||||
const ValidateFn& validate,
|
||||
std::string* outErrorMessage = nullptr);
|
||||
|
||||
// Records the current time as the "last verified" stamp of the license. Called
|
||||
// after every successful server validation so the offline grace window starts
|
||||
// (or is extended) from the most recent confirmation.
|
||||
|
||||
Reference in New Issue
Block a user