Skip to content

authspire/AuthSpire-CPP

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation


AuthSpire
AuthSpire

A FREE and secure licensing & authentication solution
using hybrid encryption.

Key FeaturesHow To UseAPI Functions

Key Features

  • License your software / application
    • Restrict access from other users and increase security
  • Manage Users
    • See who uses your application, set expiry dates for your licenses & more
  • Variables
    • Set custom hidden variables that are secured on our server and can not be cracked
  • Blacklists
    • Block users by IP or a Unique Identifier from accessing your application
  • Logging
    • Handle all logs and see what is happening inside of your application
  • Hybrid Encryption System
    • Encryption combined using AES 256 (Advanced Encryption Standard) and RSA to ensure the most security

How To Use

Create an account on the AuthSpire website. Create your application.

Install VS 2022 or any other compiler for C++ You will require Curl and Crypto++

To Install Curl and Crypto++ to VS 2022 follow these steps for each one

Curl
Download curl zip package from here
Extract downloaded package to a folder of your choice (e.g. C:\curl)
Open Developer Command Prompt for VS 2022 (see Windows Start menu or %PROGRAMDATA%\Microsoft\Windows\Start Menu\Programs\Visual Studio 2017\Visual Studio Tools) and cd to C:\curl\winbuild<br> Run nmake /f Makefile.vc mode=static. This will build curl as a static library into C:\curl\builds\libcurl-vc-x86-release-static-ipv6-sspi-winssl<br> Create a new project in Visual Studio (e.g. a Windows Console Application)
In Project Properties -> VC++ Directories -> Include Directories add C:\curl\builds\libcurl-vc-x86-release-static-ipv6-sspi-winssl\include\
In Project Properties -> VC++ Directories -> Library Directories add C:\curl\builds\libcurl-vc-x86-release-static-ipv6-sspi-winssl\lib\ there
In Project Properties -> Linker -> Input -> Additional Dependencies add libcurl_a.lib, Ws2_32.lib, Crypt32.lib, Wldap32.lib and Normaliz.lib
Add CURL_STATICLIB to Configuration Properties -> C/C++ -> Preprocessor -> Preprocessor Definitions.

Crypto++
Download crypto++ zip package from here
Extract downloaded package to a folder of your choice (e.g. C:\cryptopp)
Open cryptest.sln in VS 2022
In Project Properties -> C/C++ -> Code Generation -> Runtime Library select Multi-threaded (/MT) and set it to Release mode
Build the cryptlib project
In your project Properties -> Linker -> Input -> Additional Dependencies add path to cryptlib.lib (can be found where you compiled crpylib before)
In your project Properties -> C/C++ -> Code Generation -> Runtime Library select Multi-threaded (/MT) so it works with the crypto++ library
In your project Properties -> VC++ Directories -> Include Directories add C:\cryptopp\ if that was your installation location



Name: Name of your application in the dashboard
UserID: UserID found in your account page
Secret: Secret of your application in the dashboard
Version: Version 1.0 by default (for updates change the version accordingly)
Public Key: Public Key for encryption found in the dashboard

AuthSpire-API.cpp file

// replace with your details!

authSpire::api api(
    "your app name",
    "your userid",
    "your secret",
    "1.0",
    "your public key"
);

Functions

Initializing your application

Before using any other functions it is necessary to initialize your application with our server and retrieve all data. This can be done by calling this method in your main index.php file.

int main() {
    api.Init();
    return 0;
}

Register a user

To register and add a new user to your application you will first require a valid license key which you can generate in your authspire dashboard in your selected application.

Register a user by calling this method and validate the registration

bool registered = api.Register(username, password, license, email);
if (registered)
{
    std::cout << "Thanks for registering!" << std::endl;
}

Authenticate a user

To login and add retrieve all user data you can call this method

bool loggedIn = api.Login(username, password);
if (loggedIn)
{
  std::cout << "Welcome back " << api.user.username << std::endl;
  std::cout << std::endl;
  std::cout << api.user.email << std::endl;
  std::cout << api.user.ip << std::endl;
  std::cout << api.user.expires << std::endl;
  std::cout << api.user.hwid << std::endl;
  std::cout << api.user.last_login << std::endl;
  std::cout << api.user.created_at << std::endl;
  std::cout << api.user.variable << std::endl;
  std::cout << api.user.level << std::endl;
}

Adding logs

Sometimes it is necessary to have an overview of what is going on inside your application. For that you can use logs

To add a log you can call this method.

api.AddLog(username, action);
std::cout << "Log added!" << std::endl;

Getting Variables

You can store server-sided strings. Your application can then retrieve these strings with a secret key that will be generated in your panel when you generate your variable. This protects your strings from being decompiled or cracked.

api.GetVariable(secret);

Authenticate with only a license

Sometimes you want to keep it simple. A user can register/login with only using a license. For this you can use this function

if (api.License(license))
{
  std::cout << "Welcome back " << api.user.username << std::endl;
  std::cout << std::endl;
  std::cout << api.user.email << std::endl;
  std::cout << api.user.ip << std::endl;
  std::cout << api.user.expires << std::endl;
  std::cout << api.user.hwid << std::endl;
  std::cout << api.user.last_login << std::endl;
  std::cout << api.user.created_at << std::endl;
  std::cout << api.user.variable << std::endl;
  std::cout << api.user.level << std::endl;
}

License

MIT