Files
formbricks/apps/web/modules/auth/signup/lib/utils.ts
Johannes 58ab40ab8e chore: remove unused handleBillingLimitsCheck function and utils file
- Delete apps/web/app/api/lib/utils.ts as it only contained a no-op function
- Remove handleBillingLimitsCheck calls from all response creation endpoints
- Function was a placeholder with no actual implementation
2025-11-18 14:51:04 +01:00

30 lines
809 B
TypeScript

export const verifyTurnstileToken = async (secretKey: string, token: string): Promise<boolean> => {
const controller = new AbortController();
const timeoutId = setTimeout(() => controller.abort(), 5000);
try {
const response = await fetch("https://challenges.cloudflare.com/turnstile/v0/siteverify", {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
secret: secretKey,
response: token,
}),
signal: controller.signal,
});
if (!response.ok) {
throw new Error(`Verification failed with status: ${response.status}`);
}
const data = await response.json();
return data.success === true;
} catch (error) {
return false;
} finally {
clearTimeout(timeoutId);
}
};