A complete, ready-to-use Rust CLI integration example for the AuthVaultix authentication platform.
This repository provides a plug-and-play Rust CLI example demonstrating how to integrate the AuthVaultix authentication API into your Rust 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 as hardware fingerprint
- π User Info Display β Shows username, IP, HWID, creation date, last login & active subscriptions
- β±οΈ Expiry Countdown β Human-readable time-left format (
Xd Xh Xm)
Built as a terminal-based interactive menu app β fully blocking/synchronous using
reqwestblocking client.
authvaultix-rust-example/
βββ Cargo.toml # Dependencies & package metadata
βββ run.bat # Quick run script for Windows
βββ src/
βββ main.rs # Entry point β interactive CLI menu
βββ lib.rs # AuthVaultix API wrapper (core library)
- Rust (latest stable, 2024 edition)
- Windows OS (HWID detection uses PowerShell / WMIC)
- An AuthVaultix account β Register here
git clone https://github.com/AuthVaultix-Rust-Example-main.git
cd AuthVaultix-Rust-Example-mainOpen src/main.rs and fill in your application details from the AuthVaultix Dashboard:
let mut AuthVaultixApp = AuthVaultix::new(
"YourAppName", // name
"your_ownerid", // ownerid
"your_secret", // secret
"1.0" // version
);
β οΈ Never commit real credentials to a public repository.
cargo runOr 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 Data ===
Username: johndoe
IP: 192.168.x.x
HWID: S-1-5-21-...
Created: 2025-01-01 08:00:00 AM
Last Login: 2026-05-04 05:00:00 PM
Subscriptions:
[1] default | Expiry: 2027-01-01 12:00:00 AM | Timeleft: 240d 6h 0m
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 Rust project:
use AuthVaultix_rust::AuthVaultix;
let mut app = AuthVaultix::new("AppName", "ownerid", "secret", "1.0");
app.init(); // Must be called before any other methodapp.login("username", "password");app.register("username", "password", "LICENSE-KEY");app.license_login("LICENSE-KEY");| Method | Returns | Description |
|---|---|---|
init() |
() |
Initializes the session with the API. |
login(username, pass) |
() |
Authenticates a user. |
register(username, pass, license, email) |
() |
Registers a new user. |
license_login(license) |
() |
Authenticates directly via license key. |
check() |
bool |
Validates the current session. |
logout() |
() |
Terminates session. |
| Method | Returns | Description |
|---|---|---|
upgrade(username, license) |
bool |
Upgrades user's subscription. |
forgot_password(username, email) |
bool |
Triggers a password reset email. |
change_username(new_username) |
() |
Changes the current user's username. |
| Method | Returns | Description |
|---|---|---|
ban(reason) |
bool |
Bans the currently authenticated user. |
check_blacklist() |
bool |
Checks if the current HWID is blacklisted. |
log(message) |
bool |
Sends a log message to the dashboard. |
| Method | Returns | Description |
|---|---|---|
get_global_var(varid) |
Option<String> |
Fetches a global server variable. |
get_var(var_name) |
Option<String> |
Fetches a user-specific variable. |
set_var(var_name, value) |
bool |
Sets a user-specific variable. |
download(fileid) |
Option<Vec<u8>> |
Securely downloads a file into a byte vector. |
| Method | Returns | Description |
|---|---|---|
fetch_online() |
Option<Vec<OnlineUser>> |
Retrieves a list of online clients. |
chat_send(message, channel) |
bool |
Sends a chat message. |
chat_fetch(channel) |
Option<Vec<ChatMessage>> |
Fetches chat history for a channel. |
| Crate | Version | Purpose |
|---|---|---|
reqwest |
0.11 | HTTP client (blocking + JSON) |
serde |
1.0 | Serialization / Deserialization |
serde_json |
1.0 | JSON parsing |
chrono |
0.4 | Unix timestamp β human-readable date |
Cargo.toml:
[dependencies]
chrono = "0.4"
reqwest = { version = "0.11", features = ["blocking", "json"] }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"This example uses your Windows User SID as a hardware fingerprint. It tries two methods in order:
-
PowerShell (primary):
[System.Security.Principal.WindowsIdentity]::GetCurrent().User.Value -
WMIC (fallback):
wmic useraccount where name='%USERNAME%' get sid /value
If both fail, it falls back to
"UNKNOWN_HWID".
| Concern | Recommendation |
|---|---|
Credentials in main.rs |
Use environment variables 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 |
| Error Handling | Production apps should handle panics gracefully with Result<> returns |
- Add 2FA support: Extend the
login()andlicense_login()payloads with a"code"field - Subscription gating: Check
info.subscriptionsfor a specific tier name before granting access - Cross-platform HWID: Replace the PowerShell SID logic with a cross-platform crate like
machine-uidfor Linux/macOS support - GUI: Integrate with
eguiortaurito build a desktop GUI on top of this 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 π¦ Rust + β€οΈ using AuthVaultix