Installation
npm install @sentinelid/server
pip install sentinelid-server
<PackageReference Include="SentinelId.Server" Version="*" />
implementation 'io.sentinel-id:sentinelid-server:1.0.1'
include(FetchContent)
FetchContent_Declare(
sentinelid-server
GIT_REPOSITORY https://github.com/C-Squared-Solutions-LLC/sentinelid-server-cpp.git
GIT_TAG v1.0.3
)
FetchContent_MakeAvailable(sentinelid-server)
target_link_libraries(your_target PRIVATE sentinelid-server)
Initialisation
import { SentinelServerClient } from "@sentinelid/server";
const client = new SentinelServerClient({
apiKey: process.env.SENTINEL_API_KEY!,
gameId: "game_fps_01",
});
from sentinelid_server import SentinelServerClient
client = SentinelServerClient(
api_key=os.environ["SENTINEL_API_KEY"],
game_id="game_fps_01",
)
using SentinelId.Server;
var client = new SentinelServerClient(
apiKey: Environment.GetEnvironmentVariable("SENTINEL_API_KEY")!,
gameId: "game_fps_01"
);
import io.sentinelid.server.SentinelServerClient;
SentinelServerClient client = new SentinelServerClient(
System.getenv("SENTINEL_API_KEY"),
"game_fps_01"
);
#include <sentinelid/client.hpp>
sentinelid::ServerClient client(
std::getenv("SENTINEL_API_KEY"),
"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);
from sentinelid_server import DeviceCheckRequest
result = client.device_check(DeviceCheckRequest(
device_id="dvc_abc123",
publisher_id="pub_acme",
game_id="game_fps_01",
alg="ES256",
payload_b64=req.payload_b64,
sig_b64=req.sig_b64,
))
if result.banned:
raise PermissionError("Device is banned")
print("Cheat score:", result.reputation.cheat_score)
var result = await client.DeviceCheckAsync(new DeviceCheckRequest
{
DeviceId = "dvc_abc123",
PublisherId = "pub_acme",
GameId = "game_fps_01",
Alg = "ES256",
PayloadB64 = req.PayloadB64,
SigB64 = req.SigB64,
});
if (result.Banned)
return Forbid();
import io.sentinelid.server.models.*;
DeviceCheckRequest req = new DeviceCheckRequest(
"dvc_abc123", "pub_acme", "game_fps_01",
"ES256", payloadB64, sigB64
);
DeviceCheckResponse result = client.deviceCheck(req);
if (result.isBanned()) {
throw new SecurityException("Device is banned");
}
#include <sentinelid/client.hpp>
#include <sentinelid/models.hpp>
sentinelid::DeviceCheckRequest req{
.device_id = "dvc_abc123",
.publisher_id = "pub_acme",
.game_id = "game_fps_01",
.alg = "ES256",
.payload_b64 = payload_b64,
.sig_b64 = sig_b64,
};
auto result = client.device_check(req);
if (result.banned) {
// reject session
}
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);
from sentinelid_server import CreateBanRequest, BanType, BanScope
ban = client.create_ban(CreateBanRequest(
device_id="dvc_abc123",
ban_type=BanType.CHEAT,
scope=BanScope.GAME,
reason_code="aimbot",
details={"confidence": 0.98},
))
print("Ban ID:", ban.ban_id)
var ban = await client.CreateBanAsync(new CreateBanRequest
{
DeviceId = "dvc_abc123",
BanType = "cheat",
Scope = "game",
ReasonCode = "aimbot",
});
Console.WriteLine($"Ban ID: {ban.BanId}");
CreateBanRequest req = new CreateBanRequest(
"dvc_abc123", "cheat", "game", "aimbot"
);
CreateBanResponse ban = client.createBan(req);
System.out.println("Ban ID: " + ban.getBanId());
sentinelid::CreateBanRequest req{
.device_id = "dvc_abc123",
.ban_type = "cheat",
.scope = "game",
.reason_code = "aimbot",
};
auto ban = client.create_ban(req);
Revoke a Ban
await client.revokeBan(banId);
client.revoke_ban(ban_id)
await client.RevokeBanAsync(banId);
client.revokeBan(banId);
client.revoke_ban(ban_id);
List Bans
const cheatBans = await client.listCheatBans("dvc_abc123", "active", 20);
const socialBans = await client.listSocialBans("dvc_abc123");
cheat_bans = client.list_cheat_bans("dvc_abc123", status="active", limit=20)
social_bans = client.list_social_bans("dvc_abc123")
var cheatBans = await client.ListCheatBansAsync("dvc_abc123", status: "active", limit: 20);
var socialBans = await client.ListSocialBansAsync("dvc_abc123");
BanListResponse cheatBans = client.listCheatBans("dvc_abc123", "active", 20, null);
BanListResponse socialBans = client.listSocialBans("dvc_abc123", null, null, null);
auto cheat_bans = client.list_cheat_bans("dvc_abc123", "active", 20);
auto social_bans = client.list_social_bans("dvc_abc123");
Publisher Policy
// Get
const policy = await client.getPolicy();
// Update (partial)
const updated = await client.updatePolicy({ enforceGame: true, enforceGlobal: false });
policy = client.get_policy()
updated = client.update_policy(UpdatePolicyRequest(enforce_game=True, enforce_global=False))
var policy = await client.GetPolicyAsync();
var updated = await client.UpdatePolicyAsync(new UpdatePolicyRequest { EnforceGame = true });
PublisherPolicy policy = client.getPolicy();
PublisherPolicy updated = client.updatePolicy(new UpdatePolicyRequest().enforceGame(true));
auto policy = client.get_policy();
auto updated = client.update_policy({.enforce_game = true});
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);
}
}
from sentinelid_server import SentinelApiError
try:
client.device_check(req)
except SentinelApiError as e:
print(e.status_code, e.error_code)
using SentinelId.Server;
try {
await client.DeviceCheckAsync(req);
} catch (SentinelApiException ex) {
Console.WriteLine($"{ex.StatusCode} {ex.ErrorCode}");
}
import io.sentinelid.server.SentinelApiException;
try {
client.deviceCheck(req);
} catch (SentinelApiException e) {
System.err.println(e.getStatusCode() + " " + e.getErrorCode());
}
try {
client.device_check(req);
} catch (const sentinelid::ApiException& e) {
std::cerr << e.status_code << " " << e.error_code << "\n";
}
