Class: Secret::Collection

Inherits:
Gio::DBusProxy
  • Object
show all
Defined in:
(unknown)

Overview

The class for Secret::Collection.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(service, collection_path, flags, cancellable) ⇒ Secret::Collection

Get a new collection proxy for a collection in the secret service.

If service is nil, then [funcService.get_sync] will be called to get
the default [classService] proxy.

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

Parameters:

  • service (Secret::Service)

    a secret service object

  • collection_path (String)

    the D-Bus path of the collection

  • flags (Secret::CollectionFlags)

    options for the collection initialization

  • cancellable (Gio::Cancellable)

    optional cancellation object

Class Method Details

.create(service, label, alias, flags, cancellable, callback, user_data) ⇒ nil

Create a new collection in the secret service.

This method returns immediately and completes asynchronously. The secret
service may prompt the user. [methodService.prompt] will be used to handle
any prompts that are required.

An alias is a well-known tag for a collection, such as 'default' (ie: the
default collection to store items in). This allows other applications to
easily identify and share a collection. If you specify an alias, and a
collection with that alias already exists, then a new collection will not
be created. The previous one will be returned instead.

If service is nil, then [funcService.get] will be called to get the
default [classService] proxy.

Parameters:

  • service (Secret::Service)

    a secret service object

  • label (String)

    label for the new collection

  • alias (String)

    alias to assign to the collection

  • flags (Secret::CollectionCreateFlags)

    currently unused

  • cancellable (Gio::Cancellable)

    optional cancellation object

  • callback (Gio::AsyncReadyCallback)

    called when the operation completes

  • user_data (GObject)

    data to pass to the callback

Returns:

  • (nil)

.create_finish(result) ⇒ Secret::Collection

Finish operation to create a new collection in the secret service.

Parameters:

  • result (Gio::AsyncResult)

    the asynchronous result passed to the callback

Returns:

  • (Secret::Collection)

    the new collection, which should be unreferenced
    with [methodGObject.Object.unref]

.create_sync(service, label, alias, flags, cancellable) ⇒ Secret::Collection

Create a new collection in the secret service.

This method may block indefinitely and should not be used in user interface
threads. The secret service may prompt the user. [methodService.prompt]
will be used to handle any prompts that are required.

An alias is a well-known tag for a collection, such as default (ie: the
default collection to store items in). This allows other applications to
easily identify and share a collection. If you specify an alias, and a
collection with that alias already exists, then a new collection will not
be created. The previous one will be returned instead.

If service is nil, then [funcService.get_sync] will be called to get the
default [classService] proxy.

Parameters:

  • service (Secret::Service)

    a secret service object

  • label (String)

    label for the new collection

  • alias (String)

    alias to assign to the collection

  • flags (Secret::CollectionCreateFlags)

    currently unused

  • cancellable (Gio::Cancellable)

    optional cancellation object

Returns:

  • (Secret::Collection)

    the new collection, which should be unreferenced
    with [methodGObject.Object.unref]

.for_alias(service, alias, flags, cancellable, callback, user_data) ⇒ nil

Lookup which collection is assigned to this alias. Aliases help determine
well known collections, such as 'default'.

If service is nil, then [funcService.get] will be called to get the
default [classService] proxy.

This method will return immediately and complete asynchronously.

Parameters:

  • service (Secret::Service)

    a secret service object

  • alias (String)

    the alias to lookup

  • flags (Secret::CollectionFlags)

    options for the collection initialization

  • cancellable (Gio::Cancellable)

    optional cancellation object

  • callback (Gio::AsyncReadyCallback)

    called when the operation completes

  • user_data (GObject)

    data to pass to the callback

Returns:

  • (nil)

.for_alias_finish(result) ⇒ Secret::Collection

Finish an asynchronous operation to lookup which collection is assigned
to an alias.

Parameters:

  • result (Gio::AsyncResult)

    asynchronous result passed to callback

Returns:

.for_alias_sync(service, alias, flags, cancellable) ⇒ Secret::Collection

