Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
ddf27e2
Improve input handling and expiry display
ELF-Nigel Feb 28, 2026
832a434
Refactor examples and harden helpers
ELF-Nigel Feb 28, 2026
7a96b0b
Add local time tamper guard
ELF-Nigel Feb 28, 2026
7d5912d
Format examples and helpers
ELF-Nigel Feb 28, 2026
fc06208
Tighten subscription loop types
ELF-Nigel Feb 28, 2026
276f059
Updated library_x64.lib binrary
ELF-Nigel Mar 1, 2026
27856cf
Update main.cpp
ELF-Nigel Mar 1, 2026
a09d226
Update example to KeyAuth 1.3 SDK and remove time guard
ELF-Nigel Mar 2, 2026
8a9190c
Remove bundled SDK libs; keep placeholders
ELF-Nigel Mar 2, 2026
ffd7329
Inline sleep constants and save path
ELF-Nigel Mar 2, 2026
8e53c6f
Wire lockout helpers and delay methods
ELF-Nigel Mar 2, 2026
32eacda
Sync example with library sources and lockout helpers
ELF-Nigel Mar 2, 2026
715c600
Remove bundled libs from example
ELF-Nigel Mar 2, 2026
edac87b
Restore bundled libs for offline build
ELF-Nigel Mar 2, 2026
55e4358
Fix x64 example includes and auth header
ELF-Nigel Mar 2, 2026
d4a7606
Link x64 example with library sources
ELF-Nigel Mar 2, 2026
c3affb0
Add Security.hpp to x64 example
ELF-Nigel Mar 2, 2026
582f411
Add killEmulator header for x64 build
ELF-Nigel Mar 2, 2026
a40ce4e
Fix x64 link deps for libsodium/zlib
ELF-Nigel Mar 2, 2026
4a3bd5a
Sync auth.cpp host hardening
ELF-Nigel Mar 2, 2026
13245c8
Wipe host strings in example lib
ELF-Nigel Mar 2, 2026
b33eb65
Add https/proxy guards to example lib
ELF-Nigel Mar 2, 2026
6e85127
Sync winhttp proxy check include
ELF-Nigel Mar 2, 2026
64cce07
Link winhttp for proxy checks in example
ELF-Nigel Mar 2, 2026
96e67c8
Document lockout and delay helpers
ELF-Nigel Mar 2, 2026
3700a0b
Add library sync script and CI checkout
ELF-Nigel Mar 2, 2026
2ce4f90
Allow CI dispatch from library repo
ELF-Nigel Mar 2, 2026
248375c
Remove dispatch trigger from CI
ELF-Nigel Mar 2, 2026
3a2a419
Add network hardening example usage
ELF-Nigel Mar 2, 2026
e9150c4
Document live ban monitor
ELF-Nigel Mar 2, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: ci

on:
push:
pull_request:

jobs:
build-windows:
runs-on: windows-latest
steps:
- name: checkout
uses: actions/checkout@v4

- name: checkout keyauth-cpp-library-1.3API
uses: actions/checkout@v4
with:
repository: ELF-Nigel/keyauth-cpp-library-1.3API
path: keyauth-lib
ssh-key: ${{ secrets.KEYAUTH_CPP_LIB_DEPLOY_KEY }}

- name: sync library into example
shell: powershell
run: |
if (Test-Path "keyauth-lib") {
Copy-Item -Recurse -Force "keyauth-lib\\*" "x86\\lib"
Copy-Item -Recurse -Force "keyauth-lib\\*" "x64\\lib"
} else {
Write-Error "Library checkout missing"
}

- name: setup msvc
uses: ilammy/msvc-dev-cmd@v1

- name: build x64 release
shell: powershell
run: |
if (Test-Path "x64/example.sln") {
msbuild "x64/example.sln" /m /p:Configuration=Release /p:Platform=x64
} else {
Write-Error "x64/example.sln not found"
}
60 changes: 60 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,20 @@ if (KeyAuthApp.checkblack()) {
}
```

## **Live ban monitor (threaded)**

Optional background check that polls every 45 seconds. Always stop it before exiting.

```cpp
KeyAuthApp.start_ban_monitor(45, false, [] {
std::cout << "Blacklisted, exiting..." << std::endl;
exit(0);
});

// later, before exit
KeyAuthApp.stop_ban_monitor();
```

## **Login with username/password**

```cpp
Expand Down Expand Up @@ -367,3 +381,49 @@ if (KeyAuthApp.response.success)
std::cout << KeyAuthApp.response.message << std::endl;
}
```

## SDK Dependencies
This repo does not include the KeyAuth C++ SDK binaries/headers. Populate the following folders from the KeyAuth 1.3 SDK repo:
- `x64/lib/`
- `x86/lib/`

You can copy the `lib/` folder contents from `keyauth-cpp-library-1.3API` into each architecture folder.

## Lockout & Delay Helpers (KeyAuth 1.3 SDK)
The example now wires the built-in helpers from the KeyAuth 1.3 SDK for safer rate limiting and consistent delays.

Typical usage:
```cpp
if (KeyAuthApp.lockout_active()) {
std::cout << "Try again in " << KeyAuthApp.lockout_remaining_ms() << " ms";
KeyAuthApp.close_delay();
return 0;
}

// on init failure
KeyAuthApp.init_fail_delay();

// on bad input
KeyAuthApp.bad_input_delay();

// on failed auth
KeyAuthApp.record_login_fail();

// on successful auth
KeyAuthApp.reset_lockout();

