pub trait ServiceExt: IsA<Service> + Sealed + 'static {
Show 36 methods // Provided methods fn decode_dbus_secret(&self, value: &Variant) -> Value { ... } fn delete_item_dbus_path<P: FnOnce(Result<(), Error>) + 'static>( &self, item_path: &str, cancellable: Option<&impl IsA<Cancellable>>, callback: P ) { ... } fn delete_item_dbus_path_future( &self, item_path: &str ) -> Pin<Box_<dyn Future<Output = Result<(), Error>> + 'static>> { ... } fn delete_item_dbus_path_sync( &self, item_path: &str, cancellable: Option<&impl IsA<Cancellable>> ) -> Result<(), Error> { ... } fn encode_dbus_secret(&self, value: &Value) -> Variant { ... } fn ensure_session<P: FnOnce(Result<(), Error>) + 'static>( &self, cancellable: Option<&impl IsA<Cancellable>>, callback: P ) { ... } fn ensure_session_future( &self ) -> Pin<Box_<dyn Future<Output = Result<(), Error>> + 'static>> { ... } fn ensure_session_sync( &self, cancellable: Option<&impl IsA<Cancellable>> ) -> Result<(), Error> { ... } fn collection_gtype(&self) -> Type { ... } fn collections(&self) -> Vec<Collection> { ... } fn flags(&self) -> ServiceFlags { ... } fn item_gtype(&self) -> Type { ... } fn secret_for_dbus_path<P: FnOnce(Result<Option<Value>, Error>) + 'static>( &self, item_path: &str, cancellable: Option<&impl IsA<Cancellable>>, callback: P ) { ... } fn secret_for_dbus_path_future( &self, item_path: &str ) -> Pin<Box_<dyn Future<Output = Result<Option<Value>, Error>> + 'static>> { ... } fn secret_for_dbus_path_sync( &self, item_path: &str, cancellable: Option<&impl IsA<Cancellable>> ) -> Result<Option<Value>, Error> { ... } fn session_algorithms(&self) -> Option<GString> { ... } fn session_dbus_path(&self) -> Option<GString> { ... } fn load_collections<P: FnOnce(Result<(), Error>) + 'static>( &self, cancellable: Option<&impl IsA<Cancellable>>, callback: P ) { ... } fn load_collections_future( &self ) -> Pin<Box_<dyn Future<Output = Result<(), Error>> + 'static>> { ... } fn load_collections_sync( &self, cancellable: Option<&impl IsA<Cancellable>> ) -> Result<(), Error> { ... } fn prompt<P: FnOnce(Result<Variant, Error>) + 'static>( &self, prompt: &impl IsA<Prompt>, return_type: Option<&VariantTy>, cancellable: Option<&impl IsA<Cancellable>>, callback: P ) { ... } fn prompt_future( &self, prompt: &(impl IsA<Prompt> + Clone + 'static), return_type: Option<&VariantTy> ) -> Pin<Box_<dyn Future<Output = Result<Variant, Error>> + 'static>> { ... } fn prompt_at_dbus_path<P: FnOnce(Result<Option<Variant>, Error>) + 'static>( &self, prompt_path: &str, return_type: Option<&VariantTy>, cancellable: Option<&impl IsA<Cancellable>>, callback: P ) { ... } fn prompt_at_dbus_path_future( &self, prompt_path: &str, return_type: Option<&VariantTy> ) -> Pin<Box_<dyn Future<Output = Result<Option<Variant>, Error>> + 'static>> { ... } fn prompt_at_dbus_path_sync( &self, prompt_path: &str, cancellable: Option<&impl IsA<Cancellable>>, return_type: Option<&VariantTy> ) -> Result<Option<Variant>, Error> { ... } fn prompt_sync( &self, prompt: &impl IsA<Prompt>, cancellable: Option<&impl IsA<Cancellable>>, return_type: &VariantTy ) -> Result<Variant, Error> { ... } fn read_alias_dbus_path<P: FnOnce(Result<Option<GString>, Error>) + 'static>( &self, alias: &str, cancellable: Option<&impl IsA<Cancellable>>, callback: P ) { ... } fn read_alias_dbus_path_future( &self, alias: &str ) -> Pin<Box_<dyn Future<Output = Result<Option<GString>, Error>> + 'static>> { ... } fn read_alias_dbus_path_sync( &self, alias: &str, cancellable: Option<&impl IsA<Cancellable>> ) -> Result<Option<GString>, Error> { ... } fn set_alias<P: FnOnce(Result<(), Error>) + 'static>( &self, alias: &str, collection: Option<&impl IsA<Collection>>, cancellable: Option<&impl IsA<Cancellable>>, callback: P ) { ... } fn set_alias_future( &self, alias: &str, collection: Option<&(impl IsA<Collection> + Clone + 'static)> ) -> Pin<Box_<dyn Future<Output = Result<(), Error>> + 'static>> { ... } fn set_alias_sync( &self, alias: &str, collection: Option<&impl IsA<Collection>>, cancellable: Option<&impl IsA<Cancellable>> ) -> Result<(), Error> { ... } fn set_alias_to_dbus_path<P: FnOnce(Result<(), Error>) + 'static>( &self, alias: &str, collection_path: Option<&str>, cancellable: Option<&impl IsA<Cancellable>>, callback: P ) { ... } fn set_alias_to_dbus_path_future( &self, alias: &str, collection_path: Option<&str> ) -> Pin<Box_<dyn Future<Output = Result<(), Error>> + 'static>> { ... } fn set_alias_to_dbus_path_sync( &self, alias: &str, collection_path: Option<&str>, cancellable: Option<&impl IsA<Cancellable>> ) -> Result<(), Error> { ... } fn unlock_dbus_paths_sync( &self, paths: &[&str], cancellable: Option<&impl IsA<Cancellable>> ) -> Result<(i32, Vec<GString>), Error> { ... }
}
Expand description

