Go SDK
One file, standard library only.
Install
curl -o warden/warden.go --create-dirs https://wardenauth.dev/packages/go/1.4.0/warden.goGo 1.21+, standard library only. Run it in your module folder, then import it as <module>/warden (the module name is in go.mod).
- Go also has
Tamper(kind, detail): report a debugger, cracking tool, hook or modified client, and get backcontinue,refuseorbannedfrom the app's tamper setting (the Warden loader uses it).
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.
package main
import (
"fmt"
"myapp/warden" // <your module>/warden
)
func main() {
app, err := warden.New(
"YOUR_APP_ID",
"YOUR_PUBLIC_KEY",
"1.0",
"https://wardenauth.dev/api/v1")
if err != nil {
panic(err)
}
if err := app.Init(); err != nil {
panic(err)
}
var key string
fmt.Print("License key: ")
fmt.Scanln(&key)
user, err := app.License(key)
if err != nil {
fmt.Println(err)
return
}
fmt.Printf("Welcome %s!\n", 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
- main.go
- Run
- go run .
- Needs
- Go 1.21+
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 |
|---|---|
| app.Init(…) | Start a session. Call this first. |
| app.Login(…) | Log in with a username and password. |
| app.Register(…) | Create an account by redeeming a license key. |
| app.License(…) | Log in with just a license key. |
| app.Upgrade(…) | Redeem another key on an existing account. |
| app.Check(…) | Whether the session is still logged in. |
| app.CheckBlacklist(…) | Whether this machine's IP or HWID is blacklisted. |
| app.Var(…) | Read a global variable. |
| app.GetVar(…) | Read one of the user's variables. |
| app.SetVar(…) | Write one of the user's variables. |
| app.File(…) | Download a file into memory. |
| app.Webhook(…) | Call one of your webhooks through the server. |
| app.Log(…) | Send a log line to your dashboard. |
| app.Ban(…) | Ban the current user (e.g. after detecting a debugger). |
| app.FetchOnline(…) | Usernames with a logged-in session. |
| app.FetchStats(…) | User, online and key counts. |
| app.ChatGet(…) | The last 50 messages in a channel. |
| app.ChatSend(…) | Post to a channel. |
| app.Logout(…) | End the session. |
Errors
Methods return an error (a *warden.Error); warden.AsError(err) gives its .Message and the server's .Response.
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.