Module: Secret
- Defined in:
- lib/libsecret/loader.rb,
lib/libsecret.rb,
lib/libsecret/schema.rb
Overview
Copyright (C) 2022 Ruby-GNOME Project Team
This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Defined Under Namespace
Modules: Backend, BackendFlags, CollectionCreateFlags, CollectionFlags, Error, ItemCreateFlags, ItemFlags, Retrievable, SchemaAttributeType, SchemaFlags, SchemaType, SearchFlags, ServiceFlags Classes: Collection, Item, Loader, Prompt, Schema, Service
Constant Summary collapse
- BACKEND_EXTENSION_POINT_NAME =
Extension point for the secret backend.
secret-backend
- COLLECTION_DEFAULT =
An alias to the default collection.
This can be passed to [funcpassword_store] [funcCollection.for_alias].
default- COLLECTION_SESSION =
An alias to the session collection, which will be cleared when the user ends the session.
This can be passed to [funcpassword_store], [funcCollection.for_alias] or similar functions.
session- MAJOR_VERSION =
The major version of libsecret.
0- MICRO_VERSION =
The micro version of libsecret.
4- MINOR_VERSION =
The minor version of libsecret.
21- LOG_DOMAIN =
"Secret"
Instance Method Summary collapse
-
#attributes_build(schema, array) ⇒ GLib::HashTable<String>
Build up a hash table of attribute values.
-
#attributes_buildv(schema, va) ⇒ GLib::HashTable<String>
Build up a hash table of attribute values.
-
#attributes_validate(schema, attributes) ⇒ Boolean
Check if attributes are valid according to the provided schema.
-
#backend_get(flags, cancellable, callback, user_data) ⇒ nil
Get a Secret::Backend instance.
-
#backend_get_finish(result) ⇒ Secret::Backend
Complete an asynchronous operation to get a Secret::Backend.
-
#error_get_quark ⇒ GLib::Quark
Get the error quark.
-
#get_schema(type) ⇒ Secret::Schema
Get a secret storage schema of the given type.
-
#password_clear(schema, cancellable, callback, user_data, array) ⇒ nil
Clear unlocked matching passwords from the secret service.
-
#password_clear_finish(result) ⇒ Boolean
Finish an asynchronous operation to remove passwords from the secret service.
-
#password_clear_sync(schema, cancellable, error, array) ⇒ Boolean
Remove unlocked matching passwords from the secret service.
-
#password_clearv(schema, attributes, cancellable, callback, user_data) ⇒ nil
Remove unlocked matching passwords from the secret service.
-
#password_clearv_sync(schema, attributes, cancellable) ⇒ Boolean
Remove unlocked matching passwords from the secret service.
-
#password_free(password) ⇒ nil
Clear the memory used by a password, and then free it.
-
#password_lookup(schema, cancellable, callback, user_data, array) ⇒ nil
Lookup a password in the secret service.
-
#password_lookup_binary_finish(result) ⇒ Secret::Value
Finish an asynchronous operation to lookup a password in the secret service.
-
#password_lookup_binary_sync(schema, cancellable, error, array) ⇒ Secret::Value
Lookup a password in the secret service.
-
#password_lookup_finish(result) ⇒ String
Finish an asynchronous operation to lookup a password in the secret service.
-
#password_lookup_nonpageable_finish(result) ⇒ String
Finish an asynchronous operation to lookup a password in the secret service.
-
#password_lookup_nonpageable_sync(schema, cancellable, error, array) ⇒ String
Lookup a password in the secret service.
-
#password_lookup_sync(schema, cancellable, error, array) ⇒ String
Lookup a password in the secret service.
-
#password_lookupv(schema, attributes, cancellable, callback, user_data) ⇒ nil
Lookup a password in the secret service.
-
#password_lookupv_binary_sync(schema, attributes, cancellable) ⇒ Secret::Value
Lookup a password in the secret service.
-
#password_lookupv_nonpageable_sync(schema, attributes, cancellable) ⇒ String
Lookup a password in the secret service.
-
#password_lookupv_sync(schema, attributes, cancellable) ⇒ String
Lookup a password in the secret service.
-
#password_search(schema, flags, cancellable, callback, user_data, array) ⇒ nil
Search for items in the secret service.
-
#password_search_finish(result) ⇒ GLib::List<Secret::Retrievable>
Finish an asynchronous operation to search for items in the secret service.
-
#password_search_sync(schema, flags, cancellable, error, array) ⇒ GLib::List<Secret::Retrievable>
Search for items in the secret service.
-
#password_searchv(schema, attributes, flags, cancellable, callback, user_data) ⇒ nil
Search for items in the secret service.
-
#password_searchv_sync(schema, attributes, flags, cancellable) ⇒ GLib::List<Secret::Retrievable>
Search for items in the secret service.
-
#password_store(schema, collection, label, password, cancellable, callback, user_data, array) ⇒ nil
Store a password in the secret service.
-
#password_store_binary(schema, collection, label, value, cancellable, callback, user_data, array) ⇒ nil
Store a password in the secret service.
-
#password_store_binary_sync(schema, collection, label, value, cancellable, error, array) ⇒ Boolean
Store a password in the secret service.
-
#password_store_finish(result) ⇒ Boolean
Finish asynchronous operation to store a password in the secret service.
-
#password_store_sync(schema, collection, label, password, cancellable, error, array) ⇒ Boolean
Store a password in the secret service.
-
#password_storev(schema, attributes, collection, label, password, cancellable, callback, user_data) ⇒ nil
Store a password in the secret service.
-
#password_storev_binary(schema, attributes, collection, label, value, cancellable, callback, user_data) ⇒ nil
Store a password in the secret service.
-
#password_storev_binary_sync(schema, attributes, collection, label, value, cancellable) ⇒ Boolean
Store a password in the secret service.
-
#password_storev_sync(schema, attributes, collection, label, password, cancellable) ⇒ Boolean
Store a password in the secret service.
-
#password_wipe(password) ⇒ nil
Clear the memory used by a password.
Instance Method Details
#attributes_build(schema, array) ⇒ GLib::HashTable<String>
Build up a hash table of attribute values.
The variable argument list should contain pairs of a) The attribute name as a null-terminated string, followed by b) attribute value, either a character string, an int number, or a gboolean value, as defined in the password schema. The list of attributes should be terminated with a nil.
#attributes_buildv(schema, va) ⇒ GLib::HashTable<String>
Build up a hash table of attribute values.
The variable argument list should contain pairs of a) The attribute name as a null-terminated string, followed by b) attribute value, either a character string, an int number, or a gboolean value, as defined in the password schema. The list of attributes should be terminated with a nil.
#attributes_validate(schema, attributes) ⇒ Boolean
Check if attributes are valid according to the provided schema.
Verifies schema name if available, attribute names and parsing of attribute values.
#backend_get(flags, cancellable, callback, user_data) ⇒ nil
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.
#backend_get_finish(result) ⇒ Secret::Backend
Complete an asynchronous operation to get a Secret::Backend.
#error_get_quark ⇒ GLib::Quark
Get the error quark.
#get_schema(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.
#password_clear(schema, cancellable, callback, user_data, array) ⇒ nil
Clear unlocked matching passwords from the secret service.
The variable argument list should contain pairs of a) The attribute name as a null-terminated string, followed by b) attribute value, either a character string, an int number, or a gboolean value, as defined in the password schema. The list of attributes should be terminated with a nil.
All unlocked items that match the attributes will be deleted.
This method will return immediately and complete asynchronously.
#password_clear_finish(result) ⇒ Boolean
Finish an asynchronous operation to remove passwords from the secret service.
#password_clear_sync(schema, cancellable, error, array) ⇒ Boolean
Remove unlocked matching passwords from the secret service.
The variable argument list should contain pairs of a) The attribute name as a null-terminated string, followed by b) attribute value, either a character string, an int number, or a gboolean value, as defined in the password schema. The list of attributes should be terminated with a nil.
All unlocked items that match the attributes will be deleted.
This method may block indefinitely and should not be used in user interface threads.
#password_clearv(schema, attributes, cancellable, callback, user_data) ⇒ nil
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.
#password_clearv_sync(schema, attributes, cancellable) ⇒ Boolean
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.
#password_free(password) ⇒ nil
Clear the memory used by a password, and then free it.
This function must be used to free nonpageable memory returned by [funcpassword_lookup_nonpageable_finish], [funcpassword_lookup_nonpageable_sync] or [funcpassword_lookupv_nonpageable_sync].
#password_lookup(schema, cancellable, callback, user_data, array) ⇒ nil
Lookup a password in the secret service.
The variable argument list should contain pairs of a) The attribute name as a null-terminated string, followed by b) attribute value, either a character string, an int number, or a gboolean value, as defined in the password schema. The list of attributes should be terminated with a nil.
If no secret is found then nil is returned.
This method will return immediately and complete asynchronously.
#password_lookup_binary_finish(result) ⇒ Secret::Value
Finish an asynchronous operation to lookup a password in the secret service.
#password_lookup_binary_sync(schema, cancellable, error, array) ⇒ Secret::Value
Lookup a password in the secret service.
This is similar to [funcpassword_lookup_sync], but returns a [structValue] instead of a null-terminated password.
This method may block indefinitely and should not be used in user interface threads.
#password_lookup_finish(result) ⇒ String
Finish an asynchronous operation to lookup a password in the secret service.
#password_lookup_nonpageable_finish(result) ⇒ String
Finish an asynchronous operation to lookup a password in the secret service.
#password_lookup_nonpageable_sync(schema, cancellable, error, array) ⇒ String
Lookup a password in the secret service.
The variable argument list should contain pairs of a) The attribute name as a null-terminated string, followed by b) attribute value, either a character string, an int number, or a gboolean value, as defined in the password schema. The list of attributes should be terminated with a nil.
If no secret is found then nil is returned.
This method may block indefinitely and should not be used in user interface threads.
#password_lookup_sync(schema, cancellable, error, array) ⇒ String
Lookup a password in the secret service.
The variable argument list should contain pairs of a) The attribute name as a null-terminated string, followed by b) attribute value, either a character string, an int number, or a gboolean value, as defined in the password schema. The list of attributes should be terminated with a nil.
If no secret is found then nil is returned.
This method may block indefinitely and should not be used in user interface threads.
#password_lookupv(schema, attributes, cancellable, callback, user_data) ⇒ nil
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 nil is returned.
This method will return immediately and complete asynchronously.
#password_lookupv_binary_sync(schema, attributes, cancellable) ⇒ Secret::Value
Lookup a password in the secret service.
This is similar to [funcpassword_lookupv_sync], but returns a [structValue] instead of a null-terminated password.
This method may block indefinitely and should not be used in user interface threads.
#password_lookupv_nonpageable_sync(schema, attributes, cancellable) ⇒ String
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 nil is returned.
This method may block indefinitely and should not be used in user interface threads.
#password_lookupv_sync(schema, attributes, cancellable) ⇒ String
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 nil is returned.
This method may block indefinitely and should not be used in user interface threads.
#password_search(schema, flags, cancellable, callback, user_data, array) ⇒ nil
Search for items in the secret service.
The variable argument list should contain pairs of a) The attribute name as a null-terminated string, followed by b) attribute value, either a character string, an int number, or a gboolean value, as defined in the password schema. The list of attributes should be terminated with a nil.
This method will return immediately and complete asynchronously.
#password_search_finish(result) ⇒ GLib::List<Secret::Retrievable>
Finish an asynchronous operation to search for items in the secret service.
#password_search_sync(schema, flags, cancellable, error, array) ⇒ GLib::List<Secret::Retrievable>
Search for items in the secret service.
The variable argument list should contain pairs of a) The attribute name as a null-terminated string, followed by b) attribute value, either a character string, an int number, or a gboolean value, as defined in the password schema. The list of attributes should be terminated with a nil.
If no secret is found then nil is returned.
This method may block indefinitely and should not be used in user interface threads.
#password_searchv(schema, attributes, flags, cancellable, callback, user_data) ⇒ nil
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.
#password_searchv_sync(schema, attributes, flags, cancellable) ⇒ GLib::List<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 nil is returned.
This method may block indefinitely and should not be used in user interface threads.
#password_store(schema, collection, label, password, cancellable, callback, user_data, array) ⇒ nil
Store a password in the secret service.
The variable argument list should contain pairs of a) The attribute name as a null-terminated string, followed by b) attribute value, either a character string, an int number, or a gboolean value, as defined in the schema. The list of attributes should be terminated with a nil.
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 nil, then the default collection will be used. Use [constCOLLECTION_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.
#password_store_binary(schema, collection, label, value, cancellable, callback, user_data, array) ⇒ nil
Store a password in the secret service.
This is similar to [funcpassword_store], but takes a [structValue] as the argument instead of a null-terminated password.
This method will return immediately and complete asynchronously.
#password_store_binary_sync(schema, collection, label, value, cancellable, error, array) ⇒ Boolean
Store a password in the secret service.
This is similar to [funcpassword_store_sync], but takes a [structValue] as the argument instead of a null terminated password.
This method may block indefinitely and should not be used in user interface threads.
#password_store_finish(result) ⇒ Boolean
Finish asynchronous operation to store a password in the secret service.
#password_store_sync(schema, collection, label, password, cancellable, error, array) ⇒ Boolean
Store a password in the secret service.
The variable argument list should contain pairs of a) The attribute name as a null-terminated string, followed by b) attribute value, either a character string, an int number, or a gboolean value, as defined in the schema. The list of attributes should be terminated with a nil.
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 nil, then the default collection will be used. Use [constCOLLECTION_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.
#password_storev(schema, attributes, collection, label, password, cancellable, callback, user_data) ⇒ nil
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 nil, then the default collection will be used. Use [constCOLLECTION_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.
#password_storev_binary(schema, attributes, collection, label, value, cancellable, callback, user_data) ⇒ nil
Store a password in the secret service.
This is similar to [funcpassword_storev], but takes a [structValue] as the argument instead of a null-terminated password.
This method will return immediately and complete asynchronously.
#password_storev_binary_sync(schema, attributes, collection, label, value, cancellable) ⇒ Boolean
Store a password in the secret service.
This is similar to [funcpassword_storev_sync], but takes a [structValue] as the argument instead of a null-terminated passwords.
This method may block indefinitely and should not be used in user interface threads.
#password_storev_sync(schema, attributes, collection, label, password, cancellable) ⇒ Boolean
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 nil, then the default collection will be used. Use [constCOLLECTION_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.
#password_wipe(password) ⇒ nil
Clear the memory used by a password.