From 768b724ef9d310dc3ba28856ff22266be6c361e2 Mon Sep 17 00:00:00 2001 From: Stainless Bot Date: Thu, 6 Jul 2023 01:49:40 +0000 Subject: [PATCH] docs(webhooks): clarify webhook signature validation --- README.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 719d6b240..1d9c511b3 100644 --- a/README.md +++ b/README.md @@ -276,7 +276,11 @@ while (page != null) { We provide helper methods for verifying that a webhook request came from Lithic, and not a malicious third party. -You can use `lithic.webhooks().verifySignature(body, headers, secret?)` or `lithic.webhooks().unwrap(body, headers, secret?)`. +You can use `lithic.webhooks().verifySignature(body, headers, secret?)` or `lithic.webhooks().unwrap(body, headers, secret?)`, +both of which will raise an error if the signature is invalid. + +Note that the "body" parameter must be the raw JSON string sent from the server (do not parse it first). +The `.unwrap()` method can parse this JSON for you. ---