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§
- Create
Config - Runtime options used to create an ALTCHA challenge.
- Solve
Config - Runtime options used to solve an ALTCHA challenge.
- Verify
Output - Stable JSON output for
challenge verifyandchallenge verify-payload. - Verify
Server Output - Stable JSON output for
challenge verify-server.
Functions§
- create
- Create a challenge from a validated config.
- parse_
data_ args - Parse repeated
--data key=valueflags 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
/registerrequest body containing either: - verify_
server_ payload - Verify an ALTCHA Sentinel server-signature payload.