<script>
import WidgetDemoCode from "$lib/components/blocks/WidgetDemoCode.svelte";
import WidgetDemoFrictionless from "$lib/components/blocks/WidgetDemoFrictionless.svelte";
</script>

# Adaptive Captcha

Open-source ALTCHA presents every visitor with the same proof-of-work difficulty. Adaptive Captcha, part of Sentinel, instead scales what a visitor is asked to do based on their individual risk score.

## Frictionless Captcha vs. Code Challenge

- **Frictionless Captcha** — what legitimate users see: a background proof-of-work computation with no visual puzzle to solve.
- **Code Challenge** — what flagged users see instead: an interactive challenge that requires active participation, deliberately adding friction for traffic that looks suspicious.

## Examples

<!-- TODO: interactive example/demo placeholder -->

### Frictionless

<WidgetDemoFrictionless />

### Interactive Bot Check

<WidgetDemoCode />

## How it works

Sentinel evaluates server-side signals into a combined risk score for every request — it does not rely on browser fingerprinting or invasive client-side tracking. When the score crosses a threshold, Sentinel escalates from a frictionless challenge to a Code Challenge (or a rate limit / block, depending on your [Security Group](/docs/sentinel/configure/security-groups/) policy).

### Evaluated factors

- **Automated clients** — abnormal request timing, parallelized submissions, malformed payloads, missing browser characteristics.
- **Suspicious networks** — a local database of high-risk IPs, including Tor exit nodes and known botnet ranges.
- **High-risk geographic regions** — heightened scrutiny for locations with historically elevated automated abuse.
- **Non-standard browser requests** — missing typical headers, or unusual header combinations.
- **User penalties** — temporary penalties for exceeded rate limits, failed challenges, or malformed requests.
- **Server load** — thresholds tighten automatically during high-traffic periods.

## Accessibility & audio challenge

The Code Challenge includes an audio option to stay compliant with accessibility standards (including the European Accessibility Act, EAA 2025) for users relying on assistive technology like screen readers.

Audio is generated by a built-in text-to-speech synthesizer — no external service dependency, and generation takes under 5ms. Numeric codes are read digit-by-digit; letters are read using phonetic-alphabet pronunciation (e.g. the NATO alphabet for English).

Configuration:

- `AUDIO_CHALLENGE_DELAY` — delay before generating/returning the audio challenge (default `3s`; set to `0` for instant generation). See [ENV Variables](/docs/sentinel/operations/env-variables/#rate-limiting--proof-of-work).
- Code alphabet and code length (4–8 characters) — configurable per [Security Group](/docs/sentinel/configure/security-groups/).

### Audio samples

**Numeric codes:**

| Language | Sample |
|---|---|
| English | <audio controls preload="none" src="/audio/code-challenge-en.wav"></audio> |
| Spanish | <audio controls preload="none" src="/audio/code-challenge-es.wav"></audio> |
| French | <audio controls preload="none" src="/audio/code-challenge-fr.wav"></audio> |
| Portuguese | <audio controls preload="none" src="/audio/code-challenge-pt.wav"></audio> |
| Russian | <audio controls preload="none" src="/audio/code-challenge-ru.wav"></audio> |
| Arabic | <audio controls preload="none" src="/audio/code-challenge-ar.wav"></audio> |
| Chinese | <audio controls preload="none" src="/audio/code-challenge-zh.wav"></audio> |
| Hindi | <audio controls preload="none" src="/audio/code-challenge-hi.wav"></audio> |

**Letter pronunciation:**

| Language | Sample |
|---|---|
| English | <audio controls preload="none" src="/audio/code-challenge-en-letters.wav"></audio> |
| German | <audio controls preload="none" src="/audio/code-challenge-de-letters.wav"></audio> |
| Polish | <audio controls preload="none" src="/audio/code-challenge-pl-letters.wav"></audio> |
| Swedish | <audio controls preload="none" src="/audio/code-challenge-sv-letters.wav"></audio> |

## Supported languages

- **Full alpha-numeric support** (30 languages): Afrikaans, Bulgarian, Croatian, Czech, Danish, Dutch, English, Estonian, Finnish, French, German, Hungarian, Indonesian, Italian, Latvian, Lithuanian, Malay, Norwegian Bokmål, Polish, Portuguese, Romanian, Russian, Serbian, Slovak, Slovenian, Spanish, Swedish, Turkish, Ukrainian, Vietnamese.
- **Numeric-only support** (14 languages): Arabic, Bengali, Cantonese, Chinese, Greek, Hebrew, Hindi, Japanese, Korean, Marathi, Punjabi, Tamil, Telugu, Thai, Urdu.

## Configuration

Enable Adaptive Captcha one of two ways:

- **Autopilot** — let Sentinel manage it automatically based on observed traffic. See [Autopilot](/docs/sentinel/features/autopilot/).
- **Manual** — enable the Code Challenge feature and activate Adaptive Mode directly in your [Security Group](/docs/sentinel/configure/security-groups/) settings.

## Related

- [Autopilot](/docs/sentinel/features/autopilot/) — automatic tuning of the thresholds this feature uses.
- [Human Interaction Signature](/docs/sentinel/features/human-interaction-signature/) — one of the main signals feeding the risk score.
- [Widget Integration](/docs/integration/widget/) — the client-side component that renders the challenge.
