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 v2 | Sentinel v1 and ALTCHA Cloud | |
|---|---|---|
| Endpoint | POST /v2/verify/signature | POST /v1/verify/signature |
| Authentication | Basic credentials of a restricted or full API key of the widget key's account | None |
| 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:
| Library | Version with Sentinel v2 support | Sentinel v2 credentials |
|---|---|---|
| altcha-lib (TypeScript / Node.js) | 2.9.0 | apiKey: { id, secret } |
| altcha-lib-php | 2.4.0 | apiKey: new VerifyServerApiKey(id, secret) |
| altcha-lib-py | 2.4.0 | api_key=…, secret=… |
| altcha-lib-go | 2.5.0 | APIKey: …, Secret: … |
| altcha-lib-dotnet | 1.2.0 | ApiKey = …, 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.