RecaptchaService
Provides Google reCAPTCHA verification and HTML widget rendering for Ktor applications.
Includes server-side token verification via the Google reCAPTCHA API, a Ktor route-level validation extension, and kotlinx.html helpers for embedding the reCAPTCHA script and widget.
Holds a long-lived HttpClient; call close on application shutdown to release its resources.
Functions
Adds the Google reCAPTCHA JavaScript to the HTML HEAD if reCAPTCHA is enabled and both the site key and secret key are configured (kept in lockstep with server-side verification).
Renders the reCAPTCHA widget <div> in the HTML body if reCAPTCHA is enabled and both the site key and secret key are configured (kept in lockstep with server-side verification).
Validates the reCAPTCHA response token from form parameters within a Ktor RoutingContext.