Secret.Service
Description: Reference for Secret.Service

### Class

# SecretService

unstable since: 1

#### Description [src]

    class Secret.Service : Gio.DBusProxy
      implements Gio.AsyncInitable, Gio.DBusInterface, Gio.Initable, Secret.Backend {
      /* No available fields */
    }

A proxy object representing the Secret Service.

A `SecretService` object represents the Secret Service implementation which runs as a D-Bus service.

Normally a single `SecretService` object can be shared between multiple callers. The `secret_service_get()` method is used to access this `SecretService` object. If a new independent `SecretService` object is required, use `secret_service_open()`.

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 `SECRET_SERVICE_OPEN_SESSION` flag to the `secret_service_get()` or `secret_service_open()` functions. In order to establish a session on an already existing `SecretService`, use the `secret_service_ensure_session()` function.

To search for items, use the `secret_service_search()` method.

Multiple collections can exist in the Secret Service, each of which contains secret items. In order to instantiate `SecretCollection` objects which represent those collections while initializing a `SecretService` then pass the `SECRET_SERVICE_LOAD_COLLECTIONS` flag to the `secret_service_get()` or `secret_service_open()` functions. In order to establish a session on an already existing `SecretService`, use the `secret_service_load_collections()` function. To access the list of collections use `secret_service_get_collections()`.

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 `SecretPrompt` object is created by this library, and passed to the `secret_service_prompt()` method. In this way it is handled automatically.

In order to customize prompt handling, override the `Secret.ServiceClass.prompt_async` and `Secret.ServiceClass.prompt_finish` virtual methods of the `SecretService` class.

Stability: Stable

Available since: 1

#### Hierarchy

#### Ancestors

- GDBusProxy
- GObject

#### Implements

- GAsyncInitable
- GDBusInterface
- GInitable
- SecretBackend

#### Functions

###### secret_service_disconnect

Disconnect the default `SecretService` proxy returned by `secret_service_get()` and `secret_service_get_sync()`.

unstable since: 1

###### secret_service_get

Get a `SecretService` proxy for the Secret Service.

unstable since: 1

###### secret_service_get_finish

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

unstable since: 1

###### secret_service_get_sync

Get a `SecretService` proxy for the Secret Service.

unstable since: 1

###### secret_service_open

Create a new `SecretService` proxy for the Secret Service.

unstable since: 1

###### secret_service_open_finish

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

unstable since: 1

###### secret_service_open_sync

Create a new `SecretService` proxy for the Secret Service.

unstable since: 1

#### Instance methods

###### secret_service_clear

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

unstable since: 1

###### secret_service_clear_finish

Finish asynchronous operation to remove items from the secret service.

unstable since: 1

###### secret_service_clear_sync

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

unstable since: 1

###### secret_service_create_collection_dbus_path

Create a new collection in the secret service, and return its path.

unstable since: 1

###### secret_service_create_collection_dbus_path_finish

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

unstable since: 1

###### secret_service_create_collection_dbus_path_sync

Create a new collection in the secret service and return its path.

unstable since: 1

###### secret_service_create_item_dbus_path

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

unstable since: 1

###### secret_service_create_item_dbus_path_finish

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

unstable since: 1

###### secret_service_create_item_dbus_path_sync

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

unstable since: 1

###### secret_service_decode_dbus_secret

Decode a `SecretValue` into `GVariant` received with the Secret Service DBus API.

unstable since: 1

###### secret_service_delete_item_dbus_path

Delete a secret item from the secret service.

unstable since: 1

###### secret_service_delete_item_dbus_path_finish

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

unstable since: 1

###### secret_service_delete_item_dbus_path_sync

Delete a secret item from the secret service.

unstable since: 1

###### secret_service_encode_dbus_secret

Encodes a `SecretValue` into `GVariant` for use with the Secret Service DBus API.

unstable since: 1

###### secret_service_ensure_session

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

unstable since: 1

###### secret_service_ensure_session_finish

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

unstable since: 1

###### secret_service_ensure_session_sync

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

unstable since: 1

###### secret_service_get_collection_gtype

Get the GObject type for collections instantiated by this service.

unstable since: 1

###### secret_service_get_collections

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

unstable since: 1

###### secret_service_get_flags

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

unstable since: 1

###### secret_service_get_item_gtype

Get the GObject type for items instantiated by this service.

unstable since: 1

###### secret_service_get_secret_for_dbus_path

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

unstable since: 1

###### secret_service_get_secret_for_dbus_path_finish

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

unstable since: 1

###### secret_service_get_secret_for_dbus_path_sync

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

unstable since: 1

###### secret_service_get_secrets_for_dbus_paths

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

