Skip to content

AuthVaultix/AuthVaultix-CPP-Example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

3 Commits
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

AuthVaultix Logo

πŸ›‘οΈ AuthVaultix C++ SDK Example (AuthVaultix-CPP-Example)

This is the AuthVaultix C++ example SDK for https://authvaultix.com license key API auth.

This example demonstrates how to use the AuthVaultix SDK in your C++ project to protect your software from piracy and unauthorized access.


πŸ”’ Security Practices

  1. Utilize VMProtect or Themida: Protect your compiled .exe program from reverse engineering by using a commercial software protector like VMProtect or Themida (utilize their SDKs too for greater protection).
  2. Perform frequent integrity checks: Ensure the memory of the program has not been modified or tampered with by implementing regular integrity checks.
  3. Don't write downloaded bytes to disk: If you do not want the downloaded files/DLLs to be retrieved by the user, execute them directly in memory (using RunPE or similar techniques) rather than writing them to the hard drive.
  4. Robust Client-Side Protection: While our API ensures license validation, implementing robust client-side protection like obfuscation and integrity checks is crucial to prevent software tampering.

πŸ“„ Copyright License

AuthVaultix is licensed under the Elastic License 2.0.

  • You may not provide this software to third parties as a hosted or managed service where the service provides users with access to any substantial set of features or functionality of the software.
  • You may not move, change, disable, or circumvent the license key functionality in the software.
  • You may not alter, remove, or obscure any licensing, copyright, or other notices of the licensor in the software.

❓ What is AuthVaultix?

AuthVaultix is a powerful cloud-based authentication system designed to protect your software from piracy and unauthorized access. With AuthVaultix, you can implement secure licensing, user management, and subscription systems in your applications in minutes.


πŸ› οΈ AuthVaultixClient Instance Definition

Visit https://authvaultix.com/win/app/, select your application, and copy your credentials.

Replace them in your main.cpp file as shown below:

// πŸ›‘οΈ Encrypt credentials at compile-time to hide them from static analysis using skCrypt
auto name = skCrypt("Your_App_Name"); // App Name
auto ownerid = skCrypt("Your_Account_Owner_ID"); // Account Owner ID
auto secret = skCrypt("Your_App_Secret"); // App Secret
auto version = skCrypt("1.0"); // App Version

AuthVaultix::AuthVaultixClient client(
    name.decrypt(), 
    ownerid.decrypt(), 
    secret.decrypt(), 
    version.decrypt()
);

πŸš€ Initialize Application

You must call this function prior to using any other AuthVaultix function. Otherwise, other SDK functions will not work.

std::cout << "[+] Initializing SDK...\n";

if (!client.init()) {
    std::cout << "[-] Initialization Error: " << client.response_message << std::endl;
    system("pause");
    return 1;
}

πŸ”‘ Login with Username/Password

Authenticate a registered user using their username and password:

std::string user, pass;
std::cout << "Username: "; std::cin >> user;
std::cout << "Password: "; std::cin >> pass;

if (client.login(user, pass)) {
    std::cout << "\n[+] Login Successful! Welcome, " << client.user_data.username << std::endl;
} else {
    std::cout << "[-] Login Failed: " << client.response_message << std::endl;
}

πŸ“ Register User (Username/Password/License Key)

Register a new user account using a license key:

std::string user, pass, key;
std::cout << "Choose Username: "; std::cin >> user;
std::cout << "Choose Password: "; std::cin >> pass;
std::cout << "Enter License Key: "; std::cin >> key;

if (client.register_user(user, pass, key)) {
    std::cout << "[+] Registration Successful! You can now login." << std::endl;
} else {
    std::cout << "[-] Registration Failed: " << client.response_message << std::endl;
}

🎫 Login with License Key Only

If your application only uses license keys for access without requiring registration:

std::string key;
std::cout << "Enter License Key: "; std::cin >> key;

if (client.license_login(key)) {
    std::cout << "[+] License Login Successful!" << std::endl;
} else {
    std::cout << "[-] Error: " << client.response_message << std::endl;
}

πŸ‘€ User Data

Fetch information for the currently logged-in user:

std::cout << "\n====== USER DATA ======\n";
std::cout << "Username: " << client.user_data.username << std::endl;
std::cout << "IP Address: " << client.user_data.ip << std::endl;
std::cout << "HWID (Hardware ID): " << client.user_data.hwid << std::endl;
std::cout << "Creation Date: " << client.user_data.createdate << std::endl;
std::cout << "Last Login: " << client.user_data.lastlogin << std::endl;

πŸŽ–οΈ Check Subscriptions & Feature Permissions

Restrict certain features or menus of your app based on user subscriptions or dynamic permissions:

1. Feature Permission Check

if (client.check_feature_permission("VIP")) {
    std::cout << "[+] [VIP FEATURE] Access Granted! VIP menu loaded.\n";
    // Write your VIP code here
} else {
    std::cout << "[-] [VIP FEATURE] Access Denied! Please buy VIP package.\n";
}

2. Subscriptions & Expiry Check

if (!client.user_data.subscriptions.empty()) {
    std::cout << "\n====== ACTIVE SUBSCRIPTIONS ======\n";
    for (const auto& sub : client.user_data.subscriptions) {
        std::cout << "Subscription Name: " << sub.name << std::endl;
        std::cout << "Expiry Date: " << sub.expiry << std::endl;
        
        long long tl = sub.timeleft; // Remaining time in seconds
        long long days = tl / 86400;
        long long hours = (tl % 86400) / 3600;
        std::cout << "Time Left: " << days << "d " << hours << "h" << std::endl;
    }
}

🌐 Fetch Global Cloud Variables

Retrieve static, secure configuration strings stored on the AuthVaultix server:

// Get data from global variable with name 'UpdateURL'
std::string update_url = client.get_global_var("UpdateURL");
std::cout << "[+] Server Update URL: " << update_url << std::endl;

πŸ“₯ Secure File Download

Keep sensitive binaries or DLLs secure by downloading them directly into memory instead of storing them on disk:

std::vector<unsigned char> file_bytes;
std::string file_id = "123456"; // File ID obtained from the dashboard

if (client.download_file(file_id, file_bytes)) {
    std::cout << "[+] File downloaded successfully! Size: " << file_bytes.size() << " bytes." << std::endl;
    // Decrypt or execute bytes directly in memory
} else {
    std::cout << "[-] Download Failed: " << client.response_message << std::endl;
}

πŸ’¬ Chat Channels

Allow users to communicate amongst themselves within your program:

// Fetch recent channel messages
std::vector<AuthVaultix::ChatMessage> messages = client.chat_fetch("general");
for (const auto& msg : messages) {
    std::cout << msg.author << ": " << msg.message << std::endl;
}

// Send a message to the channel
if (client.chat_send("Hello everyone!", "general")) {
    std::cout << "[+] Message sent!" << std::endl;
}

🚫 Ban the User

If your anti-debug or security systems detect a dynamic manipulation or hacking attempt, programmatically ban the user:

// Ban user and blacklist their HWID and IP Address
if (client.ban("Tampering detected via client security checks")) {
    std::cout << "[+] User banned successfully." << std::endl;
}

πŸ’“ Heartbeat Monitor

Run a background thread to continually perform session validation with the server to prevent active session patching:

// Send background heartbeat check every 30 seconds
client.start_heartbeat(30);

// Stop it before exiting the application
client.stop_heartbeat();

About

Official C++ example project for AuthVaultix authentication system. Includes login, register, license authentication, session handling, feature permissions, security protections, and API integration examples.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages