CredKey

Struct CredKey 

Source
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

Source

pub fn with_unique_pair<T, F>(&self, f: F) -> Result<T>
where F: FnOnce(&String, &mut CredValue) -> 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.

Source

pub fn with_unique_cred<T, F>(&self, f: F) -> Result<T>
where F: FnOnce(&mut CredValue) -> T,

A simpler form of boilerplate which just looks at the cred’s value

Source

pub fn get_uuid(&self) -> Result<String>

This returns the UUID of the sole credential for this cred.

Source

pub fn get_comment(&self) -> Result<Option<String>>

This returns the comment of the sole credential for this cred.

Trait Implementations§

Source§

impl Clone for CredKey

Source§

fn clone(&self) -> CredKey

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl CredentialApi for CredKey

Source§

fn set_secret(&self, secret: &[u8]) -> Result<()>

See the API docs.

Source§

fn get_secret(&self) -> Result<Vec<u8>>

See the API docs.

Source§

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<()>

See the API docs.

Only the comment attribute can be updated.

Source§

fn delete_credential(&self) -> Result<()>

See the API docs.

Source§

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.

Source§

fn get_specifiers(&self) -> Option<(String, String)>

See the API docs.

Source§

fn as_any(&self) -> &dyn Any

See the API docs.

Source§

fn debug_fmt(&self, f: &mut Formatter<'_>) -> Result

See the API docs.

Source§

fn set_password(&self, password: &str) -> Result<()>

Set the entry’s protected data to be the given string. Read more
Source§

fn get_password(&self) -> Result<String>

Retrieve the protected data as a UTF-8 string from the underlying credential. Read more
Source§

impl Debug for CredKey

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.