unstable since: 1

###### secret_service_get_secrets_for_dbus_paths_finish

Complete asynchronous operation to get the secret values for an secret items stored in the service.

unstable since: 1

###### secret_service_get_secrets_for_dbus_paths_sync

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

unstable since: 1

###### secret_service_get_session_algorithms

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

unstable since: 1

###### secret_service_get_session_dbus_path

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.

unstable since: 1

###### secret_service_load_collections

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

unstable since: 1

###### secret_service_load_collections_finish

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

unstable since: 1

###### secret_service_load_collections_sync

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

unstable since: 1

###### secret_service_lock

Lock items or collections in the secret service.

unstable since: 1

###### secret_service_lock_dbus_paths

Lock items or collections in the secret service.

unstable since: 1

###### secret_service_lock_dbus_paths_finish

Complete asynchronous operation to lock items or collections in the secret service.

unstable since: 1

###### secret_service_lock_dbus_paths_sync

Lock items or collections in the secret service.

unstable since: 1

###### secret_service_lock_finish

Complete asynchronous operation to lock items or collections in the secret service.

unstable since: 1

###### secret_service_lock_sync

Lock items or collections in the secret service.

unstable since: 1

###### secret_service_lookup

Lookup a secret value in the secret service.

unstable since: 1

###### secret_service_lookup_finish

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

unstable since: 1

###### secret_service_lookup_sync

Lookup a secret value in the secret service.

unstable since: 1

###### secret_service_prompt

Perform prompting for a `SecretPrompt`.

unstable since: 1

###### secret_service_prompt_at_dbus_path

Perform prompting for a `SecretPrompt`.

unstable since: 1

###### secret_service_prompt_at_dbus_path_finish

Complete asynchronous operation to perform prompting for a `SecretPrompt`.

unstable since: 1

###### secret_service_prompt_at_dbus_path_sync

Perform prompting for a `SecretPrompt`.

unstable since: 1

###### secret_service_prompt_finish

Complete asynchronous operation to perform prompting for a `SecretPrompt`.

unstable since: 1

###### secret_service_prompt_sync

Perform prompting for a `SecretPrompt`.

unstable since: 1

###### secret_service_read_alias_dbus_path

Lookup which collection is assigned to this alias.

unstable since: 1

###### secret_service_read_alias_dbus_path_finish

Finish an asynchronous operation to lookup which collection is assigned to an alias.

unstable since: 1

###### secret_service_read_alias_dbus_path_sync

Lookup which collection is assigned to this alias.

unstable since: 1

###### secret_service_search

Search for items matching the `attributes`.

unstable since: 1

###### secret_service_search_finish

Complete asynchronous operation to search for items.

unstable since: 1

###### secret_service_search_for_dbus_paths

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

unstable since: 1

###### secret_service_search_for_dbus_paths_finish

Complete asynchronous operation to search for items, and return their D-Bus object paths.

unstable since: 1

###### secret_service_search_for_dbus_paths_sync

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

unstable since: 1

###### secret_service_search_sync

Search for items matching the `attributes`.

unstable since: 1

###### secret_service_set_alias

Assign a collection to this alias.

unstable since: 1

###### secret_service_set_alias_finish

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

unstable since: 1

###### secret_service_set_alias_sync

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

unstable since: 1

###### secret_service_set_alias_to_dbus_path

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.

unstable since: 1

###### secret_service_set_alias_to_dbus_path_finish

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

unstable since: 1

###### secret_service_set_alias_to_dbus_path_sync

Assign a collection to this alias.

unstable since: 1

###### secret_service_store

Store a secret value in the secret service.

unstable since: 1

###### secret_service_store_finish

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

unstable since: 1

###### secret_service_store_sync

Store a secret value in the secret service.

unstable since: 1

###### secret_service_unlock

Unlock items or collections in the secret service.

unstable since: 1

###### secret_service_unlock_dbus_paths

Unlock items or collections in the secret service.

unstable since: 1

###### secret_service_unlock_dbus_paths_finish

Complete asynchronous operation to unlock items or collections in the secret service.

unstable since: 1

###### secret_service_unlock_dbus_paths_sync

Unlock items or collections in the secret service.

unstable since: 1

###### secret_service_unlock_finish

Complete asynchronous operation to unlock items or collections in the secret service.

unstable since: 1

###### secret_service_unlock_sync

Unlock items or collections in the secret service.

unstable since: 1

##### Methods inherited from GDBusProxy (19)

###### g_dbus_proxy_call

Asynchronously invokes the `method_name` method on `proxy`.

unstable since: 2.26

###### g_dbus_proxy_call_finish

Finishes an operation started with g_dbus_proxy_call().

