Trait KeySource
pub trait KeySource:
Debug
+ Send
+ Sync {
// Required methods
fn with_key(&self, f: &mut dyn FnMut(&[u8; 32]) -> Result<()>) -> Result<()>;
fn backend_name(&self) -> &'static str;
fn provisioning_state(&self) -> ProvisioningState;
// Provided method
fn initialize(&self) -> Result<()> { ... }
}Expand description
Abstracts where the master encryption key is obtained.
Object-safe, single-trait design. Only with_key, backend_name,
and provisioning_state are required; initialize has a default
error for backends that cannot create keys locally.
Required Methods§
Sourcefn with_key(&self, f: &mut dyn FnMut(&[u8; 32]) -> Result<()>) -> Result<()>
fn with_key(&self, f: &mut dyn FnMut(&[u8; 32]) -> Result<()>) -> Result<()>
Run f with a reference to the 256-bit master key. The
reference is only valid during the call.
Sourcefn backend_name(&self) -> &'static str
fn backend_name(&self) -> &'static str
Human-readable label for diagnostic messages.
Sourcefn provisioning_state(&self) -> ProvisioningState
fn provisioning_state(&self) -> ProvisioningState
Local-only provisioning check — MUST NOT run scripts or prompt for user input.
Provided Methods§
Sourcefn initialize(&self) -> Result<()>
fn initialize(&self) -> Result<()>
Generate fresh key material. Default error for backends that cannot create keys locally.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".