mirror of
https://github.com/stack-auth/stack.git
synced 2026-06-13 21:01:21 +08:00
Enhances sign-up process with Turnstile integration for fraud protection. Builds on top of fraud-protection-temp-emails. Made with [Cursor](https://cursor.com) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Cloudflare Turnstile bot-protection across signup/sign-in flows (including SDK JSON mode). * Email deliverability checks via Emailable. * Sign-up risk scoring with persisted risk metrics and country code tracking. * UI: country-code selector, risk-score editing in user details, users list refresh button, and Turnstile signup demo pages. * **Bug Fixes** * Use actual sign-up timestamp for reporting/metrics. * **Documentation** * Expanded knowledge base on Turnstile, risk scoring, and env configuration. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Konstantin Wohlwend <n2d4xc@gmail.com> Co-authored-by: BilalG1 <bg2002@gmail.com> Co-authored-by: Armaan Jain <84474476+Developing-Gamer@users.noreply.github.com> Co-authored-by: nams1570 <amanganapathy@gmail.com>
35 lines
932 B
TypeScript
35 lines
932 B
TypeScript
export const turnstileActionValues = [
|
|
"sign_up_with_credential",
|
|
"send_magic_link_email",
|
|
"oauth_authenticate",
|
|
] as const;
|
|
|
|
export type TurnstileAction = typeof turnstileActionValues[number];
|
|
|
|
export const turnstilePhaseValues = [
|
|
"invisible",
|
|
"visible",
|
|
] as const;
|
|
|
|
export type TurnstilePhase = typeof turnstilePhaseValues[number];
|
|
|
|
export const turnstileResultValues = [
|
|
"ok",
|
|
"invalid",
|
|
"error",
|
|
] as const;
|
|
|
|
export type TurnstileResult = typeof turnstileResultValues[number];
|
|
|
|
export const turnstileDevelopmentKeys = {
|
|
visibleSiteKey: "1x00000000000000000000AA",
|
|
invisibleSiteKey: "1x00000000000000000000BB",
|
|
secretKey: "1x0000000000000000000000000000000AA",
|
|
forcedChallengeSiteKey: "3x00000000000000000000FF",
|
|
} as const;
|
|
|
|
|
|
export function isTurnstileResult(value: unknown): value is TurnstileResult {
|
|
return typeof value === "string" && turnstileResultValues.some((status) => status === value);
|
|
}
|