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.
- Utilize VMProtect or Themida: Protect your compiled
.exeprogram from reverse engineering by using a commercial software protector like VMProtect or Themida (utilize their SDKs too for greater protection). - Perform frequent integrity checks: Ensure the memory of the program has not been modified or tampered with by implementing regular integrity checks.
- 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.
- 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.
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.
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.
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()
);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;
}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 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;
}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;
}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;Restrict certain features or menus of your app based on user subscriptions or dynamic permissions:
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";
}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;
}
}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;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;
}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;
}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;
}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();