API conversion

Item attributes
Working with schemas
Storing passwords and items
Searching for passwords and items
Removing passwords and icons
Item management
Keyring management
Locking and unlocking
Non-pageable memory
Errors and cancellation

Here are some clues on how to migrate various libgnome-keyring API functions and their logical equivalents in libsecret.

Item attributes

Remember that attributes are not, and never have been stored in an encrypted fashion. They are not part of the 'secret', but instead are a way to lookup a secret item.

All attributes in libsecret are stored as strings. Sets of attributes are represented by GHashTables and the keys and values of these hash tables are strings.

libsecret is far more focused on schemas, and encourages users to define a SecretSchema for their password storage. The schema defines which attributes are allowed an item. Each schema has a name which is usually a dotted string (eg: org.gnome.MyProject.Password). This schema name is stored internally in the item attributes.

Schemas define whether an attribute should look like an integer, a boolean, or a free-form string. These types are used when validating the attribute values, even though the attribute values are stored and matched as strings. Since attribute values are used primarily for lookup of items it's important that the string representations of integers and booleans are always identical. Boolean values are stored as the strings true and false. Integer values are stored in decimal, with a preceeding negative sign for negative integers. libsecret facilitates this using the secret_attributes_build() and secret_attributes_buildv() functions.

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.

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