aegis-keys · storage
Declared module signatures, types, configuration, and source documentation.
Source: aegis/aegis-keys/src/storage.rs. SHA-256: 4a9430472f0b46e26843f729358c3202623f174053dcc5b212667a966422f103.
This source reference follows declared modules and preserves feature attributes. It includes public declarations and implementation methods in those modules. Private-module exports and trait resolution still require the compiler; not every declaration is a crate-root import. Function bodies and constant values are omitted. Source comments describe their implementation context and are not a production deployment claim.
storage::KeyStore
Trait for key storage backends (AEGIS Spec SS6.8).
All key storage backends must be thread-safe (Send + Sync) and support
async operations. Implementations may store keys in memory, on disk,
in a database, or in a hardware security module.
The stored ManagedKey already contains the encrypted private key material,
so the storage backend does not need to perform additional encryption.
#[async_trait]
pub trait KeyStore: Send + Sync {
/// Store a managed key.
///
/// If a key with the same `key_id` already exists, it is overwritten.
///
/// # Errors
///
/// Returns `KeyError::StorageError` if the storage operation fails.
async fn store(&self, key: &ManagedKey) -> Result<(), KeyError>;
/// Load a managed key by its ID.
///
/// # Errors
///
/// Returns `KeyError::NotFound` if no key with the given ID exists.
/// Returns `KeyError::StorageError` if the load operation fails.
async fn load(&self, key_id: &str) -> Result<ManagedKey, KeyError>;
/// Delete a managed key by its ID.
///
/// # Errors
///
/// Returns `KeyError::NotFound` if no key with the given ID exists.
/// Returns `KeyError::StorageError` if the delete operation fails.
async fn delete(&self, key_id: &str) -> Result<(), KeyError>;
/// List key IDs, optionally filtered by role.
///
/// # Arguments
///
/// * `role` - If `Some`, only keys with this role are returned.
/// If `None`, all key IDs are returned.
///
/// # Errors
///
/// Returns `KeyError::StorageError` if the list operation fails.
async fn list(
&self,
role: Option<KeyRole>,
pagination: Pagination,
) -> Result<Vec<String>, KeyError>;
}Source line: 26.
storage::InMemoryKeyStore
In-memory key store for testing and development.
Keys are stored in a HashMap protected by a std::sync::RwLock.
This implementation is NOT suitable for production use as keys
are lost when the process exits.
pub struct InMemoryKeyStore {
}Source line: 125.
storage::InMemoryKeyStore::new
Create a new empty in-memory key store.
pub fn new() -> Self;Source line: 131.
storage::InMemoryKeyStore::len
Returns the number of keys currently stored.
pub fn len(&self) -> usize;Source line: 138.
storage::InMemoryKeyStore::is_empty
Returns true if the store contains no keys.
pub fn is_empty(&self) -> bool;Source line: 144.