Skip to content

docs: add api-devices.md covering devices & prekeys endpoints (#433) - #521

Open
JesseJohn7 wants to merge 1 commit into
codebestia:mainfrom
JesseJohn7:docs/api-devices-433
Open

docs: add api-devices.md covering devices & prekeys endpoints (#433)#521
JesseJohn7 wants to merge 1 commit into
codebestia:mainfrom
JesseJohn7:docs/api-devices-433

Conversation

@JesseJohn7

Copy link
Copy Markdown

Summary

Adds apps/backend/docs/api-devices.md, documenting every route in
routes/devices.ts and the legacy alias route in routes/userDevices.ts,
verified against the current implementation of both files.

Coverage

  • GET /devices, POST /devices, DELETE /devices/:id,
    POST /devices/logout-everywhere, POST /devices/:id/prekeys — full
    request/response shapes, status codes, and ownership/auth checks for each
  • GET /user-devices/:id/public-key — the one route remaining in the
    legacy userDevices.ts router, including its cross-user
    conversation-membership gate (distinct from every other route on this
    page, which is same-user-only)
  • Signed-vs-one-time prekey distinction: replace-on-upsert vs.
    add-to-pool-and-ignore-conflicts, and why only the signed prekey is
    signature-verified
  • The 200-key one-time-prekey cap: exact available = 200 - currentCount
    math, the 422 when already at cap, and the silent-trim behavior
    (capped/uploadedOneTimePreKeys in the response) when a batch would
    exceed the remaining headroom
  • Revocation side effects, documented once and referenced from both
    DELETE /:id and logout-everywhere: prekey row deletion, same-node and
    cross-node (Redis pub/sub) forced disconnect, and the device_revoked
    key-change system event fan-out into every shared conversation

Cross-links

  • Linked from a new ## 📚 Documentation section in the root README
  • Also links out to, and adds a README link for, the previously-unlinked
    e2ee-onboarding.md

Verification

  • Docs-only change — no .ts files modified
  • npx tsc --noEmit, npm test — unaffected by this change; please
    confirm green in CI

Closes #433

…stia#433)

Documents every route in routes/devices.ts (list, register, revoke,
logout-everywhere, prekey upload) and the legacy public-key lookup in
routes/userDevices.ts: request/response shapes, status codes, and
ownership/auth checks per route. Covers the signed-vs-one-time prekey
distinction, the 200-key cap and trimming behavior, and documents
revocation side effects (prekey deletion, device_revoked:* publish,
key-change system event) as part of DELETE /:id and logout-everywhere.

Linked from the root README's new Documentation section, alongside the
previously-unlinked e2ee-onboarding.md.

Closes codebestia#433
@drips-wave

drips-wave Bot commented Jul 29, 2026

Copy link
Copy Markdown

@JesseJohn7 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

API docs: Devices & prekeys endpoints

1 participant