Lookup which collection is assigned to this alias. Aliases help determine
well known collections, such as default.

If service is nil, then [funcService.get_sync] will be called to get the
default [classService] proxy.

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

Parameters:

  • service (Secret::Service)

    a secret service object

  • alias (String)

    the alias to lookup

  • flags (Secret::CollectionFlags)

    options for the collection initialization

  • cancellable (Gio::Cancellable)

    optional cancellation object

Returns:

.new_for_dbus_path(service, collection_path, flags, cancellable, callback, user_data) ⇒ nil

Get a new collection proxy for a collection in the secret service.

If service is nil, then [funcService.get] will be called to get
the default [classService] proxy.

This method will return immediately and complete asynchronously.

Parameters:

  • service (Secret::Service)

    a secret service object

  • collection_path (String)

    the D-Bus path of the collection

  • flags (Secret::CollectionFlags)

    options for the collection initialization

  • cancellable (Gio::Cancellable)

    optional cancellation object

  • callback (Gio::AsyncReadyCallback)

    called when the operation completes

  • user_data (GObject)

    data to be passed to the callback

Returns:

  • (nil)

Instance Method Details

#createdInteger

The date and time (in seconds since the UNIX epoch) that this
collection was created.

Returns:

  • (Integer)

    created

#created=(created) ⇒ Integer

The date and time (in seconds since the UNIX epoch) that this
collection was created.

Parameters:

  • created (Integer)

Returns:

  • (Integer)

    created

  • (Integer)

    created

#delete(cancellable, callback, user_data) ⇒ nil

Delete this collection.

This method returns immediately and completes asynchronously. The secret
service may prompt the user. [methodService.prompt] will be used to handle
any prompts that show up.

Parameters:

  • cancellable (Gio::Cancellable)

    optional cancellation object

  • callback (Gio::AsyncReadyCallback)

    called when the operation completes

  • user_data (GObject)

    data to pass to the callback

Returns:

  • (nil)

#delete_finish(result) ⇒ Boolean

Complete operation to delete this collection.

Parameters:

  • result (Gio::AsyncResult)

    asynchronous result passed to the callback

Returns:

  • (Boolean)

    whether the collection was successfully deleted or not

#delete_sync(cancellable) ⇒ Boolean

Delete this collection.

This method may block indefinitely and should not be used in user interface
threads. The secret service may prompt the user. [methodService.prompt] will
be used to handle any prompts that show up.

Parameters:

  • cancellable (Gio::Cancellable)

    optional cancellation object

Returns:

  • (Boolean)

    whether the collection was successfully deleted or not

#flagsSecret::CollectionFlags

A set of flags describing which parts of the secret collection have
been initialized.

Returns:

#flags=(flags) ⇒ Secret::CollectionFlags

A set of flags describing which parts of the secret collection have
been initialized.

Parameters:

Returns:

#itemsSecret::

A list of [classItem] objects representing the items that are in
this collection. This list will be empty if the collection is locked.

Returns:

#items=(items) ⇒ Secret::

A list of [classItem] objects representing the items that are in
this collection. This list will be empty if the collection is locked.

Parameters:

Returns:

#labelString

The human readable label for the collection.

Setting this property will result in the label of the collection being
set asynchronously. To properly track the changing of the label use the
[methodCollection.set_label] function.

Returns:

  • (String)

    label

#label=(label) ⇒ String

The human readable label for the collection.

Setting this property will result in the label of the collection being
set asynchronously. To properly track the changing of the label use the
[methodCollection.set_label] function.

Parameters:

  • label (String)

Returns:

  • (String)

    label

  • (String)

    label

#label_finish=(result) ⇒ Boolean

Complete asynchronous operation to set the label of this collection.

Parameters:

  • result (Gio::AsyncResult)

    asynchronous result passed to callback

Returns:

  • (Boolean)

    whether the change was successful or not

#load_items(cancellable, callback, user_data) ⇒ nil

Ensure that the Secret::Collection proxy has loaded all the items present
in the Secret Service.

This affects the result of [methodCollection.get_items].

