From 1dd11e2bada949cfaef629cff49f8a93257e3caa Mon Sep 17 00:00:00 2001 From: Zeke Sikelianos Date: Mon, 13 May 2024 13:08:57 -0700 Subject: [PATCH] document webhook validation (#63) --- README.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/README.md b/README.md index 62a6b3f..2d2168e 100644 --- a/README.md +++ b/README.md @@ -94,6 +94,22 @@ if err != nil { fmt.Println("output: ", prediction.Output) ``` +### Webhooks + +To prevent unauthorized requests, Replicate signs every webhook and its metadata with a unique key for each user or organization. You can use this signature to verify the webhook indeed comes from Replicate before you process it. + +This client includes a `ValidateWebhookRequest` convenience function that you can use to validate webhooks: + +```go +import ( + "github.com/replicate/replicate-go" +) + +isValid, err := replicate.ValidateWebhookRequest(req, secret) +``` + +To learn more, see the [webhooks guide](https://replicate.com/docs/webhooks). + ## License Replicate's Go client is released under the Apache 2.0 license.