Trait containing all Service methods.

§Implementors

Service

Provided Methods§

source

fn decode_dbus_secret(&self, value: &Variant) -> Value

Decode a Value into [glib::Variant][struct@crate::glib::Variant] received with the Secret Service DBus API.

The [glib::Variant][struct@crate::glib::Variant] should have a (oayays) signature.

A session must have already been established by the Service, and the encoded secret must be valid for that session.

§value

the encoded secret

§Returns

the decoded secret value

source

fn delete_item_dbus_path<P: FnOnce(Result<(), Error>) + 'static>( &self, item_path: &str, cancellable: Option<&impl IsA<Cancellable>>, callback: P )

Delete a secret item from the secret service.

The item is represented by its D-Bus object path. If you already have a Item proxy objects, use use ItemExt::delete() instead.

This method will return immediately and complete asynchronously.

§item_path

the D-Bus path of item to delete

§cancellable

optional cancellation object

§callback

called when the operation completes

source

fn delete_item_dbus_path_future( &self, item_path: &str ) -> Pin<Box_<dyn Future<Output = Result<(), Error>> + 'static>>

source

fn delete_item_dbus_path_sync( &self, item_path: &str, cancellable: Option<&impl IsA<Cancellable>> ) -> Result<(), Error>

Delete a secret item from the secret service.

The item is represented by its D-Bus object path. If you already have a Item proxy objects, use use ItemExt::delete_sync() instead.

This method may block indefinitely and should not be used in user interface threads.

§item_path

the D-Bus path of item to delete

§cancellable

optional cancellation object

§Returns

whether the deletion was successful or not

source

fn encode_dbus_secret(&self, value: &Value) -> Variant

Encodes a Value into [glib::Variant][struct@crate::glib::Variant] for use with the Secret Service DBus API.

The resulting [glib::Variant][struct@crate::glib::Variant] will have a (oayays) signature.

A session must have already been established by the Service.

§value

the secret value

§Returns

the encoded secret

source

fn ensure_session<P: FnOnce(Result<(), Error>) + 'static>( &self, cancellable: Option<&impl IsA<Cancellable>>, callback: P )

Ensure that the #SecretService proxy has established a session with the Secret Service.

This session is used to transfer secrets.

It is not normally necessary to call this method, as the session is established as necessary. You can also pass the ServiceFlags::OPEN_SESSION to get() in order to ensure that a session has been established by the time you get the #SecretService proxy.

This method will return immediately and complete asynchronously.

