Signature
Every call we make to your wallet also carries three signature headers. Verifying them
is optional — the Authorization: Bearer contract is unchanged, and an integration
that ignores them keeps working — but a wallet that verifies knows the call came from
us, that the amount was not altered in transit, and that a captured request cannot be
replayed. The headers are present whenever a service key is stored for your
integration.
The key
One shared secret, the same bytes on both sides. You mint it, you configure it in your wallet, and you hand it to us: it goes into the back-office wallet form, where it is stored write-only — nobody reads it back, so what you handed over is what we sign with. It is the same key you accept as the Bearer on service calls. Any string of at least 32 random bytes, hex or base64, with no whitespace around it.
It keys the signature on every call, including the ones whose Bearer is a player's token. The player's token never keys anything.
What we send
X-Timestamp is unix seconds. X-Nonce is 16 random bytes, hex, fresh per request.
X-Signature is HMAC-SHA256, hex, keyed with your service key, over five parts
joined with dots:
{timestamp}.{nonce}.{METHOD}.{path+query}.{body}
{METHOD}is uppercase:GET,POST.{path+query}is the path and query string of the URL we called, exactly as they reach you: leading slash included, query in the order sent, nothing decoded and nothing re-ordered. Forhttps://casino.example.com/api/sportsbook-wallet/profile?playerId=10it is/api/sportsbook-wallet/profile?playerId=10. Read it from the request line, not from a router that strips a prefix.{body}is the exact request body, byte for byte, before any JSON parsing. Empty forGET, so the signed string then ends with a dot.
Verify
- Recompute the HMAC over the five parts with your service key and compare it to
X-Signaturein constant time. - Reject a timestamp more than 300 seconds from your clock.
- Reject a nonce you have already accepted inside that window.
Refuse with a 401, and know what that costs: on {base}/profile a 401 is a refused
token and we sign the player out — so a key that differs between your wallet and the
back-office signs out every player on their first request. Prove the pair before
you verify, and again whenever either side changes the key.
Prove the pair
Run your verifier against the vectors on the right before going live. They are
produced by the code that signs our production calls, so a verifier that passes them
agrees with us byte for byte. Then press Test connection in the back-office wallet
form: it signs exactly as production does, with the stored key, and a wallet that
verifies must answer 200. A 401 carrying your own signature error is a key that
differs.
Rotating the key
The service key can be replaced at any time without downtime:
- Mint a new key and accept both keys on your side.
- Replace the stored key in the back-office wallet form — the field is write-only — and prove the pair with its connection test.
- Retire the old key on your side.
During the window your wallet validates either key, so in-flight calls signed with the old one still land.
X-Timestamp: 1755000000
X-Nonce: 8f14e45fceea167a5a36dedd4bea2543
X-Signature: 8de899108efe281e66bb04d5e27bb64428ee95dce46aca81209956ed21b7287b
Vectors — key sk_example_9f2c1a7d4e6b8c0f, timestamp 1755000000,
nonce 8f14e45fceea167a5a36dedd4bea2543.
GET https://casino.example.com/api/sportsbook-wallet/profile?playerId=10
signed 1755000000.8f14e45fceea167a5a36dedd4bea2543.GET./api/sportsbook-wallet/profile?playerId=10.
X-Signature 8de899108efe281e66bb04d5e27bb64428ee95dce46aca81209956ed21b7287b
POST https://casino.example.com/api/sportsbook-wallet/transaction
body {"type":"bet","amount":10,"currency":"USD","reference":"bet-1","playerId":"10"}
signed 1755000000.8f14e45fceea167a5a36dedd4bea2543.POST./api/sportsbook-wallet/transaction.{"type":"bet","amount":10,"currency":"USD","reference":"bet-1","playerId":"10"}
X-Signature c95ece33fa78fda7e165fddd48d04b81ea2d79361cc4113df216e14bc61c0939
// Verify — Node
const { createHmac, timingSafeEqual } = require('node:crypto');
const signed = [
req.headers['x-timestamp'],
req.headers['x-nonce'],
req.method.toUpperCase(),
req.originalUrl, // path + query, as received
rawBody ?? '', // the exact bytes, before any JSON parsing
].join('.');
const expected = createHmac('sha256', SERVICE_KEY).update(signed).digest('hex');
const ok = timingSafeEqual(Buffer.from(expected), Buffer.from(req.headers['x-signature'] ?? ''));
// Verify — PHP (Laravel)
$signed = implode('.', [
$request->header('X-Timestamp'),
$request->header('X-Nonce'),
strtoupper($request->method()),
$request->getRequestUri(), // path + query, as received
(string) $request->getContent(), // the exact bytes
]);
$expected = hash_hmac('sha256', $signed, $serviceKey);
$ok = hash_equals($expected, strtolower((string) $request->header('X-Signature')));