Files
arena-tracker/docs/adr/0008-riot-calls-go-through-a-relay-holding-the-production-key.md
T
nessarandClaude Fable 5.2 6140bc34fb Follow an Account to its new PUUID on proof of identity (#150)
A PUUID depends on the Riot application of the API key, so the relay's
production key gives every stored Account another one. Before a request
that carries a stored PUUID (a sync, a Friend's import), the Riot ID is
resolved; when its PUUID differs and a stored published Match is among
the new PUUID's, the Account, its Matches (stored Riot responses
included), Mastery, sync mark, platform, last active mark and Friend
status move to it in one transaction. A new PUUID already stored is
merged, the published Match winning. Without proof nothing changes.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-28 19:21:52 +01:00

2.5 KiB

status
status
accepted

Riot calls go through a relay that holds the production key

This replaces the "personal Riot API key" part of ADR-0001; its two data sources stand. The app no longer sends a key: it calls a relay run by the maintainer, which holds Arena Tracker's production key, forwards only the app's six Riot calls and shares the quota between players (spec #144). Riot forbids opening an app to the public on a personal key and shipping a key inside a distributed binary, and a personal key (100 requests per 2 minutes) makes an import slow.

The relay (crates/relay) is a request in, a request out: /{routing value}{Riot path}, a closed list of routing values and routes, no cache and nothing stored. It counts requests per routing value at the production limits and per client address, and answers 429 with Retry-After at once when either is full, or when Riot itself answered 429 for that routing value. A refused key (401, 403) becomes 503: it is the relay's problem, not the player's. A 403 on a Match's timeline is passed as is: Riot refuses some timelines on their own. The same process serves the Arena Tracker site (site/, #145), built into its binary, so there is one thing to deploy on the home server and the pages describe the service that serves them. Running it: docs/service-relais.md.

Considered Options

  • Each player's own personal key (ADR-0001): not allowed for a public app, and a key to request, enter and renew for every player.
  • The production key in the binary: forbidden by Riot, and readable by anyone who has the app.
  • The site apart, served by the reverse proxy: one less job for the process that holds the key, but two things to deploy and keep in step.
  • An async server (tokio, axum): more throughput than the quota allows; the relay uses threads and the ureq client the core already uses.

Consequences

  • When the relay is down, imports stop; what is stored stays readable.
  • The relay sees each player's address and Riot IDs in transit; it logs only the type of call, the status and the duration.
  • A PUUID depends on the key's Riot application: switching to the production key changes every stored one. Before a request that carries a stored PUUID, the app asks Riot for the PUUID of the Riot ID and moves the stored Account to it only if a stored published Match is among the new PUUID's Matches; without that proof nothing changes (#150).
  • Not built yet: a cache of Matches (if the quota is reached), Riot's per-method limits (its 429 is respected).