Skip to content

Authentication

All communication between Beexar and your operator server is authenticated using HMAC-SHA256 signatures. Every request includes an X-REQUEST-SIGN header containing a hex-encoded signature of the request body.

ComponentDescription
Operator slug (casino_id)Identifies your operator account. Sent in game launch requests.
API Secret (AUTH_TOKEN)Secret key used to compute HMAC-SHA256 signatures. Never expose this publicly.
X-REQUEST-SIGNHTTP header containing the HMAC-SHA256 signature (hex-encoded, 64 characters).

signature = HMAC-SHA256(request_body, AUTH_TOKEN)
  1. Take the raw request body (the exact JSON bytes)
  2. Compute HMAC-SHA256 using your AUTH_TOKEN (API secret) as the key
  3. Hex-encode the result
  4. Send it in the X-REQUEST-SIGN header

When Beexar sends requests to your wallet endpoints (/balance, /betwin, /rollback, /finish), validate the X-REQUEST-SIGN header. If the signature does not match, respond with HTTP 400 and api_code 403 (the SoftSwiss error format — see Wallet API Overview):

const crypto = require('crypto');
function validateSignature(body, signature, apiSecret) {
const expected = crypto
.createHmac('sha256', apiSecret)
.update(body, 'utf8')
.digest('hex');
return crypto.timingSafeEqual(
Buffer.from(expected, 'hex'),
Buffer.from(signature, 'hex')
);
}
// Express middleware
app.use('/wallet', (req, res, next) => {
const signature = req.headers['x-request-sign'];
const rawBody = req.rawBody; // ensure raw body is preserved
if (!validateSignature(rawBody, signature, process.env.AUTH_TOKEN)) {
return res.status(400).json({
code: 'invalid_argument',
msg: 'Invalid signature',
meta: { api_code: '403', api_message: 'Invalid signature' },
});
}
next();
});

When you send requests to the Beexar Gateway API (e.g., POST /api/v1/softswiss/launcher/real), you must sign the request body and include the signature in the X-REQUEST-SIGN header.

Terminal window
# Example: signing a launch request
BODY='{"casino_id":"your-operator-slug","game":"dice","account":{"id":"player_1","currency":"USD"},"locale":"en","urls":{"return_url":"https://casino.example.com"}}'
SIGNATURE=$(echo -n "$BODY" | openssl dgst -sha256 -hmac "your_auth_token" | awk '{print $2}')
curl -X POST https://gateway.beexar.com/api/v1/softswiss/launcher/real \
-H "Content-Type: application/json" \
-H "X-REQUEST-SIGN: $SIGNATURE" \
-d "$BODY"

  1. Never expose AUTH_TOKEN in client-side code, logs, or version control
  2. Use timing-safe comparison when validating signatures (see code samples above)
  3. Validate every request — reject any request with missing or invalid X-REQUEST-SIGN
  4. Use HTTPS for all callback URLs — Beexar will not send requests to plain HTTP endpoints
  5. Rotate keys periodically — contact your account manager to rotate API credentials