CreaCaptcha

rest.php

Challenge REST endpoint.

Table of Contents

Functions

creationell_captcha_register_rest_routes()  : void
Registers the public challenge route.
creationell_captcha_rest_challenge()  : WP_REST_Response
Returns a fresh, single-use challenge. Records the issuance via the standard event channel — aggregate counters always increment, the detail-log entry is gated by the `log_challenge` per-type toggle from Modul 11c.
creationell_captcha_canonical_params_json()  : string
Canonical-JSON serialisation of ALTCHA challenge parameters, byte- identical to `altcha-lib-php`'s `ChallengeParameters::toCanonicalJson()` (= ksort top-level + recursive ksort on assoc sub-arrays, JSON-encoded with UNESCAPED_SLASHES | UNESCAPED_UNICODE, null keys dropped).
creationell_captcha_canonical_sort_recursive()  : void
Recursive helper used by `canonical_params_json` — mirrors the lib's `sortRecursive`. List arrays (sequential integer keys) keep their order; associative arrays get `ksort`-ed in place.

Functions

creationell_captcha_register_rest_routes()

Registers the public challenge route.

creationell_captcha_register_rest_routes() : void

creationell_captcha_rest_challenge()

Returns a fresh, single-use challenge. Records the issuance via the standard event channel — aggregate counters always increment, the detail-log entry is gated by the `log_challenge` per-type toggle from Modul 11c.

creationell_captcha_rest_challenge(WP_REST_Request $request) : WP_REST_Response
Parameters
$request : WP_REST_Request

The REST request. Optional query parameter ctx (HMAC token, used by the under-attack interstitial to suppress the code-challenge attachment).

Return values
WP_REST_Response

JSON challenge envelope with algorithm, challenge, salt, signature, parameters and optional codeChallenge.image URL.

creationell_captcha_canonical_params_json()

Canonical-JSON serialisation of ALTCHA challenge parameters, byte- identical to `altcha-lib-php`'s `ChallengeParameters::toCanonicalJson()` (= ksort top-level + recursive ksort on assoc sub-arrays, JSON-encoded with UNESCAPED_SLASHES | UNESCAPED_UNICODE, null keys dropped).

creationell_captcha_canonical_params_json(array<string, mixed> $params) : string

Needed for the re-sign step in Modul 15's /challenge handler after we mutate parameters.data.ccode.

Parameters
$params : array<string, mixed>

Parameter array from create_challenge().

Return values
string

creationell_captcha_canonical_sort_recursive()

Recursive helper used by `canonical_params_json` — mirrors the lib's `sortRecursive`. List arrays (sequential integer keys) keep their order; associative arrays get `ksort`-ed in place.

creationell_captcha_canonical_sort_recursive(array<string|int, mixed> &$data) : void
Parameters
$data : array<string|int, mixed>

        
On this page

Search results