Class: Secret::Service

Inherits:
Gio::DBusProxy
  • Object
show all
Defined in:
(unknown)

Overview

The class for Secret::Service.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.disconnectnil

Disconnect the default Secret::Service proxy returned by [funcService.get] and [funcService.get_sync].

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.

Returns:

  • (nil)

.get(flags, cancellable, callback, user_data) ⇒ nil

Get a Secret::Service proxy for the Secret Service.

If such a proxy object already exists, then the same proxy is returned.

If flags contains 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 (Secret::ServiceFlags)

    flags for which service functionality to ensure is initialized

  • cancellable (Gio::Cancellable)

    optional cancellation object

  • callback (Gio::AsyncReadyCallback)

    called when the operation completes

  • user_data (GObject)

    data to be passed to the callback

Returns:

  • (nil)

.get_finish(result) ⇒ Secret::Service

Complete an asynchronous operation to get a Secret::Service proxy for the Secret Service.

Parameters:

  • result (Gio::AsyncResult)

    the asynchronous result passed to the callback

Returns:

  • (Secret::Service)

    a new reference to a Secret::Service proxy, which should be released with [methodGObject.Object.unref].

.get_sync(flags, cancellable) ⇒ Secret::Service

Get a Secret::Service proxy for the Secret Service.

If such a proxy object already exists, then the same proxy is returned.

If flags contains 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 (Secret::ServiceFlags)

    flags for which service functionality to ensure is initialized

  • cancellable (Gio::Cancellable)

    optional cancellation object

Returns:

  • (Secret::Service)

    a new reference to a Secret::Service proxy, which should be released with [methodGObject.Object.unref].

.open(service_gtype, service_bus_name, flags, cancellable, callback, user_data) ⇒ nil

Create a new Secret::Service proxy for the Secret Service.

This function is rarely used, see [funcService.get] instead.

The service_gtype argument should be set to %SECRET_TYPE_SERVICE or a the type of a derived class.

If flags contains any flags of which parts of the secret service to ensure are initialized, then those will be initialized before returning.

If service_bus_name is nil then the default is used.

This method will return immediately and complete asynchronously.

Parameters:

  • service_gtype (GLib::Type)

    the GType of the new secret service

  • service_bus_name (String)

    the D-Bus service name of the secret service

  • flags (Secret::ServiceFlags)

    flags for which service functionality to ensure is initialized

  • cancellable (Gio::Cancellable)

    optional cancellation object

  • callback (Gio::AsyncReadyCallback)

    called when the operation completes

  • user_data (GObject)

    data to be passed to the callback

Returns:

  • (nil)

.open_finish(result) ⇒ Secret::Service

Complete an asynchronous operation to create a new Secret::Service proxy for the Secret Service.

Parameters:

  • result (Gio::AsyncResult)

    the asynchronous result passed to the callback

Returns:

  • (Secret::Service)

    a new reference to a Secret::Service proxy, which should be released with [methodGObject.Object.unref].

.open_sync(service_gtype, service_bus_name, flags, cancellable) ⇒ Secret::Service

Create a new Secret::Service proxy for the Secret Service.

This function is rarely used, see [funcService.get_sync] instead.

The service_gtype argument should be set to %SECRET_TYPE_SERVICE or a the type of a derived class.

If flags contains any flags of which parts of the secret service to ensure are initialized, then those will be initialized before returning.

If service_bus_name is nil then the default is used.

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

Parameters:

  • service_gtype (GLib::Type)

    the GType of the new secret service

  • service_bus_name (String)

    the D-Bus service name of the secret service

  • flags (Secret::ServiceFlags)

    flags for which service functionality to ensure is initialized

  • cancellable (Gio::Cancellable)

    optional cancellation object

Returns:

  • (Secret::Service)

    a new reference to a Secret::Service proxy, which should be released with [methodGObject.Object.unref].

Instance Method Details

#alias_finish=(result) ⇒ Boolean

Finish an asynchronous operation to assign a collection to an alias.

Parameters:

  • result (Gio::AsyncResult)

    asynchronous result passed to callback

Returns:

  • (Boolean)

    true if successful

#alias_to_dbus_path_finish=(result) ⇒ Boolean

Finish an asynchronous operation to assign a collection to an alias.

Parameters:

  • result (Gio::AsyncResult)

    asynchronous result passed to callback

Returns:

  • (Boolean)

    true if successful

#clear(schema, attributes, cancellable, callback, user_data) ⇒ nil

Remove unlocked items which match the attributes from the secret service.

The attributes should be a set of key and value string pairs.

If service is nil, then [funcService.get] will be called to get the default [classService] proxy.

This method will return immediately and complete asynchronously.

Parameters:

  • schema (Secret::Schema)

    the schema for the attributes

  • attributes (GLib::HashTable<String>)

    the attribute keys and values

  • cancellable (Gio::Cancellable)

    optional cancellation object

  • callback (Gio::AsyncReadyCallback)

    called when the operation completes

  • user_data (GObject)

    data to be passed to the callback

Returns:

  • (nil)

#clear_finish(result) ⇒ Boolean

Finish asynchronous operation to remove items from the secret service.

Parameters:

  • result (Gio::AsyncResult)

    the asynchronous result passed to the callback

