All SDKs

Vue SDK

The JavaScript package in a Vue app.

v1.1.0Node 20+ (any bundler, e.g. Vite)

Install

terminal
npm install https://wardenauth.dev/packages/npm/warden-auth-1.1.0.tgz

In the browser the HWID is a random ID kept in localStorage, so locking is per browser profile.

  • Create one Warden instance at module level and call init() once, as in the snippet.

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.

App.vue
<script setup>
import { ref } from "vue"
import { Warden } from "warden-auth"

const app = new Warden({
  appId: "YOUR_APP_ID",
  publicKey: "YOUR_PUBLIC_KEY",
  version: "1.0",
  apiUrl: "https://wardenauth.dev/api/v1",
})
const ready = app.init()
const user = ref(null)

async function signIn(key) {
  await ready
  user.value = await app.license(key)
}
</script>

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
src/App.vue
Run
npm install && npm run dev
Needs
Node 20+ (Vite)
Download the Vue example

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.

MethodWhat it does
await app.init(…)Start a session. Call this first.
await app.login(…)Log in with a username and password.
await app.register(…)Create an account by redeeming a license key.
await app.license(…)Log in with just a license key.
await app.upgrade(…)Redeem another key on an existing account.
await app.check(…)Whether the session is still logged in.
await app.checkBlacklist(…)Whether this machine's IP or HWID is blacklisted.
await app.var(…)Read a global variable.
await app.getVar(…)Read one of the user's variables.
await app.setVar(…)Write one of the user's variables.
await app.file(…)Download a file into memory.
await app.webhook(…)Call one of your webhooks through the server.
await app.log(…)Send a log line to your dashboard.
await app.ban(…)Ban the current user (e.g. after detecting a debugger).
await app.fetchOnline(…)Usernames with a logged-in session.
await app.fetchStats(…)User, online and key counts.
await app.chatGet(…)The last 50 messages in a channel.
await app.chatSend(…)Post to a channel.
await app.logout(…)End the session.

Errors

Failures throw WardenError; e.response holds the server's reply when it rejected the request.

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.