pub struct KeyStore { /* private fields */ }Expand description
Store for OpenPGP private keys.
Implementations§
Source§impl KeyStore
impl KeyStore
Sourcepub fn default_location() -> Result<PathBuf, PgpError>
pub fn default_location() -> Result<PathBuf, PgpError>
Returns the default path for the key store.
Sourcepub async fn open(path: Option<&Path>) -> Result<Self, PgpError>
pub async fn open(path: Option<&Path>) -> Result<Self, PgpError>
Opens a key store from disk.
If path is not None, the specified location is used. Otherwise,
if the SETT_KEYSTORE environment variable is set, its value is used.
It defaults to the data directory defined by the sequoia_directories
crate.
Sourcepub async fn open_ephemeral() -> Result<Self, PgpError>
pub async fn open_ephemeral() -> Result<Self, PgpError>
Opens an ephemeral key store.
The key store is created in a temporary directory, which is deleted when the key store is dropped.
Sourcepub async fn import(&mut self, cert: Cert) -> Result<Vec<Key>, PgpError>
pub async fn import(&mut self, cert: Cert) -> Result<Vec<Key>, PgpError>
Imports secret keys present in a TSK (Transferable Secret Key).
Ignores any keys without secret material.
Sourcepub async fn list(&mut self) -> Result<Vec<Key>, PgpError>
pub async fn list(&mut self) -> Result<Vec<Key>, PgpError>
List all keys from all backends of the store.
Sourcepub async fn find_key(
&mut self,
fingerprint: Fingerprint,
) -> Result<Vec<Key>, PgpError>
pub async fn find_key( &mut self, fingerprint: Fingerprint, ) -> Result<Vec<Key>, PgpError>
Find a key by its fingerprint.
If the key is found on multiple devices, it returns multiple keys.
Sourcepub async fn delete_key(
&mut self,
fingerprint: Fingerprint,
) -> Result<(), PgpError>
pub async fn delete_key( &mut self, fingerprint: Fingerprint, ) -> Result<(), PgpError>
Delete key from the key store.
Auto Trait Implementations§
impl Freeze for KeyStore
impl RefUnwindSafe for KeyStore
impl Send for KeyStore
impl Sync for KeyStore
impl Unpin 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
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>
Converts
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>
Converts
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 moreCreates a shared type from an unshared type.