// before exit
KeyAuthApp.close_delay();
```

## Keeping Example + Library In Sync
This repo is kept in sync with `ELF-Nigel/keyauth-cpp-library-1.3API`.

Local sync:
```bash
./scripts/sync_lib.sh git@github.com:ELF-Nigel/keyauth-cpp-library-1.3API.git
```

CI sync:
- The workflow checks out the library repo and copies it into `x86/lib` and `x64/lib` before building.
- Add a repo secret named `KEYAUTH_CPP_LIB_DEPLOY_KEY` with the **library repo** deploy key (read/write).
Binary file added library_x64.lib
Binary file not shown.
24 changes: 24 additions & 0 deletions scripts/sync_lib.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
param(
[string]$LibRepo = "git@github.com:ELF-Nigel/keyauth-cpp-library-1.3API.git",
[string]$DestX86 = "x86/lib",
[string]$DestX64 = "x64/lib"
)

$ErrorActionPreference = "Stop"

$work = Join-Path $env:TEMP "keyauth-lib-sync"
if (Test-Path $work) { Remove-Item -Recurse -Force $work }

git clone --depth 1 $LibRepo $work

# Copy entire lib contents into both arch folders
if (-not (Test-Path $DestX86)) { New-Item -ItemType Directory -Force $DestX86 | Out-Null }
if (-not (Test-Path $DestX64)) { New-Item -ItemType Directory -Force $DestX64 | Out-Null }

Remove-Item -Recurse -Force (Join-Path $DestX86 "*")
Remove-Item -Recurse -Force (Join-Path $DestX64 "*")

Copy-Item -Recurse -Force (Join-Path $work "*") $DestX86
Copy-Item -Recurse -Force (Join-Path $work "*") $DestX64

Write-Host "Synced KeyAuth library into $DestX86 and $DestX64"
18 changes: 18 additions & 0 deletions scripts/sync_lib.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env bash
set -euo pipefail

LIB_REPO=${1:-git@github.com:ELF-Nigel/keyauth-cpp-library-1.3API.git}
DEST_X86=${2:-x86/lib}
DEST_X64=${3:-x64/lib}

WORK=$(mktemp -d)
trap 'rm -rf "$WORK"' EXIT

git clone --depth 1 "$LIB_REPO" "$WORK"

mkdir -p "$DEST_X86" "$DEST_X64"
rm -rf "$DEST_X86"/* "$DEST_X64"/*
cp -R "$WORK"/* "$DEST_X86"/
cp -R "$WORK"/* "$DEST_X64"/

echo "Synced KeyAuth library into $DEST_X86 and $DEST_X64"
112 changes: 2 additions & 110 deletions x64/auth.hpp
Original file line number Diff line number Diff line change
@@ -1,111 +1,3 @@
#include <Windows.h>
#include <iostream>
#include <vector>
#include <fstream>
#pragma once

struct channel_struct
{
std::string author;
std::string message;
std::string timestamp;
};

namespace KeyAuth {
class api {
public:

std::string name, ownerid, version, url, path;
static bool debug;

api(std::string name, std::string ownerid, std::string version, std::string url, std::string path, bool debugParameter = false)
: name(name), ownerid(ownerid), version(version), url(url), path(path)
{
setDebug(debugParameter);
}

void ban(std::string reason = "");
void init();
void check(bool check_paid = false);
void log(std::string msg);
void license(std::string key, std::string code = "");
std::string var(std::string varid);
std::string webhook(std::string id, std::string params, std::string body = "", std::string contenttype = "");
void setvar(std::string var, std::string vardata);
std::string getvar(std::string var);
bool checkblack();
void web_login();
void button(std::string value);
void upgrade(std::string username, std::string key);
void login(std::string username, std::string password, std::string code = "");
std::vector<unsigned char> download(std::string fileid);
void regstr(std::string username, std::string password, std::string key, std::string email = "");
void chatget(std::string channel);
bool chatsend(std::string message, std::string channel);
void changeUsername(std::string newusername);
std::string fetchonline();
void fetchstats();
void forgot(std::string username, std::string email);
void logout();

class subscriptions_class {
public:
std::string name;
std::string expiry;
};

class userdata {
public:

// user data
std::string username;
std::string ip;
std::string hwid;
std::string createdate;
std::string lastlogin;

std::vector<subscriptions_class> subscriptions;
};

class appdata {
public:
// app data
std::string numUsers;
std::string numOnlineUsers;
std::string numKeys;
std::string version;
std::string customerPanelLink;
std::string downloadLink;
};

class responsedata {
public:
// response data
std::vector<channel_struct> channeldata;
bool success{};
std::string message;
bool isPaid{};
};

bool activate = false;
class Tfa {
public:
std::string secret;
std::string link;
Tfa& handleInput(KeyAuth::api& apiInstance);
private:
void QrCode();
};

Tfa& enable2fa(std::string code = "");
Tfa& disable2fa(std::string code = "");

userdata user_data;
appdata app_data;
responsedata response;
Tfa tfa;

private:
std::string sessionid, enckey;
static void setDebug(bool value);
};
}
#include "lib/auth.hpp"
13 changes: 13 additions & 0 deletions x64/auth_guard.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#pragma once

#include <Windows.h>
#include <string>

inline void checkAuthenticated(const std::string& ownerid) {
while (true) {
if (GlobalFindAtomA(ownerid.c_str()) == 0) {
exit(13);
}
Sleep(1000);
}
}
Loading