unstable since: 2.26

###### g_dbus_proxy_call_sync

Synchronously invokes the `method_name` method on `proxy`.

unstable since: 2.26

###### g_dbus_proxy_call_with_unix_fd_list

Like `g_dbus_proxy_call()` but also takes a `GUnixFDList` object.

unstable since: 2.30

###### g_dbus_proxy_call_with_unix_fd_list_finish

Finishes an operation started with g_dbus_proxy_call_with_unix_fd_list().

unstable since: 2.30

###### g_dbus_proxy_call_with_unix_fd_list_sync

Like `g_dbus_proxy_call_sync()` but also takes and returns `GUnixFDList` objects.

unstable since: 2.30

###### g_dbus_proxy_get_cached_property

Looks up the value for a property from the cache. This call does no blocking IO.

unstable since: 2.26

###### g_dbus_proxy_get_cached_property_names

Gets the names of all cached properties on `proxy`.

unstable since: 2.26

###### g_dbus_proxy_get_connection

Gets the connection `proxy` is for.

unstable since: 2.26

###### g_dbus_proxy_get_default_timeout

Gets the timeout to use if -1 (specifying default timeout) is passed as `timeout_msec` in the `g_dbus_proxy_call()` and `g_dbus_proxy_call_sync()` functions.

unstable since: 2.26

###### g_dbus_proxy_get_flags

Gets the flags that `proxy` was constructed with.

unstable since: 2.26

###### g_dbus_proxy_get_interface_info

Returns the `GDBusInterfaceInfo`, if any, specifying the interface that `proxy` conforms to. See the `GDBusProxy:g-interface-info` property for more details.

unstable since: 2.26

###### g_dbus_proxy_get_interface_name

Gets the D-Bus interface name `proxy` is for.

unstable since: 2.26

###### g_dbus_proxy_get_name

Gets the name that `proxy` was constructed for.

unstable since: 2.26

###### g_dbus_proxy_get_name_owner

The unique name that owns the name that `proxy` is for or `NULL` if no-one currently owns that name. You may connect to the `GObject::notify` signal to track changes to the `GDBusProxy:g-name-owner` property.

unstable since: 2.26

###### g_dbus_proxy_get_object_path

Gets the object path `proxy` is for.

unstable since: 2.26

###### g_dbus_proxy_set_cached_property

If `value` is not `NULL`, sets the cached value for the property with name `property_name` to the value in `value`.

unstable since: 2.26

###### g_dbus_proxy_set_default_timeout

Sets the timeout to use if -1 (specifying default timeout) is passed as `timeout_msec` in the `g_dbus_proxy_call()` and `g_dbus_proxy_call_sync()` functions.

unstable since: 2.26

###### g_dbus_proxy_set_interface_info

Ensure that interactions with `proxy` conform to the given interface. See the `GDBusProxy:g-interface-info` property for more details.

unstable since: 2.26

##### Methods inherited from GObject (43)

Please see GObject for a full list of methods.

##### Methods inherited from GAsyncInitable (3)

###### g_async_initable_init_async

Starts asynchronous initialization of the object implementing the interface. This must be done before any real use of the object after initial construction. If the object also implements `GInitable` you can optionally call `g_initable_init()` instead.

unstable since: 2.22

###### g_async_initable_init_finish

Finishes asynchronous initialization and returns the result. See g_async_initable_init_async().

unstable since: 2.22

###### g_async_initable_new_finish

Finishes the async construction for the various g_async_initable_new calls, returning the created object or `NULL` on error.

unstable since: 2.22

##### Methods inherited from GDBusInterface (4)

###### g_dbus_interface_dup_object

Gets the `GDBusObject` that `interface_` belongs to, if any.

unstable since: 2.32

###### g_dbus_interface_get_info

Gets D-Bus introspection information for the D-Bus interface implemented by `interface_`.

unstable since: 2.30

###### g_dbus_interface_get_object

Gets the `GDBusObject` that `interface_` belongs to, if any.

unstable since: 2.30

###### g_dbus_interface_set_object

Sets the `GDBusObject` for `interface_` to `object`.

unstable since: 2.30

##### Methods inherited from GInitable (1)

###### g_initable_init

Initializes the object implementing the interface.

unstable since: 2.22

#### Properties

###### Secret.Service:collections

A list of `SecretCollection` objects representing the collections in the Secret Service.

unstable since: 1

##### Properties inherited from GDBusProxy (9)

###### Gio.DBusProxy:g-bus-type

If this property is not `G_BUS_TYPE_NONE`, then `GDBusProxy:g-connection` must be `NULL` and will be set to the `GDBusConnection` obtained by calling `g_bus_get()` with the value of this property.

