//native
type Replicate = {
token: string;
};
/**
* Get the signing secret for the default webhook
* Get the signing secret for the default webhook endpoint. This is used to verify that webhook requests are coming from Replicate.
Example cURL request:
```console
curl -s \
-H "Authorization: Bearer $REPLICATE_API_TOKEN" \
https://api.replicate.com/v1/webhooks/default/secret
```
The response will be a JSON object with a `key` property:
```json
{
"key": "..."
}
```
*/
export async function main(auth: Replicate) {
const url = new URL(`https://api.replicate.com/v1/webhooks/default/secret`);
const response = await fetch(url, {
method: "GET",
headers: {
Authorization: "Bearer " + auth.token,
},
body: undefined,
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.json();
}
Submitted by hugo697 235 days ago