KeyProvider

Trait KeyProvider 

Source
pub trait KeyProvider: Send + Sync {
    // Required method
    fn get_private_key_by_id<'life0, 'life1, 'async_trait>(
        &'life0 self,
        key_id: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Option<KeyData>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

Trait for providing cryptographic keys by identifier.

This trait defines the interface for key providers that can retrieve private keys by their identifier. Implementations must be thread-safe to support concurrent access.

Required Methods§

Source

fn get_private_key_by_id<'life0, 'life1, 'async_trait>( &'life0 self, key_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<KeyData>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Retrieves a private key by its identifier.

§Arguments
  • key_id - The identifier of the key to retrieve
§Returns
  • Ok(Some(KeyData)) - If the key was found and successfully retrieved
  • Ok(None) - If no key exists for the given identifier
  • Err(anyhow::Error) - If an error occurred during key retrieval

Implementors§