Improve printful secret hash
This commit is contained in:
@@ -324,8 +324,8 @@ export const app = new Elysia()
|
||||
// WEBHOOKS
|
||||
.post("/webhooks/printful", async ({ body, query }) => {
|
||||
// https://webflow.com/integrations/printful
|
||||
const verified = crypto.timingSafeEqual(Buffer.from(query.secret, "hex"), Buffer.from(env.PRINTFUL_WEBHOOK_SECRET, "hex"));
|
||||
if (!verified) throw status(400, "Invalid secret");
|
||||
if (!s.Commerce.Printful.Util.verifySecret(query.secret))
|
||||
throw status(400, "Invalid secret");
|
||||
|
||||
const payload = body as Printful.Webhook.EventPayload;
|
||||
|
||||
@@ -379,7 +379,7 @@ export const app = new Elysia()
|
||||
}
|
||||
}, { query: t.Object({ secret: t.String() }) })
|
||||
.post("/webhooks/webflow", async ({ request, body }) => {
|
||||
if (!s.Commerce.Webflow.Util.verifyWebflowSignature(request, body))
|
||||
if (!s.Commerce.Webflow.Util.verifySecret(request, body))
|
||||
throw status(400, "Invalid signature");
|
||||
|
||||
const payload = body as Webflow.Webhook.EventPayload;
|
||||
|
||||
Reference in New Issue
Block a user