Returns:

  • (Boolean)

    whether items were removed or not

#clear_sync(schema, attributes, cancellable) ⇒ Boolean

Remove unlocked items which match the attributes from the secret service.

The attributes should be a set of key and value string pairs.

If service is nil, then [funcService.get_sync] will be called to get the default [classService] proxy.

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

Parameters:

  • schema (Secret::Schema)

    the schema for the attributes

  • attributes (GLib::HashTable<String>)

    the attribute keys and values

  • cancellable (Gio::Cancellable)

    optional cancellation object

Returns:

  • (Boolean)

    whether items were removed or not

#collection_gtypeGLib::Type

Get the GObject type for collections instantiated by this service.

This will always be either [classCollection] or derived from it.

Returns:

  • (GLib::Type)

    the gobject type for collections

#collectionsSecret::

A list of [classCollection] objects representing the collections in the Secret Service.

This list may be nil if the collections have not been loaded.

To load the collections, specify the %SECRET_SERVICE_LOAD_COLLECTIONS initialization flag when calling the [funcService.get] or [funcService.open] functions. Or call the [methodService.load_collections] method.

Returns:

#collections=(collections) ⇒ Secret::

A list of [classCollection] objects representing the collections in the Secret Service.

This list may be nil if the collections have not been loaded.

To load the collections, specify the %SECRET_SERVICE_LOAD_COLLECTIONS initialization flag when calling the [funcService.get] or [funcService.open] functions. Or call the [methodService.load_collections] method.

Parameters:

Returns:

#create_collection_dbus_path(properties, alias, flags, cancellable, callback, user_data) ⇒ nil

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 [funcCollection.create] which does handles this for you.

An alias is a well-known tag for a collection, such as 'default' (ie: the default collection to store items in). This allows other applications to easily identify and share a collection. If a collection with the alias already exists, then instead of creating a new collection, the existing collection will be returned. If no collection with this alias exists, then a new collection will be created and this alias will be assigned to it.

properties is a set of properties for the new collection. The keys in the hash table should be interface.property strings like org.freedesktop.Secret.Collection.Label. The values in the hash table should be [structGLib.Variant] values of the properties.

If you wish to have a

This method will return immediately and complete asynchronously. The secret service may prompt the user. [methodService.prompt] will be used to handle any prompts that are required.

Parameters:

  • properties (GLib::HashTable<String>)

    hash table of properties for the new collection

  • alias (String)

    an alias to check for before creating the new collection, or to assign to the new collection

  • flags (Secret::CollectionCreateFlags)

    not currently used

  • cancellable (Gio::Cancellable)

    optional cancellation object

  • callback (Gio::AsyncReadyCallback)

    called when the operation completes

  • user_data (GObject)

    data to be passed to the callback

Returns:

  • (nil)

#create_collection_dbus_path_finish(result) ⇒ String

Finish asynchronous operation to create a new collection in the secret service.

Parameters:

  • result (Gio::AsyncResult)

    the asynchronous result passed to the callback

Returns:

  • (String)

    a new string containing the D-Bus object path of the collection

#create_collection_dbus_path_sync(properties, alias, flags, cancellable) ⇒ String

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 [funcCollection.create] which does handles this for you.

An alias is a well-known tag for a collection, such as 'default' (ie: the default collection to store items in). This allows other applications to easily identify and share a collection. If a collection with the alias already exists, then instead of creating a new collection, the existing collection will be returned. If no collection with this alias exists, then a new collection will be created and this alias will be assigned to it.

properties is a set of properties for the new collection. The keys in the hash table should be interface.property strings like org.freedesktop.Secret.Collection.Label. The values in the hash table should be [structGLib.Variant] values of the properties.

This method may block indefinitely and should not be used in user interface threads. The secret service may prompt the user. [methodService.prompt] will be used to handle any prompts that are required.

Parameters:

  • properties (GLib::HashTable<String>)

    hash table of D-Bus properties for the new collection

  • alias (String)

    an alias to check for before creating the new collection, or to assign to the new collection

  • flags (Secret::CollectionCreateFlags)

    not currently used

  • cancellable (Gio::Cancellable)

    optional cancellation object

Returns:

  • (String)

    a new string containing the D-Bus object path of the collection

#create_item_dbus_path(collection_path, properties, value, flags, cancellable, callback, user_data) ⇒ nil

Create a new item in a secret service collection and return its D-Bus object path.

It is often easier to use [funcpassword_store] or [funcItem.create] rather than using this function. Using this method requires that you setup a correct hash table of D-Bus properties for the new collection.

If the flags contains %SECRET_ITEM_CREATE_REPLACE, then the secret service will search for an item matching the attributes, and update that item instead of creating a new one.

properties is a set of properties for the new collection. The keys in the hash table should be interface.property strings like org.freedesktop.Secret.Item.Label. The values in the hash table should be [structGLib.Variant] values of the properties.

This method will return immediately and complete asynchronously. The secret service may prompt the user. [methodService.prompt] will be used to handle any prompts that are required.

