captcha-sdk 0.0.1

Unified server-side CAPTCHA verification for Rust
Documentation

captcha-sdk

Unified server-side CAPTCHA verification for Rust.

captcha-sdk provides one provider-independent request, result, error model, and verifier trait for Cloudflare Turnstile, hCaptcha, Google reCAPTCHA, Friendly Captcha, CaptchaFox, MTCaptcha, Prosopo Procaptcha, and ALTCHA.

Status: 0.1.0 is the initial API scaffold. The normalized core and provider configuration modules are present; provider HTTP adapters are not implemented yet. The proposed replacement API is documented as TARGET architecture / implementation pending; it does not describe the current ABI.

Features

  • turnstile — Cloudflare Turnstile adapter scaffold
  • hcaptcha — hCaptcha adapter scaffold
  • recaptcha — Google reCAPTCHA adapter scaffold
  • friendlycaptcha — Friendly Captcha v2 adapter scaffold
  • captchafox — CaptchaFox adapter scaffold
  • mtcaptcha — MTCaptcha adapter scaffold
  • procaptcha — Prosopo Procaptcha adapter scaffold
  • prosopo — alias that enables procaptcha
  • altcha — ALTCHA local HMAC verification scaffold
  • all-providers — enables every provider module

No provider is enabled by default.

[dependencies]
captcha-sdk = { version = "0.1", features = ["turnstile"] }

Current scaffold API

use captcha_sdk::{FailureReason, Provider, VerificationResult};

let result = VerificationResult::invalid(
    Provider::Turnstile,
    vec![FailureReason::ActionMismatch],
);

assert!(!result.valid);
assert_eq!(result.provider, Provider::Turnstile);

This example describes only the current 0.1.0 scaffold. Its closed Provider enum and bool-based VerificationResult are not the intended long-term contract. See the target architecture for the planned ProviderId, ProviderVerdict, evidence, policy, capabilities, and third-party adapter model.

Development

cargo fmt --all --check
cargo clippy --workspace --all-targets --all-features --locked -- -D warnings
cargo test --workspace --all-features --locked

For the configured nextest runner:

cargo install cargo-nextest --locked
cargo nextest run --all-features

License

Licensed under the MIT License.