unstable since: 2.26

###### Gio.DBusProxy:g-connection

The `GDBusConnection` the proxy is for.

unstable since: 2.26

###### Gio.DBusProxy:g-default-timeout

The timeout to use if -1 (specifying default timeout) is passed as `timeout_msec` in the `g_dbus_proxy_call()` and `g_dbus_proxy_call_sync()` functions.

unstable since: 2.26

###### Gio.DBusProxy:g-flags

Flags from the `GDBusProxyFlags` enumeration.

unstable since: 2.26

###### Gio.DBusProxy:g-interface-info

Ensure that interactions with this proxy conform to the given interface. This is mainly to ensure that malformed data received from the other peer is ignored. The given `GDBusInterfaceInfo` is said to be the “expected interface”.

unstable since: 2.26

###### Gio.DBusProxy:g-interface-name

The D-Bus interface name the proxy is for.

unstable since: 2.26

###### Gio.DBusProxy:g-name

The well-known or unique name that the proxy is for.

unstable since: 2.26

###### Gio.DBusProxy:g-name-owner

The unique name that owns `GDBusProxy:g-name` or `NULL` if no-one currently owns that name. You may connect to `GObject::notify` signal to track changes to this property.

unstable since: 2.26

###### Gio.DBusProxy:g-object-path

The object path the proxy is for.

unstable since: 2.26

##### Properties inherited from SecretBackend (1)

###### SecretBackend:flags

A set of flags describing which parts of the secret backend have been initialized.

since: 0.19.0

#### Signals

##### Signals inherited from GDBusProxy (2)

###### GDBusProxy::g-properties-changed

Emitted when one or more D-Bus properties on `proxy` changes. The local cache has already been updated when this signal fires. Note that both `changed_properties` and `invalidated_properties` are guaranteed to never be `NULL` (either may be empty though).

unstable since: 2.26

###### GDBusProxy::g-signal

Emitted when a signal from the remote object and interface that `proxy` is for, has been received.

unstable since: 2.26

##### Signals inherited from GObject (1)

###### GObject::notify

The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.

unstable since: 2.0

#### Class structure

    struct SecretServiceClass {
      GDBusProxyClass parent_class;
      GType collection_gtype;
      GType item_gtype;
      GVariant* (* prompt_sync) (
        SecretService* self,
        SecretPrompt* prompt,
        GCancellable* cancellable,
        const GVariantType* return_type,
        GError** error
      );
      void (* prompt_async) (
        SecretService* self,
        SecretPrompt* prompt,
        const GVariantType* return_type,
        GCancellable* cancellable,
        GAsyncReadyCallback callback,
        gpointer user_data
      );
      GVariant* (* prompt_finish) (
        SecretService* self,
        GAsyncResult* result,
        GError** error
      );
      GType (* get_collection_gtype) (
        SecretService* self
      );
      GType (* get_item_gtype) (
        SecretService* self
      );

    }

The class for `SecretService`.

###### Class members

`parent_class: GDBusProxyClass`

  The parent class.

`collection_gtype: GType`

  The `GType` of the `SecretCollection` objects instantiated by the `SecretService` proxy.

`item_gtype: GType`

  The `GType` of the `SecretItem` objects instantiated by the `SecretService` proxy.

`prompt_sync: GVariant* (* prompt_sync) ( SecretService* self, SecretPrompt* prompt, GCancellable* cancellable, const GVariantType* return_type, GError** error )`
  No description available.
`prompt_async: void (* prompt_async) ( SecretService* self, SecretPrompt* prompt, const GVariantType* return_type, GCancellable* cancellable, GAsyncReadyCallback callback, gpointer user_data )`
  No description available.
`prompt_finish: GVariant* (* prompt_finish) ( SecretService* self, GAsyncResult* result, GError** error )`
  No description available.
`get_collection_gtype: GType (* get_collection_gtype) ( SecretService* self )`
  No description available.
`get_item_gtype: GType (* get_item_gtype) ( SecretService* self )`
  No description available.

#### Virtual methods

###### Secret.ServiceClass.get_collection_gtype

Get the GObject type for collections instantiated by this service.

unstable since: 1

###### Secret.ServiceClass.get_item_gtype

Get the GObject type for items instantiated by this service.

unstable since: 1

###### Secret.ServiceClass.prompt_async

No description available.

unstable since: 1

###### Secret.ServiceClass.prompt_finish

Complete asynchronous operation to perform prompting for a `SecretPrompt`.

unstable since: 1

###### Secret.ServiceClass.prompt_sync

Perform prompting for a `SecretPrompt`.

unstable since: 1