C# SDK
A NuGet source package for .NET 8+ and .NET Framework 4.7.2+.
Install
dotnet nuget add source https://wardenauth.dev/packages/nuget/index.json -n warden
dotnet add package Warden.ClientRun in your project folder (.NET 8+, or .NET Framework 4.7.2+). Adding the source is a one-time step per machine.
- Or commit a
nuget.configwith the source, so nobody on the team has to add it. Warden.Clientis a source package: it addsWardenClient.csto your build, so there's no DLL to ship. Thenusing Warden;.- Pin a version with
dotnet add package Warden.Client --version <version>.
The URL includes the version, and released versions never change, so a pinned install keeps working. See the changelog for older versions.
Quickstart
Replace the placeholders with your app's values from its Overview in the dashboard, where the Add Warden to your project card shows this snippet with your credentials already filled in. The application ID and public key are safe to ship; never put your seller key in client code.
using Warden;
using var app = new WardenClient(
appId: "YOUR_APP_ID",
publicKey: "YOUR_PUBLIC_KEY",
version: "1.0",
apiUrl: "https://wardenauth.dev/api/v1");
await app.InitAsync();
Console.Write("License key: ");
var user = await app.LicenseAsync(Console.ReadLine()!);
Console.WriteLine($"Welcome {user.Username}!");Example project
A complete program with the usual loader menu (login, register, upgrade, key-only login) that prints the user's details. It bundles the SDK, so it runs without installing anything. Fill in the Application credentials block and put your code where it says Your application code goes here.
- Edit
- Program.cs
- Run
- dotnet run
- Needs
- .NET 8+ (or open WardenExample.csproj in Visual Studio)
API
Every method maps to one call of the client API. Each response is checked against your public key, timestamp and nonce before the SDK uses it.
| Method | What it does |
|---|---|
| await app.InitAsync(…) | Start a session. Call this first. |
| await app.LoginAsync(…) | Log in with a username and password. |
| await app.RegisterAsync(…) | Create an account by redeeming a license key. |
| await app.LicenseAsync(…) | Log in with just a license key. |
| await app.UpgradeAsync(…) | Redeem another key on an existing account. |
| await app.CheckAsync(…) | Whether the session is still logged in. |
| await app.CheckBlacklistAsync(…) | Whether this machine's IP or HWID is blacklisted. |
| await app.VarAsync(…) | Read a global variable. |
| await app.GetVarAsync(…) | Read one of the user's variables. |
| await app.SetVarAsync(…) | Write one of the user's variables. |
| await app.FileAsync(…) | Download a file into memory. |
| await app.WebhookAsync(…) | Call one of your webhooks through the server. |
| await app.LogAsync(…) | Send a log line to your dashboard. |
| await app.BanAsync(…) | Ban the current user (e.g. after detecting a debugger). |
| await app.FetchOnlineAsync(…) | Usernames with a logged-in session. |
| await app.FetchStatsAsync(…) | User, online and key counts. |
| await app.ChatGetAsync(…) | The last 50 messages in a channel. |
| await app.ChatSendAsync(…) | Post to a channel. |
| await app.LogoutAsync(…) | End the session. |
Errors
Failures throw WardenException; e.Response holds the server's reply when it rejected the request. CheckAsync() and CheckBlacklistAsync() return booleans instead.
Rejected responses, including a bad signature, a stale timestamp or a replayed nonce, fail the same way, so a spoofed server can't log anyone in. See verifying responses, and protecting your app for what a signature check can and can't stop.