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.
31 lines
1.1 KiB
C++
31 lines
1.1 KiB
C++
#pragma once
|
|
|
|
#include <string>
|
|
|
|
namespace radiantwave::validation {
|
|
|
|
// Returns true if `email` looks like a valid email address (single '@',
|
|
// non-empty local and domain parts, no whitespace, domain has at least two
|
|
// dot-separated labels).
|
|
bool isValidEmail(const std::string& email);
|
|
|
|
// Reduces `input` to uppercase alphanumeric characters, capped at 16.
|
|
// Used for license key entry: the dash separators are re-inserted on display.
|
|
std::string sanitizeLicenseKey(const std::string& input);
|
|
|
|
// Formats a sanitized license key as four dash-separated groups of four
|
|
// characters (XXXX-XXXX-XXXX-XXXX). Partial input yields partial output.
|
|
std::string formatLicenseKey(const std::string& sanitized);
|
|
|
|
// The maximum length of a System Name (per the API contract).
|
|
constexpr size_t SYSTEM_NAME_MAX_LENGTH = 40;
|
|
|
|
// Removes leading and trailing ASCII whitespace from `input`.
|
|
std::string trim(const std::string& input);
|
|
|
|
// Returns true when `name` (already trimmed) is a valid System Name: 1-40
|
|
// characters. Empty or whitespace-only names are invalid (never a clear).
|
|
bool isValidSystemName(const std::string& name);
|
|
|
|
} // namespace radiantwave::validation
|