Skip to content

Commit

Permalink
Authentication Added
Browse files Browse the repository at this point in the history
  • Loading branch information
lakshayman committed Feb 19, 2024
1 parent 1e34139 commit 45be7e5
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/controllers/profileHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,15 @@ import { env } from "../typeDefinitions/default.types";
import { sendProfileServiceBlockedMessage } from "../utils/sendProfileServiceBlockedMessage";
import JSONResponse from "../utils/JsonResponse";
import * as response from "../constants/responses";
import { verifyAuthToken } from "../utils/verifyAuthToken";

export const sendProfileBlockedMessage = async (request: any, env: env) => {
const authHeader = request.headers.get("Authorization");
if (!authHeader) {
return new JSONResponse(response.BAD_SIGNATURE);
}
try {
await verifyAuthToken(authHeader, env)
const messageRequest: any = await request.json();
const { userId, reason } = messageRequest;
await sendProfileServiceBlockedMessage(userId, reason, env);
Expand Down

0 comments on commit 45be7e5

Please sign in to comment.