signup: optional Cloudflare Turnstile check on account creation

Off unless both TURNSTILE_SITE_KEY and TURNSTILE_SECRET_KEY are set. When on, createAccount, _account.createPasskeyAccount and SSO complete-registration need a token in the x-turnstile-token header, verified against siteverify (secret, response, remoteip from the rate limiter's client IP, PDS hostname check) before any other work or invite-code use. Siteverify failures fail closed (503 CaptchaUnavailable); missing and rejected tokens are 400 CaptchaRequired and InvalidCaptcha. Requests carrying a createAccount service token from the DID they bring (inbound migration, BYOD did:web) are exempt so goat and PDSMoover keep working; delegated accounts are already authenticated. describeServer gains turnstileSiteKey only when enabled.

b4d38212 parent e3b987b4 +928 −3
browse files