Class Service

java.lang.Object
All Implemented Interfaces:
AsyncInitable, DBusInterface, Initable, Backend, Proxy

@Generated("io.github.jwharm.JavaGI") public class Service extends DBusProxy implements AsyncInitable, DBusInterface, Initable, Backend
A proxy object representing the Secret Service.

A SecretService object either represents an implementation of the org.freedesktop.Secret D-Bus service or a file that is encrypted using a master secret that was provided by the secret portal.

Normally a single SecretService object can be shared between multiple callers. The get(java.util.Set<org.gnome.secret.ServiceFlags>, org.gnome.gio.Cancellable, org.gnome.gio.AsyncReadyCallback) method is used to access this SecretService object. If a new independent SecretService object is required, use open(org.gnome.glib.Type, java.lang.String, java.util.Set<org.gnome.secret.ServiceFlags>, org.gnome.gio.Cancellable, org.gnome.gio.AsyncReadyCallback).

In order to securely transfer secrets to the Sercret Service, a session is established. This session can be established while initializing a SecretService object by passing the ServiceFlags.OPEN_SESSION flag to the get(java.util.Set<org.gnome.secret.ServiceFlags>, org.gnome.gio.Cancellable, org.gnome.gio.AsyncReadyCallback) or open(org.gnome.glib.Type, java.lang.String, java.util.Set<org.gnome.secret.ServiceFlags>, org.gnome.gio.Cancellable, org.gnome.gio.AsyncReadyCallback) functions. In order to establish a session on an already existing SecretService, use the ensureSession(org.gnome.gio.Cancellable, org.gnome.gio.AsyncReadyCallback) function.

To search for items, use the search(org.gnome.secret.Schema, org.gnome.glib.HashTable<java.lang.String, java.lang.String>, java.util.Set<org.gnome.secret.SearchFlags>, org.gnome.gio.Cancellable, org.gnome.gio.AsyncReadyCallback) method.

Multiple collections can exist in the Secret Service, each of which contains secret items. In order to instantiate Collection objects which represent those collections while initializing a SecretService then pass the ServiceFlags.LOAD_COLLECTIONS flag to the get(java.util.Set<org.gnome.secret.ServiceFlags>, org.gnome.gio.Cancellable, org.gnome.gio.AsyncReadyCallback) or open(org.gnome.glib.Type, java.lang.String, java.util.Set<org.gnome.secret.ServiceFlags>, org.gnome.gio.Cancellable, org.gnome.gio.AsyncReadyCallback) functions. In order to establish a session on an already existing SecretService, use the loadCollections(org.gnome.gio.Cancellable, org.gnome.gio.AsyncReadyCallback) function. To access the list of collections use getCollections().

Certain actions on the Secret Service require user prompting to complete, such as creating a collection, or unlocking a collection. When such a prompt is necessary, then a Prompt object is created by this library, and passed to the prompt(org.gnome.secret.Prompt, org.gnome.glib.VariantType, org.gnome.gio.Cancellable, org.gnome.gio.AsyncReadyCallback) method. In this way it is handled automatically.

In order to customize prompt handling, override the promptAsync(org.gnome.secret.Prompt, org.gnome.glib.VariantType, org.gnome.gio.Cancellable, org.gnome.gio.AsyncReadyCallback) and promptFinish(org.gnome.gio.AsyncResult) virtual methods of the SecretService class.