Parameters:

  • collection_path (String)

    the D-Bus object path of the collection in which to create item

  • properties (GLib::HashTable<String>)

    hash table of D-Bus properties for the new collection

  • value (Secret::Value)

    the secret value to store in the item

  • flags (Secret::ItemCreateFlags)

    flags for the creation of the new item

  • cancellable (Gio::Cancellable)

    optional cancellation object

  • callback (Gio::AsyncReadyCallback)

    called when the operation completes

  • user_data (GObject)

    data to be passed to the callback

Returns:

  • (nil)

#create_item_dbus_path_finish(result) ⇒ String

Finish asynchronous operation to create a new item in the secret service.

Parameters:

  • result (Gio::AsyncResult)

    the asynchronous result passed to the callback

Returns:

  • (String)

    a new string containing the D-Bus object path of the item

#create_item_dbus_path_sync(collection_path, properties, value, flags, cancellable) ⇒ String

Create a new item in a secret service collection and return its D-Bus object path.

It is often easier to use [funcpassword_store_sync] or [funcItem.create_sync] rather than using this function. Using this method requires that you setup a correct hash table of D-Bus properties for the new collection.

If the flags contains %SECRET_ITEM_CREATE_REPLACE, then the secret service will search for an item matching the attributes, and update that item instead of creating a new one.

properties is a set of properties for the new collection. The keys in the hash table should be interface.property strings like org.freedesktop.Secret.Item.Label. The values in the hash table should be [structGLib.Variant] values of the properties.

This method may block indefinitely and should not be used in user interface threads. The secret service may prompt the user. [methodService.prompt] will be used to handle any prompts that are required.

Parameters:

  • collection_path (String)

    the D-Bus path of the collection in which to create item

  • properties (GLib::HashTable<String>)

    hash table of D-Bus properties for the new collection

  • value (Secret::Value)

    the secret value to store in the item

  • flags (Secret::ItemCreateFlags)

    flags for the creation of the new item

  • cancellable (Gio::Cancellable)

    optional cancellation object

Returns:

  • (String)

    a new string containing the D-Bus object path of the item

#decode_dbus_secret(value) ⇒ Secret::Value

Decode a [structValue] into [structGLib.Variant] received with the Secret Service DBus API.

The [structGLib.Variant] should have a (oayays) signature.

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

Parameters:

  • value (GLib::Variant)

    the encoded secret

Returns:

  • (Secret::Value)

    the decoded secret value

#delete_item_dbus_path(item_path, cancellable, callback, user_data) ⇒ nil

Delete a secret item from the secret service.

The item is represented by its D-Bus object path. If you already have a [classItem] proxy objects, use use [methodItem.delete] instead.

This method will return immediately and complete asynchronously.

Parameters:

  • item_path (String)

    the D-Bus path of item to delete

  • cancellable (Gio::Cancellable)

    optional cancellation object

  • callback (Gio::AsyncReadyCallback)

    called when the operation completes

  • user_data (GObject)

    data to be passed to the callback

Returns:

  • (nil)

#delete_item_dbus_path_finish(result) ⇒ Boolean

Complete an asynchronous operation to delete a secret item from the secret service.

Parameters:

  • result (Gio::AsyncResult)

    the asynchronous result passed to the callback

Returns:

  • (Boolean)

    whether the deletion was successful or not

#delete_item_dbus_path_sync(item_path, cancellable) ⇒ Boolean

Delete a secret item from the secret service.

The item is represented by its D-Bus object path. If you already have a [classItem] proxy objects, use use [methodItem.delete_sync] instead.

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

Parameters:

  • item_path (String)

    the D-Bus path of item to delete

  • cancellable (Gio::Cancellable)

    optional cancellation object

Returns:

  • (Boolean)

    whether the deletion was successful or not

#encode_dbus_secret(value) ⇒ GLib::Variant

Encodes a [structValue] into [structGLib.Variant] for use with the Secret Service DBus API.

The resulting [structGLib.Variant] will have a (oayays) signature.

A session must have already been established by the [classService].

Parameters:

  • value (Secret::Value)

    the secret value

Returns:

  • (GLib::Variant)

    the encoded secret

#ensure_session(cancellable, callback, user_data) ⇒ nil

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

This session is used to transfer secrets.

It is not normally necessary to call this method, as the session is established as necessary. You can also pass the %SECRET_SERVICE_OPEN_SESSION to [funcService.get] in order to ensure that a session has been established by the time you get the Secret::Service proxy.

This method will return immediately and complete asynchronously.

Parameters:

  • cancellable (Gio::Cancellable)

    optional cancellation object

  • callback (Gio::AsyncReadyCallback)

    called when the operation completes

  • user_data (GObject)

    data to be passed to the callback

Returns:

  • (nil)

#ensure_session_finish(result) ⇒ Boolean

Finish an asynchronous operation to ensure that the Secret::Service proxy has established a session with the Secret Service.

Parameters:

  • result (Gio::AsyncResult)

    the asynchronous result passed to the callback

Returns:

  • (Boolean)

    whether a session is established or not

#ensure_session_sync(cancellable) ⇒ Boolean

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

This session is used to transfer secrets.

It is not normally necessary to call this method, as the session is established as necessary. You can also pass the %SECRET_SERVICE_OPEN_SESSION to [funcService.get_sync] in order to ensure that a session has been established by the time you get the Secret::Service proxy.

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

