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 8029dcb commit 9962bd3
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Request, Response as ExpressResponse, NextFunction } from "express";

import { getAPIKey, hasPermission, hashAPIKey } from "./authorization";
import { ALLOWED_ORIGINS } from "./utils";
import { APIKey } from "./models/api_key";


export async function apiKeyMiddleware(req: Request, res: ExpressResponse, next: NextFunction): Promise<void> {
Expand All @@ -22,6 +23,7 @@ export async function apiKeyMiddleware(req: Request, res: ExpressResponse, next:
console.log(`API key exists: ${apiKeyExists}`);
const hashedKey = hashAPIKey(key as string);
console.log(`hashed key: ${hashedKey}`);
console.log(await APIKey.findAll());
if (validOrigin || (apiKeyExists && hasPermission(apiKey, req))) {
next();
} else {
Expand Down

0 comments on commit 9962bd3

Please sign in to comment.