feat: implement notification controller for handling incoming notifications with signature verification and add corresponding unit tests.
This commit is contained in:
@@ -5,12 +5,8 @@ class NotificationController {
|
||||
static async handle(req, res) {
|
||||
const payload = req.body;
|
||||
|
||||
try {
|
||||
const callbackToken = req.headers['x-callback-token'];
|
||||
if (callbackToken !== process.env.ROUTER_CALLBACK_TOKEN) {
|
||||
return responseHelper.error(res, "Unauthorized token router gateway", 401);
|
||||
}
|
||||
|
||||
try {
|
||||
const isValid = notificationService.verifySignature(payload);
|
||||
if (!isValid) {
|
||||
return responseHelper.error(res, "Invalid Signature Key", 403);
|
||||
|
||||
Reference in New Issue
Block a user