Class Service
- All Implemented Interfaces:
AsyncInitable,DBusInterface,Initable,Backend,Proxy
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.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classService.Builder<B extends Service.Builder<B>>Inner class implementing a builder pattern to construct a GObject with properties.static classThe class forSecretService.Nested classes/interfaces inherited from class org.gnome.gio.DBusProxy
DBusProxy.DBusProxyClass, DBusProxy.GPropertiesChangedCallback, DBusProxy.GSignalCallbackNested classes/interfaces inherited from class org.gnome.gobject.GObject
GObject.NotifyCallback, GObject.ObjectClassNested classes/interfaces inherited from interface org.gnome.gio.AsyncInitable
AsyncInitable.AsyncInitable$Impl, AsyncInitable.AsyncInitableIfaceNested classes/interfaces inherited from interface org.gnome.secret.Backend
Backend.Backend$Impl, Backend.BackendInterfaceNested classes/interfaces inherited from interface org.gnome.gio.DBusInterface
DBusInterface.DBusInterface$Impl, DBusInterface.DBusInterfaceIfaceNested classes/interfaces inherited from interface org.gnome.gio.Initable
Initable.Initable$Impl, Initable.InitableIface -
Constructor Summary
ConstructorsConstructorDescriptionService()Creates a new Service.Service(MemorySegment address) Create a Service proxy instance for the provided memory address. -
Method Summary
Modifier and TypeMethodDescriptionprotected ServiceasParent()Returns this instance as if it were its parent type.static Service.Builder<? extends Service.Builder> builder()AService.Builderobject constructs aServicewith the specified properties.voidclear(@Nullable Schema schema, HashTable<String, String> attributes, @Nullable Cancellable cancellable, @Nullable AsyncReadyCallback callback) Remove unlocked items which match the attributes from the secret service.booleanclearFinish(AsyncResult result) Finish asynchronous operation to remove items from the secret service.booleanclearSync(@Nullable Schema schema, HashTable<String, String> attributes, @Nullable Cancellable cancellable) Remove unlocked items which match the attributes from the secret service.voidcreateCollectionDbusPath(HashTable<String, Variant> properties, @Nullable String alias, Set<CollectionCreateFlags> flags, @Nullable Cancellable cancellable, @Nullable AsyncReadyCallback callback) Create a new collection in the secret service, and return its path.voidcreateCollectionDbusPath(HashTable<String, Variant> properties, @Nullable String alias, CollectionCreateFlags flags, @Nullable Cancellable cancellable, @Nullable AsyncReadyCallback callback) Create a new collection in the secret service, and return its path.Finish asynchronous operation to create a new collection in the secret service.createCollectionDbusPathSync(HashTable<String, Variant> properties, @Nullable String alias, Set<CollectionCreateFlags> flags, @Nullable Cancellable cancellable) Create a new collection in the secret service and return its path.createCollectionDbusPathSync(HashTable<String, Variant> properties, @Nullable String alias, CollectionCreateFlags flags, @Nullable Cancellable cancellable) Create a new collection in the secret service and return its path.voidcreateItemDbusPath(String collectionPath, HashTable<String, Variant> properties, Value value, Set<ItemCreateFlags> flags, @Nullable Cancellable cancellable, @Nullable AsyncReadyCallback callback) Create a new item in a secret service collection and return its D-Bus object path.voidcreateItemDbusPath(String collectionPath, HashTable<String, Variant> properties, Value value, ItemCreateFlags flags, @Nullable Cancellable cancellable, @Nullable AsyncReadyCallback callback) Create a new item in a secret service collection and return its D-Bus object path.createItemDbusPathFinish(AsyncResult result) Finish asynchronous operation to create a new item in the secret service.createItemDbusPathSync(String collectionPath, HashTable<String, Variant> properties, Value value, Set<ItemCreateFlags> flags, @Nullable Cancellable cancellable) Create a new item in a secret service collection and return its D-Bus object path.createItemDbusPathSync(String collectionPath, HashTable<String, Variant> properties, Value value, ItemCreateFlags flags, @Nullable Cancellable cancellable) Create a new item in a secret service collection and return its D-Bus object path.decodeDbusSecret(Variant value) Decode aValueintoGLib.Variantreceived with the Secret Service DBus API.voiddeleteItemDbusPath(String itemPath, @Nullable Cancellable cancellable, @Nullable AsyncReadyCallback callback) Delete a secret item from the secret service.booleandeleteItemDbusPathFinish(AsyncResult result) Complete an asynchronous operation to delete a secret item from the secret service.booleandeleteItemDbusPathSync(String itemPath, @Nullable Cancellable cancellable) Delete a secret item from the secret service.static voidDisconnect the defaultSecretServiceproxy returned byget(java.util.Set<org.gnome.secret.ServiceFlags>, org.gnome.gio.Cancellable, org.gnome.gio.AsyncReadyCallback)andgetSync(java.util.Set<org.gnome.secret.ServiceFlags>, org.gnome.gio.Cancellable).encodeDbusSecret(Value value) Encodes aValueintoGLib.Variantfor use with the Secret Service DBus API.voidensureSession(@Nullable Cancellable cancellable, @Nullable AsyncReadyCallback callback) Ensure that theSecretServiceproxy has established a session with the Secret Service.booleanensureSessionFinish(AsyncResult result) Finish an asynchronous operation to ensure that theSecretServiceproxy has established a session with the Secret Service.booleanensureSessionSync(@Nullable Cancellable cancellable) Ensure that theSecretServiceproxy has established a session with the Secret Service.static voidget(Set<ServiceFlags> flags, @Nullable Cancellable cancellable, @Nullable AsyncReadyCallback callback) Get aSecretServiceproxy for the Secret Service.static voidget(ServiceFlags flags, @Nullable Cancellable cancellable, @Nullable AsyncReadyCallback callback) Get aSecretServiceproxy for the Secret Service.Get the GObject type for collections instantiated by this service.@Nullable List<Collection> Get a list ofCollectionobjects representing all the collections in the secret service.static ServicegetFinish(AsyncResult result) Complete an asynchronous operation to get aSecretServiceproxy for the Secret Service.Get the GObject type for items instantiated by this service.static MemoryLayoutThe memory layout of the native struct.voidgetSecretForDbusPath(String itemPath, @Nullable Cancellable cancellable, @Nullable AsyncReadyCallback callback) Get the secret value for a secret item stored in the service.@Nullable ValueComplete asynchronous operation to get the secret value for an secret item stored in the service.@Nullable ValuegetSecretForDbusPathSync(String itemPath, @Nullable Cancellable cancellable) Get the secret value for a secret item stored in the service.voidgetSecretsForDbusPaths(String[] itemPaths, @Nullable Cancellable cancellable, @Nullable AsyncReadyCallback callback) Get the secret values for a secret item stored in the service.Complete asynchronous operation to get the secret values for an secret items stored in the service.getSecretsForDbusPathsSync(String[] itemPaths, @Nullable Cancellable cancellable) Get the secret values for a secret item stored in the service.Get the flags representing what features of theSecretServiceproxy have been initialized.@Nullable StringGet the set of algorithms being used to transfer secrets between this secret service proxy and the Secret Service itself.@Nullable StringGet the D-Bus object path of the session object being used to transfer secrets between this secret service proxy and the Secret Service itself.static ServicegetSync(Set<ServiceFlags> flags, @Nullable Cancellable cancellable) Get aSecretServiceproxy for the Secret Service.static ServicegetSync(ServiceFlags flags, @Nullable Cancellable cancellable) Get aSecretServiceproxy for the Secret Service.static @Nullable TypegetType()Get the GType of the Service classvoidloadCollections(@Nullable Cancellable cancellable, @Nullable AsyncReadyCallback callback) Ensure that theSecretServiceproxy has loaded all the collections present in the Secret Service.booleanloadCollectionsFinish(AsyncResult result) Complete an asynchronous operation to ensure that theSecretServiceproxy has loaded all the collections present in the Secret Service.booleanloadCollectionsSync(@Nullable Cancellable cancellable) Ensure that theSecretServiceproxy has loaded all the collections present in the Secret Service.voidlock(List<DBusProxy> objects, @Nullable Cancellable cancellable, @Nullable AsyncReadyCallback callback) Lock items or collections in the secret service.voidlockDbusPaths(@Nullable String @Nullable [] paths, @Nullable Cancellable cancellable, @Nullable AsyncReadyCallback callback) Lock items or collections in the secret service.intlockDbusPathsFinish(AsyncResult result, @Nullable Out<String[]> locked) Complete asynchronous operation to lock items or collections in the secret service.intlockDbusPathsSync(@Nullable String @Nullable [] paths, @Nullable Cancellable cancellable, @Nullable Out<String[]> locked) Lock items or collections in the secret service.intlockFinish(AsyncResult result, @Nullable Out<List<DBusProxy>> locked) Complete asynchronous operation to lock items or collections in the secret service.intlockSync(List<DBusProxy> objects, @Nullable Cancellable cancellable, @Nullable Out<List<DBusProxy>> locked) Lock items or collections in the secret service.voidlookup(@Nullable Schema schema, HashTable<String, String> attributes, @Nullable Cancellable cancellable, @Nullable AsyncReadyCallback callback) Lookup a secret value in the secret service.lookupFinish(AsyncResult result) Finish asynchronous operation to lookup a secret value in the secret service.lookupSync(@Nullable Schema schema, HashTable<String, String> attributes, @Nullable Cancellable cancellable) Lookup a secret value in the secret service.static voidopen(Type serviceGtype, @Nullable String serviceBusName, Set<ServiceFlags> flags, @Nullable Cancellable cancellable, @Nullable AsyncReadyCallback callback) Create a newSecretServiceproxy for the Secret Service.static voidopen(Type serviceGtype, @Nullable String serviceBusName, ServiceFlags flags, @Nullable Cancellable cancellable, @Nullable AsyncReadyCallback callback) Create a newSecretServiceproxy for the Secret Service.static ServiceopenFinish(AsyncResult result) Complete an asynchronous operation to create a newSecretServiceproxy for the Secret Service.static ServiceopenSync(Type serviceGtype, @Nullable String serviceBusName, Set<ServiceFlags> flags, @Nullable Cancellable cancellable) Create a newSecretServiceproxy for the Secret Service.static ServiceopenSync(Type serviceGtype, @Nullable String serviceBusName, ServiceFlags flags, @Nullable Cancellable cancellable) Create a newSecretServiceproxy for the Secret Service.voidprompt(Prompt prompt, @Nullable VariantType returnType, @Nullable Cancellable cancellable, @Nullable AsyncReadyCallback callback) Perform prompting for aPrompt.protected voidpromptAsync(Prompt prompt, VariantType returnType, @Nullable Cancellable cancellable, @Nullable AsyncReadyCallback callback) called to perform asynchronous prompting when necessaryvoidpromptAtDbusPath(String promptPath, @Nullable VariantType returnType, @Nullable Cancellable cancellable, @Nullable AsyncReadyCallback callback) Perform prompting for aPrompt.@Nullable VariantpromptAtDbusPathFinish(AsyncResult result) Complete asynchronous operation to perform prompting for aPrompt.@Nullable VariantpromptAtDbusPathSync(String promptPath, @Nullable Cancellable cancellable, @Nullable VariantType returnType) Perform prompting for aPrompt.promptFinish(AsyncResult result) Complete asynchronous operation to perform prompting for aPrompt.promptSync(Prompt prompt, @Nullable Cancellable cancellable, VariantType returnType) Perform prompting for aPrompt.voidreadAliasDbusPath(String alias, @Nullable Cancellable cancellable, @Nullable AsyncReadyCallback callback) Lookup which collection is assigned to this alias.@Nullable StringreadAliasDbusPathFinish(AsyncResult result) Finish an asynchronous operation to lookup which collection is assigned to an alias.@Nullable StringreadAliasDbusPathSync(String alias, @Nullable Cancellable cancellable) Lookup which collection is assigned to this alias.voidsearch(@Nullable Schema schema, HashTable<String, String> attributes, Set<SearchFlags> flags, @Nullable Cancellable cancellable, @Nullable AsyncReadyCallback callback) Search for items matching theattributes.voidsearch(@Nullable Schema schema, HashTable<String, String> attributes, SearchFlags flags, @Nullable Cancellable cancellable, @Nullable AsyncReadyCallback callback) Search for items matching theattributes.searchFinish(AsyncResult result) Complete asynchronous operation to search for items.voidsearchForDbusPaths(@Nullable Schema schema, HashTable<String, String> attributes, @Nullable Cancellable cancellable, @Nullable AsyncReadyCallback callback) Search for items matching theattributes,and return their D-Bus object paths.booleansearchForDbusPathsFinish(AsyncResult result, @Nullable Out<String[]> unlocked, @Nullable Out<String[]> locked) Complete asynchronous operation to search for items, and return their D-Bus object paths.booleansearchForDbusPathsSync(@Nullable Schema schema, HashTable<String, String> attributes, @Nullable Cancellable cancellable, @Nullable Out<String[]> unlocked, @Nullable Out<String[]> locked) Search for items matching theattributes,and return their D-Bus object paths.searchSync(@Nullable Schema schema, HashTable<String, String> attributes, Set<SearchFlags> flags, @Nullable Cancellable cancellable) Search for items matching theattributes.searchSync(@Nullable Schema schema, HashTable<String, String> attributes, SearchFlags flags, @Nullable Cancellable cancellable) Search for items matching theattributes.voidsetAlias(String alias, @Nullable Collection collection, @Nullable Cancellable cancellable, @Nullable AsyncReadyCallback callback) Assign a collection to this alias.booleansetAliasFinish(AsyncResult result) Finish an asynchronous operation to assign a collection to an alias.booleansetAliasSync(String alias, @Nullable Collection collection, @Nullable Cancellable cancellable) Assign a collection to this alias.voidsetAliasToDbusPath(String alias, @Nullable String collectionPath, @Nullable Cancellable cancellable, @Nullable AsyncReadyCallback callback) Assign a collection to this alias.booleansetAliasToDbusPathFinish(AsyncResult result) Finish an asynchronous operation to assign a collection to an alias.booleansetAliasToDbusPathSync(String alias, @Nullable String collectionPath, @Nullable Cancellable cancellable) Assign a collection to this alias.voidstore(@Nullable Schema schema, HashTable<String, String> attributes, @Nullable String collection, String label, Value value, @Nullable Cancellable cancellable, @Nullable AsyncReadyCallback callback) Store a secret value in the secret service.booleanstoreFinish(AsyncResult result) Finish asynchronous operation to store a secret value in the secret service.booleanstoreSync(@Nullable Schema schema, HashTable<String, String> attributes, @Nullable String collection, String label, Value value, @Nullable Cancellable cancellable) Store a secret value in the secret service.voidunlock(List<DBusProxy> objects, @Nullable Cancellable cancellable, @Nullable AsyncReadyCallback callback) Unlock items or collections in the secret service.voidunlockDbusPaths(@Nullable String @Nullable [] paths, @Nullable Cancellable cancellable, @Nullable AsyncReadyCallback callback) Unlock items or collections in the secret service.intunlockDbusPathsFinish(AsyncResult result, @Nullable Out<String[]> unlocked) Complete asynchronous operation to unlock items or collections in the secret service.intunlockDbusPathsSync(@Nullable String @Nullable [] paths, @Nullable Cancellable cancellable, @Nullable Out<String[]> unlocked) Unlock items or collections in the secret service.intunlockFinish(AsyncResult result, @Nullable Out<List<DBusProxy>> unlocked) Complete asynchronous operation to unlock items or collections in the secret service.intunlockSync(List<DBusProxy> objects, @Nullable Cancellable cancellable, @Nullable Out<List<DBusProxy>> unlocked) Unlock items or collections in the secret service.Methods inherited from class org.gnome.gio.DBusProxy
call, call, callFinish, callSync, callSync, callWithUnixFdList, callWithUnixFdList, callWithUnixFdListFinish, callWithUnixFdListSync, callWithUnixFdListSync, emitGPropertiesChanged, emitGSignal, finish, forBusFinish, forBusSync, forBusSync, getCachedProperty, getCachedPropertyNames, getConnection, getDefaultTimeout, getFlags, getInterfaceInfo, getInterfaceName, getName, getNameOwner, getObjectPath, gPropertiesChanged, gSignal, new_, new_, newForBus, newForBus, onGPropertiesChanged, onGSignal, setCachedProperty, setDefaultTimeout, setInterfaceInfo, sync, syncMethods inherited from class org.gnome.gobject.GObject
addToggleRef, addWeakPointer, bindProperty, bindProperty, bindProperty, bindPropertyFull, bindPropertyFull, bindPropertyWithClosures, bindPropertyWithClosures, compatControl, connect, connect, connect, constructed, disconnect, dispatchPropertiesChanged, dispose, dupData, dupQdata, emit, emitNotify, finalize_, forceFloating, freezeNotify, get, getData, getProperty, getProperty, getProperty, getQdata, getv, interfaceFindProperty, interfaceInstallProperty, interfaceListProperties, isFloating, newInstance, newInstance, newv, notify, notify, notifyByPspec, onNotify, ref, refSink, removeToggleRef, removeWeakPointer, replaceData, replaceQdata, runDispose, set, setData, setDataFull, setProperty, setProperty, setProperty, setQdata, setQdataFull, setv, stealData, stealQdata, takeRef, thawNotify, unref, watchClosure, weakRef, weakUnref, withPropertiesMethods inherited from class org.gnome.gobject.TypeInstance
callParent, callParent, cast, getPrivate, readGClass, writeGClassMethods inherited from class org.javagi.base.ProxyInstance
equals, handle, hashCodeMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.gnome.gio.AsyncInitable
initAsync, initFinishMethods inherited from interface org.gnome.gio.DBusInterface
getInfo, getObject, setObject
-
Constructor Details
-
Service
Create a Service proxy instance for the provided memory address.- Parameters:
address- the memory address of the native object
-
Service
public Service()Creates a new Service.
-
-
Method Details
-
getType
-
getMemoryLayout
The memory layout of the native struct.- Returns:
- the memory layout
-
asParent
Returns this instance as if it were its parent type. This is mostly synonymous to the Javasuperkeyword, but will set the native typeclass function pointers to the parent type. When overriding a native virtual method in Java, "chaining up" withsuper.methodName()doesn't work, because it invokes the overridden function pointer again. To chain up, callasParent().methodName(). This will call the native function pointer of this virtual method in the typeclass of the parent type. -
disconnect
public static void disconnect()Disconnect the defaultSecretServiceproxy returned byget(java.util.Set<org.gnome.secret.ServiceFlags>, org.gnome.gio.Cancellable, org.gnome.gio.AsyncReadyCallback)andgetSync(java.util.Set<org.gnome.secret.ServiceFlags>, org.gnome.gio.Cancellable).It is not necessary to call this function, but you may choose to do so at program exit. It is useful for testing that memory is not leaked.
This function is safe to call at any time. But if other objects in this library are still referenced, then this will not result in all memory being freed.
-
get
public static void get(Set<ServiceFlags> flags, @Nullable Cancellable cancellable, @Nullable AsyncReadyCallback callback) Get aSecretServiceproxy for the Secret Service.If such a proxy object already exists, then the same proxy is returned.
If
flagscontains any flags of which parts of the secret service to ensure are initialized, then those will be initialized before completing.This method will return immediately and complete asynchronously.
- Parameters:
flags- flags for which service functionality to ensure is initializedcancellable- optional cancellation objectcallback- called when the operation completes
-
get
public static void get(ServiceFlags flags, @Nullable Cancellable cancellable, @Nullable AsyncReadyCallback callback) Get aSecretServiceproxy for the Secret Service.If such a proxy object already exists, then the same proxy is returned.
If
flagscontains any flags of which parts of the secret service to ensure are initialized, then those will be initialized before completing.This method will return immediately and complete asynchronously.
- Parameters:
flags- flags for which service functionality to ensure is initializedcancellable- optional cancellation objectcallback- called when the operation completes
-
getFinish
Complete an asynchronous operation to get aSecretServiceproxy for the Secret Service.- Parameters:
result- the asynchronous result passed to the callback- Returns:
- a new reference to a
SecretServiceproxy, which should be released withGObject.unref(). - Throws:
GErrorException- seeGError
-
getSync
public static Service getSync(Set<ServiceFlags> flags, @Nullable Cancellable cancellable) throws GErrorException Get aSecretServiceproxy for the Secret Service.If such a proxy object already exists, then the same proxy is returned.
If
flagscontains any flags of which parts of the secret service to ensure are initialized, then those will be initialized before returning.This method may block indefinitely and should not be used in user interface threads.
- Parameters:
flags- flags for which service functionality to ensure is initializedcancellable- optional cancellation object- Returns:
- a new reference to a
SecretServiceproxy, which should be released withGObject.unref(). - Throws:
GErrorException- seeGError
-
getSync
public static Service getSync(ServiceFlags flags, @Nullable Cancellable cancellable) throws GErrorException Get aSecretServiceproxy for the Secret Service.If such a proxy object already exists, then the same proxy is returned.
If
flagscontains any flags of which parts of the secret service to ensure are initialized, then those will be initialized before returning.This method may block indefinitely and should not be used in user interface threads.
- Parameters:
flags- flags for which service functionality to ensure is initializedcancellable- optional cancellation object- Returns:
- a new reference to a
SecretServiceproxy, which should be released withGObject.unref(). - Throws:
GErrorException- seeGError
-
open
public static void open(Type serviceGtype, @Nullable String serviceBusName, Set<ServiceFlags> flags, @Nullable Cancellable cancellable, @Nullable AsyncReadyCallback callback) Create a newSecretServiceproxy for the Secret Service.This function is rarely used, see
get(java.util.Set<org.gnome.secret.ServiceFlags>, org.gnome.gio.Cancellable, org.gnome.gio.AsyncReadyCallback)instead.The
serviceGtypeargument should be set toSECRET_TYPE_SERVICEor a the type of a derived class.If
flagscontains any flags of which parts of the secret service to ensure are initialized, then those will be initialized before returning.If
serviceBusNameisnullthen the default is used.This method will return immediately and complete asynchronously.
- Parameters:
serviceGtype- the GType of the new secret serviceserviceBusName- the D-Bus service name of the secret serviceflags- flags for which service functionality to ensure is initializedcancellable- optional cancellation objectcallback- called when the operation completes
-
open
public static void open(Type serviceGtype, @Nullable String serviceBusName, ServiceFlags flags, @Nullable Cancellable cancellable, @Nullable AsyncReadyCallback callback) Create a newSecretServiceproxy for the Secret Service.This function is rarely used, see
get(java.util.Set<org.gnome.secret.ServiceFlags>, org.gnome.gio.Cancellable, org.gnome.gio.AsyncReadyCallback)instead.The
serviceGtypeargument should be set toSECRET_TYPE_SERVICEor a the type of a derived class.If
flagscontains any flags of which parts of the secret service to ensure are initialized, then those will be initialized before returning.If
serviceBusNameisnullthen the default is used.This method will return immediately and complete asynchronously.
- Parameters:
serviceGtype- the GType of the new secret serviceserviceBusName- the D-Bus service name of the secret serviceflags- flags for which service functionality to ensure is initializedcancellable- optional cancellation objectcallback- called when the operation completes
-
openFinish
Complete an asynchronous operation to create a newSecretServiceproxy for the Secret Service.- Parameters:
result- the asynchronous result passed to the callback- Returns:
- a new reference to a
SecretServiceproxy, which should be released withGObject.unref(). - Throws:
GErrorException- seeGError
-
openSync
public static Service openSync(Type serviceGtype, @Nullable String serviceBusName, Set<ServiceFlags> flags, @Nullable Cancellable cancellable) throws GErrorException Create a newSecretServiceproxy for the Secret Service.This function is rarely used, see
getSync(java.util.Set<org.gnome.secret.ServiceFlags>, org.gnome.gio.Cancellable)instead.The
serviceGtypeargument should be set toSECRET_TYPE_SERVICEor a the type of a derived class.If
flagscontains any flags of which parts of the secret service to ensure are initialized, then those will be initialized before returning.If
serviceBusNameisnullthen the default is used.This method may block indefinitely and should not be used in user interface threads.
- Parameters:
serviceGtype- the GType of the new secret serviceserviceBusName- the D-Bus service name of the secret serviceflags- flags for which service functionality to ensure is initializedcancellable- optional cancellation object- Returns:
- a new reference to a
SecretServiceproxy, which should be released withGObject.unref(). - Throws:
GErrorException- seeGError
-
openSync
public static Service openSync(Type serviceGtype, @Nullable String serviceBusName, ServiceFlags flags, @Nullable Cancellable cancellable) throws GErrorException Create a newSecretServiceproxy for the Secret Service.This function is rarely used, see
getSync(java.util.Set<org.gnome.secret.ServiceFlags>, org.gnome.gio.Cancellable)instead.The
serviceGtypeargument should be set toSECRET_TYPE_SERVICEor a the type of a derived class.If
flagscontains any flags of which parts of the secret service to ensure are initialized, then those will be initialized before returning.If
serviceBusNameisnullthen the default is used.This method may block indefinitely and should not be used in user interface threads.
- Parameters:
serviceGtype- the GType of the new secret serviceserviceBusName- the D-Bus service name of the secret serviceflags- flags for which service functionality to ensure is initializedcancellable- optional cancellation object- Returns:
- a new reference to a
SecretServiceproxy, which should be released withGObject.unref(). - Throws:
GErrorException- seeGError
-
clear
public void clear(@Nullable Schema schema, HashTable<String, String> attributes, @Nullable Cancellable cancellable, @Nullable AsyncReadyCallback callback) Remove unlocked items which match the attributes from the secret service.The
attributesshould be a set of key and value string pairs.If this Service is
null, thenget(java.util.Set<org.gnome.secret.ServiceFlags>, org.gnome.gio.Cancellable, org.gnome.gio.AsyncReadyCallback)will be called to get the defaultServiceproxy.This method will return immediately and complete asynchronously.
- Parameters:
schema- the schema for the attributesattributes- the attribute keys and valuescancellable- optional cancellation objectcallback- called when the operation completes
-
clearFinish
Finish asynchronous operation to remove items from the secret service.- Parameters:
result- the asynchronous result passed to the callback- Returns:
- whether items were removed or not
- Throws:
GErrorException- seeGError
-
clearSync
public boolean clearSync(@Nullable Schema schema, HashTable<String, String> attributes, @Nullable Cancellable cancellable) throws GErrorExceptionRemove unlocked items which match the attributes from the secret service.The
attributesshould be a set of key and value string pairs.If this Service is
null, thengetSync(java.util.Set<org.gnome.secret.ServiceFlags>, org.gnome.gio.Cancellable)will be called to get the defaultServiceproxy.This method may block indefinitely and should not be used in user interface threads.
- Parameters:
schema- the schema for the attributesattributes- the attribute keys and valuescancellable- optional cancellation object- Returns:
- whether items were removed or not
- Throws:
GErrorException- seeGError
-
createCollectionDbusPath
public void createCollectionDbusPath(HashTable<String, Variant> properties, @Nullable String alias, Set<CollectionCreateFlags> flags, @Nullable Cancellable cancellable, @Nullable AsyncReadyCallback callback) 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
Collection.create(org.gnome.secret.Service, java.lang.String, java.lang.String, java.util.Set<org.gnome.secret.CollectionCreateFlags>, org.gnome.gio.Cancellable, org.gnome.gio.AsyncReadyCallback)which does handles this for you.An
aliasis 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 thealiasalready 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.propertiesis a set of properties for the new collection. The keys in the hash table should be interface.property strings likeorg.freedesktop.Secret.Collection.Label. The values in the hash table should beGLib.Variantvalues of the properties.If you wish to have a
This method will return immediately and complete asynchronously. The secret service may prompt the user.
prompt(org.gnome.secret.Prompt, org.gnome.glib.VariantType, org.gnome.gio.Cancellable, org.gnome.gio.AsyncReadyCallback)will be used to handle any prompts that are required.- Parameters:
properties- hash table of properties for the new collectionalias- an alias to check for before creating the new collection, or to assign to the new collectionflags- not currently usedcancellable- optional cancellation objectcallback- called when the operation completes
-
createCollectionDbusPath
public void createCollectionDbusPath(HashTable<String, Variant> properties, @Nullable String alias, CollectionCreateFlags flags, @Nullable Cancellable cancellable, @Nullable AsyncReadyCallback callback) 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
Collection.create(org.gnome.secret.Service, java.lang.String, java.lang.String, java.util.Set<org.gnome.secret.CollectionCreateFlags>, org.gnome.gio.Cancellable, org.gnome.gio.AsyncReadyCallback)which does handles this for you.An
aliasis 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 thealiasalready 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.propertiesis a set of properties for the new collection. The keys in the hash table should be interface.property strings likeorg.freedesktop.Secret.Collection.Label. The values in the hash table should beGLib.Variantvalues of the properties.If you wish to have a
This method will return immediately and complete asynchronously. The secret service may prompt the user.
prompt(org.gnome.secret.Prompt, org.gnome.glib.VariantType, org.gnome.gio.Cancellable, org.gnome.gio.AsyncReadyCallback)will be used to handle any prompts that are required.- Parameters:
properties- hash table of properties for the new collectionalias- an alias to check for before creating the new collection, or to assign to the new collectionflags- not currently usedcancellable- optional cancellation objectcallback- called when the operation completes
-
createCollectionDbusPathFinish
Finish asynchronous operation to create a new collection in the secret service.- Parameters:
result- the asynchronous result passed to the callback- Returns:
- a new string containing the D-Bus object path of the collection
- Throws:
GErrorException- seeGError
-
createCollectionDbusPathSync
public String createCollectionDbusPathSync(HashTable<String, Variant> properties, @Nullable String alias, Set<CollectionCreateFlags> flags, @Nullable Cancellable cancellable) throws GErrorExceptionCreate 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
Collection.create(org.gnome.secret.Service, java.lang.String, java.lang.String, java.util.Set<org.gnome.secret.CollectionCreateFlags>, org.gnome.gio.Cancellable, org.gnome.gio.AsyncReadyCallback)which does handles this for you.An
aliasis 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 thealiasalready 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.propertiesis a set of properties for the new collection. The keys in the hash table should be interface.property strings likeorg.freedesktop.Secret.Collection.Label. The values in the hash table should beGLib.Variantvalues of the properties.This method may block indefinitely and should not be used in user interface threads. The secret service may prompt the user.
prompt(org.gnome.secret.Prompt, org.gnome.glib.VariantType, org.gnome.gio.Cancellable, org.gnome.gio.AsyncReadyCallback)will be used to handle any prompts that are required.- Parameters:
properties- hash table of D-Bus properties for the new collectionalias- an alias to check for before creating the new collection, or to assign to the new collectionflags- not currently usedcancellable- optional cancellation object- Returns:
- a new string containing the D-Bus object path of the collection
- Throws:
GErrorException- seeGError
-
createCollectionDbusPathSync
public String createCollectionDbusPathSync(HashTable<String, Variant> properties, @Nullable String alias, CollectionCreateFlags flags, @Nullable Cancellable cancellable) throws GErrorExceptionCreate 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
Collection.create(org.gnome.secret.Service, java.lang.String, java.lang.String, java.util.Set<org.gnome.secret.CollectionCreateFlags>, org.gnome.gio.Cancellable, org.gnome.gio.AsyncReadyCallback)which does handles this for you.An
aliasis 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 thealiasalready 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.propertiesis a set of properties for the new collection. The keys in the hash table should be interface.property strings likeorg.freedesktop.Secret.Collection.Label. The values in the hash table should beGLib.Variantvalues of the properties.This method may block indefinitely and should not be used in user interface threads. The secret service may prompt the user.
prompt(org.gnome.secret.Prompt, org.gnome.glib.VariantType, org.gnome.gio.Cancellable, org.gnome.gio.AsyncReadyCallback)will be used to handle any prompts that are required.- Parameters:
properties- hash table of D-Bus properties for the new collectionalias- an alias to check for before creating the new collection, or to assign to the new collectionflags- not currently usedcancellable- optional cancellation object- Returns:
- a new string containing the D-Bus object path of the collection
- Throws:
GErrorException- seeGError
-
createItemDbusPath
public void createItemDbusPath(String collectionPath, HashTable<String, Variant> properties, Value value, Set<ItemCreateFlags> flags, @Nullable Cancellable cancellable, @Nullable AsyncReadyCallback callback) Create a new item in a secret service collection and return its D-Bus object path.It is often easier to use
Secret.passwordStore(org.gnome.secret.Schema, org.gnome.glib.HashTable<java.lang.String, java.lang.String>, java.lang.String, java.lang.String, java.lang.String, org.gnome.gio.Cancellable, org.gnome.gio.AsyncReadyCallback)orItem.create(org.gnome.secret.Collection, org.gnome.secret.Schema, org.gnome.glib.HashTable<java.lang.String, java.lang.String>, java.lang.String, org.gnome.secret.Value, java.util.Set<org.gnome.secret.ItemCreateFlags>, org.gnome.gio.Cancellable, org.gnome.gio.AsyncReadyCallback)rather than using this function. Using this method requires that you setup a correct hash table of D-Buspropertiesfor the new collection.If the
flagscontainsItemCreateFlags.REPLACE, then the secret service will search for an item matching theattributes,and update that item instead of creating a new one.propertiesis a set of properties for the new collection. The keys in the hash table should be interface.property strings likeorg.freedesktop.Secret.Item.Label. The values in the hash table should beGLib.Variantvalues of the properties.This method will return immediately and complete asynchronously. The secret service may prompt the user.
prompt(org.gnome.secret.Prompt, org.gnome.glib.VariantType, org.gnome.gio.Cancellable, org.gnome.gio.AsyncReadyCallback)will be used to handle any prompts that are required.- Parameters:
collectionPath- the D-Bus object path of the collection in which to create itemproperties- hash table of D-Bus properties for the new collectionvalue- the secret value to store in the itemflags- flags for the creation of the new itemcancellable- optional cancellation objectcallback- called when the operation completes
-
createItemDbusPath
public void createItemDbusPath(String collectionPath, HashTable<String, Variant> properties, Value value, ItemCreateFlags flags, @Nullable Cancellable cancellable, @Nullable AsyncReadyCallback callback) Create a new item in a secret service collection and return its D-Bus object path.It is often easier to use
Secret.passwordStore(org.gnome.secret.Schema, org.gnome.glib.HashTable<java.lang.String, java.lang.String>, java.lang.String, java.lang.String, java.lang.String, org.gnome.gio.Cancellable, org.gnome.gio.AsyncReadyCallback)orItem.create(org.gnome.secret.Collection, org.gnome.secret.Schema, org.gnome.glib.HashTable<java.lang.String, java.lang.String>, java.lang.String, org.gnome.secret.Value, java.util.Set<org.gnome.secret.ItemCreateFlags>, org.gnome.gio.Cancellable, org.gnome.gio.AsyncReadyCallback)rather than using this function. Using this method requires that you setup a correct hash table of D-Buspropertiesfor the new collection.If the
flagscontainsItemCreateFlags.REPLACE, then the secret service will search for an item matching theattributes,and update that item instead of creating a new one.propertiesis a set of properties for the new collection. The keys in the hash table should be interface.property strings likeorg.freedesktop.Secret.Item.Label. The values in the hash table should beGLib.Variantvalues of the properties.This method will return immediately and complete asynchronously. The secret service may prompt the user.
prompt(org.gnome.secret.Prompt, org.gnome.glib.VariantType, org.gnome.gio.Cancellable, org.gnome.gio.AsyncReadyCallback)will be used to handle any prompts that are required.- Parameters:
collectionPath- the D-Bus object path of the collection in which to create itemproperties- hash table of D-Bus properties for the new collectionvalue- the secret value to store in the itemflags- flags for the creation of the new itemcancellable- optional cancellation objectcallback- called when the operation completes
-
createItemDbusPathFinish
Finish asynchronous operation to create a new item in the secret service.- Parameters:
result- the asynchronous result passed to the callback- Returns:
- a new string containing the D-Bus object path of the item
- Throws:
GErrorException- seeGError
-
createItemDbusPathSync
public String createItemDbusPathSync(String collectionPath, HashTable<String, Variant> properties, Value value, Set<ItemCreateFlags> flags, @Nullable Cancellable cancellable) throws GErrorExceptionCreate a new item in a secret service collection and return its D-Bus object path.It is often easier to use
Secret.passwordStoreSync(org.gnome.secret.Schema, org.gnome.glib.HashTable<java.lang.String, java.lang.String>, java.lang.String, java.lang.String, java.lang.String, org.gnome.gio.Cancellable)orItem.createSync(org.gnome.secret.Collection, org.gnome.secret.Schema, org.gnome.glib.HashTable<java.lang.String, java.lang.String>, java.lang.String, org.gnome.secret.Value, java.util.Set<org.gnome.secret.ItemCreateFlags>, org.gnome.gio.Cancellable)rather than using this function. Using this method requires that you setup a correct hash table of D-Buspropertiesfor the new collection.If the
flagscontainsItemCreateFlags.REPLACE, then the secret service will search for an item matching theattributes,and update that item instead of creating a new one.propertiesis a set of properties for the new collection. The keys in the hash table should be interface.property strings likeorg.freedesktop.Secret.Item.Label. The values in the hash table should beGLib.Variantvalues of the properties.This method may block indefinitely and should not be used in user interface threads. The secret service may prompt the user.
prompt(org.gnome.secret.Prompt, org.gnome.glib.VariantType, org.gnome.gio.Cancellable, org.gnome.gio.AsyncReadyCallback)will be used to handle any prompts that are required.- Parameters:
collectionPath- the D-Bus path of the collection in which to create itemproperties- hash table of D-Bus properties for the new collectionvalue- the secret value to store in the itemflags- flags for the creation of the new itemcancellable- optional cancellation object- Returns:
- a new string containing the D-Bus object path of the item
- Throws:
GErrorException- seeGError
-
createItemDbusPathSync
public String createItemDbusPathSync(String collectionPath, HashTable<String, Variant> properties, Value value, ItemCreateFlags flags, @Nullable Cancellable cancellable) throws GErrorExceptionCreate a new item in a secret service collection and return its D-Bus object path.It is often easier to use
Secret.passwordStoreSync(org.gnome.secret.Schema, org.gnome.glib.HashTable<java.lang.String, java.lang.String>, java.lang.String, java.lang.String, java.lang.String, org.gnome.gio.Cancellable)orItem.createSync(org.gnome.secret.Collection, org.gnome.secret.Schema, org.gnome.glib.HashTable<java.lang.String, java.lang.String>, java.lang.String, org.gnome.secret.Value, java.util.Set<org.gnome.secret.ItemCreateFlags>, org.gnome.gio.Cancellable)rather than using this function. Using this method requires that you setup a correct hash table of D-Buspropertiesfor the new collection.If the
flagscontainsItemCreateFlags.REPLACE, then the secret service will search for an item matching theattributes,and update that item instead of creating a new one.propertiesis a set of properties for the new collection. The keys in the hash table should be interface.property strings likeorg.freedesktop.Secret.Item.Label. The values in the hash table should beGLib.Variantvalues of the properties.This method may block indefinitely and should not be used in user interface threads. The secret service may prompt the user.
prompt(org.gnome.secret.Prompt, org.gnome.glib.VariantType, org.gnome.gio.Cancellable, org.gnome.gio.AsyncReadyCallback)will be used to handle any prompts that are required.- Parameters:
collectionPath- the D-Bus path of the collection in which to create itemproperties- hash table of D-Bus properties for the new collectionvalue- the secret value to store in the itemflags- flags for the creation of the new itemcancellable- optional cancellation object- Returns:
- a new string containing the D-Bus object path of the item
- Throws:
GErrorException- seeGError
-
decodeDbusSecret
Decode aValueintoGLib.Variantreceived with the Secret Service DBus API.The
GLib.Variantshould have a(oayays)signature.A session must have already been established by the
Service, and the encoded secret must be valid for that session.- Parameters:
value- the encoded secret- Returns:
- the decoded secret value
-
deleteItemDbusPath
public void deleteItemDbusPath(String itemPath, @Nullable Cancellable cancellable, @Nullable AsyncReadyCallback callback) Delete a secret item from the secret service.The item is represented by its D-Bus object path. If you already have a
Itemproxy objects, use useItem.delete(org.gnome.gio.Cancellable, org.gnome.gio.AsyncReadyCallback)instead.This method will return immediately and complete asynchronously.
- Parameters:
itemPath- the D-Bus path of item to deletecancellable- optional cancellation objectcallback- called when the operation completes
-
deleteItemDbusPathFinish
Complete an asynchronous operation to delete a secret item from the secret service.- Parameters:
result- the asynchronous result passed to the callback- Returns:
- whether the deletion was successful or not
- Throws:
GErrorException- seeGError
-
deleteItemDbusPathSync
public boolean deleteItemDbusPathSync(String itemPath, @Nullable Cancellable cancellable) throws GErrorException Delete a secret item from the secret service.The item is represented by its D-Bus object path. If you already have a
Itemproxy objects, use useItem.deleteSync(org.gnome.gio.Cancellable)instead.This method may block indefinitely and should not be used in user interface threads.
- Parameters:
itemPath- the D-Bus path of item to deletecancellable- optional cancellation object- Returns:
- whether the deletion was successful or not
- Throws:
GErrorException- seeGError
-
encodeDbusSecret
Encodes aValueintoGLib.Variantfor use with the Secret Service DBus API.The resulting
GLib.Variantwill have a(oayays)signature.A session must have already been established by the
Service.- Parameters:
value- the secret value- Returns:
- the encoded secret
-
ensureSession
Ensure that theSecretServiceproxy 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_SESSIONtoget(java.util.Set<org.gnome.secret.ServiceFlags>, org.gnome.gio.Cancellable, org.gnome.gio.AsyncReadyCallback)in order to ensure that a session has been established by the time you get theSecretServiceproxy.This method will return immediately and complete asynchronously.
- Parameters:
cancellable- optional cancellation objectcallback- called when the operation completes
-
ensureSessionFinish
Finish an asynchronous operation to ensure that theSecretServiceproxy has established a session with the Secret Service.- Parameters:
result- the asynchronous result passed to the callback- Returns:
- whether a session is established or not
- Throws:
GErrorException- seeGError
-
ensureSessionSync
Ensure that theSecretServiceproxy 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_SESSIONtogetSync(java.util.Set<org.gnome.secret.ServiceFlags>, org.gnome.gio.Cancellable)in order to ensure that a session has been established by the time you get theSecretServiceproxy.This method may block indefinitely and should not be used in user interface threads.
- Parameters:
cancellable- optional cancellation object- Returns:
- whether a session is established or not
- Throws:
GErrorException- seeGError
-
getCollectionGtype
Get the GObject type for collections instantiated by this service.This will always be either
Collectionor derived from it.- Returns:
- the gobject type for collections
-
getCollections
Get a list ofCollectionobjects representing all the collections in the secret service.If the
ServiceFlags.LOAD_COLLECTIONSflag was not specified when initializingSecretServiceproxy object, then this method will returnnull. UseloadCollections(org.gnome.gio.Cancellable, org.gnome.gio.AsyncReadyCallback)to load the collections.- Returns:
- a list of the collections in the secret service
-
getServiceFlags
Get the flags representing what features of theSecretServiceproxy have been initialized.Use
ensureSession(org.gnome.gio.Cancellable, org.gnome.gio.AsyncReadyCallback)orloadCollections(org.gnome.gio.Cancellable, org.gnome.gio.AsyncReadyCallback)to initialize further features and change the flags.- Returns:
- the flags for features initialized
-
getItemGtype
-
getSecretForDbusPath
public void getSecretForDbusPath(String itemPath, @Nullable Cancellable cancellable, @Nullable AsyncReadyCallback callback) 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
Itemproxy object, use useItem.getSecret()to more simply get its secret value.This function returns immediately and completes asynchronously.
- Parameters:
itemPath- the D-Bus path to item to retrieve secret forcancellable- optional cancellation objectcallback- called when the operation completes
-
getSecretForDbusPathFinish
Complete asynchronous operation to get the secret value for an secret item stored in the service.Will return
nullif the item is locked.- Parameters:
result- asynchronous result passed to callback- Returns:
- the newly allocated secret value
for the item, which should be released with
Value.unref() - Throws:
GErrorException- seeGError
-
getSecretForDbusPathSync
public @Nullable Value getSecretForDbusPathSync(String itemPath, @Nullable Cancellable cancellable) throws GErrorException 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
Itemproxy object, use useItem.loadSecretSync(org.gnome.gio.Cancellable)to more simply get its secret value.This method may block indefinitely and should not be used in user interface threads.
Will return
nullif the item is locked.- Parameters:
itemPath- the D-Bus path to item to retrieve secret forcancellable- optional cancellation object- Returns:
- the newly allocated secret value
the item, which should be released with
Value.unref() - Throws:
GErrorException- seeGError
-
getSecretsForDbusPaths
public void getSecretsForDbusPaths(String[] itemPaths, @Nullable Cancellable cancellable, @Nullable AsyncReadyCallback callback) 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
Itemproxy objects, use useItem.loadSecrets(org.gnome.glib.List<org.gnome.secret.Item>, org.gnome.gio.Cancellable, org.gnome.gio.AsyncReadyCallback)to more simply get their secret values.This function returns immediately and completes asynchronously.
- Parameters:
itemPaths- the D-Bus paths to items to retrieve secrets forcancellable- optional cancellation objectcallback- called when the operation completes
-
getSecretsForDbusPathsFinish
public HashTable<String,Value> getSecretsForDbusPathsFinish(AsyncResult result) throws GErrorException Complete asynchronous operation to get the secret values for an secret items stored in the service.Items that are locked will not be included the results.
- Parameters:
result- asynchronous result passed to callback- Returns:
- a newly
allocated hash table of item path keys to
Valuevalues. - Throws:
GErrorException- seeGError
-
getSecretsForDbusPathsSync
public HashTable<String,Value> getSecretsForDbusPathsSync(String[] itemPaths, @Nullable Cancellable cancellable) throws GErrorException 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
Itemproxy objects, use useItem.loadSecretsSync(org.gnome.glib.List<org.gnome.secret.Item>, org.gnome.gio.Cancellable)to more simply get their secret values.This method may block indefinitely and should not be used in user interface threads.
Items that are locked will not be included the results.
- Parameters:
itemPaths- the D-Bus paths to items to retrieve secrets forcancellable- optional cancellation object- Returns:
- a newly
allocated hash table of item_path keys to
Valuevalues. - Throws:
GErrorException- seeGError
-
getSessionAlgorithms
Get the set of algorithms being used to transfer secrets between this secret service proxy and the Secret Service itself.This will be
nullif no session has been established. UseensureSession(org.gnome.gio.Cancellable, org.gnome.gio.AsyncReadyCallback)to establish a session.- Returns:
- a string representing the algorithms for transferring secrets
-
getSessionDbusPath
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
nullif no session has been established. UseensureSession(org.gnome.gio.Cancellable, org.gnome.gio.AsyncReadyCallback)to establish a session.- Returns:
- a string representing the D-Bus object path of the session
-
loadCollections
public void loadCollections(@Nullable Cancellable cancellable, @Nullable AsyncReadyCallback callback) Ensure that theSecretServiceproxy has loaded all the collections present in the Secret Service.This affects the result of
getCollections().You can also pass the
ServiceFlags.LOAD_COLLECTIONStogetSync(java.util.Set<org.gnome.secret.ServiceFlags>, org.gnome.gio.Cancellable)in order to ensure that the collections have been loaded by the time you get theSecretServiceproxy.This method will return immediately and complete asynchronously.
- Parameters:
cancellable- optional cancellation objectcallback- called when the operation completes
-
loadCollectionsFinish
Complete an asynchronous operation to ensure that theSecretServiceproxy has loaded all the collections present in the Secret Service.- Parameters:
result- the asynchronous result passed to the callback- Returns:
- whether the load was successful or not
- Throws:
GErrorException- seeGError
-
loadCollectionsSync
Ensure that theSecretServiceproxy has loaded all the collections present in the Secret Service.This affects the result of
getCollections().You can also pass the
ServiceFlags.LOAD_COLLECTIONStogetSync(java.util.Set<org.gnome.secret.ServiceFlags>, org.gnome.gio.Cancellable)in order to ensure that the collections have been loaded by the time you get theSecretServiceproxy.This method may block indefinitely and should not be used in user interface threads.
- Parameters:
cancellable- optional cancellation object- Returns:
- whether the load was successful or not
- Throws:
GErrorException- seeGError
-
lock
public void lock(List<DBusProxy> objects, @Nullable Cancellable cancellable, @Nullable AsyncReadyCallback callback) 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 this Service is
null, thenget(java.util.Set<org.gnome.secret.ServiceFlags>, org.gnome.gio.Cancellable, org.gnome.gio.AsyncReadyCallback)will be called to get the defaultServiceproxy.This method returns immediately and completes asynchronously. The secret service may prompt the user.
prompt(org.gnome.secret.Prompt, org.gnome.glib.VariantType, org.gnome.gio.Cancellable, org.gnome.gio.AsyncReadyCallback)will be used to handle any prompts that show up.- Parameters:
objects- the items or collections to lockcancellable- optional cancellation objectcallback- called when the operation completes
-
lockDbusPaths
public void lockDbusPaths(@Nullable String @Nullable [] paths, @Nullable Cancellable cancellable, @Nullable AsyncReadyCallback callback) Lock items or collections in the secret service.The items or collections are represented by their D-Bus object paths. If you already have
ItemandCollectionproxy objects, use uselock(org.gnome.glib.List<org.gnome.gio.DBusProxy>, org.gnome.gio.Cancellable, org.gnome.gio.AsyncReadyCallback)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.
prompt(org.gnome.secret.Prompt, org.gnome.glib.VariantType, org.gnome.gio.Cancellable, org.gnome.gio.AsyncReadyCallback)will be used to handle any prompts that show up.- Parameters:
paths- the D-Bus paths for items or collections to lockcancellable- optional cancellation objectcallback- called when the operation completes
-
lockDbusPathsFinish
public int lockDbusPathsFinish(AsyncResult result, @Nullable Out<String[]> locked) throws GErrorException Complete asynchronous operation to 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.
- Parameters:
result- asynchronous result passed to the callbacklocked- location to place array of D-Bus paths of items or collections that were locked- Returns:
- the number of items or collections that were locked
- Throws:
GErrorException- seeGError
-
lockDbusPathsSync
public int lockDbusPathsSync(@Nullable String @Nullable [] paths, @Nullable Cancellable cancellable, @Nullable Out<String[]> locked) throws GErrorException Lock items or collections in the secret service.The items or collections are represented by their D-Bus object paths. If you already have
ItemandCollectionproxy objects, use uselockSync(org.gnome.glib.List<org.gnome.gio.DBusProxy>, org.gnome.gio.Cancellable, org.javagi.base.Out<org.gnome.glib.List<org.gnome.gio.DBusProxy>>)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.
prompt(org.gnome.secret.Prompt, org.gnome.glib.VariantType, org.gnome.gio.Cancellable, org.gnome.gio.AsyncReadyCallback)will be used to handle any prompts that show up.- Parameters:
paths- the D-Bus object paths of the items or collections to lockcancellable- optional cancellation objectlocked- location to place array of D-Bus paths of items or collections that were locked- Returns:
- the number of items or collections that were locked
- Throws:
GErrorException- seeGError
-
lockFinish
public int lockFinish(AsyncResult result, @Nullable Out<List<DBusProxy>> locked) throws GErrorException Complete asynchronous operation to 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.
- Parameters:
result- asynchronous result passed to the callbacklocked- location to place list of items or collections that were locked- Returns:
- the number of items or collections that were locked
- Throws:
GErrorException- seeGError
-
lockSync
public int lockSync(List<DBusProxy> objects, @Nullable Cancellable cancellable, @Nullable Out<List<DBusProxy>> locked) throws GErrorException 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 this Service is
null, thengetSync(java.util.Set<org.gnome.secret.ServiceFlags>, org.gnome.gio.Cancellable)will be called to get the defaultServiceproxy.This method may block indefinitely and should not be used in user interface threads. The secret service may prompt the user.
prompt(org.gnome.secret.Prompt, org.gnome.glib.VariantType, org.gnome.gio.Cancellable, org.gnome.gio.AsyncReadyCallback)will be used to handle any prompts that show up.- Parameters:
objects- the items or collections to lockcancellable- optional cancellation objectlocked- location to place list of items or collections that were locked- Returns:
- the number of items or collections that were locked
- Throws:
GErrorException- seeGError
-
lookup
public void lookup(@Nullable Schema schema, HashTable<String, String> attributes, @Nullable Cancellable cancellable, @Nullable AsyncReadyCallback callback) Lookup a secret value in the secret service.The
attributesshould be a set of key and value string pairs.If this Service is
null, thenget(java.util.Set<org.gnome.secret.ServiceFlags>, org.gnome.gio.Cancellable, org.gnome.gio.AsyncReadyCallback)will be called to get the defaultServiceproxy.This method will return immediately and complete asynchronously.
- Parameters:
schema- the schema for the attributesattributes- the attribute keys and valuescancellable- optional cancellation objectcallback- called when the operation completes
-
lookupFinish
Finish asynchronous operation to lookup a secret value in the secret service.If no secret is found then
nullis returned.- Parameters:
result- the asynchronous result passed to the callback- Returns:
- a newly allocated
Value, which should be released withValue.unref(), ornullif no secret found - Throws:
GErrorException- seeGError
-
lookupSync
public Value lookupSync(@Nullable Schema schema, HashTable<String, String> attributes, @Nullable Cancellable cancellable) throws GErrorExceptionLookup a secret value in the secret service.The
attributesshould be a set of key and value string pairs.If this Service is
null, thengetSync(java.util.Set<org.gnome.secret.ServiceFlags>, org.gnome.gio.Cancellable)will be called to get the defaultServiceproxy.This method may block indefinitely and should not be used in user interface threads.
- Parameters:
schema- the schema for the attributesattributes- the attribute keys and valuescancellable- optional cancellation object- Returns:
- a newly allocated
Value, which should be released withValue.unref(), ornullif no secret found - Throws:
GErrorException- seeGError
-
prompt
public void prompt(Prompt prompt, @Nullable VariantType returnType, @Nullable Cancellable cancellable, @Nullable AsyncReadyCallback callback) Perform prompting for aPrompt.This function is called by other parts of this library to handle prompts for the various actions that can require prompting.
Override the
SecretServiceClasspromptAsync(org.gnome.secret.Prompt, org.gnome.glib.VariantType, org.gnome.gio.Cancellable, org.gnome.gio.AsyncReadyCallback)virtual method to change the behavior of the prompting. The default behavior is to simply runPrompt.perform(java.lang.String, org.gnome.glib.VariantType, org.gnome.gio.Cancellable, org.gnome.gio.AsyncReadyCallback)on the prompt.- Parameters:
prompt- the promptreturnType- the variant type of the prompt resultcancellable- optional cancellation objectcallback- called when the operation completes
-
promptAtDbusPath
public void promptAtDbusPath(String promptPath, @Nullable VariantType returnType, @Nullable Cancellable cancellable, @Nullable AsyncReadyCallback callback) Perform prompting for aPrompt.This function is called by other parts of this library to handle prompts for the various actions that can require prompting.
Override the
SecretServiceClasspromptAsync(org.gnome.secret.Prompt, org.gnome.glib.VariantType, org.gnome.gio.Cancellable, org.gnome.gio.AsyncReadyCallback)virtual method to change the behavior of the propmting. The default behavior is to simply runPrompt.perform(java.lang.String, org.gnome.glib.VariantType, org.gnome.gio.Cancellable, org.gnome.gio.AsyncReadyCallback)on the prompt.- Parameters:
promptPath- the D-Bus object path of the promptreturnType- the variant type of the prompt resultcancellable- optional cancellation objectcallback- called when the operation completes
-
promptAtDbusPathFinish
Complete asynchronous operation to perform prompting for aPrompt.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.
- Parameters:
result- the asynchronous result passed to the callback- Returns:
nullif the prompt was dismissed or an error occurred, a variant result if the prompt was successful- Throws:
GErrorException- seeGError
-
promptAtDbusPathSync
public @Nullable Variant promptAtDbusPathSync(String promptPath, @Nullable Cancellable cancellable, @Nullable VariantType returnType) throws GErrorException Perform prompting for aPrompt.Override the
SecretServiceClasspromptAsync(org.gnome.secret.Prompt, org.gnome.glib.VariantType, org.gnome.gio.Cancellable, org.gnome.gio.AsyncReadyCallback)virtual method to change the behavior of the propmting. The default behavior is to simply runPrompt.perform(java.lang.String, org.gnome.glib.VariantType, org.gnome.gio.Cancellable, org.gnome.gio.AsyncReadyCallback)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.
- Parameters:
promptPath- the D-Bus object path of the promptcancellable- optional cancellation objectreturnType- the variant type of the prompt result- Returns:
nullif the prompt was dismissed or an error occurred, a variant result if the prompt was successful- Throws:
GErrorException- seeGError
-
promptFinish
Complete asynchronous operation to perform prompting for aPrompt.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.
- Parameters:
result- the asynchronous result passed to the callback- Returns:
nullif the prompt was dismissed or an error occurred, a variant result if the prompt was successful- Throws:
GErrorException- seeGError
-
promptSync
public Variant promptSync(Prompt prompt, @Nullable Cancellable cancellable, VariantType returnType) throws GErrorException Perform prompting for aPrompt.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
SecretServiceClasspromptSync(org.gnome.secret.Prompt, org.gnome.gio.Cancellable, org.gnome.glib.VariantType)virtual method to change the behavior of the prompting. The default behavior is to simply runPrompt.performSync(java.lang.String, org.gnome.gio.Cancellable, org.gnome.glib.VariantType)on the prompt with anullwindow_id.- Parameters:
prompt- the promptcancellable- optional cancellation objectreturnType- the variant type of the prompt result- Returns:
nullif the prompt was dismissed or an error occurred, a variant result if the prompt was successful- Throws:
GErrorException- seeGError
-
readAliasDbusPath
public void readAliasDbusPath(String alias, @Nullable Cancellable cancellable, @Nullable AsyncReadyCallback callback) 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.
- Parameters:
alias- the alias to lookupcancellable- optional cancellation objectcallback- called when the operation completes
-
readAliasDbusPathFinish
Finish an asynchronous operation to lookup which collection is assigned to an alias.This method returns the DBus object path of the collection
- Parameters:
result- asynchronous result passed to callback- Returns:
- the collection dbus object path,
or
nullif none assigned to the alias - Throws:
GErrorException- seeGError
-
readAliasDbusPathSync
public @Nullable String readAliasDbusPathSync(String alias, @Nullable Cancellable cancellable) throws GErrorException 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.
- Parameters:
alias- the alias to lookupcancellable- optional cancellation object- Returns:
- the collection dbus object path,
or
nullif none assigned to the alias - Throws:
GErrorException- seeGError
-
search
public void search(@Nullable Schema schema, HashTable<String, String> attributes, Set<SearchFlags> flags, @Nullable Cancellable cancellable, @Nullable AsyncReadyCallback callback) Search for items matching theattributes.All collections are searched. The
attributesshould be a table of string keys and string values.If this Service is
null, thenget(java.util.Set<org.gnome.secret.ServiceFlags>, org.gnome.gio.Cancellable, org.gnome.gio.AsyncReadyCallback)will be called to get the defaultServiceproxy.If
SearchFlags.ALLis set inflags,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.UNLOCKis set inflags,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_SECRETSis set inflags,then the items will have their secret values loaded and available viaItem.getSecret().This function returns immediately and completes asynchronously.
- Parameters:
schema- the schema for the attributesattributes- search for items matching these attributesflags- search option flagscancellable- optional cancellation objectcallback- called when the operation completes
-
search
public void search(@Nullable Schema schema, HashTable<String, String> attributes, SearchFlags flags, @Nullable Cancellable cancellable, @Nullable AsyncReadyCallback callback) Search for items matching theattributes.All collections are searched. The
attributesshould be a table of string keys and string values.If this Service is
null, thenget(java.util.Set<org.gnome.secret.ServiceFlags>, org.gnome.gio.Cancellable, org.gnome.gio.AsyncReadyCallback)will be called to get the defaultServiceproxy.If
SearchFlags.ALLis set inflags,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.UNLOCKis set inflags,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_SECRETSis set inflags,then the items will have their secret values loaded and available viaItem.getSecret().This function returns immediately and completes asynchronously.
- Parameters:
schema- the schema for the attributesattributes- search for items matching these attributesflags- search option flagscancellable- optional cancellation objectcallback- called when the operation completes
-
searchFinish
Complete asynchronous operation to search for items.- Parameters:
result- asynchronous result passed to callback- Returns:
- a list of items that matched the search
- Throws:
GErrorException- seeGError
-
searchForDbusPaths
public void searchForDbusPaths(@Nullable Schema schema, HashTable<String, String> attributes, @Nullable Cancellable cancellable, @Nullable AsyncReadyCallback callback) Search for items matching theattributes,and return their D-Bus object paths.All collections are searched. The
attributesshould be a table of string keys and string values.This function returns immediately and completes asynchronously.
When your callback is called use
searchForDbusPathsFinish(org.gnome.gio.AsyncResult, org.javagi.base.Out<java.lang.String[]>, org.javagi.base.Out<java.lang.String[]>)to get the results of this function. Only the D-Bus object paths of the items will be returned. If you would likeItemobjects to be returned instead, then use thesearch(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)function.- Parameters:
schema- the schema for the attributesattributes- search for items matching these attributescancellable- optional cancellation objectcallback- called when the operation completes
-
searchForDbusPathsFinish
public boolean searchForDbusPathsFinish(AsyncResult result, @Nullable Out<String[]> unlocked, @Nullable Out<String[]> locked) throws GErrorException Complete asynchronous operation to search for items, and return their D-Bus object paths.Matching items that are locked or unlocked, have their D-Bus paths placed in the
lockedorunlockedarrays respectively.D-Bus object paths of the items will be returned in the
unlockedorlockedarrays. If you would to haveItemobjects to be returned instead, then us thesearch(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)andsearchFinish(org.gnome.gio.AsyncResult)functions.- Parameters:
result- asynchronous result passed to callbackunlocked- location to place an array of D-Bus object paths for matching items which were locked.locked- location to place an array of D-Bus object paths for matching items which were locked.- Returns:
- whether the search was successful or not
- Throws:
GErrorException- seeGError
-
searchForDbusPathsSync
public boolean searchForDbusPathsSync(@Nullable Schema schema, HashTable<String, String> attributes, @Nullable Cancellable cancellable, @Nullable Out<String[]> unlocked, @Nullable Out<String[]> locked) throws GErrorExceptionSearch for items matching theattributes,and return their D-Bus object paths.All collections are searched. The
attributesshould be a table of string keys and string values.This function may block indefinitely. Use the asynchronous version in user interface threads.
Matching items that are locked or unlocked, have their D-Bus paths placed in the
lockedorunlockedarrays respectively.D-Bus object paths of the items will be returned in the
unlockedorlockedarrays. If you would to haveItemobjects to be returned instead, then use thesearchSync(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)function.- Parameters:
schema- the schema for the attributesattributes- search for items matching these attributescancellable- optional cancellation objectunlocked- location to place an array of D-Bus object paths for matching items which were locked.locked- location to place an array of D-Bus object paths for matching items which were locked.- Returns:
- whether the search was successful or not
- Throws:
GErrorException- seeGError
-
searchSync
public List<Item> searchSync(@Nullable Schema schema, HashTable<String, String> attributes, Set<SearchFlags> flags, @Nullable Cancellable cancellable) throws GErrorExceptionSearch for items matching theattributes.All collections are searched. The
attributesshould be a table of string keys and string values.If this Service is
null, thengetSync(java.util.Set<org.gnome.secret.ServiceFlags>, org.gnome.gio.Cancellable)will be called to get the defaultServiceproxy.If
SearchFlags.ALLis set inflags,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.UNLOCKis set inflags,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_SECRETSis set inflags,then the items' secret values will be loaded for any unlocked items. Loaded item secret values are available viaItem.getSecret(). If the load of a secret values fail, then theThis function may block indefinitely. Use the asynchronous version in user interface threads.
- Parameters:
schema- the schema for the attributesattributes- search for items matching these attributesflags- search option flagscancellable- optional cancellation object- Returns:
- a list of items that matched the search
- Throws:
GErrorException- seeGError
-
searchSync
public List<Item> searchSync(@Nullable Schema schema, HashTable<String, String> attributes, SearchFlags flags, @Nullable Cancellable cancellable) throws GErrorExceptionSearch for items matching theattributes.All collections are searched. The
attributesshould be a table of string keys and string values.If this Service is
null, thengetSync(java.util.Set<org.gnome.secret.ServiceFlags>, org.gnome.gio.Cancellable)will be called to get the defaultServiceproxy.If
SearchFlags.ALLis set inflags,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.UNLOCKis set inflags,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_SECRETSis set inflags,then the items' secret values will be loaded for any unlocked items. Loaded item secret values are available viaItem.getSecret(). If the load of a secret values fail, then theThis function may block indefinitely. Use the asynchronous version in user interface threads.
- Parameters:
schema- the schema for the attributesattributes- search for items matching these attributesflags- search option flagscancellable- optional cancellation object- Returns:
- a list of items that matched the search
- Throws:
GErrorException- seeGError
-
setAlias
public void setAlias(String alias, @Nullable Collection collection, @Nullable Cancellable cancellable, @Nullable AsyncReadyCallback callback) Assign a collection to this alias.Aliases help determine well known collections, such as 'default'.
If this Service is
null, thenget(java.util.Set<org.gnome.secret.ServiceFlags>, org.gnome.gio.Cancellable, org.gnome.gio.AsyncReadyCallback)will be called to get the defaultServiceproxy.This method will return immediately and complete asynchronously.
- Parameters:
alias- the alias to assign the collection tocollection- the collection to assign to the aliascancellable- optional cancellation objectcallback- called when the operation completes
-
setAliasFinish
Finish an asynchronous operation to assign a collection to an alias.- Parameters:
result- asynchronous result passed to callback- Returns:
trueif successful- Throws:
GErrorException- seeGError
-
setAliasSync
public boolean setAliasSync(String alias, @Nullable Collection collection, @Nullable Cancellable cancellable) throws GErrorException Assign a collection to this alias. Aliases help determine well known collections, such as 'default'.If this Service is
null, thengetSync(java.util.Set<org.gnome.secret.ServiceFlags>, org.gnome.gio.Cancellable)will be called to get the defaultServiceproxy.This method may block and should not be used in user interface threads.
- Parameters:
alias- the alias to assign the collection tocollection- the collection to assign to the aliascancellable- optional cancellation object- Returns:
trueif successful- Throws:
GErrorException- seeGError
-
setAliasToDbusPath
public void setAliasToDbusPath(String alias, @Nullable String collectionPath, @Nullable Cancellable cancellable, @Nullable AsyncReadyCallback callback) 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.
- Parameters:
alias- the alias to assign the collection tocollectionPath- the dbus object path of the collection to assign to the aliascancellable- optional cancellation objectcallback- called when the operation completes
-
setAliasToDbusPathFinish
Finish an asynchronous operation to assign a collection to an alias.- Parameters:
result- asynchronous result passed to callback- Returns:
trueif successful- Throws:
GErrorException- seeGError
-
setAliasToDbusPathSync
public boolean setAliasToDbusPathSync(String alias, @Nullable String collectionPath, @Nullable Cancellable cancellable) throws GErrorException 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.
- Parameters:
alias- the alias to assign the collection tocollectionPath- the D-Bus object path of the collection to assign to the aliascancellable- optional cancellation object- Returns:
trueif successful- Throws:
GErrorException- seeGError
-
store
public void store(@Nullable Schema schema, HashTable<String, String> attributes, @Nullable String collection, String label, Value value, @Nullable Cancellable cancellable, @Nullable AsyncReadyCallback callback) Store a secret value in the secret service.The
attributesshould 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 this Service is
null, thenget(java.util.Set<org.gnome.secret.ServiceFlags>, org.gnome.gio.Cancellable, org.gnome.gio.AsyncReadyCallback)will be called to get the defaultServiceproxy.If
collectionis not specified, then the default collection will be used. UseCOLLECTION_SESSIONto store the password in the session collection, which doesn't get stored across login sessions.This method will return immediately and complete asynchronously.
- Parameters:
schema- the schema to use to check attributesattributes- the attribute keys and valuescollection- a collection alias, or D-Bus object path of the collection where to store the secretlabel- label for the secretvalue- the secret valuecancellable- optional cancellation objectcallback- called when the operation completes
-
storeFinish
Finish asynchronous operation to store a secret value in the secret service.- Parameters:
result- the asynchronous result passed to the callback- Returns:
- whether the storage was successful or not
- Throws:
GErrorException- seeGError
-
storeSync
public boolean storeSync(@Nullable Schema schema, HashTable<String, String> attributes, @Nullable String collection, String label, Value value, @Nullable Cancellable cancellable) throws GErrorExceptionStore a secret value in the secret service.The
attributesshould 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
collectionisnull, then the default collection will be used. UseCOLLECTION_SESSIONto store the password in the session collection, which doesn't get stored across login sessions.If this Service is
null, thengetSync(java.util.Set<org.gnome.secret.ServiceFlags>, org.gnome.gio.Cancellable)will be called to get the defaultServiceproxy.This method may block indefinitely and should not be used in user interface threads.
- Parameters:
schema- the schema for the attributesattributes- the attribute keys and valuescollection- a collection alias, or D-Bus object path of the collection where to store the secretlabel- label for the secretvalue- the secret valuecancellable- optional cancellation object- Returns:
- whether the storage was successful or not
- Throws:
GErrorException- seeGError
-
unlock
public void unlock(List<DBusProxy> objects, @Nullable Cancellable cancellable, @Nullable AsyncReadyCallback callback) 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 this Service is
null, thenget(java.util.Set<org.gnome.secret.ServiceFlags>, org.gnome.gio.Cancellable, org.gnome.gio.AsyncReadyCallback)will be called to get the defaultServiceproxy.This method may block indefinitely and should not be used in user interface threads. The secret service may prompt the user.
prompt(org.gnome.secret.Prompt, org.gnome.glib.VariantType, org.gnome.gio.Cancellable, org.gnome.gio.AsyncReadyCallback)will be used to handle any prompts that show up.- Parameters:
objects- the items or collections to unlockcancellable- optional cancellation objectcallback- called when the operation completes
-
unlockDbusPaths
public void unlockDbusPaths(@Nullable String @Nullable [] paths, @Nullable Cancellable cancellable, @Nullable AsyncReadyCallback callback) Unlock items or collections in the secret service.The items or collections are represented by their D-Bus object paths. If you already have
ItemandCollectionproxy objects, use useunlock(org.gnome.glib.List<org.gnome.gio.DBusProxy>, org.gnome.gio.Cancellable, org.gnome.gio.AsyncReadyCallback)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.
prompt(org.gnome.secret.Prompt, org.gnome.glib.VariantType, org.gnome.gio.Cancellable, org.gnome.gio.AsyncReadyCallback)will be used to handle any prompts that show up.- Parameters:
paths- the D-Bus paths for items or collections to unlockcancellable- optional cancellation objectcallback- called when the operation completes
-
unlockDbusPathsFinish
public int unlockDbusPathsFinish(AsyncResult result, @Nullable Out<String[]> unlocked) throws GErrorException Complete asynchronous operation to 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.
- Parameters:
result- asynchronous result passed to the callbackunlocked- location to place array of D-Bus paths of items or collections that were unlocked- Returns:
- the number of items or collections that were unlocked
- Throws:
GErrorException- seeGError
-
unlockDbusPathsSync
public int unlockDbusPathsSync(@Nullable String @Nullable [] paths, @Nullable Cancellable cancellable, @Nullable Out<String[]> unlocked) throws GErrorException Unlock items or collections in the secret service.The items or collections are represented by their D-Bus object paths. If you already have
ItemandCollectionproxy objects, use useunlockSync(org.gnome.glib.List<org.gnome.gio.DBusProxy>, org.gnome.gio.Cancellable, org.javagi.base.Out<org.gnome.glib.List<org.gnome.gio.DBusProxy>>)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(org.gnome.secret.Prompt, org.gnome.glib.VariantType, org.gnome.gio.Cancellable, org.gnome.gio.AsyncReadyCallback)will be used to handle any prompts that show up.- Parameters:
paths- the D-Bus object paths of the items or collections to unlockcancellable- optional cancellation objectunlocked- location to place array of D-Bus paths of items or collections that were unlocked- Returns:
- the number of items or collections that were unlocked
- Throws:
GErrorException- seeGError
-
unlockFinish
public int unlockFinish(AsyncResult result, @Nullable Out<List<DBusProxy>> unlocked) throws GErrorException Complete asynchronous operation to 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.
- Parameters:
result- asynchronous result passed to the callbackunlocked- location to place list of items or collections that were unlocked- Returns:
- the number of items or collections that were unlocked
- Throws:
GErrorException- seeGError
-
unlockSync
public int unlockSync(List<DBusProxy> objects, @Nullable Cancellable cancellable, @Nullable Out<List<DBusProxy>> unlocked) throws GErrorException 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 this Service is
null, thengetSync(java.util.Set<org.gnome.secret.ServiceFlags>, org.gnome.gio.Cancellable)will be called to get the defaultServiceproxy.This method may block indefinitely and should not be used in user interface threads. The secret service may prompt the user.
prompt(org.gnome.secret.Prompt, org.gnome.glib.VariantType, org.gnome.gio.Cancellable, org.gnome.gio.AsyncReadyCallback)will be used to handle any prompts that show up.- Parameters:
objects- the items or collections to unlockcancellable- optional cancellation objectunlocked- location to place list of items or collections that were unlocked- Returns:
- the number of items or collections that were unlocked
- Throws:
GErrorException- seeGError
-
promptAsync
protected void promptAsync(Prompt prompt, VariantType returnType, @Nullable Cancellable cancellable, @Nullable AsyncReadyCallback callback) called to perform asynchronous prompting when necessary -
builder
AService.Builderobject constructs aServicewith the specified properties. Use the variousset...()methods to set properties, and finish construction withService.Builder.build().- Returns:
- the builder object
-