pub struct CredKey {
pub store: Arc<Store>,
pub id: CredId,
pub uuid: Option<String>,
}
Expand description
Each of these keys specifies a specific credential in the store.
For each credential ID, the store maintains a list of all the credentials associated with that ID. The first in that list (element 0) is the credential specified by the ID, so it’s the one that’s auto-created if there are no credentials with that ID in the store and a password is set. All keys with indices higher than 0 are wrappers for a specific credential, but they do not specify a credential.
Fields§
§store: Arc<Store>
§id: CredId
§uuid: Option<String>
Implementations§
Source§impl CredKey
impl CredKey
Sourcepub fn with_unique_pair<T, F>(&self, f: F) -> Result<T>
pub fn with_unique_pair<T, F>(&self, f: F) -> Result<T>
This is the boilerplate for all credential-reading/updating calls.
It makes sure there is just one credential and, if so, it reads/updates it. If there is no credential, it returns a NoEntry error. If there are multiple credentials, it returns an ambiguous error.
It knows about the difference between specifiers and wrappers and acts accordingly.
Sourcepub fn with_unique_cred<T, F>(&self, f: F) -> Result<T>
pub fn with_unique_cred<T, F>(&self, f: F) -> Result<T>
A simpler form of boilerplate which just looks at the cred’s value
Sourcepub fn get_uuid(&self) -> Result<String>
pub fn get_uuid(&self) -> Result<String>
This returns the UUID of the sole credential for this cred.
Sourcepub fn get_comment(&self) -> Result<Option<String>>
pub fn get_comment(&self) -> Result<Option<String>>
This returns the comment of the sole credential for this cred.
Trait Implementations§
Source§impl CredentialApi for CredKey
impl CredentialApi for CredKey
Source§fn get_attributes(&self) -> Result<HashMap<String, String>>
fn get_attributes(&self) -> Result<HashMap<String, String>>
See the API docs.
The possible attributes on credentials in this store are uuid
, comment
,
and creation-date
.
Source§fn update_attributes(&self, attrs: &HashMap<&str, &str>) -> Result<()>
fn update_attributes(&self, attrs: &HashMap<&str, &str>) -> Result<()>
See the API docs.
Only the comment
attribute can be updated.
Source§fn delete_credential(&self) -> Result<()>
fn delete_credential(&self) -> Result<()>
See the API docs.
Source§fn get_credential(&self) -> Result<Option<Arc<Credential>>>
fn get_credential(&self) -> Result<Option<Arc<Credential>>>
See the API docs.
This always returns a new wrapper, even if this is already a wrapper, because that’s just as easy to do once we’ve checked the error conditions.