From 097c1b559a51db10f8184c6c539aac8cc4f668ba Mon Sep 17 00:00:00 2001 From: Moein zargarzadeh Date: Sat, 17 Feb 2024 08:56:49 +0330 Subject: [PATCH 1/2] fix api-key header (remove underscore) --- src/api/authentication.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/api/authentication.ts b/src/api/authentication.ts index bbbd32cd..48389c3b 100644 --- a/src/api/authentication.ts +++ b/src/api/authentication.ts @@ -4,7 +4,7 @@ import { getConfig } from '../config/config'; import { uint8ArrayToHex } from '../utils/utils'; const authenticateKey = (req: Request, res: Response, next: NextFunction) => { - const api_key: string = req.header('API_KEY')!; + const api_key: string = req.header('Api-Key')!; if ( api_key && uint8ArrayToHex(blake2b(api_key, undefined, 32)) == From b26e092171bd3979b9ea6768b1ba540ac59a1f3a Mon Sep 17 00:00:00 2001 From: Moein zargarzadeh Date: Sat, 17 Feb 2024 08:58:24 +0330 Subject: [PATCH 2/2] fix log message --- src/api/authentication.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/api/authentication.ts b/src/api/authentication.ts index 48389c3b..822f10b4 100644 --- a/src/api/authentication.ts +++ b/src/api/authentication.ts @@ -12,7 +12,7 @@ const authenticateKey = (req: Request, res: Response, next: NextFunction) => { ) { next(); } else { - res.status(403).send({ message: "API_KEY doesn't exist or it is wrong" }); + res.status(403).send({ message: "Api-Key doesn't exist or it is wrong" }); } };