# ALTCHA
ALTCHA is a self-hosted, privacy-first security solution that protects your websites, APIs, and online services from spam and abuse through an innovative proof-of-work mechanism. Unlike traditional CAPTCHAs that depend on intrusive methods like cookies or fingerprinting, ALTCHA delivers robust protection while respecting user privacy.
ALTCHA is fully compliant with:
- **Global privacy regulations**: GDPR, HIPAA, CCPA, PIPEDA/CPPA, LGPD, DPDPA, and PIPL
- **Accessibility standards**: [WCAG 2.2 AA-level](https://altcha.org/legal/compliance/wcag/) and the [European Accessibility Act](https://altcha.org/legal/compliance/eaa/)
For more details, visit [altcha.org](https://altcha.org).
## Playground
Want to see it in action? Visit the official ALTCHA Playground to experiment with widget configurations, fine-tune the Proof-of-Work (PoW) settings, and see how the security mechanisms hold up in real-time.
[Open ALTCHA Playground](https://playground.altcha.org)
## Features
- **Frictionless Experience**: Eliminates frustrating visual puzzles by using background **Proof-of-Work (PoW)** for a seamless user journey.
- **Hardware-Resistant Security**: Leverages **Argon2 and Scrypt** memory-bound algorithms to neutralize hardware acceleration (ASICs/GPUs) and sophisticated bot farms.
- **Accessible Code Challenges**: Provides "Enter code from image" fallbacks with built-in **audio support** for visually impaired users.
- **Privacy by Design**: Fully **GDPR compliant** and cookie-free—no tracking, no fingerprinting, and no data collection.
- **Universal Accessibility**: Engineered to exceed **WCAG 2.2 AA** standards, ensuring compliance with the **European Accessibility Act (EAA)**.
- **Lightweight**: Minimal footprint, optimized for rapid page loads and high-performance environments.
- **100% Self-Hosted**: Maintain full sovereignty over your infrastructure with no reliance on third-party API availability.
## What’s New in v3
- **Next-Gen PoW**: Significant performance gains and reduced CPU overhead through an optimized verification mechanism.
- **Advanced Bot Defense**: Native support for **Argon2 and Scrypt**, raising the cost of attack for automated scripts and specialized hardware.
- **Modern UI**: Refined styling options, including a suite of new built-in themes and improved CSS custom property support.
- **Developer Experience**: Improved TypeScript support and streamlined integration.
### Migrating from v2
See [MIGRATION-v2.md](https://github.com/altcha-org/altcha/blob/v3/MIGRATION-v2.md).
## Examples
Explore starter templates for popular frameworks:
- [React](https://github.com/altcha-org/altcha-starter-react-ts)
- [Vue](https://github.com/altcha-org/altcha-starter-vue-ts)
- [Svelte](https://github.com/altcha-org/altcha-starter-svelte-ts)
- [Solid](https://github.com/altcha-org/altcha-starter-solid-ts)
- [Lit](https://github.com/altcha-org/altcha-starter-lit-ts)
- [Angular](https://github.com/altcha-org/altcha-starter-angular)
## Server Integrations
- [TypeScript](https://github.com/altcha-org/altcha-lib)
- [Dart](https://github.com/altcha-org/altcha-lib-dart)
- [PHP](https://github.com/altcha-org/altcha-lib-php)
- [Go](https://github.com/altcha-org/altcha-lib-go)
- [Python](https://github.com/altcha-org/altcha-lib-py)
- [Java](https://github.com/altcha-org/altcha-lib-java)
- [Ruby](https://github.com/altcha-org/altcha-lib-rb)
- [Elixir](https://github.com/altcha-org/altcha-lib-ex)
- [Rust](https://github.com/altcha-org/altcha-lib-rs)
- [C++](https://github.com/altcha-org/altcha-lib-cpp)
## Plugins & CMS
- [Libraries and plugins](https://altcha.org/docs/integration/server/)
## Usage
The ALTCHA widget is distributed as a **Web Component**.
### 1. Install ALTCHA
```sh
npm install altcha
```
Import in your main file:
```js
import 'altcha';
```
Or load via `
```
### 2. Add `` to Your Forms
```html
```
See [configuration options](#configuration) or the [website integration docs](https://altcha.org/docs/integration/widget/).
### 3. Integrate with Your Server
Refer to the [server documentation](https://altcha.org/docs/integration/server/) for implementation details.
## Supported Browsers
ALTCHA works on modern browsers with **Web Crypto API** support (specifically `crypto.subtle` - [caniuse.com](https://caniuse.com/?search=subtle)).
**Supported**:
- Chrome 67+ (desktop & Android)
- Edge 79+
- Firefox 63+ (desktop & Android)
- Safari 11+ (macOS & iOS)
- Any browser supporting Web Components + Web Crypto
**Not Supported**:
- Internet Explorer 11 (or older)
## Bundle Size
ALTCHA is optimized for performance:
| Distribution | Size (GZIPped) |
| ---------------------------- | -------------- |
| ALTCHA | 34 kB |
| ALTCHA with all translations | 52 kB |
| Cloudflare Turnstile | 85+ kB |
| hCaptcha | 250+ kB |
| reCAPTCHA | 300+ kB |
When GZIPped, it totals about 34 kB, making ALTCHA’s widget about ~90% smaller than reCAPTCHA.
## Content Security Policy (CSP)
The default bundle includes styles and workers in a single file. For strict CSP compliance, use scripts from `/dist/external`. Learn more in the [documentation](https://altcha.org/docs/integration/widget/).
## Configuration
### Programmatic Configuration
The widget provides a global `$altcha` object to manage defaults, register new algorithms, or add custom translations.
To update an existing widget instance, use the `.configure()` [method](<>). This is the preferred way to handle complex objects or functions that cannot be passed via HTML attributes.
```ts
// Set defaults for all future widget instances:
$altcha.defaults.set({
challenge: 'https://api.example.com/challenge',
debug: true
});
// Update a specific instance dynamically:
const widget = document.querySelector('altcha-widget');
widget.configure({
workers: 2,
language: 'fr'
});
```
### Attribute Configuration
For simple implementations, the widget supports a subset of configuration options directly as HTML attributes. For more advanced properties, use the programmatic approach above.
**Supported Attributes:**
```html
```
> [!TIP]
> The `configuration` attribute accepts a JSON-encoded string, allowing you to pass complex settings directly in your HTML markup.
### Core Settings
- **`name`**: The `name` attribute of the hidden input field containing the payload. (Default: `"altcha"`)
- **`form`** (attribute only): The `id` of the `