Skip to content

Commit

Permalink
Merge branch '210-add-api_key' into 'dev'
Browse files Browse the repository at this point in the history
fix api-key header (remove underscore)

Closes #210

See merge request ergo/rosen-bridge/watcher!241
  • Loading branch information
vorujack committed Feb 17, 2024
2 parents f79fb72 + b26e092 commit 85d04e8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/api/authentication.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ 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)) ==
getConfig().general.apiKeyHash
) {
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" });
}
};

Expand Down

0 comments on commit 85d04e8

Please sign in to comment.