pub struct ManagedSecrets { /* private fields */ }Expand description
Versioned persistence keys. New ciphertext uses the current version; retained versions read existing ciphertext without rewriting it. Removing a retained version retires it immediately. Signed cookies use only the current key and are invalidated when that key changes.
Implementations§
Source§impl ManagedSecrets
impl ManagedSecrets
pub fn new(version: u64, secret: impl Into<String>) -> Self
Sourcepub fn retain(self, version: u64, secret: impl Into<String>) -> Self
pub fn retain(self, version: u64, secret: impl Into<String>) -> Self
Retain a previous version for reads. Replacing the current version’s key changes its key material; it does not change the selected version.
Sourcepub fn retire(self, version: u64) -> Self
pub fn retire(self, version: u64) -> Self
Retire a reader. The current version cannot be retired; rotate by constructing a new configuration with a new current version instead.
pub const fn current_version(&self) -> u64
pub fn current_secret(&self) -> &str
pub fn key(&self, version: u64) -> Option<&str>
pub fn verification_secrets(&self) -> impl Iterator<Item = &str>
Trait Implementations§
Source§impl Clone for ManagedSecrets
impl Clone for ManagedSecrets
Auto Trait Implementations§
impl Freeze for ManagedSecrets
impl RefUnwindSafe for ManagedSecrets
impl Send for ManagedSecrets
impl Sync for ManagedSecrets
impl Unpin for ManagedSecrets
impl UnsafeUnpin for ManagedSecrets
impl UnwindSafe for ManagedSecrets
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