All SDKs

C++ SDK

A single header; no dependencies on Windows.

v1.1.0Any C++17 compiler

Install

terminal
curl -o warden.hpp https://wardenauth.dev/packages/cpp/1.1.0/warden.hpp

One header, C++17. No dependencies on Windows (Visual Studio links the system libraries itself; MinGW: -lwinhttp -lbcrypt). Linux/macOS: -lcurl.

  • Then #include "warden.hpp". On Windows it uses WinHTTP and the system random number generator; signature checks, SHA-2 and JSON are built in.
  • With MinGW, link statically (-static) so the program doesn't pick up another MinGW's runtime DLLs.

The URL includes the version, and released versions never change, so a pinned install keeps working. See the changelog for older versions.

Quickstart

Replace the placeholders with your app's values from its Overview in the dashboard, where the Add Warden to your project card shows this snippet with your credentials already filled in. The application ID and public key are safe to ship; never put your seller key in client code.

main.cpp
#include <iostream>
#include "warden.hpp"

int main() {
    warden::Client app(
        "YOUR_APP_ID",
        "YOUR_PUBLIC_KEY",
        "1.0",
        "https://wardenauth.dev/api/v1");

    if (!app.init().success) return 1;

    std::string key;
    std::cout << "License key: ";
    std::getline(std::cin, key);
    auto res = app.license(key);
    if (!res.success) return 1;
    std::cout << "Welcome " << app.user.username << "\n";
}

Example project

A complete program with the usual loader menu (login, register, upgrade, key-only login) that prints the user's details. It bundles the SDK, so it runs without installing anything. Fill in the Application credentials block and put your code where it says Your application code goes here.

Edit
main.cpp
Run
cl /std:c++17 /EHsc main.cpp (or g++, CMake)
Needs
Any C++17 compiler
Download the C++ example

API

Every method maps to one call of the client API. Each response is checked against your public key, timestamp and nonce before the SDK uses it.

MethodWhat it does
app.init(…)Start a session. Call this first.
app.login(…)Log in with a username and password.
app.register_user(…)Create an account by redeeming a license key.
app.license(…)Log in with just a license key.
app.upgrade(…)Redeem another key on an existing account.
app.check(…)Whether the session is still logged in.
app.check_blacklist(…)Whether this machine's IP or HWID is blacklisted.
app.var(…)Read a global variable.
app.get_var(…)Read one of the user's variables.
app.set_var(…)Write one of the user's variables.
app.file(…)Download a file into memory.
app.webhook(…)Call one of your webhooks through the server.
app.log(…)Send a log line to your dashboard.
app.ban(…)Ban the current user (e.g. after detecting a debugger).
app.fetch_online(…)Usernames with a logged-in session.
app.fetch_stats(…)User, online and key counts.
app.chat_get(…)The last 50 messages in a channel.
app.chat_send(…)Post to a channel.
app.logout(…)End the session.

Errors

No exceptions: calls return a warden::Response (success, message, data), and app.last_error holds the latest failure. Lookups such as var() and file() return std::optional.

Rejected responses, including a bad signature, a stale timestamp or a replayed nonce, fail the same way, so a spoofed server can't log anyone in. See verifying responses, and protecting your app for what a signature check can and can't stop.