fix(AWS SNS Trigger Node): add missing jsonParse import (#4463)

* fix(AwsSnsTrigger): add missing jsonParse import

* add clear typings for req.rawBody and getHeaderData()
This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™
2022-10-28 11:24:11 +02:00
committed by GitHub
parent d9a41ea9d7
commit e6ec134cf3
16 changed files with 17 additions and 30 deletions

View File

@@ -156,21 +156,17 @@ export class WooCommerceTrigger implements INodeType {
},
};
//@ts-ignore
async webhook(this: IWebhookFunctions): Promise<IWebhookResponseData> {
const req = this.getRequestObject();
const headerData = this.getHeaderData();
const webhookData = this.getWorkflowStaticData('node');
//@ts-ignore
if (headerData['x-wc-webhook-id'] === undefined) {
return {};
}
const computedSignature = createHmac('sha256', webhookData.secret as string)
//@ts-ignore
.update(req.rawBody)
.digest('base64');
//@ts-ignore
if (headerData['x-wc-webhook-signature'] !== computedSignature) {
// Signature is not valid so ignore call
return {};