Repository navigation
feat(admin): list API keys with pagination and revoked filter (#505) - #569
sparkysolutions10-pixel wants to merge 2 commits into
Conversation
2513163 to
4aac320
Compare
|
Same note as on #561: this implements #505, which is assigned to @Zuliyat, whose #593 is open for it. I've reviewed theirs for that issue. Worth knowing regardless of who lands it, since I found it while reviewing: part of #505 already shipped. The rule I'm applying is the one from your earlier re-cut: where two PRs implement the same issue, the assignee's goes first. Nothing against the work — it's the only tiebreak that's fair to whoever claimed it. Leaving this open rather than closing it myself. If you want a nearby thing to pick up that nobody holds: #589's generated README table needs the |
|
@Miracle656 Closing this out as Issue #505 is assigned to @Zuliyat to avoid duplicate work and keep PR tracking clean. |
Description
Fixes #505.
Summary of Changes
The admin surface allowed minting a key and revoking a key by ID, but provided no way to list existing keys. Operators who did not capture the ID at mint time were unable to identify or revoke keys through the API.
This PR implements
GET /admin/keysaccording to all issue requirements:GET /admin/keys):isAdminAuthorized(), returning 401 on unauthorized attempts.hashand plaintext from the Prisma query select and JSON response. Onlyid,label, quotas,createdAt,revokedAt, andexpiresAtare exposed.where: { revokedAt: null }) to reflect currently live keys.includeRevoked=true.limit(default 50, capped at 100) andoffset(default 0), returning{ keys, total, limit, offset, hasMore }.src/__tests__/adminListKeys.test.tsverifying 401 unauthenticated responses, non-revoked default filtering, pagination parameters, and explicit assertion thathashis absent from the response body.Testing
npx vitest run src/__tests__/adminListKeys.test.ts(3/3 passed)npx vitest run tests/openapi.test.ts(8/8 passed)