|
Cedarling C API
|
Cedarling is a local authorization engine built on the Rust Cedar Engine. The C bindings expose it as a native library: create an instance from a JSON bootstrap configuration, send authorization requests as JSON, and read results and logs back as JSON strings.
Every function is declared in cedarling_c.h. Complete, compilable programs are listed on the Examples page.
bootstrap_config_json and request_json are JSON strings; see basic_example.c for complete values.
Strings and results allocated by the library belong to the caller and must be released with the matching function: cedarling_free_string, cedarling_free_result, cedarling_free_instance_result or cedarling_free_string_array. The exception is cedarling_version(), which returns a static string that must not be freed.
Functions return 0 on success. Result structs carry an error_code (SUCCESS is 0) and an error_message; branch on error_code. For failures not described by a result struct, cedarling_get_last_error() returns a thread-local message, which must be freed with cedarling_free_string.