A complete, ready-to-use Go CLI integration example for the AuthVaultix authentication platform.
This repository provides a plug-and-play Go CLI example demonstrating how to integrate the AuthVaultix authentication API into your Go application. It includes:
- π Login β Authenticate users with username & password
- π Register β Create new accounts with a license key
- π License Login β Access the app using only a license key
- π₯οΈ HWID Detection β Automatically reads the Windows User SID via PowerShell
- π User Info Display β Shows username, IP, HWID & active subscriptions with expiry
- π HTTPS API v1.0 β Communicates with
https://authvaultix.com/api/1.0/
Built as a terminal-based interactive CLI app using only Go's standard library (no external HTTP dependencies needed beyond
encoding/jsonandnet/http).
authvaultix-go-example/
βββ main.go # Entry point β interactive CLI menu
βββ authvaultix.go # AuthVaultix API wrapper (core library)
βββ run.bat # Quick setup & run script for Windows
- Go 1.21 or higher
- Windows OS (HWID detection uses PowerShell)
- An AuthVaultix account β Register here
git clone https://github.com/AuthVaultix/AuthVaultix-Go-Example.git
cd AuthVaultix-Go-ExampleOpen main.go and fill in your application details from the AuthVaultix Dashboard:
AuthVaultixApp := NewAuthVaultix(
"YourAppName", // name
"your_ownerid", // ownerid
"your_secret", // secret
"1.0", // version
)
β οΈ Never commit real credentials to a public repository.
go mod init authvaultix
go run .Or simply use the included Windows batch script:
run.batWhen you run the app, you'll see an interactive menu:
Connecting...
β
Initialized Successfully!
[1] Login
[2] Register
[3] License Login
[4] Exit
Choose option:
Username: johndoe
Password: β’β’β’β’β’β’β’β’
β
Logged in!
π€ User Info:
Username: johndoe
IP: 192.168.x.x
HWID: S-1-5-21-...
β default | Expiry: 1767225600 | Left: 20736000
Username: newuser
Password: β’β’β’β’β’β’β’β’
License: XXXX-XXXX-XXXX-XXXX
β
Registered Successfully!
License: XXXX-XXXX-XXXX-XXXX
β
License Login Successful!
You can use the Authvaultix struct directly in your own Go project:
app := NewAuthVaultix("AppName", "ownerid", "secret", "1.0")
app.Init() // Must be called before any other methodapp.Login("username", "password")app.Register("username", "password", "LICENSE-KEY", "")app.LicenseLogin("LICENSE-KEY")| Method | Returns | Description |
|---|---|---|
Init() |
bool |
Initializes the session with the API. |
Login(username, pass) |
bool |
Authenticates a user. |
Register(user, pass, key, email) |
bool |
Registers a new user. |
LicenseLogin(licenseKey) |
bool |
Authenticates directly via license key. |
Check() |
bool |
Validates the current session. |
Logout() |
Terminates session. |
| Method | Returns | Description |
|---|---|---|
Upgrade(username, licenseKey) |
bool |
Upgrades user's subscription. |
ForgotPassword(username, email) |
bool |
Triggers a password reset email. |
ChangeUsername(newUsername) |
Changes the current user's username. |
| Method | Returns | Description |
|---|---|---|
Ban(reason) |
bool |
Bans the currently authenticated user. |
CheckBlacklist() |
bool |
Checks if the current HWID is blacklisted. |
Log(message) |
bool |
Sends a log message to the dashboard. |
| Method | Returns | Description |
|---|---|---|
GetGlobalVar(varId) |
string |
Fetches a global server variable. |
GetVar(varName) |
string |
Fetches a user-specific variable. |
SetVar(varName, value) |
bool |
Sets a user-specific variable. |
Download(fileId) |
[]byte |
Securely downloads a file. |
| Method | Returns | Description |
|---|---|---|
FetchOnline() |
[]OnlineUser |
Retrieves a list of online clients. |
ChatSend(message, channel) |
bool |
Sends a chat message. |
ChatFetch(channel) |
[]ChatMessage |
Fetches chat history for a channel. |
This project uses only the Go standard library β no go get required for the core SDK.
| Package | Source | Purpose |
|---|---|---|
net/http |
stdlib | HTTP POST requests to the API |
encoding/json |
stdlib | JSON parsing of API responses |
os/exec |
stdlib | PowerShell HWID detection |
bytes, strings, fmt, io |
stdlib | Utilities |
The
run.batcallsgo mod init authvaultixautomatically β no manual module setup needed.
This example uses your Windows User SID (Security Identifier) as the hardware fingerprint, fetched via PowerShell:
[System.Security.Principal.WindowsIdentity]::GetCurrent().User.ValueIf the command fails for any reason, it falls back to "UNKNOWN_HWID".
For cross-platform support, you can replace this with a library like
github.com/denisbrodbeck/machineid.
| Concern | Recommendation |
|---|---|
Credentials in main.go |
Use environment variables (os.Getenv) or a config file in production |
| HWID Binding | AuthVaultix locks sessions to the detected SID by default |
| HTTPS | All API calls go to https://authvaultix.com β always encrypted |
| URL Encoding | Use url.Values instead of manual string building for production safety |
- Add 2FA support: Extend the
Login()andLicense()payload maps with a"code"key - Subscription gating: Loop through
user.Subscriptionsand check for a specificsub.Subscriptionname before granting app access - Cross-platform HWID: Replace PowerShell logic with
machineidfor Linux/macOS support - GUI: Build a desktop frontend using
FyneorWailson top of this core library
Contributions, issues, and feature requests are welcome!
- Fork the repository
- Create a new branch:
git checkout -b feature/my-feature - Commit your changes:
git commit -m 'Add my feature' - Push to the branch:
git push origin feature/my-feature - Open a Pull Request
- π AuthVaultix Documentation
- π¬ Discord Community
- π Open an Issue
This project is licensed under the MIT License β feel free to use, modify, and distribute it.
Made with πΉ Go + β€οΈ using AuthVaultix