(a: string, b: string)
| 8 | import { unauthorized, errorResponse } from './errors' |
| 9 | |
| 10 | function safeTokenCompare(a: string, b: string): boolean { |
| 11 | const bufA = Buffer.from(a) |
| 12 | const bufB = Buffer.from(b) |
| 13 | if (bufA.length !== bufB.length) return false |
| 14 | return timingSafeEqual(bufA, bufB) |
| 15 | } |
| 16 | |
| 17 | export async function authHook(request: FastifyRequest, reply: FastifyReply): Promise<void> { |
| 18 | const authHeader = request.headers.authorization |