§cancellable

optional cancellation object

§callback

called when the operation completes

source

fn ensure_session_future( &self ) -> Pin<Box_<dyn Future<Output = Result<(), Error>> + 'static>>

source

fn ensure_session_sync( &self, cancellable: Option<&impl IsA<Cancellable>> ) -> Result<(), Error>

Ensure that the #SecretService proxy has established a session with the Secret Service.

This session is used to transfer secrets.

It is not normally necessary to call this method, as the session is established as necessary. You can also pass the ServiceFlags::OPEN_SESSION to get_sync() in order to ensure that a session has been established by the time you get the #SecretService proxy.

This method may block indefinitely and should not be used in user interface threads.

§cancellable

optional cancellation object

§Returns

whether a session is established or not

source

fn collection_gtype(&self) -> Type

Get the GObject type for collections instantiated by this service.

This will always be either Collection or derived from it.

§Returns

the gobject type for collections

source

fn collections(&self) -> Vec<Collection>

Get a list of Collection objects representing all the collections in the secret service.

If the ServiceFlags::LOAD_COLLECTIONS flag was not specified when initializing #SecretService proxy object, then this method will return None. Use load_collections() to load the collections.

§Returns

a list of the collections in the secret service

source

fn flags(&self) -> ServiceFlags

Get the flags representing what features of the #SecretService proxy have been initialized.

Use ensure_session() or load_collections() to initialize further features and change the flags.

§Returns

the flags for features initialized

source

fn item_gtype(&self) -> Type

Get the GObject type for items instantiated by this service.

This will always be either Item or derived from it.

§Returns

the gobject type for items

source

fn secret_for_dbus_path<P: FnOnce(Result<Option<Value>, Error>) + 'static>( &self, item_path: &str, cancellable: Option<&impl IsA<Cancellable>>, callback: P )

Get the secret value for a secret item stored in the service.

The item is represented by its D-Bus object path. If you already have a Item proxy object, use use ItemExt::secret() to more simply get its secret value.

This function returns immediately and completes asynchronously.

§item_path

the D-Bus path to item to retrieve secret for

§cancellable

optional cancellation object

§callback

called when the operation completes

source

fn secret_for_dbus_path_future( &self, item_path: &str ) -> Pin<Box_<dyn Future<Output = Result<Option<Value>, Error>> + 'static>>

source

fn secret_for_dbus_path_sync( &self, item_path: &str, cancellable: Option<&impl IsA<Cancellable>> ) -> Result<Option<Value>, Error>

Get the secret value for a secret item stored in the service.

The item is represented by its D-Bus object path. If you already have a Item proxy object, use use ItemExt::load_secret_sync() to more simply get its secret value.

This method may block indefinitely and should not be used in user interface threads.

Will return None if the item is locked.

§item_path

the D-Bus path to item to retrieve secret for

§cancellable

optional cancellation object

§Returns

the newly allocated secret value the item, which should be released with Value::unref()

source

fn session_algorithms(&self) -> Option<GString>

Get the set of algorithms being used to transfer secrets between this secret service proxy and the Secret Service itself.

This will be None if no session has been established. Use ensure_session() to establish a session.

§Returns

a string representing the algorithms for transferring secrets

source

fn session_dbus_path(&self) -> Option<GString>

Get the D-Bus object path of the session object being used to transfer secrets between this secret service proxy and the Secret Service itself.

This will be None if no session has been established. Use ensure_session() to establish a session.

§Returns

a string representing the D-Bus object path of the session

source

fn load_collections<P: FnOnce(Result<(), Error>) + 'static>( &self, cancellable: Option<&impl IsA<Cancellable>>, callback: P )

Ensure that the #SecretService proxy has loaded all the collections present in the Secret Service.

This affects the result of collections().

You can also pass the ServiceFlags::LOAD_COLLECTIONS to get_sync() in order to ensure that the collections have been loaded by the time you get the #SecretService proxy.

This method will return immediately and complete asynchronously.

§cancellable

optional cancellation object

§callback

called when the operation completes

source

fn load_collections_future( &self ) -> Pin<Box_<dyn Future<Output = Result<(), Error>> + 'static>>

source