Parameters:

  • cancellable (Gio::Cancellable)

    optional cancellation object

Returns:

  • (Boolean)

    whether a session is established or not

#flagsSecret::ServiceFlags

Get the flags representing what features of the Secret::Service proxy have been initialized.

Use [methodService.ensure_session] or [methodService.load_collections] to initialize further features and change the flags.

Returns:

#get_secret_for_dbus_path(item_path, cancellable, callback, user_data) ⇒ nil

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 [classItem] proxy object, use use [methodItem.get_secret] to more simply get its secret value.

This function returns immediately and completes asynchronously.

Parameters:

  • item_path (String)

    the D-Bus path to item to retrieve secret for

  • cancellable (Gio::Cancellable)

    optional cancellation object

  • callback (Gio::AsyncReadyCallback)

    called when the operation completes

  • user_data (GObject)

    data to pass to the callback

Returns:

  • (nil)

#get_secret_for_dbus_path_finish(result) ⇒ Secret::Value

Complete asynchronous operation to get the secret value for an secret item stored in the service.

Will return nil if the item is locked.

Parameters:

  • result (Gio::AsyncResult)

    asynchronous result passed to callback

Returns:

  • (Secret::Value)

    the newly allocated secret value for the item, which should be released with [methodValue.unref]

#get_secret_for_dbus_path_sync(item_path, cancellable) ⇒ Secret::Value

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 [classItem] proxy object, use use [methodItem.load_secret_sync] to more simply get its secret value.

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

Will return nil if the item is locked.

Parameters:

  • item_path (String)

    the D-Bus path to item to retrieve secret for

  • cancellable (Gio::Cancellable)

    optional cancellation object

Returns:

  • (Secret::Value)

    the newly allocated secret value the item, which should be released with [methodValue.unref]

#get_secrets_for_dbus_paths(item_paths, cancellable, callback, user_data) ⇒ nil

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 [classItem] proxy objects, use use [funcItem.load_secrets] to more simply get their secret values.

This function returns immediately and completes asynchronously.

Parameters:

  • item_paths (String)

    the D-Bus paths to items to retrieve secrets for

  • cancellable (Gio::Cancellable)

    optional cancellation object

  • callback (Gio::AsyncReadyCallback)

    called when the operation completes

  • user_data (GObject)

    data to pass to the callback

Returns:

  • (nil)

#get_secrets_for_dbus_paths_finish(result) ⇒ GLib::HashTable<String>

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 (Gio::AsyncResult)

    asynchronous result passed to callback

Returns:

  • (GLib::HashTable<String>)

    a newly allocated hash table of item path keys to [structValue] values.

#get_secrets_for_dbus_paths_sync(item_paths, cancellable) ⇒ GLib::HashTable<String>

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 [classItem] proxy objects, use use [funcItem.load_secrets_sync] 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:

  • item_paths (String)

    the D-Bus paths to items to retrieve secrets for

  • cancellable (Gio::Cancellable)

    optional cancellation object

Returns:

  • (GLib::HashTable<String>)

    a newly allocated hash table of item_path keys to [structValue] values.

#item_gtypeGLib::Type

Get the GObject type for items instantiated by this service.

This will always be either [classItem] or derived from it.

Returns:

  • (GLib::Type)

    the gobject type for items

#load_collections(cancellable, callback, user_data) ⇒ nil

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

This affects the result of [methodService.get_collections].

You can also pass the %SECRET_SERVICE_LOAD_COLLECTIONS to [funcService.get_sync] in order to ensure that the collections have been loaded by the time you get the Secret::Service proxy.

This method will return immediately and complete asynchronously.

Parameters:

  • cancellable (Gio::Cancellable)

    optional cancellation object

  • callback (Gio::AsyncReadyCallback)

    called when the operation completes

  • user_data (GObject)

    data to be passed to the callback

Returns:

  • (nil)

#load_collections_finish(result) ⇒ Boolean

Complete an asynchronous operation to ensure that the Secret::Service proxy has loaded all the collections present in the Secret Service.

Parameters:

  • result (Gio::AsyncResult)

    the asynchronous result passed to the callback

Returns:

  • (Boolean)

    whether the load was successful or not

#load_collections_sync(cancellable) ⇒ Boolean

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

This affects the result of [methodService.get_collections].

You can also pass the %SECRET_SERVICE_LOAD_COLLECTIONS to [funcService.get_sync] in order to ensure that the collections have been loaded by the time you get the Secret::Service proxy.

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

Parameters:

  • cancellable (Gio::Cancellable)

    optional cancellation object

Returns:

  • (Boolean)

    whether the load was successful or not

#lock(objects, cancellable, callback, user_data) ⇒ nil

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 service is nil, then [funcService.get] will be called to get the default [classService] proxy.

This method returns immediately and completes asynchronously. The secret service may prompt the user. [methodService.prompt] will be used to handle any prompts that show up.

Parameters:

  • objects (GLib::List<Gio::DBusProxy>)

    the items or collections to lock

  • cancellable (Gio::Cancellable)

    optional cancellation object

  • callback (Gio::AsyncReadyCallback)

    called when the operation completes

  • user_data (GObject)

    data to pass to the callback

Returns:

  • (nil)

#lock_dbus_paths(paths, cancellable, callback, user_data) ⇒ nil

