Files
romm/backend/utils
Georges-Antoine Assi 0f75e6aaf4 fix(client-tokens): let a client token revoke itself without me.write (#5419)
* fix(client-tokens): let a client token revoke itself without me.write

A device that signs out or re-pairs had no way to revoke its own token
unless it held me.write, which also lets it mint tokens and approve
pairings. DELETE /api/client-tokens/{id} now skips the me.write check
when the id is the token authenticating the request.

Fixes #5274

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(client-tokens): code-review pass on self-revoke

Annotate raise_auth_error as NoReturn, trim the delete_token docstring, and
cover a me.write token revoking a sibling, the revoked token failing to
authenticate, and socket closure on self-revoke.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(client-tokens): revoke the calling token through DELETE /current

Self-revoke moves to an id-less route so a device never needs to know its
token id, and DELETE /{token_id} keeps me.write in its decorator and in
OpenAPI. The device-authorization token response now also returns token_id.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* refactor(client-tokens): simplify pass, reuse raise_auth_error for /current

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* revert(client-tokens): drop DELETE /current and the device-flow token_id

Self-revoke stays on DELETE /{token_id} with the in-handler check.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* feat(device-auth): return the issued token's id from the device token poll

A device paired through the device-authorization flow can now revoke its
own token with DELETE /api/client-tokens/{id}, as tokens from /exchange can.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Update docs/BACKEND_ARCHITECTURE.md

* docs: format client tokens table

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 19:05:52 -04:00
..
2026-06-28 21:48:50 -04:00
2026-07-06 22:17:56 -04:00