marsidev / react-turnstile

Cloudflare Turnstile integration for React.
https://www.npmjs.com/package/@marsidev/react-turnstile
MIT License
357 stars 20 forks source link

fix: update server-side validation response types #55

Closed jinsley8 closed 7 months ago

jinsley8 commented 7 months ago

Description

Cloudflare returns extra properties not yet accounted for in TurnstileServerValidationResponse and the error-codes is always returned whether the validation is successful or not.

messages and metadata seem like they have been added to the response more recently but not yet documented in the official server-side validation docs.

metadata is returned when validation is successful.

I am not quite sure of the purpose of messages so the comment isn't as detailed but it is only returned if validation fails.

Changes Made

Examples

Screenshot 2024-02-16 at 11 52 00 PM Screenshot 2024-02-16 at 11 52 10 PM
vercel[bot] commented 7 months ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
react-turnstile ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 18, 2024 4:58pm
jinsley8 commented 7 months ago

@marsidev I've updated the 'error-codes' type

marsidev commented 7 months ago

Thanks @jinsley8!