You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: backend/API.md
+7-1Lines changed: 7 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -419,12 +419,18 @@ to check independently.
419
419
The four write routes are gated on `BATTLE_BACKEND_MODE_ENABLED` and return **503
420
420
`backend-battle-mode-disabled`** when it is off. Every read below stays served regardless:
421
421
switching the mode off stops new battles, it does not retract receipts already issued.
422
-
`DELETE /authorizations` is ungated too, since withdrawing consent must keep working.
422
+
`DELETE /authorizations` is ungated too, since withdrawing consent must keep working, and
423
+
`GET /authorizations` for the same reason: a defender needs to see that their consent went
424
+
stale precisely when something is off, and a mode flag should not be what hides it.
425
+
`DELETE /sessions` is ungated too, so withdrawing a delegated key never depends on a flag.
423
426
424
427
| POST |`/api/battle/intents`| JWT | Submit a signed battle intent (§D). |
425
428
| POST |`/api/battle/intents/:intentHash/accept`| JWT | Freeze the snapshot, commit to a future drand round, sign the commitment, and return it synchronously (§E). |
426
429
| POST |`/api/battle/authorizations`| JWT | Submit a signed standing defence authorization (§D). |
427
430
| DELETE |`/api/battle/authorizations?chainId=`| JWT | Revoke every live authorization for the caller on one chain. No wallet signature required — refusing battles is never the dangerous direction. |
431
+
| POST |`/api/battle/sessions`| JWT | Approve a client-held key to sign battle intents for the caller (§D). The key is generated in the browser and never sent here, so the operator still cannot forge an intent — only the number of wallet prompts changes. Scope is `battle-intent` alone and the window is capped at 24h. |
432
+
| DELETE |`/api/battle/sessions?chainId=`| JWT | Revoke every session key for the caller on one chain. Unsigned, like consent revocation: the failure mode is more prompts, never fewer. |
433
+
| GET |`/api/battle/authorizations?chainId=`| JWT | The caller's own live authorizations, plus the `rulesetHash` now being served. Each carries `isStale`, true when it was signed under a different ruleset and therefore covers no battle. Always scoped to the authenticated wallet, never to a queried address: one wallet's consent state says which of their pets can be challenged and until when. |
428
434
| GET |`/api/battle/config`| none | The `deploymentId`, served `chainIds`, and active ruleset a client needs *before* it can build a signable intent. None of it is derivable client-side, and guessing it fails only after the wallet prompt: a wrong deployment is refused as `wrong-deployment`, a wrong ruleset produces an authorization no battle matches. |
429
435
| GET |`/api/battle/:battleId`| none | Battle state summary: state, failure reason, both pets, ruleset hash. |
430
436
| GET |`/api/battle/:battleId/commitment`| none | The signed commitment, exactly as delivered at accept time — the re-fetch path if a client's local copy was lost. |
0 commit comments