Working with schemas: Libsecret Library Reference Manual

## Working with schemas

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 name is stored in the item attributes. The schema name is also used when looking up an item, to make sure that the stored schema matches that used during the lookup. If you wish to lookup items that were stored by libgnome-keyring, you should specify the `SECRET_SCHEMA_DONT_MATCH_NAME` flag in the schema so that the schema name is not matched, since it was not stored by libgnome-keyring.

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 stored, even though the attribute values are stored and matched as strings.

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

Table 2.

libgnome-keyring | libsecret
--- | ---
GnomeKeyringPasswordSchema | SecretSchema
GnomeKeyringPasswordSchemaAttribute | SecretSchemaAttribute
`GNOME_KEYRING_ITEM_APPLICATION_SECRET` | no equivalent
`GNOME_KEYRING_ITEM_CHAINED_KEYRING_PASSWORD` | no equivalent
`GNOME_KEYRING_ITEM_ENCRYPTION_KEY_PASSWORD` | no equivalent
`GNOME_KEYRING_ITEM_PK_STORAGE` | no equivalent
`GNOME_KEYRING_ITEM_GENERIC_SECRET` | no equivalent, define a specific schema with an appropriate dotted name
`GNOME_KEYRING_ITEM_NETWORK_PASSWORD` | the `SECRET_SCHEMA_COMPAT_NETWORK` schema, although not recommended for new uses
`GNOME_KEYRING_ITEM_NOTE` | the `SECRET_SCHEMA_NOTE` schema
`GNOME_KEYRING_NETWORK_PASSWORD` | the `SECRET_SCHEMA_COMPAT_NETWORK` schema, although not recommended for new uses