Daniel Regeci f8e15857ce 0.1.6
2024-02-12 15:24:32 +01:00
2023-11-18 14:08:48 +04:00
2024-02-12 15:24:32 +01:00
2023-11-18 14:08:48 +04:00
2024-02-12 15:24:32 +01:00
2023-11-18 14:08:48 +04:00
2023-11-18 16:12:03 +04:00
2024-01-18 14:16:43 +02:00
2024-01-18 14:31:25 +02:00
2023-12-05 09:18:09 +04:00
2023-11-18 14:08:48 +04:00
2023-11-27 17:23:30 +04:00
2023-11-18 16:40:58 +04:00
2024-02-12 15:24:32 +01:00
2024-02-12 15:24:32 +01:00
2023-11-18 14:08:48 +04:00
2023-11-18 14:08:48 +04:00
2023-11-18 14:08:48 +04:00

ALTCHA

ALTCHA uses a proof-of-work mechanism to protect your website, APIs, and online services from spam and abuse. Unlike other solutions, ALTCHA is self-hosted, does not use cookies nor fingerprinting, does not track users, and is fully compliant with GDPR.

https://altcha.org

Benefits

  • Friction-less - Using PoW instead of visual puzzles.
  • Cookie-less - GDPR compliant by design.
  • Self-hosted - Without reliance on external providers.

Usage

ALTCHA widget is distributed as a "Web Component" and supports all modern browsers.

1. Install ALTCHA

npm install altcha

import altcha in your main file:

import 'altcha';

or insert <script> tag to your website:

<script async defer src="/altcha.js" type="module"></script>

CDN: https://cdn.jsdelivr.net/gh/altcha-org/altcha@main/dist/altcha.min.js

2. Use <altcha-widget> tag in your forms

<form>
  <altcha-widget
    challengeurl="https://..."
  ></altcha-widget>  
</form>

See the configuration below or visit the website integration documentation.

3. Integrate ALTCHA with your server

See server documentation for more details.

Configuration

Required options (at least one is required):

  • challengeurl - URL of your server to fetch the challenge from. Refer to server integration.
  • challengejson - JSON-encoded challenge data. If avoiding an HTTP request to challengeurl, provide the data here.

Additional options:

  • auto - Automatically verify without user interaction (possible values: onload, onsubmit).
  • hidefooter - Hide the footer (ALTCHA link).
  • hidelogo - Hide the ALTCHA logo.
  • maxnumber - The max. number to iterate to (defaults to 10,000,000).
  • name - The name of the hidden field containing the payload (defaults to "altcha").
  • strings - JSON-encoded translation strings. Refer to customization.

Development / testing options:

  • debug - Print log messages in the console.
  • mockerror - Causes the verification to always fail with a "mock" error.
  • test - Generates a "mock" challenge within the widget, bypassing the request to challengeurl.

Events:

  • statechange - Triggers whenever an internal state changes.
  • verified - Triggers when the challenge is verified.

Using events:

document.querySelector('#altcha').addEventListener('statechange', (ev) => {
  // state can be: unverified, verifying, verified, error
  console.log('state:', ev.detail.state);
});

Important

Ensure that you attach event listeners after the ALTCHA script loads, such as within window.addEventListener('load', ...), to ensure the events trigger correctly.

Contributing

See Contributing Guide and please follow our Code of Conduct.

License

MIT

Languages
JavaScript 77.6%
TypeScript 14.1%
Svelte 6.6%
HTML 1%
CSS 0.7%