For collections returned from [methodService.get_collections] the items will
have already been loaded.

This method will return immediately and complete asynchronously.

Parameters:

  • cancellable (Gio::Cancellable)

    optional cancellation object

  • callback (Gio::AsyncReadyCallback)

    called when the operation completes

  • user_data (GObject)

    data to be passed to the callback

Returns:

  • (nil)

#load_items_finish(result) ⇒ Boolean

Complete an asynchronous operation to ensure that the Secret::Collection proxy
has loaded all the items present in the Secret Service.

Parameters:

  • result (Gio::AsyncResult)

    the asynchronous result passed to the callback

Returns:

  • (Boolean)

    whether the load was successful or not

#load_items_sync(cancellable) ⇒ Boolean

Ensure that the Secret::Collection proxy has loaded all the items present
in the Secret Service. This affects the result of
[methodCollection.get_items].

For collections returned from [methodService.get_collections] the items
will have already been loaded.

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

Parameters:

  • cancellable (Gio::Cancellable)

    optional cancellation object

Returns:

  • (Boolean)

    whether the load was successful or not

#lockedBoolean

Get whether the collection is locked or not.

Use [methodService.lock] or [methodService.unlock] to lock or unlock the
collection.

Returns:

  • (Boolean)

    whether the collection is locked or not

#locked=(locked) ⇒ Boolean

Whether the collection is locked or not.

To lock or unlock a collection use the [methodService.lock] or
[methodService.unlock] functions.

Parameters:

  • locked (Boolean)

Returns:

  • (Boolean)

    locked

  • (Boolean)

    locked

#locked?Boolean

Whether the collection is locked or not.

To lock or unlock a collection use the [methodService.lock] or
[methodService.unlock] functions.

Returns:

  • (Boolean)

    locked

#modifiedInteger

The date and time (in seconds since the UNIX epoch) that this
collection was last modified.

Returns:

  • (Integer)

    modified

#modified=(modified) ⇒ Integer

The date and time (in seconds since the UNIX epoch) that this
collection was last modified.

Parameters:

  • modified (Integer)

Returns:

  • (Integer)

    modified

  • (Integer)

    modified

#refreshnil

Refresh the properties on this collection. This fires off a request to
refresh, and the properties will be updated later.

Calling this method is not normally necessary, as the secret service
will notify the client when properties change.

Returns:

  • (nil)

#search(schema, attributes, flags, cancellable, callback, user_data) ⇒ nil

Search for items matching the attributes in the collection.
The attributes should be a table of string keys and string values.

If %SECRET_SEARCH_ALL is set in flags, then all the items matching the
search will be returned. Otherwise only the first item will be returned.
This is almost always the unlocked item that was most recently stored.

If %SECRET_SEARCH_UNLOCK is set in flags, then items will be unlocked
if necessary. In either case, locked and unlocked items will match the
search and be returned. If the unlock fails, the search does not fail.

If %SECRET_SEARCH_LOAD_SECRETS is set in flags, then the items will have
their secret values loaded and available via [methodItem.get_secret].

This function returns immediately and completes asynchronously.

Parameters:

  • schema (Secret::Schema)

    the schema for the attributes

  • attributes (GLib::HashTable<String>)

    search for items matching these attributes

  • flags (Secret::SearchFlags)

    search option flags

  • cancellable (Gio::Cancellable)

    optional cancellation object

  • callback (Gio::AsyncReadyCallback)

    called when the operation completes

  • user_data (GObject)

    data to pass to the callback

Returns:

  • (nil)

#search_finish(result) ⇒ GLib::List<Secret::Item>

Complete asynchronous operation to search for items in a collection.

Parameters:

  • result (Gio::AsyncResult)

    asynchronous result passed to callback

Returns:

  • (GLib::List<Secret::Item>)

    a list of items that matched the search

#search_for_dbus_paths(schema, attributes, cancellable, callback, user_data) ⇒ nil

Search for items in collection matching the attributes, and return their
DBus object paths.

