pub struct Keystore { /* private fields */ }Expand description
A handle to the key store.
Implementations§
Source§impl Keystore
impl Keystore
Sourcepub fn connect(c: &Context) -> Result<Self>
pub fn connect(c: &Context) -> Result<Self>
Connects to the keystore.
To set the context’s home directory, you should usually
instantiate a sequoia_dirs::Home object, and use the value
returned by
home.data_dir(sequoia_dirs::Component::Keystore).
Sourcepub async fn backends_async(&mut self) -> Result<Vec<Backend>>
pub async fn backends_async(&mut self) -> Result<Vec<Backend>>
Lists all backends.
Sourcepub fn find_keys(
&mut self,
ids: &[KeyHandle],
) -> Result<(Vec<Key>, Vec<KeyHandle>)>
pub fn find_keys( &mut self, ids: &[KeyHandle], ) -> Result<(Vec<Key>, Vec<KeyHandle>)>
Finds the specified keys.
As a key may reside on multiple devices, this may return multiple handles for a given key.
The second return value is the list of keys that were not found on the keystore.
Sourcepub async fn find_keys_async(
&mut self,
ids: &[KeyHandle],
) -> Result<(Vec<Key>, Vec<KeyHandle>)>
pub async fn find_keys_async( &mut self, ids: &[KeyHandle], ) -> Result<(Vec<Key>, Vec<KeyHandle>)>
Finds the specified keys.
As a key may reside on multiple devices, this may return multiple handles for a given key.
The second return value is the list of keys that were not found on the keystore.
Sourcepub fn find_key(&mut self, id: KeyHandle) -> Result<Vec<Key>>
pub fn find_key(&mut self, id: KeyHandle) -> Result<Vec<Key>>
Finds the specified key.
As a key may reside on multiple devices, this may return multiple keys for a given id.
Sourcepub async fn find_key_async(&mut self, id: KeyHandle) -> Result<Vec<Key>>
pub async fn find_key_async(&mut self, id: KeyHandle) -> Result<Vec<Key>>
Finds the specified key.
As a key may reside on multiple devices, this may return multiple keys for a given id.
Sourcepub fn decrypt(
&mut self,
pkesks: &[PKESK],
) -> Result<(usize, Fingerprint, Option<SymmetricAlgorithm>, SessionKey)>
pub fn decrypt( &mut self, pkesks: &[PKESK], ) -> Result<(usize, Fingerprint, Option<SymmetricAlgorithm>, SessionKey)>
Decrypts a PKESK.
The keystore tries to decrypt the PKESKs in an arbitrary order. When it succeeds in decrypting a PKESK, it stops and returns the decrypted session key. By not enforcing an order, the keystore is able to first try keys that are immediately available, and only try keys that need to be unlocked or connected to if that fails.
On success, this function returns the index of the PKESK that was decrypted, the fingerprint of the key that decrypted the PKESK, and the plaintext (the symmetric algorithm and the session key).
Sourcepub async fn decrypt_async(
&mut self,
pkesks: &[PKESK],
) -> Result<(usize, Fingerprint, Option<SymmetricAlgorithm>, SessionKey)>
pub async fn decrypt_async( &mut self, pkesks: &[PKESK], ) -> Result<(usize, Fingerprint, Option<SymmetricAlgorithm>, SessionKey)>
Decrypts a PKESK.
The keystore tries to decrypt the PKESKs in an arbitrary order. When it succeeds in decrypting a PKESK, it stops and returns the decrypted session key. By not enforcing an order, the keystore is able to first try keys that are immediately available, and only try keys that need to be unlocked or connected to if that fails.
On success, this function returns the index of the PKESK that was decrypted, the fingerprint of the key that decrypted the PKESK, and the plaintext (the symmetric algorithm and the session key).