Skip to main content
ALTCHA®

Server Integration

For seamless backend integration, official ALTCHA libraries are available for various programming languages and environments.

Libraries

Frameworks & Plugins

Challenge Generation

Your server must generate a fresh, single-use challenge for each user interaction. The widget requests a new challenge from the configured URL when the user begins verification.

ALTCHA Sentinel provides a built-in API endpoint, GET /v1/challenge. Custom server integrations should expose a comparable endpoint that returns a newly generated challenge on every request.

For an overview of the complete workflow, see the verification diagram.

Server Verification

After the widget verifies the user, you must cryptographically verify the ALTCHA payload submitted by the widget on your server. The payload is a Base64-encoded JSON string, typically submitted as a form field named altcha (this can be customized using the name attribute in the widget).

This verification usually occurs in your form submission handler (e.g., a POST /submit endpoint) where the form data is processed.

When using the library, verification is entirely cryptographic and requires no API calls, making it efficient and fast.

Verifying with ALTCHA Sentinel

a) Using the Library

When using the ALTCHA Sentinel server, verify the payload with the verifyServerSignature function from the ALTCHA library. Use the API key secret generated by ALTCHA Sentinel as the HMAC key.

For supported environments, see Libraries and Plugins. Currently supported environments include TypeScript, Dart, Dotnet, Go, Python, Java, Elixir, PHP, Ruby, Rust, and C++.

For an overview of the verification flow, refer to the verification diagram.

b) Using the verification API

For built-in protection against replay attacks, or to verify without holding the widget key's secret, let Sentinel verify the payload. The endpoint answers verified: true only once per payload, and the response includes apiKey and the parsed verificationData.

Sentinel v2Sentinel v1 and ALTCHA Cloud
EndpointPOST /v2/verify/signaturePOST /v1/verify/signature
AuthenticationBasic credentials of a restricted or full API key of the widget key's accountNone
Request body{ "payload": "…" }{ "payload": "…", "secret": "…" }; secret is optional and checked against the payload's API key

The verifyServer helpers of these libraries call either version:

LibraryVersion with Sentinel v2 supportSentinel v2 credentials
altcha-lib (TypeScript / Node.js)2.9.0apiKey: { id, secret }
altcha-lib-php2.4.0apiKey: new VerifyServerApiKey(id, secret)
altcha-lib-py2.4.0api_key=…, secret=…
altcha-lib-go2.5.0APIKey: …, Secret: …
altcha-lib-dotnet1.2.0ApiKey = …, Secret = …

For Sentinel v2 examples, see Verifying submissions. In other environments, call the endpoint over HTTP.

Verifying without ALTCHA Sentinel

For solutions not using ALTCHA Sentinel, use the verification functions provided by the libraries. Each library’s documentation contains specific implementation details.

A custom server integration requires implementing an HTTP endpoint to generate new challenges. Configure this endpoint as the challenge URL in the widget.

Start typing to search...

↑ ↓ Navigate ↵ Select