pub struct KeyInfoManagerClient { /* private fields */ }Expand description
KeyInfoManager client structure that bridges between the KIM and the providers that need to use it.
Implementations§
Source§impl KeyInfoManagerClient
impl KeyInfoManagerClient
Sourcepub fn get_key_identity(
&self,
application: ApplicationIdentity,
key_name: String,
) -> KeyIdentity
pub fn get_key_identity( &self, application: ApplicationIdentity, key_name: String, ) -> KeyIdentity
Get the KeyIdentity representing a key.
Sourcepub fn get_key_id<T: DeserializeOwned>(
&self,
key_identity: &KeyIdentity,
) -> Result<T>
pub fn get_key_id<T: DeserializeOwned>( &self, key_identity: &KeyIdentity, ) -> Result<T>
Get the key ID for a given KeyIdentity
The ID does not have to be a specific type. Rather, it must implement the serde::Deserialize
trait. Before returning, an instance of that type is created from the bytes stored by the KIM.
§Errors
If the key does not exist, PsaErrorDoesNotExist is returned. If any error occurs while fetching the key info, KeyInfoManagerError is returned. If deserializing the stored key ID to the desired type fails, InvalidEncoding is returned.
Sourcepub fn get_key_attributes(
&self,
key_identity: &KeyIdentity,
) -> Result<Attributes>
pub fn get_key_attributes( &self, key_identity: &KeyIdentity, ) -> Result<Attributes>
Get the Attributes for a given KeyIdentity
§Errors
If the key does not exist, PsaErrorDoesNotExist is returned. If any other error occurs, KeyInfoManagerError is returned.
Sourcepub fn get_all(&self) -> Result<Vec<KeyIdentity>>
pub fn get_all(&self) -> Result<Vec<KeyIdentity>>
Get all the key identities for the current provider
Sourcepub fn remove_key_info(&self, key_identity: &KeyIdentity) -> Result<()>
pub fn remove_key_info(&self, key_identity: &KeyIdentity) -> Result<()>
Remove the key represented by a KeyIdentity and return the stored info.
§Errors
If the key does not exist, PsaErrorDoesNotExist is returned. If any other error occurs, KeyInfoManagerError is returned.
Sourcepub fn insert_key_info<T: Serialize>(
&self,
key_identity: KeyIdentity,
key_id: &T,
attributes: Attributes,
) -> Result<()>
pub fn insert_key_info<T: Serialize>( &self, key_identity: KeyIdentity, key_id: &T, attributes: Attributes, ) -> Result<()>
Insert key info for a given KeyIdentity.
§Errors
If the KeyIdentity already existed in the KIM, PsaErrorAlreadyExists is returned. For any other error occurring in the KIM, KeyInfoManagerError is returned.
Sourcepub fn replace_key_info<T: Serialize>(
&self,
key_identity: KeyIdentity,
key_id: &T,
attributes: Attributes,
) -> Result<()>
pub fn replace_key_info<T: Serialize>( &self, key_identity: KeyIdentity, key_id: &T, attributes: Attributes, ) -> Result<()>
Replace the KeyInfo saved for a given KeyIdentity
§Errors
If the key identity doesn’t exist in the KIM, PsaErrorDoesNotExist is returned. For any other error occurring in the KIM, KeyInfoManagerError is returned.
Sourcepub fn list_clients(&self) -> Result<Vec<ApplicationIdentity>>
pub fn list_clients(&self) -> Result<Vec<ApplicationIdentity>>
Returns a Vec
§Errors
Returns an error as a String if there was a problem accessing the Key Info Manager.
Sourcepub fn list_keys(
&self,
application_identity: &ApplicationIdentity,
) -> Result<Vec<KeyInfo>>
pub fn list_keys( &self, application_identity: &ApplicationIdentity, ) -> Result<Vec<KeyInfo>>
Returns a Vec of the KeyInfo objects corresponding to the given ApplicationIdentity, and the KIM client ProviderIdentity.
§Errors
Returns an error as a String if there was a problem accessing the Key Info Manager.
Sourcepub fn does_not_exist(
&self,
key_identity: &KeyIdentity,
) -> Result<(), ResponseStatus>
pub fn does_not_exist( &self, key_identity: &KeyIdentity, ) -> Result<(), ResponseStatus>
Check if a KeyIdentity exists in the Key Info Manager and return a ResponseStatus
§Errors
Returns PsaErrorAlreadyExists if the KeyIdentity already exists or KeyInfoManagerError for another error.