Expand description
Proc-macros for Confium plugin authors.
Two macros reduce the per-plugin boilerplate that would otherwise be
hand-rolled extern "C" symbols plus the plugin lifecycle hooks:
plugin_interfaceon animpl Trait for Typeblock emits thecfmp_<iface>_*FFI entry-point symbols from the trait methods.exportemits the plugin lifecycle symbols (cfmp_interface_version,cfmp_initialize,cfmp_finalize,cfmp_query_interfaces) plus the optionalcfmp_metadatasymbol when paired withplugin_metadata.
§Supported interfaces
The #[plugin_interface] macro recognizes the wire protocol for all
Confium crypto interfaces at version 0: hash, cipher, aead,
kdf, rng, signature, kem, and keyfmt. Each interface emits
its canonical cfmp_<iface>_* symbol set, dispatching through the
corresponding trait in confium_api::plugin.
Interfaces with complex parameter lists (signature, kem,
keyfmt) automatically get #[allow(clippy::too_many_arguments)]
on the affected symbols, since the parameter count is fixed by the
C ABI.
Interface auto-discovery: every #[plugin_interface] attribute
registers its (name, version) pair at link time via inventory.
The #[export] macro iterates these registrations at runtime to
populate cfmp_query_interfaces, so plugin authors do not need to
repeat the interface list in #[export].
See TODO.roadmap/03-plugin-contract.md for the wire contract and
crates/confium-api/src/ for the shared types the macros consume.
Attribute Macros§
- export
- Emits the plugin lifecycle symbols:
- plugin_
interface - Attribute macro that emits the
cfmp_<iface>_*FFI entry-point symbols for the wire protocol named byname = "...". - plugin_
metadata - Attribute used together with
exportto attach static registry metadata to the plugin. The strings are leaked at plugin load time and exposed through the generatedcfmp_metadatasymbol.