Skip to main content

Crate challenge

Crate challenge 

Source
Expand description

Reusable helpers for the challenge ALTCHA CLI.

The binary in src/main.rs is intentionally thin; most validation and JSON shaping lives here so it can be unit-tested without spawning the CLI.

Structs§

CreateConfig
Runtime options used to create an ALTCHA challenge.
SolveConfig
Runtime options used to solve an ALTCHA challenge.
VerifyOutput
Stable JSON output for challenge verify and challenge verify-payload.
VerifyServerOutput
Stable JSON output for challenge verify-server.

Functions§

create
Create a challenge from a validated config.
parse_data_args
Parse repeated --data key=value flags into signed challenge metadata.
parse_server_payload
Decode an ALTCHA Sentinel payload from JSON or base64-encoded JSON.
print_json
Print any serializable value as pretty or compact JSON.
read_input
Read a UTF-8 input file or stdin when path is -.
read_json
Read and deserialize a JSON file or stdin when path is -.
solve
Solve a challenge. Returns an error when the configured timeout elapses.
unix_now
Return Unix time in seconds.
verify_pair
Verify a submitted solution against the original challenge.
verify_register_payload
Verify a /register request body containing either:
verify_server_payload
Verify an ALTCHA Sentinel server-signature payload.