pub trait Keystore:
Send
+ Sync
+ 'static {
// Required methods
fn id(&self) -> &KeystoreId;
fn contains(
&self,
key_spec: &dyn KeySpecifier,
item_type: &KeystoreItemType,
) -> Result<bool>;
fn get(
&self,
key_spec: &dyn KeySpecifier,
item_type: &KeystoreItemType,
) -> Result<Option<ErasedKey>>;
fn insert(
&self,
key: &dyn EncodableItem,
key_spec: &dyn KeySpecifier,
item_type: &KeystoreItemType,
) -> Result<()>;
fn remove(
&self,
key_spec: &dyn KeySpecifier,
item_type: &KeystoreItemType,
) -> Result<Option<()>>;
fn list(&self) -> Result<Vec<(KeyPath, KeystoreItemType)>>;
}
Available on crate feature
keymgr
only.Expand description
A generic key store.
Required Methods§
Sourcefn id(&self) -> &KeystoreId
fn id(&self) -> &KeystoreId
An identifier for this key store instance.
This identifier is used by some KeyMgr
APIs to identify a specific key
store.
Sourcefn contains(
&self,
key_spec: &dyn KeySpecifier,
item_type: &KeystoreItemType,
) -> Result<bool>
fn contains( &self, key_spec: &dyn KeySpecifier, item_type: &KeystoreItemType, ) -> Result<bool>
Check if the key identified by key_spec
exists in this key store.
Sourcefn get(
&self,
key_spec: &dyn KeySpecifier,
item_type: &KeystoreItemType,
) -> Result<Option<ErasedKey>>
fn get( &self, key_spec: &dyn KeySpecifier, item_type: &KeystoreItemType, ) -> Result<Option<ErasedKey>>
Retrieve the key identified by key_spec
.
Returns Ok(Some(key))
if the key was successfully retrieved. Returns Ok(None)
if the
key does not exist in this key store.
Sourcefn insert(
&self,
key: &dyn EncodableItem,
key_spec: &dyn KeySpecifier,
item_type: &KeystoreItemType,
) -> Result<()>
fn insert( &self, key: &dyn EncodableItem, key_spec: &dyn KeySpecifier, item_type: &KeystoreItemType, ) -> Result<()>
Write key
to the key store.
Sourcefn remove(
&self,
key_spec: &dyn KeySpecifier,
item_type: &KeystoreItemType,
) -> Result<Option<()>>
fn remove( &self, key_spec: &dyn KeySpecifier, item_type: &KeystoreItemType, ) -> Result<Option<()>>
Remove the specified key.
A return value of Ok(None)
indicates the key doesn’t exist in this key store, whereas
Ok(Some(())
means the key was successfully removed.
Returns Err
if an error occurred while trying to remove the key.
Implementors§
impl Keystore for ArtiEphemeralKeystore
Available on crate feature
ephemeral-keystore
only.impl Keystore for ArtiNativeKeystore
impl Keystore for CTorClientKeystore
Available on crate feature
ctor-keystore
only.impl Keystore for CTorServiceKeystore
Available on crate feature
ctor-keystore
only.