Document how to validate webhooks if your app is not using Request™
zeke opened this issue · 2 comments
zeke commented
From @aron in #259 (comment)
We should cover what to do if your environment doesn't support
Request, in which case you pass through the parts manually:
const requestData = {
id: "123", // the `Webhook-Id` header
timestamp: 0123456, // the `Webhook-Timestamp` header
signature: "xyz", // the `Webhook-Signature` header
body: "", // the request body as a string, ArrayBuffer or ReadableStream
};
const webhookIsValid = await validateWebhook(requestData, secret);mattt commented
FYI - The supported / expected argument types are documented here:
replicate-javascript/lib/util.js
Lines 3 to 31 in 70ca64a