pub struct Service<'a> { /* private fields */ }
Expand description
The entry point of communicating with a org.freedesktop.Secrets
implementation.
It will automatically create a session for you and allow you to retrieve collections or create new ones.
Certain actions requires on the Secret Service implementation requires a user prompt to complete like creating a collection, locking or unlocking a collection. The library handles that automatically for you.
use oo7::dbus::Service;
let service = Service::new().await?;
let collection = service.default_collection().await?;
// Do something with the collection
}
Implementations§
source§impl<'a> Service<'a>
impl<'a> Service<'a>
sourcepub async fn new() -> Result<Service<'a>, Error>
pub async fn new() -> Result<Service<'a>, Error>
Create a new instance of the Service, an encrypted communication would be attempted first and would fall back to a plain one if that fails.
sourcepub async fn plain() -> Result<Service<'a>, Error>
pub async fn plain() -> Result<Service<'a>, Error>
Create a new instance of the Service with plain algorithm.
sourcepub async fn encrypted() -> Result<Service<'a>, Error>
pub async fn encrypted() -> Result<Service<'a>, Error>
Create a new instance of the Service with encrypted algorithm.
sourcepub async fn default_collection(&self) -> Result<Collection<'a>, Error>
pub async fn default_collection(&self) -> Result<Collection<'a>, Error>
Retrieve the default collection.
sourcepub async fn with_alias(
&self,
alias: &str
) -> Result<Option<Collection<'a>>, Error>
pub async fn with_alias( &self, alias: &str ) -> Result<Option<Collection<'a>>, Error>
Find a collection with it alias.
Applications should make use of Service::default_collection
instead.
sourcepub async fn collections(&self) -> Result<Vec<Collection<'a>>, Error>
pub async fn collections(&self) -> Result<Vec<Collection<'a>>, Error>
Get a list of all the available collections.
sourcepub async fn create_collection(
&self,
label: &str,
alias: Option<&str>
) -> Result<Collection<'a>, Error>
pub async fn create_collection( &self, label: &str, alias: Option<&str> ) -> Result<Collection<'a>, Error>
Create a new collection.
The alias can only be equal to DEFAULT_COLLECTION
otherwise it must
not be set.
sourcepub async fn with_label(
&self,
label: &str
) -> Result<Option<Collection<'a>>, Error>
pub async fn with_label( &self, label: &str ) -> Result<Option<Collection<'a>>, Error>
Find a collection with it label.