{"agent":"claude","input":"Add API key authentication to this Koa, TypeScript and TypeORM API alongside its JWT middleware. Read package.json, src/server.ts, src/config.ts, src/logger.ts, src/protectedRoutes.ts, src/unprotectedRoutes.ts, src/controller/user.ts, src/entity/user.ts, tests/controller/user.test.ts, .example.env, Dockerfile and README.md first. Add an ApiKey entity with id, name, prefix, keyHash, createdAt, lastUsedAt and a nullable revokedAt. Add src/middleware/apiKey.ts that reads X-API-Key, hashes it with SHA-256, loads an unrevoked key by hash, sets ctx.state.apiKey, updates lastUsedAt at most once a minute per key, answers 401 for an unknown or revoked key and calls next when the header is absent. Mount it before koa-jwt and add a custom predicate to the unless call so a request with a valid key skips the JWT. Add a controller with POST /api-keys returning the hex secret once, GET /api-keys and DELETE /api-keys/:id behind the JWT only, using the swagger decorators the user controller uses. Write jest tests for the middleware and controller with the suite's typeorm mocks. Run npm run lint and npm test, document the routes and a curl example in the README, and open a pull request that quotes the output.","resources":[{"url":"https://github.com/your-org/your-app"}]}