Functions

  backend_get (flags, cancellable, callback, *user_data)
  backend_get_finish (result)
  error_get_quark ()
  get_schema (type)
  password_clear (schema, attributes, cancellable, callback, *user_data)
  password_clear_finish (result)
  password_clear_sync (schema, attributes, cancellable)
  password_lookup (schema, attributes, cancellable, callback, *user_data)
  password_lookup_finish (result)
  password_lookup_sync (schema, attributes, cancellable)
  password_search (schema, attributes, flags, cancellable, callback, *user_data)
  password_search_finish (result)
  password_search_sync (schema, attributes, flags, cancellable)
  password_store (schema, attributes, collection, label, password, cancellable, callback, *user_data)
  password_store_binary (schema, attributes, collection, label, value, cancellable, callback, *user_data)
  password_store_binary_sync (schema, attributes, collection, label, value, cancellable)
  password_store_finish (result)
  password_store_sync (schema, attributes, collection, label, password, cancellable)
  password_wipe (password)

Details

Secret.backend_get(flags, cancellable, callback, *user_data)
Parameters:

Get a Secret.Backend instance. If such a backend already exists, then the same backend is returned.

If flags contains any flags of which parts of the secret backend to ensure are initialized, then those will be initialized before completing.

This method will return immediately and complete asynchronously.

New in version 0.19.0.

Secret.backend_get_finish(result)
Parameters:result (Gio.AsyncResult) – the asynchronous result passed to the callback
Raises:GLib.Error
Returns:a new reference to a Secret.Backend proxy, which should be released with GObject.Object.unref().
Return type:Secret.Backend

Complete an asynchronous operation to get a Secret.Backend.

New in version 0.19.0.

Secret.error_get_quark()
Return type:int
Secret.get_schema(type)
Parameters:type (Secret.SchemaType) – type of schema to get
Returns:schema type
Return type:Secret.Schema

Get a secret storage schema of the given type.

C code may access the schemas (such as %SECRET_SCHEMA_NOTE) directly, but language bindings cannot, and must use this accessor.

New in version 0.18.6.

Secret.password_clear(schema, attributes, cancellable, callback, *user_data)
Parameters:

Remove unlocked matching passwords from the secret service.

The attributes should be a set of key and value string pairs.

All unlocked items that match the attributes will be deleted.

This method will return immediately and complete asynchronously.

Secret.password_clear_finish(result)
Parameters:result (Gio.AsyncResult) – the asynchronous result passed to the callback
Raises:GLib.Error
Returns:whether any passwords were removed
Return type:bool

Finish an asynchronous operation to remove passwords from the secret service.

Secret.password_clear_sync(schema, attributes, cancellable)
Parameters:
Raises:

GLib.Error

Returns:

whether any passwords were removed

Return type:

bool

Remove unlocked matching passwords from the secret service.

The attributes should be a set of key and value string pairs.

All unlocked items that match the attributes will be deleted.

This method may block indefinitely and should not be used in user interface threads.

Secret.password_lookup(schema, attributes, cancellable, callback, *user_data)
Parameters:

Lookup a password in the secret service.

The attributes should be a set of key and value string pairs.

If no secret is found then None is returned.

This method will return immediately and complete asynchronously.

Secret.password_lookup_finish(result)
Parameters:result (Gio.AsyncResult) – the asynchronous result passed to the callback
Raises:GLib.Error
Returns:a new password string which should be freed with secret_password_free() or may be freed with GLib.free() when done
Return type:str

Finish an asynchronous operation to lookup a password in the secret service.

Secret.password_lookup_sync(schema, attributes, cancellable)
Parameters:
Raises:

GLib.Error

Returns:

a new password string which should be freed with secret_password_free() or may be freed with GLib.free() when done

Return type:

str

Lookup a password in the secret service.

The attributes should be a set of key and value string pairs.

If no secret is found then None is returned.

This method may block indefinitely and should not be used in user interface threads.

Parameters:

Search for items in the secret service.

The attributes should be a set of key and value string pairs.

This method will return immediately and complete asynchronously.

