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 const DEFAULT_COLLECTION: &'static str = "default"
pub const DEFAULT_COLLECTION: &'static str = "default"
The default collection alias.
In general, you are supposed to use Service::default_collection
.
Sourcepub const SESSION_COLLECTION: &'static str = "session"
pub const SESSION_COLLECTION: &'static str = "session"
A session collection.
The collection is cleared when the user ends the session.
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 if any or create one.
The created collection label is set to Default
. If you want to
translate the string, use Self::with_alias_or_create instead.
Sourcepub async fn session_collection(&self) -> Result<Collection<'a>, Error>
pub async fn session_collection(&self) -> Result<Collection<'a>, Error>
Retrieve the session collection if any or create one.
The created collection label is set to Default
. If you want to
translate the string, use Self::with_alias_or_create instead.
pub async fn with_alias_or_create( &self, alias: &str, label: &str, window_id: Option<WindowIdentifier>, ) -> Result<Collection<'a>, Error>
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: &str,
window_id: Option<WindowIdentifier>,
) -> Result<Collection<'a>, Error>
pub async fn create_collection( &self, label: &str, alias: &str, window_id: Option<WindowIdentifier>, ) -> Result<Collection<'a>, Error>
Create a new collection.
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.
Sourcepub async fn receive_collection_created(
&self,
) -> Result<impl Stream<Item = Collection<'a>> + '_, Error>
pub async fn receive_collection_created( &self, ) -> Result<impl Stream<Item = Collection<'a>> + '_, Error>
Stream yielding when new collections get created
Sourcepub async fn receive_collection_changed(
&self,
) -> Result<impl Stream<Item = Collection<'a>> + '_, Error>
pub async fn receive_collection_changed( &self, ) -> Result<impl Stream<Item = Collection<'a>> + '_, Error>
Stream yielding when existing collections get changed
Sourcepub async fn receive_collection_deleted(
&self,
) -> Result<impl Stream<Item = OwnedObjectPath>, Error>
pub async fn receive_collection_deleted( &self, ) -> Result<impl Stream<Item = OwnedObjectPath>, Error>
Stream yielding when existing collections get deleted