Lock items or collections in the secret service.

The items or collections are represented by their D-Bus object paths. If you already have [classItem] and [classCollection] proxy objects, use use [methodService.lock] instead.

The secret service may not be able to lock items individually, and may lock an entire collection instead.

This method returns immediately and completes asynchronously. The secret service may prompt the user. [methodService.prompt] will be used to handle any prompts that show up.

Parameters:

  • paths (Array<String>)

    the D-Bus paths for items or collections to lock

  • cancellable (Gio::Cancellable)

    optional cancellation object

  • callback (Gio::AsyncReadyCallback)

    called when the operation completes

  • user_data (GObject)

    data to pass to the callback

Returns:

  • (nil)

#lock_dbus_paths_finish(result, locked) ⇒ Integer

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 (Gio::AsyncResult)

    asynchronous result passed to the callback

  • locked (Array<String>)

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

Returns:

  • (Integer)

    the number of items or collections that were locked

#lock_dbus_paths_sync(paths, cancellable, locked) ⇒ Integer

Lock items or collections in the secret service.

The items or collections are represented by their D-Bus object paths. If you already have [classItem] and [classCollection] proxy objects, use use [methodService.lock_sync] instead.

The secret service may not be able to lock items individually, and may lock an entire collection instead.

This method may block indefinitely and should not be used in user interface threads. The secret service may prompt the user. [methodService.prompt] will be used to handle any prompts that show up.

Parameters:

  • paths (Array<String>)

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

  • cancellable (Gio::Cancellable)

    optional cancellation object

  • locked (Array<String>)

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

Returns:

  • (Integer)

    the number of items or collections that were locked

#lock_finish(result, locked) ⇒ Integer

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 (Gio::AsyncResult)

    asynchronous result passed to the callback

  • locked (GLib::List<Gio::DBusProxy>)

    location to place list of items or collections that were locked

Returns:

  • (Integer)

    the number of items or collections that were locked

#lock_sync(objects, cancellable, locked) ⇒ Integer

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 service is nil, then [funcService.get_sync] will be called to get the default [classService] proxy.

This method may block indefinitely and should not be used in user interface threads. The secret service may prompt the user. [methodService.prompt] will be used to handle any prompts that show up.

Parameters:

  • objects (GLib::List<Gio::DBusProxy>)

    the items or collections to lock

  • cancellable (Gio::Cancellable)

    optional cancellation object

  • locked (GLib::List<Gio::DBusProxy>)

    location to place list of items or collections that were locked

Returns:

  • (Integer)

    the number of items or collections that were locked

#lookup(schema, attributes, cancellable, callback, user_data) ⇒ nil

Lookup a secret value in the secret service.

The attributes should be a set of key and value string pairs.

If service is nil, then [funcService.get] will be called to get the default [classService] proxy.

This method will return immediately and complete asynchronously.

Parameters:

  • schema (Secret::Schema)

    the schema for the attributes

  • attributes (GLib::HashTable<String>)

    the attribute keys and values

  • cancellable (Gio::Cancellable)

    optional cancellation object

  • callback (Gio::AsyncReadyCallback)

    called when the operation completes

  • user_data (GObject)

    data to be passed to the callback

Returns:

  • (nil)

#lookup_finish(result) ⇒ Secret::Value

Finish asynchronous operation to lookup a secret value in the secret service.

If no secret is found then nil is returned.

Parameters:

  • result (Gio::AsyncResult)

    the asynchronous result passed to the callback

Returns:

  • (Secret::Value)

    a newly allocated [structValue], which should be released with [methodValue.unref], or nil if no secret found

#lookup_sync(schema, attributes, cancellable) ⇒ Secret::Value

Lookup a secret value in the secret service.

The attributes should be a set of key and value string pairs.

If service is nil, then [funcService.get_sync] will be called to get the default [classService] proxy.

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

Parameters:

  • schema (Secret::Schema)

    the schema for the attributes

  • attributes (GLib::HashTable<String>)

    the attribute keys and values

  • cancellable (Gio::Cancellable)

    optional cancellation object

Returns:

  • (Secret::Value)

    a newly allocated [structValue], which should be released with [methodValue.unref], or nil if no secret found

#prompt(prompt, return_type, cancellable, callback, user_data) ⇒ nil

Perform prompting for a [classPrompt].

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

Override the Secret::ServiceClass [vfuncService.prompt_async] virtual method to change the behavior of the prompting. The default behavior is to simply run [methodPrompt.perform] on the prompt.

Parameters:

  • prompt (Secret::Prompt)

    the prompt

  • return_type (GLib::VariantType)

    the variant type of the prompt result

  • cancellable (Gio::Cancellable)

    optional cancellation object

  • callback (Gio::AsyncReadyCallback)

    called when the operation completes

  • user_data (GObject)

    data to be passed to the callback

Returns:

  • (nil)

#prompt_at_dbus_path(prompt_path, return_type, cancellable, callback, user_data) ⇒ nil

Perform prompting for a [classPrompt].

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

Override the Secret::ServiceClass [vfuncService.prompt_async] virtual method to change the behavior of the propmting. The default behavior is to simply run [methodPrompt.perform] on the prompt.

