confium_api/lib.rs
1//! Public Rust API and plugin SDK for Confium.
2//!
3//! This crate is the bottom of the dependency stack. Everyone (core, store,
4//! registry, net, tc, plugin authors) can depend on it. It does **not**
5//! include the plugin loader itself.
6//!
7//! It exposes the shared types that plugin authors need to write a Confium
8//! plugin in Rust without re-declaring the wire types:
9//!
10//! - Opaque handle helpers ([`OpaqueHandle`]) for boxing/unboxing Rust
11//! objects behind the type-erased `*mut c_void` plugin contract.
12//! - Option map types ([`OptionMap`], [`OptionValue`]) used by the
13//! `cfmp_<iface>_create` family to pass string/u32/nested configuration
14//! from Confium to the plugin.
15//! - Error conversion ([`PluginError`], [`ErrorCode`]) — the canonical
16//! numeric codes returned through the FFI surface, plus a `From` impl so
17//! plugin authors can `?` their own errors into the wire code.
18//!
19//! The proc-macros in `confium-macros` consume these types when generating
20//! the `cfmp_<iface>_*` entry points and the `cfmp_query_interfaces` /
21//! `cfmp_metadata` boilerplate. See `TODO.roadmap/02-workspace-layout.md`
22//! and `TODO.roadmap/03-plugin-contract.md` for the design.
23
24pub mod error;
25pub mod handle;
26pub mod metadata;
27pub mod options;
28pub mod plugin;
29pub mod registry;
30
31pub use error::{ErrorCode, PluginError, PluginResult};
32pub use handle::OpaqueHandle;
33pub use metadata::{PluginMetadata, PluginMetadataBuilder};
34pub use options::{OptionMap, OptionValue, OptionView};
35pub use plugin::{
36 AeadPlugin, CipherPlugin, HashPlugin, KdfPlugin, KemPlugin, KeyfmtPlugin, RngPlugin,
37 SignaturePlugin,
38};
39
40/// Re-export of the proc-macros so plugin authors can write
41/// `use confium_api::plugin_interface` without depending on
42/// `confium-macros` directly.
43#[doc(hidden)]
44pub use confium_macros::{export, plugin_interface, plugin_metadata};