pub struct Keystore { /* private fields */ }Implementations§
Source§impl Keystore
impl Keystore
pub fn new(path: impl Into<PathBuf>) -> Self
pub fn default_path() -> PathBuf
pub fn unlock(&self, passphrase: &str) -> Result<()>
Sourcepub fn unlock_machine(&self) -> Result<()>
pub fn unlock_machine(&self) -> Result<()>
Unlock with a machine-derived passphrase.
Strategy:
- Try the current machine-id based passphrase (stable random ID).
- Fall back to legacy hostname-based passphrases for migration.
- On legacy success, re-key the keystore to the new machine-id passphrase.
Security note: This provides convenience-only protection. The passphrase
file is readable by any local process. Use unlock() with a user-supplied
passphrase for secrets requiring real confidentiality.
pub fn is_unlocked(&self) -> bool
pub fn get(&self, key: &str) -> Option<String>
pub fn set(&self, key: &str, value: &str) -> Result<()>
pub fn remove(&self, key: &str) -> Result<bool>
pub fn list_keys(&self) -> Vec<String>
pub fn import(&self, new_entries: HashMap<String, String>) -> Result<usize>
pub fn lock(&self)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Keystore
impl RefUnwindSafe for Keystore
impl Send for Keystore
impl Sync for Keystore
impl Unpin for Keystore
impl UnsafeUnpin for Keystore
impl UnwindSafe for Keystore
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