Only the specified collection is searched. The attributes should be a table
of string keys and string values.

This function returns immediately and completes asynchronously.

When your callback is called use [methodCollection.search_for_dbus_paths_finish]
to get the results of this function. Only the DBus object paths of the
items will be returned. If you would like [classItem] objects to be returned
instead, then use the [methodCollection.search] function.

Parameters:

  • schema (Secret::Schema)

    the schema for the attributes

  • attributes (GLib::HashTable<String>)

    search for items matching these attributes

  • cancellable (Gio::Cancellable)

    optional cancellation object

  • callback (Gio::AsyncReadyCallback)

    called when the operation completes

  • user_data (GObject)

    data to pass to the callback

Returns:

  • (nil)

#search_for_dbus_paths_finish(result) ⇒ Array<String>

Complete asynchronous operation to search for items in a collection.

DBus object paths of the items will be returned. If you would to have
[classItem] objects to be returned instead, then use the
[methodCollection.search] and [methodCollection.search_finish] functions.

Parameters:

  • result (Gio::AsyncResult)

    asynchronous result passed to callback

Returns:

  • (Array<String>)

    an array of DBus object
    paths for matching items.

#search_for_dbus_paths_sync(schema, attributes, cancellable) ⇒ Array<String>

Search for items matching the attributes in collection, and return their
DBus object paths.

The attributes should be a table of string keys and string values.

This function may block indefinitely. Use the asynchronous version
in user interface threads.

DBus object paths of the items will be returned. If you would to have
[classItem] objects to be returned instead, then use the
[methodCollection.search_sync] function.

Parameters:

  • schema (Secret::Schema)

    the schema for the attributes

  • attributes (GLib::HashTable<String>)

    search for items matching these attributes

  • cancellable (Gio::Cancellable)

    optional cancellation object

Returns:

  • (Array<String>)

    an array of DBus object
    paths for matching items.

#search_sync(schema, attributes, flags, cancellable) ⇒ GLib::List<Secret::Item>

Search for items matching the attributes in the collection.
The attributes should be a table of string keys and string values.

If %SECRET_SEARCH_ALL is set in flags, then all the items matching the
search will be returned. Otherwise only the first item will be returned.
This is almost always the unlocked item that was most recently stored.

If %SECRET_SEARCH_UNLOCK is set in flags, then items will be unlocked
if necessary. In either case, locked and unlocked items will match the
search and be returned. If the unlock fails, the search does not fail.

If %SECRET_SEARCH_LOAD_SECRETS is set in flags, then the items will have
their secret values loaded and available via [methodItem.get_secret].

This function may block indefinitely. Use the asynchronous version
in user interface threads.

Parameters:

  • schema (Secret::Schema)

    the schema for the attributes

  • attributes (GLib::HashTable<String>)

    search for items matching these attributes

  • flags (Secret::SearchFlags)

    search option flags

  • cancellable (Gio::Cancellable)

    optional cancellation object

Returns:

  • (GLib::List<Secret::Item>)

    a list of items that matched the search

#serviceSecret::Service

The [classService] object that this collection is associated with and
uses to interact with the actual D-Bus Secret Service.

Returns:

#service=(service) ⇒ Secret::Service

The [classService] object that this collection is associated with and
uses to interact with the actual D-Bus Secret Service.

Parameters:

Returns:

#set_label(label, cancellable, callback, user_data) ⇒ nil

Set the label of this collection.

This function returns immediately and completes asynchronously.

Parameters:

  • label (String)

    a new label

  • cancellable (Gio::Cancellable)

    optional cancellation object

  • callback (Gio::AsyncReadyCallback)

    called when the operation completes

  • user_data (GObject)

    data to pass to the callback

Returns:

  • (nil)

#set_label_sync(label, cancellable) ⇒ Boolean

Set the label of this collection.

This function may block indefinitely. Use the asynchronous version
in user interface threads.

Parameters:

  • label (String)

    a new label

  • cancellable (Gio::Cancellable)

    optional cancellation object

Returns:

  • (Boolean)

    whether the change was successful or not