pub struct KeyRotationManager { /* private fields */ }Expand description
Manages automatic key rotation for encryption keys.
Implementations§
Source§impl KeyRotationManager
impl KeyRotationManager
Sourcepub fn new(store: Arc<dyn SecretStore>, key_prefix: impl Into<String>) -> Self
pub fn new(store: Arc<dyn SecretStore>, key_prefix: impl Into<String>) -> Self
Create a new key rotation manager.
Sourcepub fn with_rotation_interval(self, interval: Duration) -> Self
pub fn with_rotation_interval(self, interval: Duration) -> Self
Set the rotation interval.
Sourcepub async fn get_current_key(&self) -> SecretResult<SecretValue>
pub async fn get_current_key(&self) -> SecretResult<SecretValue>
Get the current encryption key.
Sourcepub async fn get_key_version(&self, version: u64) -> SecretResult<SecretValue>
pub async fn get_key_version(&self, version: u64) -> SecretResult<SecretValue>
Get a specific key version.
Sourcepub fn needs_rotation(&self) -> bool
pub fn needs_rotation(&self) -> bool
Check if rotation is needed.
Sourcepub fn rotate(&self)
pub fn rotate(&self)
Rotate to a new key version.
Note: The actual key must be pre-provisioned in the secret store.
Sourcepub fn current_version(&self) -> u64
pub fn current_version(&self) -> u64
Get the current key version number.
Auto Trait Implementations§
impl !Freeze for KeyRotationManager
impl !RefUnwindSafe for KeyRotationManager
impl Send for KeyRotationManager
impl Sync for KeyRotationManager
impl Unpin for KeyRotationManager
impl !UnwindSafe for KeyRotationManager
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Converts some archived metadata to the pointer metadata for itself.
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
Source§impl<F, W, T, D> Deserialize<With<T, W>, D> for F
impl<F, W, T, D> Deserialize<With<T, W>, D> for F
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Gets the layout of the type.