The server SDK wraps the Sentinel Network REST API. Use it on your game server or backend — never in client-side code, as it requires your API key.

Installation

npm install @sentinelid/server

Initialisation

import { SentinelServerClient } from "@sentinelid/server";

const client = new SentinelServerClient({
  apiKey: process.env.SENTINEL_API_KEY!,
  gameId: "game_fps_01",
});

Device Check

Verify the signed payload from a device and retrieve its ban and reputation status.
const result = await client.deviceCheck({
  deviceId:    "dvc_abc123",
  publisherId: "pub_acme",
  gameId:      "game_fps_01",
  alg:         "ES256",
  payloadB64:  req.payloadB64,
  sigB64:      req.sigB64,
});

if (result.banned) {
  // reject session
}
console.log("Cheat score:", result.reputation.cheatScore);

Create a Ban

const ban = await client.createBan({
  deviceId:   "dvc_abc123",
  banType:    "cheat",
  scope:      "game",
  reasonCode: "aimbot",
  details:    { confidence: 0.98 },
});
console.log("Ban ID:", ban.banId);

Revoke a Ban

await client.revokeBan(banId);

List Bans

const cheatBans = await client.listCheatBans("dvc_abc123", "active", 20);
const socialBans = await client.listSocialBans("dvc_abc123");

Publisher Policy

// Get
const policy = await client.getPolicy();

// Update (partial)
const updated = await client.updatePolicy({ enforceGame: true, enforceGlobal: false });

Error Handling

All SDKs throw a typed exception when the API returns a non-2xx response.
import { SentinelApiError } from "@sentinelid/server";

try {
  await client.deviceCheck(req);
} catch (e) {
  if (e instanceof SentinelApiError) {
    console.error(e.statusCode, e.errorCode);
  }
}