Skip to content

Commit

Permalink
More debugging.
Browse files Browse the repository at this point in the history
  • Loading branch information
Carifio24 committed Oct 1, 2024
1 parent 0143376 commit 8029dcb
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/middleware.ts
Original file line number Diff line number Diff line change
@@ -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";


Expand All @@ -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 {
Expand Down

0 comments on commit 8029dcb

Please sign in to comment.