( request: FastifyRequest, reply: FastifyReply, done: any )
| 3 | |
| 4 | // Check valid token |
| 5 | export const authenticateUser = ( |
| 6 | request: FastifyRequest, |
| 7 | reply: FastifyReply, |
| 8 | done: any |
| 9 | ) => { |
| 10 | const bearer = request.headers.authorization!.split(" ")[1]; |
| 11 | const token = checkToken(bearer); |
| 12 | |
| 13 | if (!token) { |
| 14 | return reply.code(401).send({ error: "Unauthorized" }); |
| 15 | } |
| 16 | |
| 17 | // User is authenticated, continue to the route handler |
| 18 | done(); |
| 19 | }; |
nothing calls this directly
no test coverage detected