C++ SDK

Native C++ SDK for Windows applications. Uses WinHTTP for HTTP requests — no external dependencies required.

✓ Header-only library

Just include authon.h in your project. Links against winhttp.lib automatically via pragma.

Installation

Download authon.h and place it in your project directory. Link against winhttp.lib (handled automatically via pragma comment).

Project structure
text
your_project/
├── main.cpp
├── authon.h        ← SDK header
└── CMakeLists.txt  (optional)
Compile with MSVC
cmd
cl /EHsc main.cpp /link winhttp.lib
Compile with g++ (MinGW)
cmd
g++ main.cpp -o loader.exe -lwinhttp

Quick Start

A minimal example showing initialization, login, and session verification:

main.cpp
C++
#include <iostream>
#include <string>
#include <windows.h>
#include "authon.h"

#define APP_ID  "your-app-id-here"
#define API_KEY "your-api-key-here"
#define API_URL "https://api.authon.pro"

// Generate a hardware ID from volume serial
std::string getHWID() {
    DWORD serial = 0;
    GetVolumeInformationA("C:\\", NULL, 0, &serial, NULL, NULL, NULL, 0);
    char hwid[32];
    sprintf_s(hwid, "HWID-%08X", serial);
    return std::string(hwid);
}

int main() {
    // Create SDK instance
    authon::Authon auth(APP_ID, API_KEY, API_URL);

    // Step 1: Initialize
    std::cout << "[*] Initializing..." << std::endl;
    if (!auth.init()) {
        std::cout << "[!] Failed to connect." << std::endl;
        return 1;
    }

    auto app = auth.getApp();
    std::cout << "[+] Connected to: " << app.name
              << " (v" << app.version << ")" << std::endl;

    // Step 2: Login
    std::string hwid = getHWID();
    std::string username, password;
    std::cout << "Username: "; std::getline(std::cin, username);
    std::cout << "Password: "; std::getline(std::cin, password);

    if (!auth.login(username, password, hwid)) {
        std::cout << "[!] Login failed." << std::endl;
        return 1;
    }

    auto user = auth.getUser();
    std::cout << "[+] Welcome, " << user.username << "!" << std::endl;
    std::cout << "    Level: " << user.level << std::endl;
    std::cout << "    Expires: " << user.expiresAt << std::endl;

    // Step 3: Verify session
    if (auth.check()) {
        std::cout << "[+] Session valid." << std::endl;
    }

    // Your application code here...
    system("pause");
    return 0;
}

SDK Reference

All methods are in the authon namespace.

Constructor

Create instance
C++
authon::Authon auth(
    const std::string& appId,
    const std::string& apiKey,
    const std::string& apiUrl = "https://api.authon.pro"
);

init()

Validates credentials and fetches app info. Must be called first.

C++
bool success = auth.init();

login(username, password, hwid)

Authenticate with username/password. HWID is optional but recommended.

C++
bool success = auth.login("user", "pass", "HWID-12345");

registerUser(username, password, licenseKey, hwid)

Register a new user with a license key.

C++
bool success = auth.registerUser("newuser", "pass", "AUTH-XXXX-XXXX", "HWID-12345");

license(licenseKey, hwid)

Authenticate with license key only (no username needed).

C++
bool success = auth.license("AUTH-XXXX-XXXX-XXXX", "HWID-12345");

check()

Verify the current session is still valid.

C++
bool valid = auth.check();

getVar(key)

Retrieve an application variable by key.

C++
std::string value = auth.getVar("latest_version");

setVar(key, value)

Set a user-specific variable.

C++
auth.setVar("last_login_time", "2025-06-15");

downloadFile(fileId)

Download an encrypted file as raw bytes.

C++
std::vector<unsigned char> bytes = auth.downloadFile("file_id_here");
// Write to disk or load into memory

log(message)

Send a log message to the dashboard.

C++
auth.log("User opened settings panel");

Getters

Data structures
C++
// After successful login/register:
authon::UserData user = auth.getUser();
// user.username, user.level, user.expiresAt, user.sessionToken

// After init:
authon::AppData app = auth.getApp();
// app.name, app.version, app.updateUrl

// Status:
bool ready = auth.isInitialized();

Full Example with Menu

A complete loader application with login, register, and license-only options:

loader.cpp
C++
#include <iostream>
#include <string>
#include <windows.h>
#include "authon.h"

#define APP_ID  "your-app-id"
#define API_KEY "your-api-key"
#define API_URL "https://api.authon.pro"

std::string getHWID() {
    DWORD serial = 0;
    GetVolumeInformationA("C:\\", NULL, 0, &serial, NULL, NULL, NULL, 0);
    char hwid[32];
    sprintf_s(hwid, "HWID-%08X", serial);
    return std::string(hwid);
}

int main() {
    SetConsoleTitleA("My Application Loader");
    authon::Authon auth(APP_ID, API_KEY, API_URL);

    std::cout << "[*] Connecting..." << std::endl;
    if (!auth.init()) {
        std::cout << "[!] Connection failed." << std::endl;
        system("pause"); return 1;
    }
    std::cout << "[+] Connected to " << auth.getApp().name << std::endl << std::endl;

    std::string hwid = getHWID();

    std::cout << "[1] Login" << std::endl;
    std::cout << "[2] Register" << std::endl;
    std::cout << "[3] License Key" << std::endl;
    std::cout << std::endl << "Choice: ";

    int choice; std::cin >> choice; std::cin.ignore();
    std::cout << std::endl;

    if (choice == 1) {
        std::string user, pass;
        std::cout << "Username: "; std::getline(std::cin, user);
        std::cout << "Password: "; std::getline(std::cin, pass);
        if (!auth.login(user, pass, hwid)) {
            std::cout << "[!] Login failed." << std::endl;
            system("pause"); return 1;
        }
    } else if (choice == 2) {
        std::string user, pass, key;
        std::cout << "Username: "; std::getline(std::cin, user);
        std::cout << "Password: "; std::getline(std::cin, pass);
        std::cout << "License:  "; std::getline(std::cin, key);
        if (!auth.registerUser(user, pass, key, hwid)) {
            std::cout << "[!] Registration failed." << std::endl;
            system("pause"); return 1;
        }
    } else {
        std::string key;
        std::cout << "License Key: "; std::getline(std::cin, key);
        if (!auth.license(key, hwid)) {
            std::cout << "[!] Invalid license." << std::endl;
            system("pause"); return 1;
        }
    }

    std::cout << std::endl << "[+] Authenticated!" << std::endl;
    auto user = auth.getUser();
    std::cout << "    Level: " << user.level << std::endl;
    std::cout << "    Expires: " << user.expiresAt << std::endl;

    // Send activity log
    auth.log("Application loaded successfully");

    // Get server variable
    std::string version = auth.getVar("app_version");
    if (!version.empty()) {
        std::cout << "    Server version: " << version << std::endl;
    }

    std::cout << std::endl << "Application ready!" << std::endl;
    system("pause");
    return 0;
}

Platform Notes

Windows Only (WinHTTP)

The SDK uses WinHTTP by default. For Linux/Mac, the header includes libcurl support when _WIN32 is not defined.

SSL/TLS

The SDK connects over HTTPS (port 443) to api.authon.pro. SSL validation is handled automatically.

Anti-Debug

For production loaders, consider adding anti-debug checks (IsDebuggerPresent, CheckRemoteDebuggerPresent) before initialization.

HWID Generation

The example uses volume serial number. For stronger binding, combine multiple hardware identifiers (CPU ID, motherboard serial, etc).