feat: Introduce webhook secret key to verify webhook requests

This commit is contained in:
Faruk AYDIN
2022-12-07 13:09:04 +01:00
parent 5d80fd523c
commit 75196cbf84
8 changed files with 41 additions and 28 deletions

View File

@@ -11,7 +11,7 @@ const verifyWebhook = async ($: IGlobalVariable) => {
const verifySignature = function (receivedSignature: string, payload: string) {
const hash = crypto
.createHmac('sha256', appConfig.appSecretKey)
.createHmac('sha256', appConfig.webhookSecretKey)
.update(payload)
.digest('base64');
return receivedSignature === `sha256=${hash}`;