ancaptcha-ffi (0.4.2)

Published 2026-11-08 07:41:08 +00:00 by maverick in maverick/ancaptcha

Installation

[registries.forgejo]
index = "sparse+" # Sparse index
# index = "" # Git

[net]
git-fetch-with-cli = true
cargo add ancaptcha-ffi@0.4.2 --registry forgejo

About this package

C-ABI bridge for the anCaptcha engine.

anCaptcha FFI

C-ABI bridge for the anCaptcha engine. This crate provides the foreign function interface necessary to integrate stateless, No-JS verification into Go, Python, PHP, and other languages.

Distribution

The C header file and compiled libraries are distributed via the repository's dist/ directory.

FFI API Snapshot

Configuration

// Initialize configuration with 32-byte secret and global asset warming
Status anCaptcha_set_config(const uint8_t* secret_bytes, bool warm_up);

Generation

// Generate challenges (difficulty: 0=Easy, 1=Medium, 2=Hard)
// Memory for strings must be freed using anCaptcha_free_string
Status anCaptcha_generate_rotate(int32_t difficulty, const char* error_msg, char** token_out, char** html_out, char** css_out);
Status anCaptcha_generate_slider(int32_t difficulty, const char* error_msg, char** token_out, char** html_out, char** css_out);
Status anCaptcha_generate_pair(int32_t difficulty, const char* error_msg, char** token_out, char** html_out, char** css_out);

Verification

// Automatic verification from URL-encoded form data
Status anCaptcha_verify_auto(const char* form_data_urlencoded);

// Manual verification
Status anCaptcha_verify_rotate(const char* token, const char** values, size_t values_len);

Integration

Official high-level wrappers are maintained in the main repository:

  • examples/go/
  • examples/python/
  • examples/php/

(c) 2026 Maverick. Apache-2.0.

Dependencies

ID Version
ancaptcha ^0.4.2
libc ^0.2.191
percent-encoding ^2.3.2
tracing ^0.1.44
cbindgen ^0.29.4

Keywords

captcha no-js privacy ffi bindings
Details
Cargo
2026-11-08 07:41:08 +00:00
7
Maverick
Apache-2.0
15 KiB
Assets (1)
Versions (8) View all
0.4.2 2026-11-08
0.4.1 2026-08-23
0.4.0 2026-06-06
0.3.0 2026-04-19
0.2.0 2026-04-17