New in version 0.19.0.

Secret.password_search_finish(result)
Parameters:result (Gio.AsyncResult) – the asynchronous result passed to the callback
Raises:GLib.Error
Returns:a list of Secret.Retrievable containing attributes of the matched items
Return type:[Secret.Retrievable]

Finish an asynchronous operation to search for items in the secret service.

New in version 0.19.0.

Secret.password_search_sync(schema, attributes, flags, cancellable)
Parameters:
Raises:

GLib.Error

Returns:

a list of Secret.Retrievable containing attributes of the matched items

Return type:

[Secret.Retrievable]

Search for items in the secret service.

The attributes should be a set of key and value string pairs.

If no secret is found then None is returned.

This method may block indefinitely and should not be used in user interface threads.

New in version 0.19.0.

Secret.password_store(schema, attributes, collection, label, password, cancellable, callback, *user_data)
Parameters:
  • schema (Secret.Schema or None) – the schema for attributes
  • attributes ({str: str}) – the attribute keys and values
  • collection (str or None) – a collection alias, or D-Bus object path of the collection where to store the secret
  • label (str) – label for the secret
  • password (str) – the null-terminated password to store
  • cancellable (Gio.Cancellable or None) – optional cancellation object
  • callback (Gio.AsyncReadyCallback or None) – called when the operation completes
  • user_data (object or None) – data to be passed to the callback

Store a password in the secret service.

The attributes should be a set of key and value string pairs.

If the attributes match a secret item already stored in the collection, then the item will be updated with these new values.

If collection is None, then the default collection will be used. Use Secret.COLLECTION_SESSION to store the password in the session collection, which doesn’t get stored across login sessions.

This method will return immediately and complete asynchronously.

Secret.password_store_binary(schema, attributes, collection, label, value, cancellable, callback, *user_data)
Parameters:

Store a password in the secret service.

This is similar to Secret.password_store(), but takes a Secret.Value as the argument instead of a null-terminated password.

This method will return immediately and complete asynchronously.

New in version 0.19.0.

Secret.password_store_binary_sync(schema, attributes, collection, label, value, cancellable)
Parameters:
  • schema (Secret.Schema or None) – the schema for attributes
  • attributes ({str: str}) – the attribute keys and values
  • collection (str or None) – a collection alias, or D-Bus object path of the collection where to store the secret
  • label (str) – label for the secret
  • value (Secret.Value) – a Secret.Value
  • cancellable (Gio.Cancellable or None) – optional cancellation object
Raises:

GLib.Error

Returns:

whether the storage was successful or not

Return type:

bool

Store a password in the secret service.

This is similar to Secret.password_store_sync(), but takes a Secret.Value as the argument instead of a null-terminated passwords.

This method may block indefinitely and should not be used in user interface threads.

New in version 0.19.0.

Secret.password_store_finish(result)
Parameters:result (Gio.AsyncResult) – the asynchronous result passed to the callback
Raises:GLib.Error
Returns:whether the storage was successful or not
Return type:bool

Finish asynchronous operation to store a password in the secret service.

Secret.password_store_sync(schema, attributes, collection, label, password, cancellable)
Parameters:
  • schema (Secret.Schema or None) – the schema for attributes
  • attributes ({str: str}) – the attribute keys and values
  • collection (str or None) – a collection alias, or D-Bus object path of the collection where to store the secret
  • label (str) – label for the secret
  • password (str) – the null-terminated password to store
  • cancellable (Gio.Cancellable or None) – optional cancellation object
Raises:

GLib.Error

Returns:

whether the storage was successful or not

Return type:

bool

Store a password in the secret service.

The attributes should be a set of key and value string pairs.

If the attributes match a secret item already stored in the collection, then the item will be updated with these new values.

If collection is None, then the default collection will be used. Use Secret.COLLECTION_SESSION to store the password in the session collection, which doesn’t get stored across login sessions.

This method may block indefinitely and should not be used in user interface threads.

Secret.password_wipe(password)
Parameters:password (str or None) – password to clear

Clear the memory used by a password.