pub trait ServiceExtManual: 'static {
Show 25 methods
// Required methods
fn lock<P: FnOnce(Result<Vec<DBusProxy>, Error>) + 'static>(
&self,
objects: &[DBusProxy],
cancellable: Option<&impl IsA<Cancellable>>,
callback: P,
);
fn lock_future(
&self,
objects: &[DBusProxy],
) -> Pin<Box_<dyn Future<Output = Result<Vec<DBusProxy>, Error>> + 'static>>;
fn lock_dbus_paths<P: FnOnce(Result<Vec<GString>, Error>) + 'static>(
&self,
paths: &[&str],
cancellable: Option<&impl IsA<Cancellable>>,
callback: P,
);
fn lock_dbus_paths_future(
&self,
paths: &[&str],
) -> Pin<Box_<dyn Future<Output = Result<Vec<GString>, Error>> + 'static>>;
fn lock_dbus_paths_sync(
&self,
paths: Vec<&str>,
cancellable: Option<&impl IsA<Cancellable>>,
) -> Result<Vec<GString>, Error>;
fn unlock<P: FnOnce(Result<Vec<DBusProxy>, Error>) + 'static>(
&self,
objects: &[DBusProxy],
cancellable: Option<&impl IsA<Cancellable>>,
callback: P,
);
fn unlock_future(
&self,
objects: &[DBusProxy],
) -> Pin<Box_<dyn Future<Output = Result<Vec<DBusProxy>, Error>> + 'static>>;
fn unlock_dbus_paths<P: FnOnce(Result<Vec<GString>, Error>) + 'static>(
&self,
paths: &[&str],
cancellable: Option<&impl IsA<Cancellable>>,
callback: P,
);
fn unlock_dbus_paths_future(
&self,
paths: &[&str],
) -> Pin<Box_<dyn Future<Output = Result<Vec<GString>, Error>> + 'static>>;
fn store<P: FnOnce(Result<(), Error>) + 'static>(
&self,
schema: Option<&Schema>,
attributes: HashMap<&str, &str>,
collection: Option<&str>,
label: &str,
value: &Value,
cancellable: Option<&impl IsA<Cancellable>>,
callback: P,
);
fn store_future(
&self,
schema: Option<&Schema>,
attributes: HashMap<&str, &str>,
collection: Option<&str>,
label: &str,
value: &Value,
) -> Pin<Box_<dyn Future<Output = Result<(), Error>> + 'static>>;
fn search<P: FnOnce(Result<Vec<Item>, Error>) + 'static>(
&self,
schema: Option<&Schema>,
attributes: HashMap<&str, &str>,
flags: SearchFlags,
cancellable: Option<&impl IsA<Cancellable>>,
callback: P,
);
fn search_future(
&self,
schema: Option<&Schema>,
attributes: HashMap<&str, &str>,
flags: SearchFlags,
) -> Pin<Box_<dyn Future<Output = Result<Vec<Item>, Error>> + 'static>>;
fn lookup<P: FnOnce(Result<Value, Error>) + 'static>(
&self,
schema: Option<&Schema>,
attributes: HashMap<&str, &str>,
cancellable: Option<&impl IsA<Cancellable>>,
callback: P,
);
fn lookup_future(
&self,
schema: Option<&Schema>,
attributes: HashMap<&str, &str>,
) -> Pin<Box_<dyn Future<Output = Result<Value, Error>> + 'static>>;
fn clear<P: FnOnce(Result<(), Error>) + 'static>(
&self,
schema: Option<&Schema>,
attributes: HashMap<&str, &str>,
cancellable: Option<&impl IsA<Cancellable>>,
callback: P,
);
fn clear_future(
&self,
schema: Option<&Schema>,
attributes: HashMap<&str, &str>,
) -> Pin<Box_<dyn Future<Output = Result<(), Error>> + 'static>>;
fn create_item_dbus_path<P: FnOnce(Result<GString, Error>) + 'static>(
&self,
collection_path: &str,
properties: HashMap<&str, &Variant>,
value: &Value,
flags: ItemCreateFlags,
cancellable: Option<&impl IsA<Cancellable>>,
callback: P,
);
fn create_item_dbus_path_future(
&self,
collection_path: &str,
properties: HashMap<&str, &Variant>,
value: &Value,
flags: ItemCreateFlags,
) -> Pin<Box_<dyn Future<Output = Result<GString, Error>> + 'static>>;
fn create_collection_dbus_path<P: FnOnce(Result<GString, Error>) + 'static>(
&self,
properties: HashMap<&str, &Variant>,
alias: Option<&str>,
flags: CollectionCreateFlags,
cancellable: Option<&impl IsA<Cancellable>>,
callback: P,
);
fn create_collection_dbus_path_future(
&self,
properties: HashMap<&str, &Variant>,
alias: Option<&str>,
flags: CollectionCreateFlags,
) -> Pin<Box_<dyn Future<Output = Result<GString, Error>> + 'static>>;
fn secrets_for_dbus_paths<P: FnOnce(Result<HashMap<String, Value>, Error>) + 'static>(
&self,
item_paths: &str,
cancellable: Option<&impl IsA<Cancellable>>,
callback: P,
);
fn secrets_for_dbus_paths_future(
&self,
item_paths: &str,
) -> Pin<Box_<dyn Future<Output = Result<HashMap<String, Value>, Error>> + 'static>>;
fn search_for_dbus_paths<P: FnOnce(Result<(Vec<GString>, Vec<GString>), Error>) + 'static>(
&self,
schema: Option<&Schema>,
attributes: HashMap<&str, &str>,
cancellable: Option<&impl IsA<Cancellable>>,
callback: P,
);
fn search_for_dbus_paths_future(
&self,
schema: Option<&Schema>,
attributes: HashMap<&str, &str>,
) -> Pin<Box_<dyn Future<Output = Result<(Vec<GString>, Vec<GString>), Error>> + 'static>>;
}
Required Methods§
Sourcefn lock<P: FnOnce(Result<Vec<DBusProxy>, Error>) + 'static>(
&self,
objects: &[DBusProxy],
cancellable: Option<&impl IsA<Cancellable>>,
callback: P,
)
fn lock<P: FnOnce(Result<Vec<DBusProxy>, Error>) + 'static>( &self, objects: &[DBusProxy], cancellable: Option<&impl IsA<Cancellable>>, callback: P, )
Lock items or collections in the secret service.
The secret service may not be able to lock items individually, and may lock an entire collection instead.
If @self is None
, then get()
will be called to get
the default Service
proxy.
This method returns immediately and completes asynchronously. The secret
service may prompt the user. ServiceExt::prompt()
will be used to handle
any prompts that show up.
§objects
the items or collections to lock
§cancellable
optional cancellation object
§callback
called when the operation completes
fn lock_future( &self, objects: &[DBusProxy], ) -> Pin<Box_<dyn Future<Output = Result<Vec<DBusProxy>, Error>> + 'static>>
Sourcefn lock_dbus_paths<P: FnOnce(Result<Vec<GString>, Error>) + 'static>(
&self,
paths: &[&str],
cancellable: Option<&impl IsA<Cancellable>>,
callback: P,
)
fn lock_dbus_paths<P: FnOnce(Result<Vec<GString>, Error>) + 'static>( &self, paths: &[&str], cancellable: Option<&impl IsA<Cancellable>>, callback: P, )
Lock items or collections in the secret service.
The items or collections are represented by their D-Bus object paths. If you
already have Item
and Collection
proxy objects, use use
lock()
instead.
The secret service may not be able to lock items individually, and may lock an entire collection instead.
This method returns immediately and completes asynchronously. The secret
service may prompt the user. ServiceExt::prompt()
will be used to handle
any prompts that show up.
§paths
the D-Bus paths for items or collections to lock
§cancellable
optional cancellation object
§callback
called when the operation completes
fn lock_dbus_paths_future( &self, paths: &[&str], ) -> Pin<Box_<dyn Future<Output = Result<Vec<GString>, Error>> + 'static>>
Sourcefn lock_dbus_paths_sync(
&self,
paths: Vec<&str>,
cancellable: Option<&impl IsA<Cancellable>>,
) -> Result<Vec<GString>, Error>
fn lock_dbus_paths_sync( &self, paths: Vec<&str>, cancellable: Option<&impl IsA<Cancellable>>, ) -> Result<Vec<GString>, Error>
Lock items or collections in the secret service.
The items or collections are represented by their D-Bus object paths. If you
already have Item
and Collection
proxy objects, use use
Service::lock_sync()
instead.
The secret service may not be able to lock items individually, and may lock an entire collection instead.
This method may block indefinitely and should not be used in user
interface threads. The secret service may prompt the user.
ServiceExt::prompt()
will be used to handle any prompts that show up.
§paths
the D-Bus object paths of the items or collections to lock
§cancellable
optional cancellation object
§Returns
the number of items or collections that were locked
§locked
location to place array of D-Bus paths of items or collections that were locked
Sourcefn unlock<P: FnOnce(Result<Vec<DBusProxy>, Error>) + 'static>(
&self,
objects: &[DBusProxy],
cancellable: Option<&impl IsA<Cancellable>>,
callback: P,
)
fn unlock<P: FnOnce(Result<Vec<DBusProxy>, Error>) + 'static>( &self, objects: &[DBusProxy], cancellable: Option<&impl IsA<Cancellable>>, callback: P, )
Unlock items or collections in the secret service.
The secret service may not be able to unlock items individually, and may unlock an entire collection instead.
If @self is None
, then get()
will be called to get
the default Service
proxy.
This method may block indefinitely and should not be used in user
interface threads. The secret service may prompt the user.
ServiceExt::prompt()
will be used to handle any prompts that show up.
§objects
the items or collections to unlock
§cancellable
optional cancellation object
§callback
called when the operation completes
fn unlock_future( &self, objects: &[DBusProxy], ) -> Pin<Box_<dyn Future<Output = Result<Vec<DBusProxy>, Error>> + 'static>>
Sourcefn unlock_dbus_paths<P: FnOnce(Result<Vec<GString>, Error>) + 'static>(
&self,
paths: &[&str],
cancellable: Option<&impl IsA<Cancellable>>,
callback: P,
)
fn unlock_dbus_paths<P: FnOnce(Result<Vec<GString>, Error>) + 'static>( &self, paths: &[&str], cancellable: Option<&impl IsA<Cancellable>>, callback: P, )
Unlock items or collections in the secret service.
The items or collections are represented by their D-Bus object paths. If you
already have Item
and Collection
proxy objects, use use
unlock()
instead.
The secret service may not be able to unlock items individually, and may unlock an entire collection instead.
This method returns immediately and completes asynchronously. The secret
service may prompt the user. ServiceExt::prompt()
will be used to handle
any prompts that show up.
§paths
the D-Bus paths for items or collections to unlock
§cancellable
optional cancellation object
§callback
called when the operation completes
fn unlock_dbus_paths_future( &self, paths: &[&str], ) -> Pin<Box_<dyn Future<Output = Result<Vec<GString>, Error>> + 'static>>
Sourcefn store<P: FnOnce(Result<(), Error>) + 'static>(
&self,
schema: Option<&Schema>,
attributes: HashMap<&str, &str>,
collection: Option<&str>,
label: &str,
value: &Value,
cancellable: Option<&impl IsA<Cancellable>>,
callback: P,
)
fn store<P: FnOnce(Result<(), Error>) + 'static>( &self, schema: Option<&Schema>, attributes: HashMap<&str, &str>, collection: Option<&str>, label: &str, value: &Value, cancellable: Option<&impl IsA<Cancellable>>, callback: P, )
Store a secret value in the secret service.
The @attributes should be a set of key and value string pairs.
If the attributes match a secret item already stored in the collection, then the item will be updated with these new values.
If @self is None
, then get()
will be called to get
the default Service
proxy.
If @collection is not specified, then the default collection will be
used. Use COLLECTION_SESSION
to store the password in the session
collection, which doesn’t get stored across login sessions.
This method will return immediately and complete asynchronously.
§schema
the schema to use to check attributes
§attributes
the attribute keys and values
§collection
a collection alias, or D-Bus object path of the collection where to store the secret
§label
label for the secret
§value
the secret value
§cancellable
optional cancellation object
§callback
called when the operation completes
fn store_future( &self, schema: Option<&Schema>, attributes: HashMap<&str, &str>, collection: Option<&str>, label: &str, value: &Value, ) -> Pin<Box_<dyn Future<Output = Result<(), Error>> + 'static>>
Sourcefn search<P: FnOnce(Result<Vec<Item>, Error>) + 'static>(
&self,
schema: Option<&Schema>,
attributes: HashMap<&str, &str>,
flags: SearchFlags,
cancellable: Option<&impl IsA<Cancellable>>,
callback: P,
)
fn search<P: FnOnce(Result<Vec<Item>, Error>) + 'static>( &self, schema: Option<&Schema>, attributes: HashMap<&str, &str>, flags: SearchFlags, cancellable: Option<&impl IsA<Cancellable>>, callback: P, )
Search for items matching the @attributes.
All collections are searched. The @attributes should be a table of string keys and string values.
If @self is None
, then get()
will be called to get
the default Service
proxy.
If SearchFlags::ALL
is set in @flags, then all the items matching the
search will be returned. Otherwise only the first item will be returned.
This is almost always the unlocked item that was most recently stored.
If SearchFlags::UNLOCK
is set in @flags, then items will be unlocked
if necessary. In either case, locked and unlocked items will match the
search and be returned. If the unlock fails, the search does not fail.
If SearchFlags::LOAD_SECRETS
is set in @flags, then the items will have
their secret values loaded and available via ItemExt::secret()
.
This function returns immediately and completes asynchronously.
§schema
the schema for the attributes
§attributes
search for items matching these attributes
§flags
search option flags
§cancellable
optional cancellation object
§callback
called when the operation completes
fn search_future( &self, schema: Option<&Schema>, attributes: HashMap<&str, &str>, flags: SearchFlags, ) -> Pin<Box_<dyn Future<Output = Result<Vec<Item>, Error>> + 'static>>
Sourcefn lookup<P: FnOnce(Result<Value, Error>) + 'static>(
&self,
schema: Option<&Schema>,
attributes: HashMap<&str, &str>,
cancellable: Option<&impl IsA<Cancellable>>,
callback: P,
)
fn lookup<P: FnOnce(Result<Value, Error>) + 'static>( &self, schema: Option<&Schema>, attributes: HashMap<&str, &str>, cancellable: Option<&impl IsA<Cancellable>>, callback: P, )
Lookup a secret value in the secret service.
The @attributes should be a set of key and value string pairs.
If @self is None
, then get()
will be called to get
the default Service
proxy.
This method will return immediately and complete asynchronously.
§schema
the schema for the attributes
§attributes
the attribute keys and values
§cancellable
optional cancellation object
§callback
called when the operation completes
fn lookup_future( &self, schema: Option<&Schema>, attributes: HashMap<&str, &str>, ) -> Pin<Box_<dyn Future<Output = Result<Value, Error>> + 'static>>
Sourcefn clear<P: FnOnce(Result<(), Error>) + 'static>(
&self,
schema: Option<&Schema>,
attributes: HashMap<&str, &str>,
cancellable: Option<&impl IsA<Cancellable>>,
callback: P,
)
fn clear<P: FnOnce(Result<(), Error>) + 'static>( &self, schema: Option<&Schema>, attributes: HashMap<&str, &str>, cancellable: Option<&impl IsA<Cancellable>>, callback: P, )
Remove unlocked items which match the attributes from the secret service.
The @attributes should be a set of key and value string pairs.
If @self is None
, then get()
will be called to get
the default Service
proxy.
This method will return immediately and complete asynchronously.
§schema
the schema for the attributes
§attributes
the attribute keys and values
§cancellable
optional cancellation object
§callback
called when the operation completes
fn clear_future( &self, schema: Option<&Schema>, attributes: HashMap<&str, &str>, ) -> Pin<Box_<dyn Future<Output = Result<(), Error>> + 'static>>
Sourcefn create_item_dbus_path<P: FnOnce(Result<GString, Error>) + 'static>(
&self,
collection_path: &str,
properties: HashMap<&str, &Variant>,
value: &Value,
flags: ItemCreateFlags,
cancellable: Option<&impl IsA<Cancellable>>,
callback: P,
)
fn create_item_dbus_path<P: FnOnce(Result<GString, Error>) + 'static>( &self, collection_path: &str, properties: HashMap<&str, &Variant>, value: &Value, flags: ItemCreateFlags, cancellable: Option<&impl IsA<Cancellable>>, callback: P, )
Create a new item in a secret service collection and return its D-Bus object path.
It is often easier to use password_store()
or create()
rather than using this function. Using this method requires that you setup
a correct hash table of D-Bus @properties for the new collection.
If the @flags contains ItemCreateFlags::REPLACE
, then the secret
service will search for an item matching the @attributes, and update that item
instead of creating a new one.
@properties is a set of properties for the new collection. The keys in the
hash table should be interface.property strings like
org.freedesktop.Secret.Item.Label
. The values
in the hash table should be [glib::Variant
][struct@crate::glib::Variant] values of the properties.
This method will return immediately and complete asynchronously. The secret
service may prompt the user. ServiceExt::prompt()
will be used to handle
any prompts that are required.
§collection_path
the D-Bus object path of the collection in which to create item
§properties
hash table of D-Bus properties for the new collection
§value
the secret value to store in the item
§flags
flags for the creation of the new item
§cancellable
optional cancellation object
§callback
called when the operation completes
fn create_item_dbus_path_future( &self, collection_path: &str, properties: HashMap<&str, &Variant>, value: &Value, flags: ItemCreateFlags, ) -> Pin<Box_<dyn Future<Output = Result<GString, Error>> + 'static>>
Sourcefn create_collection_dbus_path<P: FnOnce(Result<GString, Error>) + 'static>(
&self,
properties: HashMap<&str, &Variant>,
alias: Option<&str>,
flags: CollectionCreateFlags,
cancellable: Option<&impl IsA<Cancellable>>,
callback: P,
)
fn create_collection_dbus_path<P: FnOnce(Result<GString, Error>) + 'static>( &self, properties: HashMap<&str, &Variant>, alias: Option<&str>, flags: CollectionCreateFlags, cancellable: Option<&impl IsA<Cancellable>>, callback: P, )
Create a new collection in the secret service, and return its path.
Using this method requires that you setup a correct hash table of D-Bus
properties for the new collection. You may prefer to use
create()
which does handles this for you.
An @alias is a well-known tag for a collection, such as ‘default’ (ie: the default collection to store items in). This allows other applications to easily identify and share a collection. If a collection with the @alias already exists, then instead of creating a new collection, the existing collection will be returned. If no collection with this alias exists, then a new collection will be created and this alias will be assigned to it.
@properties is a set of properties for the new collection. The keys in the
hash table should be interface.property strings like
org.freedesktop.Secret.Collection.Label
. The values
in the hash table should be [glib::Variant
][struct@crate::glib::Variant] values of the properties.
If you wish to have a
This method will return immediately and complete asynchronously. The secret
service may prompt the user. ServiceExt::prompt()
will be used to handle
any prompts that are required.
§properties
hash table of properties for the new collection
§alias
an alias to check for before creating the new collection, or to assign to the new collection
§flags
not currently used
§cancellable
optional cancellation object
§callback
called when the operation completes
fn create_collection_dbus_path_future( &self, properties: HashMap<&str, &Variant>, alias: Option<&str>, flags: CollectionCreateFlags, ) -> Pin<Box_<dyn Future<Output = Result<GString, Error>> + 'static>>
Sourcefn secrets_for_dbus_paths<P: FnOnce(Result<HashMap<String, Value>, Error>) + 'static>(
&self,
item_paths: &str,
cancellable: Option<&impl IsA<Cancellable>>,
callback: P,
)
fn secrets_for_dbus_paths<P: FnOnce(Result<HashMap<String, Value>, Error>) + 'static>( &self, item_paths: &str, cancellable: Option<&impl IsA<Cancellable>>, callback: P, )
Get the secret values for a secret item stored in the service.
The items are represented by their D-Bus object paths. If you already have
Item
proxy objects, use use load_secrets()
to more simply
get their secret values.
This function returns immediately and completes asynchronously.
§item_paths
the D-Bus paths to items to retrieve secrets for
§cancellable
optional cancellation object
§callback
called when the operation completes
fn secrets_for_dbus_paths_future( &self, item_paths: &str, ) -> Pin<Box_<dyn Future<Output = Result<HashMap<String, Value>, Error>> + 'static>>
Sourcefn search_for_dbus_paths<P: FnOnce(Result<(Vec<GString>, Vec<GString>), Error>) + 'static>(
&self,
schema: Option<&Schema>,
attributes: HashMap<&str, &str>,
cancellable: Option<&impl IsA<Cancellable>>,
callback: P,
)
fn search_for_dbus_paths<P: FnOnce(Result<(Vec<GString>, Vec<GString>), Error>) + 'static>( &self, schema: Option<&Schema>, attributes: HashMap<&str, &str>, cancellable: Option<&impl IsA<Cancellable>>, callback: P, )
Search for items matching the @attributes, and return their D-Bus object paths.
All collections are searched. The @attributes should be a table of string keys and string values.
This function returns immediately and completes asynchronously.
When your callback is called use Service::search_for_dbus_paths_finish()
to get the results of this function. Only the D-Bus object paths of the
items will be returned. If you would like Item
objects to be returned
instead, then use the search()
function.
§schema
the schema for the attributes
§attributes
search for items matching these attributes
§cancellable
optional cancellation object
§callback
called when the operation completes
fn search_for_dbus_paths_future( &self, schema: Option<&Schema>, attributes: HashMap<&str, &str>, ) -> Pin<Box_<dyn Future<Output = Result<(Vec<GString>, Vec<GString>), Error>> + 'static>>
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.