From 8029dcb7072863837c22e5346416d7ce9faef6ce Mon Sep 17 00:00:00 2001 From: Carifio24 Date: Tue, 1 Oct 2024 14:30:14 -0400 Subject: [PATCH] More debugging. --- src/middleware.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/middleware.ts b/src/middleware.ts index 62849b3..6e501ab 100644 --- a/src/middleware.ts +++ b/src/middleware.ts @@ -1,6 +1,6 @@ import { Request, Response as ExpressResponse, NextFunction } from "express"; -import { getAPIKey, hasPermission } from "./authorization"; +import { getAPIKey, hasPermission, hashAPIKey } from "./authorization"; import { ALLOWED_ORIGINS } from "./utils"; @@ -20,6 +20,8 @@ export async function apiKeyMiddleware(req: Request, res: ExpressResponse, next: console.log(`key is null: ${key === null}`); console.log(`key is undefined: ${key === undefined}`); console.log(`API key exists: ${apiKeyExists}`); + const hashedKey = hashAPIKey(key as string); + console.log(`hashed key: ${hashedKey}`); if (validOrigin || (apiKeyExists && hasPermission(apiKey, req))) { next(); } else {