SecretRetrievable

SecretRetrievable — A read-only secret item

Functions

Properties

GHashTable * attributes Read / Write
guint64 created Read / Write
gchar * label Read / Write
guint64 modified Read / Write

Types and Values

Object Hierarchy

    GInterface
    ╰── SecretRetrievable

Prerequisites

SecretRetrievable requires GObject.

Known Implementations

SecretRetrievable is implemented by SecretItem.

Includes

#include <libsecret/secret.h>

Description

SecretRetrievable provides a read-only view of a secret item stored in the Secret Service.

Each item has a value, represented by a SecretValue, which can be retrieved by secret_retrievable_retrieve_secret() and secret_retrievable_retrieve_secret_finish().

Functions

secret_retrievable_get_attributes ()

GHashTable *
secret_retrievable_get_attributes (SecretRetrievable *self);

Get the attributes of this object.

The attributes are a mapping of string keys to string values. Attributes are used to search for items. Attributes are not stored or transferred securely by the secret service.

Do not modify the attribute returned by this method.

Parameters

self

a retrievable object

 

Returns

a new reference to the attributes, which should not be modified, and released with g_hash_table_unref().

[transfer full][element-type utf8 utf8]

Since: 0.19.0


secret_retrievable_get_created ()

guint64
secret_retrievable_get_created (SecretRetrievable *self);

Get the created date and time of the object. The return value is the number of seconds since the unix epoch, January 1st 1970.

Parameters

self

a retrievable object

 

Returns

the created date and time

Since: 0.19.0


secret_retrievable_get_label ()

gchar *
secret_retrievable_get_label (SecretRetrievable *self);

Get the label of this item.

Parameters

self

a retrievable object

 

Returns

the label, which should be freed with g_free().

[transfer full]

Since: 0.19.0


secret_retrievable_get_modified ()

guint64
secret_retrievable_get_modified (SecretRetrievable *self);

Get the modified date and time of the object. The return value is the number of seconds since the unix epoch, January 1st 1970.

Parameters

self

a retrievable object

 

Returns

the modified date and time

Since: 0.19.0


secret_retrievable_retrieve_secret ()

void
secret_retrievable_retrieve_secret (SecretRetrievable *self,
                                    GCancellable *cancellable,
                                    GAsyncReadyCallback callback,
                                    gpointer user_data);

Retrieve the secret value of this object.

Each retrievable object has a single secret which might be a password or some other secret binary value.

This function returns immediately and completes asynchronously.

Parameters

self

a retrievable object

 

cancellable

optional cancellation object.

[nullable]

callback

called when the operation completes

 

user_data

data to pass to the callback

 

Since: 0.19.0


secret_retrievable_retrieve_secret_finish ()

SecretValue *
secret_retrievable_retrieve_secret_finish
                               (SecretRetrievable *self,
                                GAsyncResult *result,
                                GError **error);

Complete asynchronous operation to retrieve the secret value of this object.

Parameters

self

a retrievable object

 

result

asynchronous result passed to callback

 

error

location to place error on failure

 

Returns

the secret value which should be released with secret_value_unref(), or NULL.

[transfer full][nullable]

Since: 0.19.0


secret_retrievable_retrieve_secret_sync ()

SecretValue *
secret_retrievable_retrieve_secret_sync
                               (SecretRetrievable *self,
                                GCancellable *cancellable,
                                GError **error);

Retrieve the secret value of this object synchronously.

Each retrievable object has a single secret which might be a password or some other secret binary value.

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

Parameters

self

a retrievable object

 

cancellable

optional cancellation object.

[nullable]

error

location to place error on failure

 

Returns

the secret value which should be released with secret_value_unref(), or NULL.

[transfer full][nullable]

Since: 0.19.0

Types and Values

SECRET_TYPE_RETRIEVABLE

#define SECRET_TYPE_RETRIEVABLE secret_retrievable_get_type ()

SecretRetrievable

typedef struct _SecretRetrievable SecretRetrievable;

An object representing a read-only view of a secret item in the Secret Service.

Since: 0.19.0


struct SecretRetrievableInterface

struct SecretRetrievableInterface {
	GTypeInterface parent_iface;

	void         (*retrieve_secret)        (SecretRetrievable *self,
						GCancellable *cancellable,
						GAsyncReadyCallback callback,
						gpointer user_data);
	SecretValue *(*retrieve_secret_finish) (SecretRetrievable *self,
						GAsyncResult *result,
						GError **error);
};

The interface for SecretRetrievable.

Members

GTypeInterface parent_iface;

the parent interface

 

retrieve_secret ()

implementation of secret_retrievable_retrieve_secret(), required

 

retrieve_secret_finish ()

implementation of secret_retrievable_retrieve_secret_finish(), required

 

Since: 0.19.0

Property Details

The “attributes” property

  “attributes”               GHashTable *

The attributes set on this item. Attributes are used to locate an item. They are not guaranteed to be stored or transferred securely.

[transfer full]

Owner: SecretRetrievable

Flags: Read / Write

Since: 0.19.0


The “created” property

  “created”                  guint64

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

Owner: SecretRetrievable

Flags: Read / Write

Default value: 0

Since: 0.19.0


The “label” property

  “label”                    gchar *

The human readable label for the item.

Owner: SecretRetrievable

Flags: Read / Write

Default value: NULL

Since: 0.19.0


The “modified” property

  “modified”                 guint64

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

Owner: SecretRetrievable

Flags: Read / Write

Default value: 0

Since: 0.19.0