Appearance
Implementation Notes
Security best practices
- HTTPS-only on your wallet API. Modern TLS (1.2 minimum, 1.3 preferred).
- IP allowlist: TS will send you its outbound IP ranges. Restrict your wallet API to only accept calls from those IPs.
- Validate every call: HMAC signature,
tokenlookup,currencymatches the user's currency. SameSite=None; Secureon any cookies your wallet API sets (rare in this integration since all calls are server-to-server, but worth noting).- CSRF: not applicable to server-to-server calls. DO still protect your
/authenticatefrom accidental browser-initiated calls. - Secrets: store the HMAC shared secret in a vault, never in code. Rotate quarterly. Monitor HMAC mismatch rates as a leading indicator of secret drift / clock drift.
Implementation notes (Tap-specific)
- High-frequency settlement. A winning cell closes ~80 ms after the touch event detected by TS's engine. Bursts on
/closetradeare normal — peak rates of dozens of trades per second per player are realistic during fast-paced sessions. Size your wallet API accordingly (target p99 < 200 ms on/closetradefor smooth UX). - Idempotency or it didn't happen. TS retries on any non-2xx response or timeout. Use
externalTradeIdas your idempotency key in a unique index. Returning a duplicate200 Okis the correct response for an already-applied trade. - Atomic state transitions. A reservation lifecycle is
open → closed. There's no "edit" for Tap. If you see/opentradewith anexternalTradeIdyou've already closed (rare, but possible during retries against a stale window), reject withInvalidTokenorOk— your call, document it. - String precision. All amounts (
amount,balance,stake,payout,pnl) are strings. Do not coerce to floats during HMAC body hashing or balance arithmetic. Use a decimal library on your side. touchPriceis informational. Reporting only. Never use for wallet math.- Cancellation at window boundaries. Rare but normal: a trade that opened at the very edge of a trading-window close may settle as a cancellation with no prior partner signal. Treat it as a tie (
amount === stake). - Clock sync. NTP-sync your wallet API hosts. HMAC
X-Timestamptolerates only ±60 s drift; clock drift = silent rejection of every callback.