replicate-javascript
replicate-javascript copied to clipboard
Document how to validate webhooks if your app is not using Request™
From @aron in https://github.com/replicate/replicate-javascript/pull/259#discussion_r1599131203
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);