Parameters:

  • prompt_path (String)

    the D-Bus object path of the prompt

  • return_type (GLib::VariantType)

    the variant type of the prompt result

  • cancellable (Gio::Cancellable)

    optional cancellation object

  • callback (Gio::AsyncReadyCallback)

    called when the operation completes

  • user_data (GObject)

    data to be passed to the callback

Returns:

  • (nil)

#prompt_at_dbus_path_finish(result) ⇒ GLib::Variant

Complete asynchronous operation to perform prompting for a [classPrompt].

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 (Gio::AsyncResult)

    the asynchronous result passed to the callback

Returns:

  • (GLib::Variant)

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

#prompt_at_dbus_path_sync(prompt_path, cancellable, return_type) ⇒ GLib::Variant

Perform prompting for a [classPrompt].

Override the Secret::ServiceClass [vfuncService.prompt_async] virtual method to change the behavior of the propmting. The default behavior is to simply run [methodPrompt.perform] on the prompt.

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

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

Parameters:

  • prompt_path (String)

    the D-Bus object path of the prompt

  • cancellable (Gio::Cancellable)

    optional cancellation object

  • return_type (GLib::VariantType)

    the variant type of the prompt result

Returns:

  • (GLib::Variant)

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

#prompt_finish(result) ⇒ GLib::Variant

Complete asynchronous operation to perform prompting for a [classPrompt].

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 (Gio::AsyncResult)

    the asynchronous result passed to the callback

Returns:

  • (GLib::Variant)

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

#prompt_sync(prompt, cancellable, return_type) ⇒ GLib::Variant

Perform prompting for a [classPrompt].

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 Secret::ServiceClass [vfuncService.prompt_sync] virtual method to change the behavior of the prompting. The default behavior is to simply run [methodPrompt.perform_sync] on the prompt with a nil window_id.

Parameters:

  • prompt (Secret::Prompt)

    the prompt

  • cancellable (Gio::Cancellable)

    optional cancellation object

  • return_type (GLib::VariantType)

    the variant type of the prompt result

Returns:

  • (GLib::Variant)

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

#read_alias_dbus_path(alias, cancellable, callback, user_data) ⇒ nil

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 (String)

    the alias to lookup

  • cancellable (Gio::Cancellable)

    optional cancellation object

  • callback (Gio::AsyncReadyCallback)

    called when the operation completes

  • user_data (GObject)

    data to pass to the callback

Returns:

  • (nil)

#read_alias_dbus_path_finish(result) ⇒ String

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 (Gio::AsyncResult)

    asynchronous result passed to callback

Returns:

  • (String)

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

#read_alias_dbus_path_sync(alias, cancellable) ⇒ String

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 (String)

    the alias to lookup

  • cancellable (Gio::Cancellable)

    optional cancellation object

Returns:

  • (String)

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

#search(schema, attributes, flags, cancellable, callback, user_data) ⇒ nil

Search for items matching the attributes.

All collections are searched. The attributes should be a table of string keys and string values.

If service is nil, then [funcService.get] will be called to get the default [classService] proxy.

If %SECRET_SEARCH_ALL is set in flags, then all the items matching the search will be returned. Otherwise only the first item will be returned. This is almost always the unlocked item that was most recently stored.

If %SECRET_SEARCH_UNLOCK is set in flags, then items will be unlocked if necessary. In either case, locked and unlocked items will match the search and be returned. If the unlock fails, the search does not fail.

If %SECRET_SEARCH_LOAD_SECRETS is set in flags, then the items will have their secret values loaded and available via [methodItem.get_secret].

This function returns immediately and completes asynchronously.

Parameters:

  • schema (Secret::Schema)

    the schema for the attributes

  • attributes (GLib::HashTable<String>)

    search for items matching these attributes

  • flags (Secret::SearchFlags)

    search option flags

  • cancellable (Gio::Cancellable)

    optional cancellation object

  • callback (Gio::AsyncReadyCallback)

    called when the operation completes

  • user_data (GObject)

    data to pass to the callback

Returns:

  • (nil)

#search_finish(result) ⇒ GLib::List<Secret::Item>

Complete asynchronous operation to search for items.

Parameters:

  • result (Gio::AsyncResult)

    asynchronous result passed to callback

Returns:

  • (GLib::List<Secret::Item>)

    a list of items that matched the search

#search_for_dbus_paths(schema, attributes, cancellable, callback, user_data) ⇒ nil

Search for items matching the attributes, and return their D-Bus object paths.

All collections are searched. The attributes should be a table of string keys and string values.

This function returns immediately and completes asynchronously.

When your callback is called use [methodService.search_for_dbus_paths_finish] to get the results of this function. Only the D-Bus object paths of the items will be returned. If you would like [classItem] objects to be returned instead, then use the [methodService.search] function.

Parameters:

  • schema (Secret::Schema)

    the schema for the attributes

  • attributes (GLib::HashTable<String>)

    search for items matching these attributes

  • cancellable (Gio::Cancellable)

    optional cancellation object

  • callback (Gio::AsyncReadyCallback)

    called when the operation completes

  • user_data (GObject)

    data to pass to the callback

Returns:

  • (nil)

#search_for_dbus_paths_finish(result, unlocked, locked) ⇒ Boolean

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 locked or unlocked arrays respectively.

