Trait keyring::credential::CredentialApi

source ·
pub trait CredentialApi {
    // Required methods
    fn set_password(&self, password: &str) -> Result<()>;
    fn get_password(&self) -> Result<String>;
    fn delete_password(&self) -> Result<()>;
    fn as_any(&self) -> &dyn Any;
}
Expand description

The API that credentials implement.

Required Methods§

source

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

Set the credential’s password.

This will persist the password in the underlying store.

source

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

Retrieve a password from the credential, if one has been set.

This has no effect on the underlying store.

source

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

Forget the credential’s password, if one has been set.

This will also remove the credential from the underlying store, so a second call to delete_password will return a NoEntry error.

source

fn as_any(&self) -> &dyn Any

Return the underlying concrete object cast to Any.

This allows clients to downcast the credential to its concrete type so they can do platform-specific things with it (e.g., query its attributes in the underlying store).

Implementors§