### Setup swtpm emulator Source: https://gnome.pages.gitlab.gnome.org/libsecret/libsecret-tpm2.html Commands to install and configure the swtpm TPM emulator, including starting the swtpm socket and the tpm2-abrmd resource manager, and setting the TCTI environment variable. ```bash dnf install swtpm swtpm-tools tpm2-abrmd tpm2-tss-devel eval `dbus-launch --sh-syntax` export XDG_CONFIG_HOME=$HOME/.config/swtpm /usr/share/swtpm/swtpm-create-user-config-files --mkdir -p ${XDG_CONFIG_HOME}/mytpm1 swtpm_setup --tpm2 --tpmstate $XDG_CONFIG_HOME/mytpm1 --createek --allow-signing --decryption --create-ek-cert --create-platform-cert --lock-nvram --overwrite --display swtpm socket --tpm2 --tpmstate dir=$XDG_CONFIG_HOME/mytpm1 --flags startup-clear --ctrl type=tcp,port=2322 --server type=tcp,port=2321 --daemon tpm2-abrmd --logger=stdout --tcti=swtpm: --session --allow-root --flush-all & export TCTI=tabrmd:bus_type=session ``` -------------------------------- ### Example schema definition with SecretSchema Source: https://gnome.pages.gitlab.gnome.org/libsecret/struct.Schema.html Example of defining a custom SecretSchema in a header and source file. The schema is named 'org.example.Password' and defines three attributes: 'number' (integer), 'string' (string), and 'even' (boolean). The function returns a pointer to the static schema, and the macro EXAMPLE_SCHEMA provides a convenient accessor. ```c // in a header: const SecretSchema * example_get_schema (void) G_GNUC_CONST; #define EXAMPLE_SCHEMA example_get_schema () // in a .c file const SecretSchema * example_get_schema (void) { static const SecretSchema the_schema = { "org.example.Password", SECRET_SCHEMA_NONE, { { "number", SECRET_SCHEMA_ATTRIBUTE_INTEGER }, { "string", SECRET_SCHEMA_ATTRIBUTE_STRING }, { "even", SECRET_SCHEMA_ATTRIBUTE_BOOLEAN }, { NULL, 0 }, } }; return &the_schema; } ``` -------------------------------- ### Python: Import libsecret via GObject Introspection Source: https://gnome.pages.gitlab.gnome.org/libsecret/libsecret-using.html Import libsecret in Python using the standard introspection mechanism. The example also shows creating a schema. ```python import gi gi.require_version("Secret", "1") from gi.repository import Secret # ... and a here's sample line of code which uses the import schema = Secret.Schema.new("org.mock.Schema", Secret.SchemaFlags.NONE, { "name": Secret.SchemaAttributeType.STRING }) ``` -------------------------------- ### JavaScript: Import libsecret via GObject Introspection Source: https://gnome.pages.gitlab.gnome.org/libsecret/libsecret-using.html Import libsecret in JavaScript using the standard introspection mechanism. The example also shows creating a schema. ```javascript const Secret = imports.gi.Secret; // ... and here's a sample line of code which uses the import var schema = new Secret.Schema.new("org.mock.Schema", Secret.SchemaFlags.NONE, { "name", Secret.SchemaAttributeType.STRING }); ``` -------------------------------- ### g_dbus_proxy_get_connection Source: https://gnome.pages.gitlab.gnome.org/libsecret/class.Prompt.html Gets the connection proxy is for. Inherited from GDBusProxy. ```APIDOC ## g_dbus_proxy_get_connection ### Description Gets the connection `proxy` is for. ### Method Instance method ### Parameters None explicitly documented. ### Returns No explicit return value documented. ``` -------------------------------- ### Define a password schema with Secret.Schema Source: https://gnome.pages.gitlab.gnome.org/libsecret/libsecret-vala-examples.html Defines a schema named 'org.example.Password' with three attributes: 'number' (INTEGER), 'string' (STRING), and 'even' (BOOLEAN). The schema is typically defined once globally and used in other examples. ```vala var example = new Secret.Schema ("org.example.Password", Secret.SchemaFlags.NONE, "number", Secret.SchemaAttributeType.INTEGER, "string", Secret.SchemaAttributeType.STRING, "even", Secret.SchemaAttributeType.BOOLEAN); ``` -------------------------------- ### g_async_initable_init_async Source: https://gnome.pages.gitlab.gnome.org/libsecret/class.Prompt.html 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. Inherited from GAsyncInitable. ```APIDOC ## g_async_initable_init_async ### Description 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. ### Method Instance method ### Parameters - **io_priority** (gint) - The I/O priority. - **cancellable** (GCancellable) - Optional cancellable object. - **callback** (GAsyncReadyCallback) - Callback to invoke when the operation completes. - **user_data** (gpointer) - User data to pass to the callback. ### Returns No explicit return value documented. ``` -------------------------------- ### secret_service_get Source: https://gnome.pages.gitlab.gnome.org/libsecret/type_func.Service.get.html Asynchronously gets a SecretService proxy. If a proxy already exists, the same proxy is returned. Initializes requested service functionality before completing. Use secret_service_get_finish() in the callback to obtain the result. ```APIDOC ## secret_service_get ### Description Get a `SecretService` 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. This function completes asynchronously. Use `secret_service_get_finish()` inside the `GAsyncReadyCallback` to obtain the result of the operation. ### Declaration ```c void secret_service_get ( SecretServiceFlags flags, GCancellable* cancellable, GAsyncReadyCallback callback, gpointer user_data ) ``` ### Parameters - **flags** (SecretServiceFlags) - Required - Flags for which service functionality to ensure is initialized. - **cancellable** (GCancellable) - Optional - Optional cancellation object. The argument can be `NULL`. The data is owned by the caller of the function. - **callback** (GAsyncReadyCallback) - Required - Called when the operation completes. - **user_data** (gpointer) - Optional - Data to be passed to the callback. The argument can be `NULL`. The data is owned by the caller of the function. ### Return Value This function does not return a value directly. The result is obtained asynchronously via `secret_service_get_finish()` in the provided callback. ``` -------------------------------- ### secret_collection_new_for_dbus_path_sync Source: https://gnome.pages.gitlab.gnome.org/libsecret/class.Collection.html Gets a new collection proxy for a collection in the secret service. ```APIDOC ## secret_collection_new_for_dbus_path_sync ### Description Gets a new collection proxy for a collection in the secret service. ### Method Function ### Signature `SecretCollection* secret_collection_new_for_dbus_path_sync (SecretService* service, const gchar* collection_path, SecretCollectionFlags flags, GCancellable* cancellable, GError** error)` ### Parameters - **service** (SecretService*) - The secret service object. - **collection_path** (const gchar*) - The D-Bus path of the collection. - **flags** (SecretCollectionFlags) - Flags for the collection proxy. - **cancellable** (GCancellable*) - Optional cancellable object. - **error** (GError**) - Return location for an error, or NULL. ### Returns - **SecretCollection*** - The new collection proxy, or NULL on error. ``` -------------------------------- ### Store a password asynchronously Source: https://gnome.pages.gitlab.gnome.org/libsecret/libsecret-js-examples.html Stores a password asynchronously using password_store, appropriate for GUI applications to avoid blocking the UI. Uses the example schema. ```javascript const Secret = imports.gi.Secret; function on_password_stored(source, result) { Secret.password_store_finish(result); /* ... do something now that the password has been stored */ } /* * The attributes used to later lookup the password. These * attributes should conform to the schema. */ var attributes = { "number": "8", "string": "eight", "even": "true" }; Secret.password_store(EXAMPLE_SCHEMA, attributes, Secret.COLLECTION_DEFAULT, "The label", "the password", null, on_password_stored); ``` -------------------------------- ### secret_collection_new_for_dbus_path_finish Source: https://gnome.pages.gitlab.gnome.org/libsecret/ctor.Collection.new_for_dbus_path_finish.html Finishes an asynchronous operation to get a new collection proxy for a collection in the secret service. This constructor is not directly available to language bindings. ```APIDOC ## secret_collection_new_for_dbus_path_finish ### Description Finishes an asynchronous operation to get a new collection proxy for a collection in the secret service. This constructor is not directly available to language bindings. ### Declaration ```c SecretCollection* secret_collection_new_for_dbus_path_finish ( GAsyncResult* result, GError** error ) ``` ### Parameters #### `result` - **Type:** `GAsyncResult` - The asynchronous result passed to the callback. - The data is owned by the caller of the function. #### `error` - **Type:** `GError **` - The return location for a recoverable error. - The argument can be `NULL`. - If the return location is not `NULL`, then you must initialize it to a `NULL` `GError*`. - The argument will be left initialized to `NULL` by the constructor if there are no errors. - In case of error, the argument will be set to a newly allocated `GError`; the caller will take ownership of the data, and be responsible for freeing it. ### Return Value - **Type:** `SecretCollection` - The new collection, which should be unreferenced with `g_object_unref()`. - The caller of the function takes ownership of the data, and is responsible for freeing it. ``` -------------------------------- ### secret_item_new_for_dbus_path_finish Source: https://gnome.pages.gitlab.gnome.org/libsecret/ctor.Item.new_for_dbus_path_finish.html Finishes an asynchronous operation to get a new item proxy for a secret item in the secret service. This constructor is not directly available to language bindings. ```APIDOC ## SecretItem* secret_item_new_for_dbus_path_finish (GAsyncResult* result, GError** error) ### Description Finishes an asynchronous operation to get a new item proxy for a secret item in the secret service. ### Stability Unstable ### Parameters - **result** (GAsyncResult*) - The asynchronous result passed to the callback. The data is owned by the caller of the function. - **error** (GError**) - The return location for a recoverable error. The argument can be NULL. If the return location is not NULL, then you must initialize it to a NULL GError*. The argument will be left initialized to NULL by the constructor if there are no errors. In case of error, the argument will be set to a newly allocated GError; the caller will take ownership of the data, and be responsible for freeing it. ### Return Value - **SecretItem** - The new item, which should be unreferenced with g_object_unref(). The caller of the function takes ownership of the data, and is responsible for freeing it. ``` -------------------------------- ### secret_item_get_label Source: https://gnome.pages.gitlab.gnome.org/libsecret/class.Item.html Get the label of this item. ```APIDOC ## secret_item_get_label ### Description Get the label of this item. ### Method Instance method ### Signature secret_item_get_label() ### Parameters No parameters documented. ### Returns No return value documented. ### Errors No error handling documented. ``` -------------------------------- ### Build libsecret with TPM2 support Source: https://gnome.pages.gitlab.gnome.org/libsecret/libsecret-tpm2.html Commands to configure and build libsecret with TPM2 support using the -Dtpm2=true flag. Run these in the libsecret source directory. ```bash meson _build -Dtpm2=true ninja -C _build ninja -C _build install ``` -------------------------------- ### secret_collection_get_items Source: https://gnome.pages.gitlab.gnome.org/libsecret/class.Collection.html Gets the list of items in this collection. ```APIDOC ## secret_collection_get_items ### Description Gets the list of items in this collection. ### Method Instance method ### Signature `GList* secret_collection_get_items (SecretCollection* self)` ### Parameters - **self** (SecretCollection*) - The collection proxy. ### Returns - **GList*** - A list of SecretItem objects. ``` -------------------------------- ### SecretService.prompt_sync Source: https://gnome.pages.gitlab.gnome.org/libsecret/method.Service.prompt_sync.html Documentation for the SecretService.prompt_sync method, including its signature, parameters, and return value. ```APIDOC ## SecretService.prompt_sync ### Description Perform prompting for a `SecretPrompt`. 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. ### Method Synchronous method call ### Signature ``` GVariant* secret_service_prompt_sync ( SecretService* self, SecretPrompt* prompt, GCancellable* cancellable, const GVariantType* return_type, GError** error ) ``` ### Parameters - **self** (SecretService*) - The `SecretService` instance. - **prompt** (SecretPrompt*) - The prompt. The data is owned by the caller of the method. - **cancellable** (GCancellable*) - Optional cancellation object. The argument can be `NULL`. The data is owned by the caller of the method. - **return_type** (GVariantType*) - The variant type of the prompt result. The data is owned by the caller of the method. - **error** (GError**) - The return location for a recoverable error. The argument can be `NULL`. If the return location is not `NULL`, then you must initialize it to a `NULL` `GError*`. The argument will be left initialized to `NULL` by the method if there are no errors. In case of error, the argument will be set to a newly allocated `GError`; the caller will take ownership of the data, and be responsible for freeing it. ### Return Value - **GVariant*** - `NULL` if the prompt was dismissed or an error occurred, a variant result if the prompt was successful. The caller of the method takes ownership of the returned data, and is responsible for freeing it. ### Notes This function is called by other parts of this library to handle prompts for the various actions that can require prompting. Override the `SecretServiceClass` `Secret.ServiceClass.prompt_sync` virtual method to change the behavior of the prompting. The default behavior is to simply run `secret_prompt_perform_sync()` on the prompt with a `NULL` `window_id`. ``` -------------------------------- ### secret_item_get_secret Source: https://gnome.pages.gitlab.gnome.org/libsecret/class.Item.html Get the secret value of this item. ```APIDOC ## secret_item_get_secret ### Description Get the secret value of this item. ### Method Instance method ### Signature secret_item_get_secret() ### Parameters No parameters documented. ### Returns No return value documented. ### Errors No error handling documented. ``` -------------------------------- ### C: pkg-config check for libsecret-1 Source: https://gnome.pages.gitlab.gnome.org/libsecret/libsecret-using.html Use this in configure.ac to check for libsecret-1 and set compiler flags. Requires pkg-config. ```autoconf PKG_CHECK_MODULES(LIBSECRET, [libsecret-1 >= 1.0]) AC_SUBST(LIBSECRET_CFLAGS) AC_SUBST(LIBSECRET_LIBS) ``` -------------------------------- ### secret_item_get_locked Source: https://gnome.pages.gitlab.gnome.org/libsecret/class.Item.html Get whether the item is locked or not. ```APIDOC ## secret_item_get_locked ### Description Get whether the item is locked or not. ### Method Instance method ### Signature secret_item_get_locked() ### Parameters No parameters documented. ### Returns No return value documented. ### Errors No error handling documented. ``` -------------------------------- ### C: pkg-config check for libsecret-unstable Source: https://gnome.pages.gitlab.gnome.org/libsecret/libsecret-using.html Use this in configure.ac to enable unstable libsecret API. The API may change. ```autoconf PKG_CHECK_MODULES(LIBSECRET, [libsecret-unstable >= 1.0]) AC_SUBST(LIBSECRET_CFLAGS) AC_SUBST(LIBSECRET_LIBS) ``` -------------------------------- ### secret_service_get Source: https://gnome.pages.gitlab.gnome.org/libsecret/class.Service.html Gets a SecretService proxy for the Secret Service. ```APIDOC ## secret_service_get ### Description Get a `SecretService` proxy for the Secret Service. ### Method N/A (function) ### Endpoint N/A ### Parameters None ### Request Example N/A ### Response N/A ### Error Handling N/A ``` -------------------------------- ### Vala: Set libsecret-1 pkg in Makefile.am Source: https://gnome.pages.gitlab.gnome.org/libsecret/libsecret-using.html Use this in Makefile.am to compile Vala code against libsecret-1. ```makefile AM_VALAFLAGS = \ --pkg=libsecret-1 ``` -------------------------------- ### void retrieve_secret (SecretRetrievable* self, GCancellable* cancellable, GAsyncReadyCallback callback, gpointer user_data) Source: https://gnome.pages.gitlab.gnome.org/libsecret/vfunc.Retrievable.retrieve_secret.html Starts an asynchronous retrieval of the secret value associated with the SecretRetrievable object. It accepts an optional cancellable, a callback for completion, and user data to pass to the callback. ```APIDOC ## retrieve_secret ### Description Retrieve the secret value of this object. Each retrievable object has a single secret which might be a password or some other secret binary value. This function returns immediately and completes asynchronously. ### Method void retrieve_secret (SecretRetrievable* self, GCancellable* cancellable, GAsyncReadyCallback callback, gpointer user_data) ### Parameters - **self** (SecretRetrievable*) - Required - The SecretRetrievable object. - **cancellable** (GCancellable) - Optional - Optional cancellation object. The argument can be NULL. The data is owned by the caller of the method. - **callback** (GAsyncReadyCallback) - Required - Called when the operation completes. - **user_data** (gpointer) - Optional - Data to pass to the callback. The argument can be NULL. The data is owned by the caller of the method. ### Available since 0.19.0 ``` -------------------------------- ### secret_collection_get_modified Source: https://gnome.pages.gitlab.gnome.org/libsecret/class.Collection.html Gets the modified date and time of the collection. ```APIDOC ## secret_collection_get_modified ### Description Gets the modified date and time of the collection. ### Method Instance method ### Signature `GDateTime* secret_collection_get_modified (SecretCollection* self)` ### Parameters - **self** (SecretCollection*) - The collection proxy. ### Returns - **GDateTime*** - The modified date and time. ``` -------------------------------- ### secret_backend_get_finish Source: https://gnome.pages.gitlab.gnome.org/libsecret/iface.Backend.html Completes an asynchronous operation to get a SecretBackend. ```APIDOC ## secret_backend_get_finish ### Description Completes an asynchronous operation to get a `SecretBackend`. ### Method Function ### Signature `secret_backend_get_finish` ### Parameters None documented. ### Return Value A `SecretBackend` instance. ### Since 0.19.0 ``` -------------------------------- ### secret_prompt_perform_sync Source: https://gnome.pages.gitlab.gnome.org/libsecret/class.Prompt.html Runs a prompt and performs the prompting synchronously. This is an instance method of the SecretPrompt class. ```APIDOC ## secret_prompt_perform_sync ### Description Runs a prompt and performs the prompting synchronously. ### Method Instance method ### Parameters None explicitly documented. ### Returns No explicit return value documented. ``` -------------------------------- ### secret_backend_get Source: https://gnome.pages.gitlab.gnome.org/libsecret/iface.Backend.html Gets a SecretBackend instance. This is an asynchronous operation. ```APIDOC ## secret_backend_get ### Description Gets a `SecretBackend` instance. ### Method Function ### Signature `secret_backend_get` ### Parameters None documented. ### Return Value A `SecretBackend` instance. ### Since 0.19.0 ``` -------------------------------- ### secret_item_get_modified Source: https://gnome.pages.gitlab.gnome.org/libsecret/class.Item.html Get the modified date and time of the item. ```APIDOC ## secret_item_get_modified ### Description Get the modified date and time of the item. ### Method Instance method ### Signature secret_item_get_modified() ### Parameters No parameters documented. ### Returns No return value documented. ### Errors No error handling documented. ``` -------------------------------- ### Vala: Enable unstable API with SECRET_WITH_UNSTABLE Source: https://gnome.pages.gitlab.gnome.org/libsecret/libsecret-using.html Define SECRET_WITH_UNSTABLE in Makefile.am to use unstable libsecret API, otherwise the build fails. ```makefile AM_CPPFLAGS = \ -DSECRET_WITH_UNSTABLE=1 ``` -------------------------------- ### secret_item_get_created Source: https://gnome.pages.gitlab.gnome.org/libsecret/class.Item.html Get the created date and time of the item. ```APIDOC ## secret_item_get_created ### Description Get the created date and time of the item. ### Method Instance method ### Signature secret_item_get_created() ### Parameters No parameters documented. ### Returns No return value documented. ### Errors No error handling documented. ``` -------------------------------- ### Lookup password asynchronously with Secret.password_lookupv Source: https://gnome.pages.gitlab.gnome.org/libsecret/libsecret-vala-examples.html Use for GUI applications to avoid blocking the UI. Builds an attributes hash table and calls Secret.password_lookupv.begin, then retrieves the password in the callback via Secret.password_lookup.end. ```vala var attributes = new GLib.HashTable (); attributes["number"] = "8"; attributes["string"] = "eight"; attributes["even"] = "true"; Secret.password_lookupv.begin (example_schema, attributes, null, (obj, async_res) => { string password = Secret.password_lookup.end (async_res); }); ``` -------------------------------- ### secret_value_get_content_type Source: https://gnome.pages.gitlab.gnome.org/libsecret/method.Value.get_content_type.html Get the content type of the secret value, such as `text/plain`. ```APIDOC ## secret_value_get_content_type ### Description Get the content type of the secret value, such as `text/plain`. ### Declaration ```c const gchar* secret_value_get_content_type ( SecretValue* value ) ``` ### Parameters - **value** (SecretValue*) - The secret value whose content type is to be retrieved. ### Return Value - **Type:** `const gchar*` - The content type. The returned data is owned by the instance. The value is a NUL terminated UTF-8 string. ``` -------------------------------- ### g_async_initable_init_finish Source: https://gnome.pages.gitlab.gnome.org/libsecret/class.Prompt.html Finishes asynchronous initialization and returns the result. See g_async_initable_init_async(). Inherited from GAsyncInitable. ```APIDOC ## g_async_initable_init_finish ### Description Finishes asynchronous initialization and returns the result. See g_async_initable_init_async(). ### Method Instance method ### Parameters - **res** (GAsyncResult) - The result of the asynchronous operation. ### Returns No explicit return value documented. ``` -------------------------------- ### secret_service_create_collection_dbus_path_sync Source: https://gnome.pages.gitlab.gnome.org/libsecret/class.Service.html Creates a new collection in the secret service and returns its path synchronously. ```APIDOC ## secret_service_create_collection_dbus_path_sync ### Description Create a new collection in the secret service and return its path. ### Method N/A (instance method) ### Endpoint N/A ### Parameters None ### Request Example N/A ### Response N/A ### Error Handling N/A ``` -------------------------------- ### secret_item_get_service Source: https://gnome.pages.gitlab.gnome.org/libsecret/class.Item.html Get the Secret Service object that this item was created with. ```APIDOC ## secret_item_get_service ### Description Get the Secret Service object that this item was created with. ### Method Instance method ### Signature secret_item_get_service() ### Parameters No parameters documented. ### Returns No return value documented. ### Errors No error handling documented. ``` -------------------------------- ### g_dbus_interface_get_object Source: https://gnome.pages.gitlab.gnome.org/libsecret/class.Prompt.html Gets the GDBusObject that interface_ belongs to, if any. Inherited from GDBusInterface. ```APIDOC ## g_dbus_interface_get_object ### Description Gets the `GDBusObject` that `interface_` belongs to, if any. ### Method Instance method ### Parameters None explicitly documented. ### Returns No explicit return value documented. ``` -------------------------------- ### void secret_service_set_alias_to_dbus_path (SecretService* self, const gchar* alias, const gchar* collection_path, GCancellable* cancellable, GAsyncReadyCallback callback, gpointer user_data) Source: https://gnome.pages.gitlab.gnome.org/libsecret/method.Service.set_alias_to_dbus_path.html Assigns a collection to a well-known alias asynchronously. The collection is identified by its D-Bus object path. The operation completes asynchronously; use secret_service_set_alias_to_dbus_path_finish() in the callback to obtain the result. ```APIDOC ## void secret_service_set_alias_to_dbus_path (SecretService* self, const gchar* alias, const gchar* collection_path, GCancellable* cancellable, GAsyncReadyCallback callback, gpointer user_data) ### Description Assigns a collection to a well-known alias, such as 'default'. The collection is identified by its D-Bus object path. This method returns immediately and completes asynchronously. ### Method void ### Signature ```c void secret_service_set_alias_to_dbus_path ( SecretService* self, const gchar* alias, const gchar* collection_path, GCancellable* cancellable, GAsyncReadyCallback callback, gpointer user_data ) ``` ### Parameters - **self** (SecretService*) - The SecretService object. - **alias** (const gchar*) - The alias to assign the collection to. NUL terminated UTF-8 string. Data owned by caller. - **collection_path** (const gchar*) - The D-Bus object path of the collection to assign to the alias. Can be NULL. NUL terminated UTF-8 string. Data owned by caller. - **cancellable** (GCancellable*) - Optional cancellation object. Can be NULL. Data owned by caller. - **callback** (GAsyncReadyCallback) - Called when the operation completes. Can be NULL. - **user_data** (gpointer) - Data to pass to the callback. Can be NULL. Data owned by caller. ### Return Value void ### Notes - Stability: Unstable - This method completes asynchronously. Use `secret_service_set_alias_to_dbus_path_finish()` inside the `GAsyncReadyCallback` to obtain the result. - This method is not directly available to language bindings. ``` -------------------------------- ### g_dbus_interface_dup_object Source: https://gnome.pages.gitlab.gnome.org/libsecret/class.Prompt.html Gets the GDBusObject that interface_ belongs to, if any. Inherited from GDBusInterface. ```APIDOC ## g_dbus_interface_dup_object ### Description Gets the `GDBusObject` that `interface_` belongs to, if any. ### Method Instance method ### Parameters None explicitly documented. ### Returns No explicit return value documented. ``` -------------------------------- ### g_dbus_proxy_get_object_path Source: https://gnome.pages.gitlab.gnome.org/libsecret/class.Prompt.html Gets the object path proxy is for. Inherited from GDBusProxy. ```APIDOC ## g_dbus_proxy_get_object_path ### Description Gets the object path `proxy` is for. ### Method Instance method ### Parameters None explicitly documented. ### Returns No explicit return value documented. ``` -------------------------------- ### secret_prompt_perform Source: https://gnome.pages.gitlab.gnome.org/libsecret/class.Prompt.html Runs a prompt and performs the prompting. This is an instance method of the SecretPrompt class. ```APIDOC ## secret_prompt_perform ### Description Runs a prompt and performs the prompting. ### Method Instance method ### Parameters None explicitly documented. ### Returns No explicit return value documented. ``` -------------------------------- ### g_dbus_proxy_get_name Source: https://gnome.pages.gitlab.gnome.org/libsecret/class.Prompt.html Gets the name that proxy was constructed for. Inherited from GDBusProxy. ```APIDOC ## g_dbus_proxy_get_name ### Description Gets the name that `proxy` was constructed for. ### Method Instance method ### Parameters None explicitly documented. ### Returns No explicit return value documented. ``` -------------------------------- ### g_initable_init Source: https://gnome.pages.gitlab.gnome.org/libsecret/class.Prompt.html Initializes the object implementing the interface. Inherited from GInitable. ```APIDOC ## g_initable_init ### Description Initializes the object implementing the interface. ### Method Instance method ### Parameters - **cancellable** (GCancellable) - Optional cancellable object. - **error** (GError) - Location to store error information. ### Returns No explicit return value documented. ``` -------------------------------- ### g_dbus_proxy_get_flags Source: https://gnome.pages.gitlab.gnome.org/libsecret/class.Prompt.html Gets the flags that proxy was constructed with. Inherited from GDBusProxy. ```APIDOC ## g_dbus_proxy_get_flags ### Description Gets the flags that `proxy` was constructed with. ### Method Instance method ### Parameters None explicitly documented. ### Returns No explicit return value documented. ``` -------------------------------- ### Method declaration for secret_service_set_alias_to_dbus_path Source: https://gnome.pages.gitlab.gnome.org/libsecret/method.Service.set_alias_to_dbus_path.html C function declaration for the asynchronous method. Use this signature when calling the method; it returns immediately and completes asynchronously. The callback should be used with secret_service_set_alias_to_dbus_path_finish() to obtain the result. ```c void secret_service_set_alias_to_dbus_path ( SecretService* self, const gchar* alias, const gchar* collection_path, GCancellable* cancellable, GAsyncReadyCallback callback, gpointer user_data ) ``` -------------------------------- ### g_dbus_proxy_call_with_unix_fd_list_finish Source: https://gnome.pages.gitlab.gnome.org/libsecret/class.Prompt.html Finishes an operation started with g_dbus_proxy_call_with_unix_fd_list(). Inherited from GDBusProxy. ```APIDOC ## g_dbus_proxy_call_with_unix_fd_list_finish ### Description Finishes an operation started with g_dbus_proxy_call_with_unix_fd_list(). ### Method Instance method ### Parameters - **res** (GAsyncResult) - The result of the asynchronous operation. ### Returns No explicit return value documented. ``` -------------------------------- ### Interface member: ensure_for_flags_finish Source: https://gnome.pages.gitlab.gnome.org/libsecret/iface.Backend.html Optional implementation of reinitialization step in constructor. Returns gboolean and takes SecretBackend, GAsyncResult, and GError**. ```c gboolean (* ensure_for_flags_finish) ( SecretBackend* self, GAsyncResult* result, GError** error ) ``` -------------------------------- ### g_dbus_proxy_call_finish Source: https://gnome.pages.gitlab.gnome.org/libsecret/class.Prompt.html Finishes an operation started with g_dbus_proxy_call(). Inherited from GDBusProxy. ```APIDOC ## g_dbus_proxy_call_finish ### Description Finishes an operation started with g_dbus_proxy_call(). ### Method Instance method ### Parameters - **res** (GAsyncResult) - The result of the asynchronous operation. ### Returns No explicit return value documented. ``` -------------------------------- ### secret_service_open Source: https://gnome.pages.gitlab.gnome.org/libsecret/type_func.Service.open.html Asynchronously creates a new SecretService proxy for the Secret Service. This function is rarely used; use secret_service_get() instead. It completes asynchronously and uses secret_service_open_finish() to obtain the result. ```APIDOC ## secret_service_open ### Description Create a new `SecretService` proxy for the Secret Service. This function is rarely used, see `secret_service_get()` instead. This method will return immediately and complete asynchronously. Use `secret_service_open_finish()` inside the `GAsyncReadyCallback` to obtain the result of the operation. ### Function Signature ```c void secret_service_open ( GType service_gtype, const gchar* service_bus_name, SecretServiceFlags flags, GCancellable* cancellable, GAsyncReadyCallback callback, gpointer user_data ) ``` ### Parameters - `service_gtype` (GType) - Required - The GType of the new secret service. - `service_bus_name` (const gchar*) - Optional - The D-Bus service name of the secret service. Can be `NULL`. The data is owned by the caller of the function. The value is a NUL terminated UTF-8 string. - `flags` (SecretServiceFlags) - Required - Flags for which service functionality to ensure is initialized. - `cancellable` (GCancellable) - Optional - Optional cancellation object. Can be `NULL`. The data is owned by the caller of the function. - `callback` (GAsyncReadyCallback) - Required - Called when the operation completes. - `user_data` (gpointer) - Optional - Data to be passed to the callback. Can be `NULL`. The data is owned by the caller of the function. ### Return Value This function does not return a value. The result of the operation is obtained asynchronously via `secret_service_open_finish()`. ``` -------------------------------- ### secret_service_get_flags Source: https://gnome.pages.gitlab.gnome.org/libsecret/method.Service.get_flags.html Gets the flags representing what features of the SecretService proxy have been initialized. ```APIDOC ## secret_service_get_flags ### Description Get the flags representing what features of the `SecretService` proxy have been initialized. ### Method secret_service_get_flags ### Signature ```c SecretServiceFlags secret_service_get_flags ( SecretService* self ) ``` ### Parameters - **self** (SecretService*) - The SecretService proxy instance. ### Return Value - **SecretServiceFlags** - The flags for features initialized. ### Remarks Use `secret_service_ensure_session()` or `secret_service_load_collections()` to initialize further features and change the flags. ``` -------------------------------- ### secret_collection_new_for_dbus_path Source: https://gnome.pages.gitlab.gnome.org/libsecret/class.Collection.html Gets a new collection proxy for a collection in the secret service. ```APIDOC ## secret_collection_new_for_dbus_path ### Description Gets a new collection proxy for a collection in the secret service. ### Method Function ### Signature `void secret_collection_new_for_dbus_path (SecretService* service, const gchar* collection_path, SecretCollectionFlags flags, GCancellable* cancellable, GAsyncReadyCallback callback, gpointer user_data)` ### Parameters - **service** (SecretService*) - The secret service object. - **collection_path** (const gchar*) - The D-Bus path of the collection. - **flags** (SecretCollectionFlags) - Flags for the collection proxy. - **cancellable** (GCancellable*) - Optional cancellable object. - **callback** (GAsyncReadyCallback) - Callback to call when the operation completes. - **user_data** (gpointer) - User data to pass to the callback. ``` -------------------------------- ### Test TPM2 support Source: https://gnome.pages.gitlab.gnome.org/libsecret/libsecret-tpm2.html Commands to build and test the TPM2 support using the secret-tool store command, which stores a secret in the file backend. ```bash cd libsecret meson _build -Dtpm2=true ninja -C _build export SECRET_BACKEND=file export SECRET_FILE_TEST_PATH=$PWD/keyring ./_build/tool/secret-tool store --label=foo bar baz ls # keyring ``` -------------------------------- ### secret_prompt_run Source: https://gnome.pages.gitlab.gnome.org/libsecret/class.Prompt.html Runs a prompt and performs the prompting. This is an instance method of the SecretPrompt class. ```APIDOC ## secret_prompt_run ### Description Runs a prompt and performs the prompting. ### Method Instance method ### Parameters None explicitly documented. ### Returns No explicit return value documented. ``` -------------------------------- ### secret_collection_get_label Source: https://gnome.pages.gitlab.gnome.org/libsecret/method.Collection.get_label.html Get the label of this collection. The returned string should be freed with g_free(). ```APIDOC ## secret_collection_get_label ### Description Get the label of this collection. ### Declaration ```c gchar* secret_collection_get_label ( SecretCollection* self ) ``` ### Parameters #### self - **type**: SecretCollection* - The collection whose label is to be retrieved. ### Return Value - **type**: gchar* - The label, which should be freed with `g_free()`. The caller of the method takes ownership of the returned data, and is responsible for freeing it. The value is a NUL terminated UTF-8 string. ``` -------------------------------- ### secret_retrievable_get_label Source: https://gnome.pages.gitlab.gnome.org/libsecret/iface.Retrievable.html Get the label of this item. Returns the human readable label. ```APIDOC ## secret_retrievable_get_label ### Description Get the label of this item. ### Method GET ### Endpoint secret_retrievable_get_label ### Parameters None ### Response #### Success Response - **label** (gchar*) - The human readable label for the item. #### Response Example ```json { "label": "My Secret" } ``` ``` -------------------------------- ### g_dbus_proxy_call_with_unix_fd_list_sync Source: https://gnome.pages.gitlab.gnome.org/libsecret/class.Prompt.html Like g_dbus_proxy_call_sync() but also takes and returns GUnixFDList objects. Inherited from GDBusProxy. ```APIDOC ## g_dbus_proxy_call_with_unix_fd_list_sync ### Description Like `g_dbus_proxy_call_sync()` but also takes and returns `GUnixFDList` objects. ### Method Instance method ### Parameters - **method_name** (string) - The name of the method to invoke. - **parameters** (GVariant) - The parameters to pass to the method. - **flags** (GDBusCallFlags) - Flags for the call. - **timeout_msec** (gint) - Timeout in milliseconds. - **fd_list** (GUnixFDList) - File descriptor list to pass. - **cancellable** (GCancellable) - Optional cancellable object. - **error** (GError) - Location to store error information. ### Returns No explicit return value documented. ``` -------------------------------- ### secret_service_prompt_at_dbus_path_sync Source: https://gnome.pages.gitlab.gnome.org/libsecret/method.Service.prompt_at_dbus_path_sync.html Performs prompting for a SecretPrompt synchronously. This method blocks and should not be used in user interface threads. It is not directly available to language bindings. ```APIDOC ## secret_service_prompt_at_dbus_path_sync ### Description Perform prompting for a `SecretPrompt`. Override the `SecretServiceClass` `Secret.ServiceClass.prompt_async` virtual method to change the behavior of the prompting. The default behavior is to simply run `secret_prompt_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. ### Method Synchronous function call ### Signature ```c GVariant* secret_service_prompt_at_dbus_path_sync ( SecretService* self, const gchar* prompt_path, GCancellable* cancellable, const GVariantType* return_type, GError** error ) ``` ### Parameters - **self** (SecretService*) - The SecretService instance. - **prompt_path** (const gchar*) - The D-Bus object path of the prompt. The data is owned by the caller of the method. The value is a NUL terminated UTF-8 string. - **cancellable** (GCancellable*) - Optional cancellation object. The argument can be `NULL`. The data is owned by the caller of the method. - **return_type** (GVariantType*) - The variant type of the prompt result. The argument can be `NULL`. The data is owned by the caller of the method. - **error** (GError**) - The return location for a recoverable error. The argument can be `NULL`. If the return location is not `NULL`, then you must initialize it to a `NULL` `GError*`. The argument will be left initialized to `NULL` by the method if there are no errors. In case of error, the argument will be set to a newly allocated `GError`; the caller will take ownership of the data, and be responsible for freeing it. ### Return Value - **GVariant*** - `NULL` if the prompt was dismissed or an error occurred, a variant result if the prompt was successful. The caller of the method takes ownership of the returned data, and is responsible for freeing it. The return value can be `NULL`. ### Stability Unstable ### Availability This method is not directly available to language bindings. ``` -------------------------------- ### secret_item_get_flags Source: https://gnome.pages.gitlab.gnome.org/libsecret/class.Item.html Get the flags representing what features of the SecretItem proxy have been initialized. ```APIDOC ## secret_item_get_flags ### Description Get the flags representing what features of the SecretItem proxy have been initialized. ### Method Instance method ### Signature secret_item_get_flags() ### Parameters No parameters documented. ### Returns No return value documented. ### Errors No error handling documented. ``` -------------------------------- ### SecretCollection.new_for_dbus_path (async) Source: https://gnome.pages.gitlab.gnome.org/libsecret/type_func.Collection.new_for_dbus_path.html Asynchronously creates a new collection proxy for a collection in the secret service. The function returns immediately and completes asynchronously, with results obtained via secret_collection_new_for_dbus_path_finish(). ```APIDOC ## SecretCollection.new_for_dbus_path ### Description Get a new collection proxy for a collection in the secret service. If `service` is NULL, `secret_service_get()` will be called to get the default `SecretService` proxy. This method returns immediately and completes asynchronously. Use `secret_collection_new_for_dbus_path_finish()` inside the `GAsyncReadyCallback` to obtain the result. ### Function Signature ```c void secret_collection_new_for_dbus_path ( SecretService* service, const gchar* collection_path, SecretCollectionFlags flags, GCancellable* cancellable, GAsyncReadyCallback callback, gpointer user_data ); ``` ### Parameters - **service** (SecretService*) - The secret service object. Can be NULL. Data is owned by the caller. - **collection_path** (const gchar*) - The D-Bus path of the collection. NUL-terminated UTF-8 string. Data is owned by the caller. - **flags** (SecretCollectionFlags) - Options for the collection initialization. - **cancellable** (GCancellable*) - Optional cancellation object. Can be NULL. Data is owned by the caller. - **callback** (GAsyncReadyCallback) - Called when the operation completes. - **user_data** (gpointer) - Data passed to the callback. Can be NULL. Data is owned by the caller. ### Response #### Async Completion Use `secret_collection_new_for_dbus_path_finish()` in the `GAsyncReadyCallback` to obtain the result. ### Stability Unstable ``` -------------------------------- ### secret_service_open_sync Source: https://gnome.pages.gitlab.gnome.org/libsecret/type_func.Service.open_sync.html Creates a new SecretService proxy for the Secret Service. This function is rarely used; see secret_service_get_sync() instead. It may block indefinitely and should not be used in user interface threads. ```APIDOC ## Function: secret_service_open_sync ### Description Create a new `SecretService` proxy for the Secret Service. This function is rarely used, see `secret_service_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 `NULL` then the default is used. This method may block indefinitely and should not be used in user interface threads. ### Declaration ```c SecretService* secret_service_open_sync ( GType service_gtype, const gchar* service_bus_name, SecretServiceFlags flags, GCancellable* cancellable, GError** error ) ``` ### Parameters - **service_gtype** (GType) - The GType of the new secret service. - **service_bus_name** (const gchar*) - The D-Bus service name of the secret service. The argument can be `NULL`. The data is owned by the caller of the function. The value is a NUL terminated UTF-8 string. - **flags** (SecretServiceFlags) - Flags for which service functionality to ensure is initialized. - **cancellable** (GCancellable*) - Optional cancellation object. The argument can be `NULL`. The data is owned by the caller of the function. - **error** (GError**) - The return location for a recoverable error. The argument can be `NULL`. If the return location is not `NULL`, then you must initialize it to a `NULL` `GError*`. The argument will be left initialized to `NULL` by the function if there are no errors. In case of error, the argument will be set to a newly allocated `GError`; the caller will take ownership of the data, and be responsible for freeing it. ### Return Value - **SecretService*** - A new reference to a `SecretService` proxy, which should be released with `g_object_unref()`. The caller of the function takes ownership of the data, and is responsible for freeing it. ``` -------------------------------- ### g_dbus_proxy_get_interface_name Source: https://gnome.pages.gitlab.gnome.org/libsecret/class.Prompt.html Gets the D-Bus interface name proxy is for. Inherited from GDBusProxy. ```APIDOC ## g_dbus_proxy_get_interface_name ### Description Gets the D-Bus interface name `proxy` is for. ### Method Instance method ### Parameters None explicitly documented. ### Returns No explicit return value documented. ``` -------------------------------- ### secret_password_searchv_sync Source: https://gnome.pages.gitlab.gnome.org/libsecret/func.password_searchv_sync.html Documentation for the secret_password_searchv_sync function, including signature, parameters, return value, and availability. ```APIDOC ## secret_password_searchv_sync ### Description Searches for items in the secret service using the provided schema and attributes. Returns a list of matching items or NULL if no secret is found. This method may block indefinitely and should not be used in user interface threads. ### Function Signature ```c GList* secret_password_searchv_sync ( const SecretSchema* schema, GHashTable* attributes, SecretSearchFlags flags, GCancellable* cancellable, GError** error ) ``` ### Parameters - **schema** (const SecretSchema*) - The schema for attributes. Can be NULL. Data is owned by the caller. - **attributes** (GHashTable*) - The attribute keys and values. Data is owned by the caller. - **flags** (SecretSearchFlags) - Search option flags. - **cancellable** (GCancellable*) - Optional cancellation object. Can be NULL. Data is owned by the caller. - **error** (GError**) - Return location for a recoverable error. Can be NULL. If not NULL, must be initialized to NULL before calling. On error, set to a newly allocated GError owned by the caller. ### Return Value - **GList*** - A list of SecretRetrievable containing attributes of the matched items. The caller takes ownership of the data and is responsible for freeing it. Returns NULL if no secret is found. ### Availability Available since: 0.19.0 ### Notes This function is renamed to `secret_password_search_sync()` in language bindings. ``` -------------------------------- ### g_dbus_proxy_get_cached_property_names Source: https://gnome.pages.gitlab.gnome.org/libsecret/class.Prompt.html Gets the names of all cached properties on proxy. Inherited from GDBusProxy. ```APIDOC ## g_dbus_proxy_get_cached_property_names ### Description Gets the names of all cached properties on `proxy`. ### Method Instance method ### Parameters None explicitly documented. ### Returns No explicit return value documented. ```