## Searching for passwords and items

In general libsecret tries not to unlocking keyrings where not necessary. Many search methods only return one item or password that matches, preferring already unlocked items, and recently stored items.

Attributes are meant to be used for lookup of items; they're not designed to be used as a generic key/value database. Although you can force libsecret to do the latter, it's better to store your account information elsewhere if possible, and use libsecret to store the password or other secret. Because of this many search methods return just the password or secret.

Replacements for related libgnome-keyring functions and types are described below:

Table 4.

libgnome-keyring | libsecret
--- | ---
`gnome_keyring_find_password()` | `secret_password_lookup()`
`gnome_keyring_find_password_sync()` | `secret_password_lookup_sync()`
`gnome_keyring_find_items()` | `secret_service_search()`, with flags to fine tune behavior
`gnome_keyring_find_itemsv()` | `secret_service_search()`, with flags to fine tune behavior
`gnome_keyring_find_items_sync()` | `secret_service_search_sync()`, with flags to fine tune behavior
`gnome_keyring_find_itemsv_sync()` | `secret_service_search()`, with flags to fine tune behavior
GnomeKeyringFound | no equivalent, `secret_service_search()` returns a GList of SecretItems, and other methods return passwords directly.
`gnome_keyring_found_copy()` | no equivalent
`gnome_keyring_found_free()` | `g_object_unref()` on the each of the items returned from `secret_service_search()`
`gnome_keyring_found_list_free()` | `g_list_free_full()` used with `g_object_unref()` on the items returned from `secret_service_search()`
`gnome_keyring_find_network_password()` | `secret_password_lookup()` with `SECRET_SCHEMA_COMPAT_NETWORK`, although this only returns one password and no attributes
`gnome_keyring_find_network_password_sync()` | `secret_password_lookup_sync()` with `SECRET_SCHEMA_COMPAT_NETWORK`, although this only returns one password and no attributes
GnomeKeyringNetworkPasswordData | no equivalent, `secret_password_lookup()` gets the password directly and no attributes
`gnome_keyring_network_password_free()` | no equivalent
`gnome_keyring_network_password_list_free()` | no equivalent