Skip to main content

Module ffi

Module ffi 

Source
Expand description

FFI surface for the Store crate.

Exposes the cfm_keystore_* C ABI. The wire protocol mirrors TODO.finalize/12-keystore-interface.md. Key material is opaque (*mut c_void) — the Store never interprets key bytes, it only indexes and returns handles owned by the caller (typically the Engine’s keyfmt interface).

Entry points follow the conventions established by confium-core’s FFI layer: raw-pointer parameters, null-checked on entry, and a u32 result encoding either 0 for success or a numeric crate::error::ErrorCode.

Structs§

KeyIterator
Backing storage for an iterator handle. Owns a Vec snapshot taken at enumerate time — iteration does not hold a borrow on the keystore, so the caller may continue mutating the store while iterating over a past snapshot.

Enums§

FFIKeyIterator
Opaque key iterator handle.
FFIKeystore
Opaque handle returned to C callers. Never dereferenced by C; only passed back into the FFI.

Functions§

cfm_keystore_create
Create a keystore backed by backend_name (e.g. "memory").
cfm_keystore_destroy
Drop a keystore handle. Safe to call with NULL.
cfm_keystore_enumerate
Enumerate entries in one compartment of one (module, app) scope.
cfm_keystore_get_public
Fetch a public key from the public compartment by identity.
cfm_keystore_get_secret
Fetch a secret key from the private compartment.
cfm_keystore_iterator_destroy
Drop an iterator handle. Safe to call with NULL.
cfm_keystore_iterator_next
Advance the iterator. Returns 0 and writes the next key handle into *out, or Error::ValueNotFound when the iterator is exhausted (in which case *out is left untouched).
cfm_keystore_put_public
Insert a public key into the public compartment with a detached identity signature.
cfm_keystore_put_secret
Insert a secret key into the private compartment.
cfm_keystore_sign
Out-buffer convention for byte results: the caller passes a destination pointer plus its capacity; on success out receives a freshly heap-allocated buffer (freed with CFM_FREE semantics by the embedding engine) and out_len its length.

Type Aliases§

FFIKey
Opaque key handle. The Store treats this as a caller-owned token; it stores and returns the pointer verbatim and never dereferences it.