Guides
Authentication and signing
Every Operator API request carries two credentials at once: your Operator API Token and an Ed25519 HTTP Message Signature made with your private key. Neither works alone, and both travel over TLS.
How it works
The signature covers the method, the complete target URI, the Authorization header and, for a body, its media type, its SHA-256 digest and the Idempotency-Key. We check the body digest, the token, the signature parameters and their time window, and the Ed25519 signature with the public key you registered. Only after the signature verifies do we register the nonce and read the JSON body.
The profile narrows RFC 9421 to exactly one way of signing. There’s no algorithm negotiation and no optional component, so your signer either matches the rules below byte for byte or the request fails.
Request headers
| Header | Value |
|---|---|
Authorization | Bearer, one space, then your Operator API Token exactly as issued. |
Signature-Input | The signature’s covered components and parameters, labeled sig1. Format |
Signature | sig1=:, the 64-byte Ed25519 signature in standard base64 with padding, then :. |
Content-Type | For a body: exactly application/json, with no charset or other parameter. |
Content-Digest | For a body: sha-256=:, the base64 SHA-256 of the exact body bytes, then :. Details |
Idempotency-Key | On POST /v1/game-sessions: your key for the business operation, 16–128 visible ASCII characters. Details |
X-Request-Id | Optional. Your correlation ID for this attempt, 16–64 characters of letters, digits, ., _, : and -. It isn’t signed. |
Send each of these headers once. Don’t send Content-Encoding: compressed request bodies aren’t supported. Headers such as X-Request-Id, traceparent, User-Agent and Content-Length are never covered by the signature, so proxies may change them.
Covered components
The covered components and their order are fixed. Use lowercase header names.
| Request | Covered components, in this order |
|---|---|
Every GET | "@method" "@target-uri" "authorization" |
POST /v1/game-sessions | "@method" "@target-uri" "authorization" "content-type" "content-digest" "idempotency-key" |
Signature parameters
The sig1 member of Signature-Input has exactly these six parameters, in this order. The label is always sig1, and there’s exactly one signature per request.
| Parameter | Type | Rule |
|---|---|---|
created | Integer | Unix time in whole seconds when you signed. |
expires | Integer | Later than created, at most 300 seconds after it. |
nonce | String | At least 128 random bits from a secure random generator, in unpadded base64url: 22 to 128 characters. |
keyid | String | The key ID you registered with the public key. |
alg | String | Exactly ed25519. |
tag | String | Exactly provider-operator-api-v1. |
Serialize the header exactly as RFC 8941 does, with no extra spaces: one space between components, none around ; and =, strings in double quotes. We accept only that exact serialization, because the parameters we verify must be the bytes you signed.
Signature-Input: sig1=("@method" "@target-uri" "authorization");created=1786960800;expires=1786961100;nonce="7S0YjJ0nD8ZxQvH3aP2mLw";keyid="op-example-prod-key-2026-01";alg="ed25519";tag="provider-operator-api-v1"
Time window and nonce
- We accept a signature when
createdis no more than 60 seconds ahead of our clock andexpiresis no more than 60 seconds behind it. Keep your servers on NTP. - A lifetime of about two minutes works well: sign right before you send, with
expires = created + 120. - Use a new nonce for every request, retries included. A nonce we’ve already seen for your key fails as a replay. Never derive it from an Idempotency Key, an External Player ID or other business data.
The signature base
You sign the RFC 9421 signature base: one line per covered component, then the @signature-params line. Each line is the quoted component name, a colon, a space and the value. Lines end with a single line feed (\n), and there’s no line feed after the last one.
@methodis the uppercase method.@target-uriis the complete URL you send:https, our public host name, the path and the full query string in the order and percent-encoding you send. Behind your own proxy, sign the URL our server receives, never an internal one.authorization,content-type,content-digestandidempotency-keyare the header values exactly as sent.@signature-paramsis theSignature-Inputvalue without thesig1=prefix.
"@method": GET
"@target-uri": https://operator-api.production.example.com/v1/games?limit=25¤cy=EUR
"authorization": Bearer op_tok_example_01.example_only_secret_do_not_use
"@signature-params": ("@method" "@target-uri" "authorization");created=1786960800;expires=1786961100;nonce="7S0YjJ0nD8ZxQvH3aP2mLw";keyid="op-example-prod-key-2026-01";alg="ed25519";tag="provider-operator-api-v1"Signed with the test-only key of our test vectors, this base produces:
Signature: sig1=:0E1DKQsidooEo58xrwbt2O0cswfYTfNi2q8A6PMwks7gAApDC/yluw8/0ESQDYKceZG36vyvjhyRf5jw1cDpCQ==:
Body and Content-Digest
For a request with a body, serialize the JSON once, compute SHA-256 over those exact bytes, and send the same bytes. Whitespace, key order and escapes all change the digest, so never re-serialize between hashing and sending. We hash the raw bytes we receive before we parse them.
{"brand_id":"brand_example_eu","game_id":"game_example_aurora","mode":"real","player":{"id":"player_example_123","country":"DE","currency":"EUR","locale":"de-DE","ip":"192.0.2.44"},"operator_session_token":"example_only_operator_session_token","client":{"type":"desktop"},"return_urls":{"lobby":"https://brand.example.com/lobby"}}POST /v1/game-sessions HTTP/1.1
Host: operator-api.production.example.com
Authorization: Bearer op_tok_example_01.example_only_secret_do_not_use
Content-Type: application/json
Content-Digest: sha-256=:j9qWbFZjZCtdBgJdtpcSf1gk0DS1LL59ycGAeIlU7ik=:
Idempotency-Key: idem_example_create_session_0001
X-Request-Id: req_example_post_01
Signature-Input: sig1=("@method" "@target-uri" "authorization" "content-type" "content-digest" "idempotency-key");created=1786960800;expires=1786961100;nonce="fQ8eL1uT6cN2sA9kR4mV7w";keyid="op-example-prod-key-2026-01";alg="ed25519";tag="provider-operator-api-v1"
Signature: sig1=:MWgTjCEUxHuMN9XStTWf0lAVLkFE0W0AV+u9+93NYl37KVRQU8EwFzzyaOwV8/fy5qoLeKWK9svcAD9ECB4NCA==:The digest and both signatures are real values for the fictional token and the test-only key. Use them to check your implementation, never as credentials.
Sign in code
operator-request-signer.mjs is a complete signer for Node.js 22 or later with no dependencies. Its signRequest function returns the headers of one attempt:
import { readFileSync } from 'node:fs';
import { randomUUID } from 'node:crypto';
import { signRequest } from './operator-request-signer.mjs';
const url = 'https://sandbox-api.luckyeight.games/v1/game-sessions';
const body = JSON.stringify(sessionRequest); // serialize once, send these bytes
const idempotencyKey = `session_${randomUUID()}`; // keep it for retries
const headers = signRequest({
method: 'POST',
url,
token: process.env.LUCKY_OPERATOR_TOKEN,
keyId: 'acme-sandbox-2026-10',
privateKey: readFileSync('operator-signing-key.pem'),
body,
idempotencyKey,
});
const response = await fetch(url, { method: 'POST', headers, body, redirect: 'error' });
In another language, the core is the same: build the signature base as text, sign its UTF-8 bytes with Ed25519 (RFC 8032, no prehash), and encode the 64-byte result in base64.
Test vectors
operator-request-vectors-v1.json has a signed GET and a signed POST: the inputs, the exact signature base, the Signature-Input and the expected Signature. Ed25519 is deterministic, so with the same inputs your signer must produce the same bytes.
The vectors use a test-only private key whose 32-byte seed is the public sequence 00 01 02 … 1f. Never use it anywhere else. To reproduce a signature with OpenSSL, wrap the seed in a PKCS #8 envelope and sign the base bytes:
# PKCS #8 prefix of an Ed25519 key, then the seed bytes 00..1f
printf '302e020100300506032b657004220420000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f' \
| xxd -r -p > test-key.der
# base.bin holds the signature_base bytes of a vector, without a final newline
openssl pkeyutl -sign -rawin -keyform DER -inkey test-key.der -in base.bin | openssl base64 -A
Your production keys are never involved: compare your signer’s output with the vectors in your test suite, then sign real requests with your own key.
Retries and replay protection
A retry is a new message about the same business operation. For a retried POST /v1/game-sessions:
- keep the same body bytes, so the same
Content-Digest, and the sameIdempotency-Key; - create a new nonce, new
createdandexpiresvalues and a new signature; - optionally send a new
X-Request-Id.
Reusing a nonce fails authentication even with the same Idempotency-Key, and a new nonce never turns a different body into the same operation. Errors and retries covers when to retry.
When verification fails
Every authentication failure returns 401 authentication_failed with WWW-Authenticate: Bearer realm="operator-api". On purpose, the answer doesn’t say which check failed. These are the usual causes:
- The signed
@target-uridiffers from the URL sent: another host, a trailing slash, a reordered or re-encoded query, or an internal proxy URL. - The
authorizationline differs from the header: a missingBearer, extra whitespace or a token with a trailing newline. - The body changed after hashing: it was pretty-printed, re-serialized or re-encoded by your HTTP client.
- The
Idempotency-KeyofPOST /v1/game-sessionsis missing, repeated, or differs from the signed value. Signature-Inputisn’t in canonical form: extra spaces, another parameter order, a missing or extra parameter, or another label thansig1.createdis more than 60 seconds ahead of our clock,expiresis more than 60 seconds behind it, orexpiresis more than 300 seconds aftercreated.- A nonce was reused, for example by a retry, or isn’t 22–128 base64url characters.
- The key ID isn’t registered for this Environment, the key isn’t valid yet or anymore, or your token isn’t bound to it.
- The signature base ends with a line feed or uses
\r\n. - The signature is in base64url or lacks the
:delimiters. - A security header, such as
Authorization, appears twice.
A Content-Type with ; charset=utf-8 is refused before these checks, with 415 unsupported_media_type.
If you still can’t find it, send us the X-Request-Id of the response and the time. Never send the token, the private key or the signature.
Keep credentials out of logs
Don’t log the token, the Authorization header, the signature, the signature base (it contains the token) or request bodies with an Operator Session Token. Log the X-Request-Id, your Idempotency-Key and the IDs we return instead. Keep the private key in your secret store; we never ask for it.