pub struct DbKeyStore { /* private fields */ }Implementations§
Source§impl DbKeyStore
impl DbKeyStore
pub fn new(config: DbKeyStoreConfig) -> Result<Arc<DbKeyStore>>
pub fn new_with_modifiers( modifiers: &HashMap<&str, &str>, ) -> Result<Arc<DbKeyStore>>
Sourcepub fn is_encrypted(&self) -> bool
pub fn is_encrypted(&self) -> bool
Returns true if the db file is encrypted
Sourcepub fn rekey(
source_path: impl AsRef<Path>,
source_opts: Option<EncryptionOpts>,
dest_path: impl AsRef<Path>,
dest_opts: Option<EncryptionOpts>,
) -> Result<RekeyOutcome>
pub fn rekey( source_path: impl AsRef<Path>, source_opts: Option<EncryptionOpts>, dest_path: impl AsRef<Path>, dest_opts: Option<EncryptionOpts>, ) -> Result<RekeyOutcome>
Rekey a keystore out-of-place: read every credential from the source database and write it into a freshly created destination database.
This is used to add, remove, or rotate the on-disk encryption key (a DEK
rotation): pass dest_opts = Some(..) to add or rotate encryption, or
dest_opts = None to write an unencrypted copy. source_opts must
supply the cipher/key the source was written with (or None if the
source is unencrypted).
The operation is non-destructive to the source: the source database is opened read-only-ish (no rows are mutated) and left fully intact, and the destination is fully written before returning. Callers that own a verify-then-swap-then-delete sequence (for example secret-vault rotate-dek) should treat the returned destination as the new candidate and only retire the source after independently verifying it.
Each credential is copied with its service, user, uuid, comment,
and secret preserved. Whether the source enforced (service, user)
uniqueness is detected from the source schema and mirrored on the
destination so ambiguous keystores round-trip unchanged.
dest_path must not already exist. Returns a RekeyOutcome describing
how many credentials were copied. No secret material is logged or
included in any returned value.
Trait Implementations§
Source§impl Clone for DbKeyStore
impl Clone for DbKeyStore
Source§fn clone(&self) -> DbKeyStore
fn clone(&self) -> DbKeyStore
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl CredentialStoreApi for DbKeyStore
impl CredentialStoreApi for DbKeyStore
Source§fn build(
&self,
service: &str,
user: &str,
modifiers: Option<&HashMap<&str, &str>>,
) -> Result<Entry>
fn build( &self, service: &str, user: &str, modifiers: Option<&HashMap<&str, &str>>, ) -> Result<Entry>
Create a credential entry for service and user.
Service and user must be non-empty, and within the length limits. (<=1024 chars)
Supported modifiers: uuid, comment.
Source§fn search(&self, spec: &HashMap<&str, &str>) -> Result<Vec<Entry>>
fn search(&self, spec: &HashMap<&str, &str>) -> Result<Vec<Entry>>
Source§fn persistence(&self) -> CredentialPersistence
fn persistence(&self) -> CredentialPersistence
Auto Trait Implementations§
impl !RefUnwindSafe for DbKeyStore
impl !UnwindSafe for DbKeyStore
impl Freeze for DbKeyStore
impl Send for DbKeyStore
impl Sync for DbKeyStore
impl Unpin for DbKeyStore
impl UnsafeUnpin for DbKeyStore
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<K, Q> Comparable<Q> for K
impl<K, Q> Comparable<Q> for K
Source§impl<K, Q> Equivalent<Q> for K
impl<K, Q> Equivalent<Q> for K
Source§fn equivalent(&self, key: &Q) -> bool
fn equivalent(&self, key: &Q) -> bool
key and return true if they are equal.impl<T> ErasedDestructor for Twhere
T: 'static,
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more