fn load_collections_sync( &self, cancellable: Option<&impl IsA<Cancellable>> ) -> Result<(), Error>

Ensure that the #SecretService proxy has loaded all the collections present in the Secret Service.

This affects the result of collections().

You can also pass the ServiceFlags::LOAD_COLLECTIONS to get_sync() in order to ensure that the collections have been loaded by the time you get the #SecretService proxy.

This method may block indefinitely and should not be used in user interface threads.

§cancellable

optional cancellation object

§Returns

whether the load was successful or not

source

fn prompt<P: FnOnce(Result<Variant, Error>) + 'static>( &self, prompt: &impl IsA<Prompt>, return_type: Option<&VariantTy>, cancellable: Option<&impl IsA<Cancellable>>, callback: P )

Perform prompting for a Prompt.

This function is called by other parts of this library to handle prompts for the various actions that can require prompting.

Override the #SecretServiceClass vfunc::Service::prompt_async virtual method to change the behavior of the prompting. The default behavior is to simply run PromptExtManual::perform() on the prompt.

§prompt

the prompt

§return_type

the variant type of the prompt result

§cancellable

optional cancellation object

§callback

called when the operation completes

source

fn prompt_future( &self, prompt: &(impl IsA<Prompt> + Clone + 'static), return_type: Option<&VariantTy> ) -> Pin<Box_<dyn Future<Output = Result<Variant, Error>> + 'static>>

source

fn prompt_at_dbus_path<P: FnOnce(Result<Option<Variant>, Error>) + 'static>( &self, prompt_path: &str, return_type: Option<&VariantTy>, cancellable: Option<&impl IsA<Cancellable>>, callback: P )

Perform prompting for a Prompt.

This function is called by other parts of this library to handle prompts for the various actions that can require prompting.

Override the #SecretServiceClass vfunc::Service::prompt_async virtual method to change the behavior of the propmting. The default behavior is to simply run PromptExtManual::perform() on the prompt.

§prompt_path

the D-Bus object path of the prompt

§return_type

the variant type of the prompt result

§cancellable

optional cancellation object

§callback

called when the operation completes

source

fn prompt_at_dbus_path_future( &self, prompt_path: &str, return_type: Option<&VariantTy> ) -> Pin<Box_<dyn Future<Output = Result<Option<Variant>, Error>> + 'static>>

source

fn prompt_at_dbus_path_sync( &self, prompt_path: &str, cancellable: Option<&impl IsA<Cancellable>>, return_type: Option<&VariantTy> ) -> Result<Option<Variant>, Error>

Perform prompting for a Prompt.

Override the #SecretServiceClass vfunc::Service::prompt_async virtual method to change the behavior of the propmting. The default behavior is to simply run PromptExtManual::perform() on the prompt.

Returns a variant result if the prompt was completed and not dismissed. The type of result depends on the action the prompt is completing, and is defined in the Secret Service DBus API specification.

This method may block and should not be used in user interface threads.

§prompt_path

the D-Bus object path of the prompt

§cancellable

optional cancellation object

§return_type

the variant type of the prompt result

§Returns

None if the prompt was dismissed or an error occurred, a variant result if the prompt was successful

source

fn prompt_sync( &self, prompt: &impl IsA<Prompt>, cancellable: Option<&impl IsA<Cancellable>>, return_type: &VariantTy ) -> Result<Variant, Error>

Perform prompting for a Prompt.

Runs a prompt and performs the prompting. Returns a variant result if the prompt was completed and not dismissed. The type of result depends on the action the prompt is completing, and is defined in the Secret Service DBus API specification.

This function is called by other parts of this library to handle prompts for the various actions that can require prompting.

Override the #SecretServiceClass [ServiceImpl::prompt_sync()][crate::subclass::prelude::ServiceImpl::prompt_sync()] virtual method to change the behavior of the prompting. The default behavior is to simply run PromptExt::perform_sync() on the prompt with a None window_id.

§prompt

the prompt

§cancellable

optional cancellation object

§return_type

the variant type of the prompt result

§Returns

None if the prompt was dismissed or an error occurred, a variant result if the prompt was successful

source

fn read_alias_dbus_path<P: FnOnce(Result<Option<GString>, Error>) + 'static>( &self, alias: &str, cancellable: Option<&impl IsA<Cancellable>>, callback: P )

Lookup which collection is assigned to this alias.

Aliases help determine well known collections, such as ‘default’. This method looks up the dbus object path of the well known collection.

This method will return immediately and complete asynchronously.

§alias

the alias to lookup

§cancellable

optional cancellation object

§callback

called when the operation completes

source

fn read_alias_dbus_path_future( &self, alias: &str ) -> Pin<Box_<dyn Future<Output = Result<Option<GString>, Error>> + 'static>>

source

fn read_alias_dbus_path_sync( &self, alias: &str, cancellable: Option<&impl IsA<Cancellable>> ) -> Result<Option<GString>, Error>

Lookup which collection is assigned to this alias.

Aliases help determine well known collections, such as ‘default’. This method returns the dbus object path of the collection.

This method may block and should not be used in user interface threads.

§alias

the alias to lookup

§cancellable

optional cancellation object

§Returns

the collection dbus object path, or None if none assigned to the alias

source

fn set_alias<P: FnOnce(Result<(), Error>) + 'static>( &self, alias: &str, collection: Option<&impl IsA<Collection>>, cancellable: Option<&impl IsA<Cancellable>>, callback: P )

Assign a collection to this alias.

Aliases help determine well known collections, such as ‘default’.

If @self is None, then get() will be called to get the default Service proxy.

This method will return immediately and complete asynchronously.

§alias

the alias to assign the collection to

§collection

the collection to assign to the alias

§cancellable

optional cancellation object

§callback

called when the operation completes

source

fn set_alias_future( &self, alias: &str, collection: Option<&(impl IsA<Collection> + Clone + 'static)> ) -> Pin<Box_<dyn Future<Output = Result<(), Error>> + 'static>>

source

fn set_alias_sync( &self, alias: &str, collection: Option<&impl IsA<Collection>>, cancellable: Option<&impl IsA<Cancellable>> ) -> Result<(), Error>

Assign a collection to this alias. Aliases help determine well known collections, such as ‘default’.

If @self is None, then get_sync() will be called to get the default Service proxy.

This method may block and should not be used in user interface threads.

§alias

the alias to assign the collection to

§collection

the collection to assign to the alias

§cancellable

optional cancellation object

§Returns

true if successful

source

fn set_alias_to_dbus_path<P: FnOnce(Result<(), Error>) + 'static>( &self, alias: &str, collection_path: Option<&str>, cancellable: Option<&impl IsA<Cancellable>>, callback: P )

Assign a collection to this alias. Aliases help determine well known collections, such as ‘default’. This method takes the dbus object path of the collection to assign to the alias.

This method will return immediately and complete asynchronously.

§alias

the alias to assign the collection to

§collection_path

the dbus object path of the collection to assign to the alias

§cancellable

optional cancellation object

§callback

called when the operation completes

source

fn set_alias_to_dbus_path_future( &self, alias: &str, collection_path: Option<&str> ) -> Pin<Box_<dyn Future<Output = Result<(), Error>> + 'static>>

source

fn set_alias_to_dbus_path_sync( &self, alias: &str, collection_path: Option<&str>, cancellable: Option<&impl IsA<Cancellable>> ) -> Result<(), Error>

Assign a collection to this alias.

Aliases help determine well known collections, such as ‘default’. This method takes the dbus object path of the collection to assign to the alias.

This method may block and should not be used in user interface threads.

§alias

the alias to assign the collection to

§collection_path

the D-Bus object path of the collection to assign to the alias

§cancellable

optional cancellation object

§Returns

true if successful

source

fn unlock_dbus_paths_sync( &self, paths: &[&str], cancellable: Option<&impl IsA<Cancellable>> ) -> Result<(i32, Vec<GString>), Error>

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 Service::unlock_sync() instead.

The secret service may not be able to unlock items individually, and may unlock 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. prompt() will be used to handle any prompts that show up.

§paths

the D-Bus object paths of the items or collections to unlock

§cancellable

optional cancellation object

§Returns

the number of items or collections that were unlocked

§unlocked

location to place array of D-Bus paths of items or collections that were unlocked

Object Safety§

This trait is not object safe.

Implementors§