Aller au contenu

Le GET /api/v1/votes/claim est retiré le 1 octobre 2026.

Voir la migration

Webhook de vote

POST signé HMAC SHA-256, anti-rejeu, timestamp dans le corps.

À chaque vote, CGS Hub POSTe l’URL configurée (Paramètres).

En-têtes

POST <votre URL>
Content-Type: application/json
X-CgsHubs-Signature: sha256=<hmac_sha256(secret, corps brut)>

La signature couvre le corps brut. Le timestamp est dans le JSON signé : pas d’en-tête d’horloge à part.

Corps

{
  "type": "vote",
  "id": "3f2a…",
  "server": "mon-serveur",
  "playername": "Pseudo",
  "votedAt": "2026-09-06T18:24:11.000Z",
  "timestamp": 1788719051000
}

id : UUID, clé d’anti-rejeu. playername peut être null. timestamp : ms epoch, fenêtre de fraîcheur ± 5 min.

Vérification (Lua)

local expected = exports.crypto:hmac_sha256(secret, rawBody)
if ("sha256=" .. expected) ~= headers["X-CgsHubs-Signature"] then return end

Rejetez un id déjà vu et un timestamp trop ancien ou trop futur. Transport : HTTPS uniquement.