from gi.repository import Secret, SecretUnstable

EXAMPLE_SCHEMA = Secret.Schema.new('org.mock.type.Store',
	Secret.SchemaFlags.NONE,
	{
		'number': Secret.SchemaAttributeType.INTEGER,
		'string': Secret.SchemaAttributeType.STRING,
		'even': Secret.SchemaAttributeType.BOOLEAN,
	}
)

attributes = {
	'number': '8',
	'string': 'eight',
	'even': 'true'
}

Secret.password_store_sync(EXAMPLE_SCHEMA, attributes, Secret.COLLECTION_DEFAULT,
	'the label', 'the password', None)

secret_service = SecretUnstable.Service.get_sync(
	SecretUnstable.ServiceFlags.NONE, None)

items = secret_service.search_sync(EXAMPLE_SCHEMA,
	{'even': 'true'},
	SecretUnstable.SearchFlags.ALL | SecretUnstable.SearchFlags.LOAD_SECRETS,
	None)

item = items[0]
item_secret = item.get_secret()
item_secret.get()
