These docs cover the official vauth class in documentation/client/vauth.cs. Add that file to your WinForms or .NET app and talk to API 1.1 — you do not call the HTTP API by hand.
/api/1.1/index.php. Sensitive fields are encrypted with your app secret before they leave the client. Hardware ID is taken automatically from the current Windows user SID.
vauth.cs to your C# project.Newtonsoft.Json from NuGet._apiBaseUrl in the class to your VelvetAuth host (it currently defaults to localhost).Install-Package Newtonsoft.Json
private string _apiBaseUrl = "https://your-domain.com/api/1.1/";
The client is a WinForms-friendly class. It uses HttpClient, AES encryption, and the Windows identity for HWID.
Pass the values from your dashboard. The constructor encrypts appId and version with the secret and keeps the secret for later requests. The class implements IDisposable — wrap it in using.
using (var auth = new vauth("YOUR_APP_ID", "YOUR_SECRET", "1.0"))
{
if (!auth.Initialize())
return;
// register, login, etc.
}| Parameter | Description |
|---|---|
appId | Application ID from dashboard Settings |
secret | Hex secret used as the AES-256 key |
version | Client version string your app expects (e.g. 1.0) |
After a successful RegisterLicense or LoginUser, user details are stored on the instance.
| Property | Type | Description |
|---|---|---|
Username | string | Logged-in username |
Email | string | Email returned by the API |
user_level | int | License / user level |
ExpiryDate | DateTime? | Subscription expiry, or null |
_sessionId | string | Session from Initialize() |
_hwid | string | Windows SID — set automatically |
if (auth.LoginUser(username, password))
{
string name = auth.Username;
string email = auth.Email;
int level = auth.user_level;
DateTime? expiry = auth.ExpiryDate;
}Call this first. Sends type: "init" and stores session_id on success. Register, login, logout, and password reset all need that session.
if (!auth.Initialize())
{
MessageBox.Show("Could not initialize VelvetAuth.");
return;
}Returns true when the API responds with status: "true". Common failures: wrong secret, wrong app version, or the server is unreachable.
Creates a user with a license key. Requires a session from Initialize(). On success it fills Username, Email, ExpiryDate, and user_level.
bool ok = auth.RegisterLicense(
"player1",
"secure_password",
"XXXX-XXXX-XXXX",
"[email protected]"
);API type: register. Username, password, license, email, HWID, and session ID are encrypted automatically.
Registers without a license key. Keyless mode must be enabled for the app in the dashboard.
bool ok = auth.keyless_register("player1", "secure_password", "[email protected]");API type: keyless. Typical errors: username already used, email already used, or keyless disabled.
Logs in with username and password. HWID and session ID are attached automatically. On success the same user properties as register are populated.
if (auth.LoginUser(txtUser.Text, txtPass.Text))
{
// open your main form
}API type: login. Failures include wrong credentials, HWID mismatch, paused/banned user, expired license, or a missing session.
Ends the current session for the logged-in username. Call this when the user signs out of your app.
auth.Logout();
API type: logout. Success message: Logout successful.
Sends a reset code to the user's email. Initialize() must have already succeeded.
if (auth.ForgotPassword("[email protected]"))
{
// ask the user for the email code, then call ResetPassword
}API type: forgot_password. Success message: Password reset code sent.
Completes a password reset with the code from email. Also requires Initialize() first.
bool ok = auth.ResetPassword(
"[email protected]",
txtCode.Text,
txtNewPassword.Text
);API type: reset_password. Success message: Password reset successful.
Applies another license key to an existing user and updates ExpiryDate from data.new_expiry_date.
if (auth.ExtendLicenseExpiry(auth.Username, "NEW-XXXX-XXXX"))
{
DateTime? newExpiry = auth.ExpiryDate;
}API type: extend_expiry.
Sends an encrypted message to the Discord webhook configured in your app settings. The server appends the client IP.
auth.Log(auth.Username + " opened the loader");
API type: log. Success message: Log sent to Discord. Set a webhook URL in Settings or this will fail.
You normally do not encrypt anything yourself. The class encrypts fields before each request.
| Setting | Value |
|---|---|
| Algorithm | AES-256-CBC |
| Key | App secret (hex → bytes) |
| IV | 16 random bytes, prepended to ciphertext |
| Output | Base64(IV + encrypted bytes) |
Helpers if you need them:
secret and type are sent in plaintext. Everything else the methods send (username, password, email, license, HWID, session, message) is encrypted.
using (var auth = new vauth(appId, secret, "1.0"))
{
if (!auth.Initialize()) return;
if (auth.RegisterLicense(user, pass, license, email))
{
// auth.Username, auth.ExpiryDate, auth.user_level
}
}using (var auth = new vauth(appId, secret, "1.0"))
{
if (!auth.Initialize()) return;
if (auth.LoginUser(user, pass))
{
auth.Log(user + " logged in");
// show main UI
auth.Logout();
}
}using (var auth = new vauth(appId, secret, "1.0"))
{
if (!auth.Initialize()) return;
auth.ForgotPassword(email);
// user enters the email code
auth.ResetPassword(email, code, newPassword);
}No. Use the vauth methods. They POST to /api/1.1/index.php with the correct type and encryption.
The version you pass to the constructor must match the version set on the application in the dashboard.
HWID is bound to the Windows user SID. A different machine or Windows account will not match.
Newtonsoft.Json. The rest is in the .NET Framework / Windows Forms references already used by vauth.cs.
See the API 1.1 reference if you are writing a client in another language. For C#, stay on this page and use vauth.cs.