C++ SDK
SDK 2.1.1 offline migration: configure trusted tenant public keys independently of cache files. No pins means no cached authorization. Persisted offline helpers use the configured client and re-verify the original signed token on every read. Offline setup and migration.
Device and usage operations in SDK 2.1.1: all clients can request key-only device removal using tenant slug, key and activation ID. HTTP 204 confirms removal; protected portals still require OTP/account customer flows. Usage reporting returns boolean confirmation, supports nested/empty metadata objects and normalizes quantities below 1 to 1. Java/C++ use tryMeter/try_meter for that boolean contract and retain legacy detailed meter results. Neither operation retries automatically or uses offline cache. See this SDK's README for signatures and failure handling.
Floating sessions in SDK 2.1.1: checkout and heartbeat return a failed session without credentials on network/HTTP/parse failure (RequestFailed). Business denial preserves its error code or uses FloatingDenied. Floating never uses offline cache. The new boolean TryCheckin equivalent confirms HTTP 204; legacy checkin is best effort. Method names follow this language's conventions. See the source README and SDK availability matrix before choosing a registry version.
Official SDKsC++ SDK
SDK 2.1.1 request settings
A slow or unavailable license server must not leave your application waiting indefinitely. All eight SDKs default to a 10-second timeout for each attempt and two additional attempts for safe requests. The usual backoff is 250 milliseconds, then 500 milliseconds. This is not a single 10-second deadline for the complete operation: activation also fetches a nonce.
- License validation, nonce/public-key retrieval and floating heartbeat may retry a network failure or HTTP 5xx response. Set the retry count to zero to disable these retries; the range is 0–5.
- Floating checkout, activation POST, usage reporting, device removal and checkin are sent once. A lost response can follow a successful server change, so retrying these blindly can duplicate work.
- HTTP 3xx/4xx responses and malformed successful responses do not retry. SDK-owned transports do not follow redirects, so configure the final HTTPS API address directly.
For validate/activate, branch on the server's error code when available. Otherwise
HttpError means an HTTP rejection, InvalidResponse means malformed
successful license/nonce evidence and RequestFailed means the network/5xx attempts
were exhausted without a usable signed cache. Rejection or malformed successful evidence never
becomes cached authorization. A network outage can use only a separately trusted, unexpired proof.
| SDK | Configuration |
|---|---|
| C++ | The constructor takes URL, 10 timeout seconds, cache toggle, trusted keys, cache path, device ID, then 2 retries. |
Timeout mechanisms follow each runtime: Python uses socket I/O timeouts; Unity delegates to its transport. Caller cancellation is separate from retry policy. Unity's default adapter disables redirects; WebGL needs Unity 2021.3 or later for that protection and fails closed on older versions. Portable .NET tests do not certify an Editor, IL2CPP or browser build. Verify your actual target before shipping.
Install SDK 2.1.1 using the SDK installation references and follow the offline migration guide when upgrading from 1.x.
C++17 static library. SDK 2.1.1 requires libcurl, OpenSSL and nlohmann/json 3.11.3+ (header-only, build time). Public SDK headers use standard-library types. Check your package registry for the released version. JSON fields are extracted using targeted string search so the dependency tree stays minimal. Built with CMake 3.14+.
Download C++ SDK (ZIP)Building — Linux / macOS
# Ubuntu / Debian sudo apt-get install libcurl4-openssl-dev libssl-dev nlohmann-json3-dev # macOS (Homebrew) brew install curl openssl cd SDKs/cpp cmake -B build -DCMAKE_BUILD_TYPE=Release cmake --build build
Building — Windows (vcpkg + Visual Studio)
vcpkg install curl:x64-windows openssl:x64-windows
cmake -B build `
-DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake
cmake --build build --config ReleaseIntegrating into your CMake project
add_subdirectory(SDKs/cpp) target_link_libraries(your_target PRIVATE permitcore)
Quick start
#include <permitcore/permit_client.hpp> #include <iostream> int main() { permitcore::PermitClient client("https://api.permitcore.dev"); auto result = client.validate("PERMIT-XXXX-XXXX-XXXX-XXXX", "", "7f3e9a2b-1c4d-4e8f-9a6b-3d2c1e0f5a8b"); // expected_product_id — optional, reject a key issued for a different product if (result.is_valid) { std::cout << "License OK — product: " << result.product_name << " (" << result.product_id << ")\n"; if (result.is_offline) std::cout << "Running on a cached result — server was unreachable.\n"; } else if (result.error_code == "WrongProduct") { std::cerr << "This key is for a different product: " << result.product_id << "\n"; } else { std::cerr << "License rejected: " << result.message << "\n"; } }
validate() and activate() never throw for a network failure — they fall back to the local offline-grace cache automatically and, failing that, return is_valid: false with is_offline: true. Only meter() throws PermitException.
Validate with version check
auto result = client.validate("PERMIT-XXXX-XXXX-XXXX-XXXX", "2.3.1"); if (!result.is_valid && !result.min_version.empty()) show_error("Upgrade required: minimum version is " + result.min_version);
Activation
permitcore::ActivateOptions opts; opts.device_id = "sha256-of-mac-plus-board-serial"; opts.device_name = "My-Linux-Server"; opts.version = "2.3.1"; opts.expected_product_id = "7f3e9a2b-1c4d-4e8f-9a6b-3d2c1e0f5a8b"; // optional auto result = client.activate("PERMIT-XXXX-XXXX-XXXX-XXXX", opts); if (result.is_valid) { std::cout << "Activated successfully.\n"; } else if (result.error_code == "WrongProduct") { std::cerr << "Wrong product: " << result.product_id << "\n"; } else { std::cerr << "Activation failed: " << result.message << "\n"; }
Metered billing
auto m = client.meter("PERMIT-XXXX-XXXX-XXXX-XXXX", "export", 1); if (m.recorded) std::cout << "Usage recorded.\n"; // Batch — 5 API calls at once auto m2 = client.meter("PERMIT-XXXX-XXXX-XXXX-XXXX", "api_call", 5);
ValidateResult struct fields
| Field | Type | Description |
|---|---|---|
is_valid | bool | true if the license is active and all checks pass |
product_name | std::string | Product name |
remaining_activations | int | Remaining activation seats (0 = at limit) |
expires_at | std::string | ISO 8601 expiry timestamp; empty if perpetual |
message | std::string | Status message from the server |
vendor_warning | std::string | Non-empty if the vendor's PermitCore plan is lapsing |
features | std::vector<std::string> | Enabled feature flags |
custom_fields | std::map<std::string, std::string> | Vendor-defined metadata |
is_trial | bool | true if this is a trial license |
trial_days_remaining | int | Days remaining in the trial |
node_locked | bool | true if HWID node-locking is enabled |
offline_grace_days | int | Days the software may run without a server check |
min_version | std::string | Minimum required software version; empty if unrestricted |
max_version | std::string | Maximum allowed software version; empty if unrestricted |
is_offline | bool | true when this result was served from the local offline-grace cache (server unreachable) |
product_id | std::string | Stable ID of the product this license belongs to. Always present when a license was found, even without passing expected_product_id. |
ActivateOptions struct
| Field | Description |
|---|---|
device_id | Hardware fingerprint — SHA-256 of MAC address, motherboard serial, or similar stable identifier |
device_name | Human-readable label shown in the admin activation history |
version | Current software version string, e.g. "2.3.1" |
expected_product_id | Optional — reject (error_code == "WrongProduct") unless this key belongs to this exact product. Also accepted as validate()'s 3rd argument. |
Product scoping: by default, any active key belonging to your tenant validates/activates successfully regardless of which product it was issued for. Find a product's ID in the Admin panel under Products.
Offline grace period (built in)
When offline_grace_days is set on the license, validate()/activate() cache every successful result to the OS temp directory (%TEMP% on Windows, $TMPDIR//tmp on POSIX). If a later call can't reach the server, the cached result is returned automatically — check is_offline to detect it. Disable via the third constructor argument: permitcore::PermitClient client(base_url, 10, false);.
Implementation notes
- No JSON library. Fields extracted from responses (including the cache file) using
std::string::find— the client also links OpenSSL for signature verification. - Thread safety. Each method call creates and destroys its own curl easy handle. Safe to call from multiple threads on a shared
PermitClientinstance. - Custom timeout. Default is 10 seconds. Pass a second argument:
permitcore::PermitClient client("https://...", 5);for 5 seconds. - HTTPS on Windows. Build against the WinSSL backend (
CURL_USE_SCHANNEL) for zero-config HTTPS without deploying a CA bundle.