D-Bus object paths of the items will be returned in the unlocked or locked arrays. If you would to have [classItem] objects to be returned instead, then us the [methodService.search] and [methodService.search_finish] functions.

Parameters:

  • result (Gio::AsyncResult)

    asynchronous result passed to callback

  • unlocked (Array<String>)

    location to place an array of D-Bus object paths for matching items which were locked.

  • locked (Array<String>)

    location to place an array of D-Bus object paths for matching items which were locked.

Returns:

  • (Boolean)

    whether the search was successful or not

#search_for_dbus_paths_sync(schema, attributes, cancellable, unlocked, locked) ⇒ Boolean

Search for items matching the attributes, and return their D-Bus object paths.

All collections are searched. The attributes should be a table of string keys and string values.

This function 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 locked or unlocked arrays respectively.

D-Bus object paths of the items will be returned in the unlocked or locked arrays. If you would to have [classItem] objects to be returned instead, then use the [methodService.search_sync] function.

Parameters:

  • schema (Secret::Schema)

    the schema for the attributes

  • attributes (GLib::HashTable<String>)

    search for items matching these attributes

  • cancellable (Gio::Cancellable)

    optional cancellation object

  • unlocked (Array<String>)

    location to place an array of D-Bus object paths for matching items which were locked.

  • locked (Array<String>)

    location to place an array of D-Bus object paths for matching items which were locked.

Returns:

  • (Boolean)

    whether the search was successful or not

#search_sync(schema, attributes, flags, cancellable) ⇒ GLib::List<Secret::Item>

Search for items matching the attributes.

All collections are searched. The attributes should be a table of string keys and string values.

If service is nil, then [funcService.get_sync] will be called to get the default [classService] proxy.

If %SECRET_SEARCH_ALL is set in flags, then all the items matching the search will be returned. Otherwise only the first item will be returned. This is almost always the unlocked item that was most recently stored.

If %SECRET_SEARCH_UNLOCK is set in flags, then items will be unlocked if necessary. In either case, locked and unlocked items will match the search and be returned. If the unlock fails, the search does not fail.

If %SECRET_SEARCH_LOAD_SECRETS is set in flags, then the items' secret values will be loaded for any unlocked items. Loaded item secret values are available via [methodItem.get_secret]. If the load of a secret values fail, then the

This function may block indefinitely. Use the asynchronous version in user interface threads.

Parameters:

  • schema (Secret::Schema)

    the schema for the attributes

  • attributes (GLib::HashTable<String>)

    search for items matching these attributes

  • flags (Secret::SearchFlags)

    search option flags

  • cancellable (Gio::Cancellable)

    optional cancellation object

Returns:

  • (GLib::List<Secret::Item>)

    a list of items that matched the search

#session_algorithmsString

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

This will be nil if no session has been established. Use [methodService.ensure_session] to establish a session.

Returns:

  • (String)

    a string representing the algorithms for transferring secrets

#session_dbus_pathString

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 nil if no session has been established. Use [methodService.ensure_session] to establish a session.

Returns:

  • (String)

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

#set_alias(alias, collection, cancellable, callback, user_data) ⇒ nil

Assign a collection to this alias.

Aliases help determine well known collections, such as 'default'.

If service is nil, then [funcService.get] will be called to get the default [classService] proxy.

This method will return immediately and complete asynchronously.

Parameters:

  • alias (String)

    the alias to assign the collection to

  • collection (Secret::Collection)

    the collection to assign to the alias

  • cancellable (Gio::Cancellable)

    optional cancellation object

  • callback (Gio::AsyncReadyCallback)

    called when the operation completes

  • user_data (GObject)

    data to pass to the callback

Returns:

  • (nil)

#set_alias_sync(alias, collection, cancellable) ⇒ Boolean

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

If service is nil, then [funcService.get_sync] will be called to get the default [classService] proxy.

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

Parameters:

  • alias (String)

    the alias to assign the collection to

  • collection (Secret::Collection)

    the collection to assign to the alias

  • cancellable (Gio::Cancellable)

    optional cancellation object

Returns:

  • (Boolean)

    true if successful

#set_alias_to_dbus_path(alias, collection_path, cancellable, callback, user_data) ⇒ nil

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 (String)

    the alias to assign the collection to

  • collection_path (String)

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

  • cancellable (Gio::Cancellable)

    optional cancellation object

  • callback (Gio::AsyncReadyCallback)

    called when the operation completes

  • user_data (GObject)

    data to pass to the callback

Returns:

  • (nil)

#set_alias_to_dbus_path_sync(alias, collection_path, cancellable) ⇒ Boolean

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 (String)

    the alias to assign the collection to

  • collection_path (String)

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

  • cancellable (Gio::Cancellable)

    optional cancellation object

Returns:

  • (Boolean)

    true if successful

#store(schema, attributes, collection, label, value, cancellable, callback, user_data) ⇒ nil

Store a secret value in the secret service.

The attributes should be a set of key and value string pairs.

If the attributes match a secret item already stored in the collection, then the item will be updated with these new values.

If service is nil, then [funcService.get] will be called to get the default [classService] proxy.

