pub struct KeyManager { /* private fields */ }Implementations§
Source§impl KeyManager
impl KeyManager
pub async fn new(config: KeyManagerConfig) -> Result<Self, Box<dyn Error>>
Sourcepub async fn new_with_seed(
config: KeyManagerConfig,
seed: Vec<u8>,
) -> Result<Self, Box<dyn Error>>
pub async fn new_with_seed( config: KeyManagerConfig, seed: Vec<u8>, ) -> Result<Self, Box<dyn Error>>
Create a key manager with a seed for deterministic key generation
Sourcepub async fn get_current_server(&self) -> Result<OhttpServer, Box<dyn Error>>
pub async fn get_current_server(&self) -> Result<OhttpServer, Box<dyn Error>>
Get the current active server for decryption
Sourcepub async fn get_server_by_id(&self, key_id: u8) -> Option<OhttpServer>
pub async fn get_server_by_id(&self, key_id: u8) -> Option<OhttpServer>
Get a server by key ID (for handling requests with specific key IDs)
Sourcepub async fn get_encoded_config(&self) -> Result<Vec<u8>, Box<dyn Error>>
pub async fn get_encoded_config(&self) -> Result<Vec<u8>, Box<dyn Error>>
Get encoded config with length prefix per RFC 9458 Section 3.2
Sourcepub async fn rotate_keys(&self) -> Result<(), Box<dyn Error>>
pub async fn rotate_keys(&self) -> Result<(), Box<dyn Error>>
Rotate keys by generating a new key and marking old ones for expiration
Sourcepub async fn should_rotate(&self) -> bool
pub async fn should_rotate(&self) -> bool
Check if rotation is needed
Sourcepub async fn start_rotation_scheduler(self: Arc<Self>)
pub async fn start_rotation_scheduler(self: Arc<Self>)
Start automatic key rotation scheduler
Sourcepub async fn get_stats(&self) -> KeyManagerStats
pub async fn get_stats(&self) -> KeyManagerStats
Get key manager statistics
Trait Implementations§
impl Send for KeyManager
impl Sync for KeyManager
Auto Trait Implementations§
impl Freeze for KeyManager
impl !RefUnwindSafe for KeyManager
impl Unpin for KeyManager
impl UnsafeUnpin for KeyManager
impl !UnwindSafe for KeyManager
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more