(req: Request, res: Response, next: NextFunction)
| 45 | } |
| 46 | |
| 47 | requireAuth(req: Request, res: Response, next: NextFunction): void { |
| 48 | const user = this.authenticate(req as unknown as IncomingMessage); |
| 49 | if (!user) { |
| 50 | res.status(401).json({ error: "Unauthorized" }); |
| 51 | return; |
| 52 | } |
| 53 | (req as AuthenticatedRequest).user = user; |
| 54 | next(); |
| 55 | } |
| 56 | |
| 57 | // ── Internals ───────────────────────────────────────────────────────────── |
| 58 |
nothing calls this directly
no test coverage detected