If collection is not specified, then the default collection will be used. Use [constCOLLECTION_SESSION] to store the password in the session collection, which doesn't get stored across login sessions.

This method will return immediately and complete asynchronously.

Parameters:

  • schema (Secret::Schema)

    the schema to use to check attributes

  • attributes (GLib::HashTable<String>)

    the attribute keys and values

  • collection (String)

    a collection alias, or D-Bus object path of the collection where to store the secret

  • label (String)

    label for the secret

  • value (Secret::Value)

    the secret value

  • cancellable (Gio::Cancellable)

    optional cancellation object

  • callback (Gio::AsyncReadyCallback)

    called when the operation completes

  • user_data (GObject)

    data to be passed to the callback

Returns:

  • (nil)

#store_finish(result) ⇒ Boolean

Finish asynchronous operation to store a secret value in the secret service.

Parameters:

  • result (Gio::AsyncResult)

    the asynchronous result passed to the callback

Returns:

  • (Boolean)

    whether the storage was successful or not

#store_sync(schema, attributes, collection, label, value, cancellable) ⇒ Boolean

Store a secret value in the secret service.

The attributes should be a set of key and value string pairs.

If the attributes match a secret item already stored in the collection, then the item will be updated with these new values.

If collection is nil, then the default collection will be used. Use [constCOLLECTION_SESSION] to store the password in the session collection, which doesn't get stored across login sessions.

If service is nil, then [funcService.get_sync] will be called to get the default [classService] proxy.

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

Parameters:

  • schema (Secret::Schema)

    the schema for the attributes

  • attributes (GLib::HashTable<String>)

    the attribute keys and values

  • collection (String)

    a collection alias, or D-Bus object path of the collection where to store the secret

  • label (String)

    label for the secret

  • value (Secret::Value)

    the secret value

  • cancellable (Gio::Cancellable)

    optional cancellation object

Returns:

  • (Boolean)

    whether the storage was successful or not

#unlock(objects, cancellable, callback, user_data) ⇒ nil

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 service is nil, then [funcService.get] will be called to get the default [classService] proxy.

This method may block indefinitely and should not be used in user interface threads. The secret service may prompt the user. [methodService.prompt] will be used to handle any prompts that show up.

Parameters:

  • objects (GLib::List<Gio::DBusProxy>)

    the items or collections to unlock

  • cancellable (Gio::Cancellable)

    optional cancellation object

  • callback (Gio::AsyncReadyCallback)

    called when the operation completes

  • user_data (GObject)

    data to pass to the callback

Returns:

  • (nil)

#unlock_dbus_paths(paths, cancellable, callback, user_data) ⇒ nil

Unlock items or collections in the secret service.

The items or collections are represented by their D-Bus object paths. If you already have [classItem] and [classCollection] proxy objects, use use [methodService.unlock] instead.

The secret service may not be able to unlock items individually, and may unlock an entire collection instead.

This method returns immediately and completes asynchronously. The secret service may prompt the user. [methodService.prompt] will be used to handle any prompts that show up.

Parameters:

  • paths (Array<String>)

    the D-Bus paths for items or collections to unlock

  • cancellable (Gio::Cancellable)

    optional cancellation object

  • callback (Gio::AsyncReadyCallback)

    called when the operation completes

  • user_data (GObject)

    data to pass to the callback

Returns:

  • (nil)

#unlock_dbus_paths_finish(result, unlocked) ⇒ Integer

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 (Gio::AsyncResult)

    asynchronous result passed to the callback

  • unlocked (Array<String>)

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

Returns:

  • (Integer)

    the number of items or collections that were unlocked

#unlock_dbus_paths_sync(paths, cancellable, unlocked) ⇒ Integer

Unlock items or collections in the secret service.

The items or collections are represented by their D-Bus object paths. If you already have [classItem] and [classCollection] proxy objects, use use [methodService.unlock_sync] instead.

The secret service may not be able to unlock items individually, and may unlock an entire collection instead.

This method may block indefinitely and should not be used in user interface threads. The secret service may prompt the user. [methodService.prompt] will be used to handle any prompts that show up.

Parameters:

  • paths (Array<String>)

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

  • cancellable (Gio::Cancellable)

    optional cancellation object

  • unlocked (Array<String>)

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

Returns:

  • (Integer)

    the number of items or collections that were unlocked

#unlock_finish(result, unlocked) ⇒ Integer

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 (Gio::AsyncResult)

    asynchronous result passed to the callback

  • unlocked (GLib::List<Gio::DBusProxy>)

    location to place list of items or collections that were unlocked

Returns:

  • (Integer)

    the number of items or collections that were unlocked

#unlock_sync(objects, cancellable, unlocked) ⇒ Integer

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 service is nil, then [funcService.get_sync] will be called to get the default [classService] proxy.

This method may block indefinitely and should not be used in user interface threads. The secret service may prompt the user. [methodService.prompt] will be used to handle any prompts that show up.

Parameters:

  • objects (GLib::List<Gio::DBusProxy>)

    the items or collections to unlock

  • cancellable (Gio::Cancellable)

    optional cancellation object

  • unlocked (GLib::List<Gio::DBusProxy>)

    location to place list of items or collections that were unlocked

Returns:

  • (Integer)

    the number of items or collections that were unlocked