(a: string, b: string)
| 29 | const hmacKey = randomBytes(32) |
| 30 | |
| 31 | function safeTokenCompare(a: string, b: string): boolean { |
| 32 | const hashA = createHmac('sha256', hmacKey).update(a).digest() |
| 33 | const hashB = createHmac('sha256', hmacKey).update(b).digest() |
| 34 | return timingSafeEqual(hashA, hashB) |
| 35 | } |
| 36 | |
| 37 | export async function authHook(request: FastifyRequest, reply: FastifyReply): Promise<void> { |
| 38 | if (!cachedToken) return |
no test coverage detected