![]() |
![]() |
![]() |
Libsecret Library Reference Manual | ![]() |
---|---|---|---|---|
Top | Description | Object Hierarchy | Implemented Interfaces | Properties |
#include <secret/secret-unstable.h> SecretItem; struct SecretItemClass; void secret_item_new (SecretService *service
,const gchar *item_path
,GCancellable *cancellable
,GAsyncReadyCallback callback
,gpointer user_data
); SecretItem * secret_item_new_finish (GAsyncResult *result
,GError **error
); SecretItem * secret_item_new_sync (SecretService *service
,const gchar *item_path
,GCancellable *cancellable
,GError **error
); void secret_item_create (SecretCollection *collection
,const gchar *label
,GHashTable *attributes
,SecretValue *value
,gboolean replace
,GCancellable *cancellable
,GAsyncReadyCallback callback
,gpointer user_data
); SecretItem * secret_item_create_finish (GAsyncResult *result
,GError **error
); SecretItem * secret_item_create_sync (SecretCollection *collection
,const gchar *label
,GHashTable *attributes
,SecretValue *value
,gboolean replace
,GCancellable *cancellable
,GError **error
); void secret_item_delete (SecretItem *self
,GCancellable *cancellable
,GAsyncReadyCallback callback
,gpointer user_data
); gboolean secret_item_delete_finish (SecretItem *self
,GAsyncResult *result
,GError **error
); gboolean secret_item_delete_sync (SecretItem *self
,GCancellable *cancellable
,GError **error
); GHashTable * secret_item_get_attributes (SecretItem *self
); void secret_item_set_attributes (SecretItem *self
,GHashTable *attributes
,GCancellable *cancellable
,GAsyncReadyCallback callback
,gpointer user_data
); gboolean secret_item_set_attributes_finish (SecretItem *self
,GAsyncResult *result
,GError **error
); gboolean secret_item_set_attributes_sync (SecretItem *self
,GHashTable *attributes
,GCancellable *cancellable
,GError **error
); guint64 secret_item_get_created (SecretItem *self
); gchar * secret_item_get_label (SecretItem *self
); void secret_item_set_label (SecretItem *self
,const gchar *label
,GCancellable *cancellable
,GAsyncReadyCallback callback
,gpointer user_data
); gboolean secret_item_set_label_finish (SecretItem *self
,GAsyncResult *result
,GError **error
); gboolean secret_item_set_label_sync (SecretItem *self
,const gchar *label
,GCancellable *cancellable
,GError **error
); gboolean secret_item_get_locked (SecretItem *self
); guint64 secret_item_get_modified (SecretItem *self
); SecretService * secret_item_get_service (SecretItem *self
); void secret_item_get_secret (SecretItem *self
,GCancellable *cancellable
,GAsyncReadyCallback callback
,gpointer user_data
); SecretValue * secret_item_get_secret_finish (SecretItem *self
,GAsyncResult *result
,GError **error
); SecretValue * secret_item_get_secret_sync (SecretItem *self
,GCancellable *cancellable
,GError **error
); void secret_item_set_secret (SecretItem *self
,SecretValue *value
,GCancellable *cancellable
,GAsyncReadyCallback callback
,gpointer user_data
); gboolean secret_item_set_secret_finish (SecretItem *self
,GAsyncResult *result
,GError **error
); gboolean secret_item_set_secret_sync (SecretItem *self
,SecretValue *value
,GCancellable *cancellable
,GError **error
); void secret_item_refresh (SecretItem *self
);
"attributes" GHashTable* : Read / Write "created" guint64 : Read / Write "label" gchar* : Read / Write "locked" gboolean : Read "modified" guint64 : Read / Write "service" SecretService* : Read / Write / Construct Only
SecretItem represents a secret item stored in the Secret Service.
Each item has a value, represented by a SecretValue, which can be
retrieved by secret_item_get_secret()
or set by secret_item_set_secret()
.
The item is only available when the item is not locked.
Items can be locked or unlocked using the secret_service_lock()
or
secret_service_unlock()
functions. The Secret Service may not be able to
unlock individual items, and may unlock an entire collection when a single
item is unlocked.
Each item has a set of attributes, which are used to locate the item later.
These are not stored or transferred in a secure manner. Each attribute has
a string name and a string value. Use secret_service_search()
to search for
items based on their attributes, and secret_item_set_attributes to change
the attributes associated with an item.
Items can be created with secret_item_create()
or secret_service_store()
.
typedef struct _SecretItem SecretItem;
A proxy object representing a secret item in the Secret Service.
struct SecretItemClass { GDBusProxyClass parent_class; };
The class for SecretItem.
void secret_item_new (SecretService *service
,const gchar *item_path
,GCancellable *cancellable
,GAsyncReadyCallback callback
,gpointer user_data
);
Get a new item proxy for a secret item in the secret service.
This method will return immediately and complete asynchronously.
|
a secret service object |
|
the D-Bus path of the collection |
|
optional cancellation object |
|
called when the operation completes |
|
data to be passed to the callback |
SecretItem * secret_item_new_finish (GAsyncResult *result
,GError **error
);
Finish asynchronous operation to get a new item proxy for an secret item in the secret service.
|
the asynchronous result passed to the callback |
|
location to place an error on failure |
Returns : |
the new item, which should be unreferenced
with g_object_unref() . [transfer full]
|
SecretItem * secret_item_new_sync (SecretService *service
,const gchar *item_path
,GCancellable *cancellable
,GError **error
);
Get a new item proxy for a secret item in the secret service.
This method may block indefinitely and should not be used in user interface threads.
|
a secret service object |
|
the D-Bus path of the item |
|
optional cancellation object |
|
location to place an error on failure |
Returns : |
the new item, which should be unreferenced
with g_object_unref() . [transfer full]
|
void secret_item_create (SecretCollection *collection
,const gchar *label
,GHashTable *attributes
,SecretValue *value
,gboolean replace
,GCancellable *cancellable
,GAsyncReadyCallback callback
,gpointer user_data
);
Create a new item in the secret service.
If the replace
is set to TRUE
, then the secret service will search for
an item matching the attributes
, and update that item instead of creating
a new one.
This method may block indefinitely and should not be used in user interface
threads. The secret service may prompt the user. secret_service_prompt()
will be used to handle any prompts that are required.
|
a secret collection to create this item in |
|
label for the new item |
|
attributes for the new item. [element-type utf8 utf8] |
|
secret value for the new item |
|
whether to replace an existing item with the same attributes |
|
optional cancellation object |
|
called when the operation completes |
|
data to pass to the callback |
SecretItem * secret_item_create_finish (GAsyncResult *result
,GError **error
);
Finish operation to create a new item in the secret service.
|
the asynchronous result passed to the callback |
|
location to place an error on failure |
Returns : |
the new item, which should be unreferenced
with g_object_unref() . [transfer full]
|
SecretItem * secret_item_create_sync (SecretCollection *collection
,const gchar *label
,GHashTable *attributes
,SecretValue *value
,gboolean replace
,GCancellable *cancellable
,GError **error
);
Create a new item in the secret service.
If the replace
is set to TRUE
, then the secret service will search for
an item matching the attributes
, and update that item instead of creating
a new one.
This method may block indefinitely and should not be used in user interface
threads. The secret service may prompt the user. secret_service_prompt()
will be used to handle any prompts that are required.
|
a secret collection to create this item in |
|
label for the new item |
|
attributes for the new item. [element-type utf8 utf8] |
|
secret value for the new item |
|
whether to replace an existing item with the same attributes |
|
optional cancellation object |
|
location to place an error on failure |
Returns : |
the new item, which should be unreferenced
with g_object_unref() . [transfer full]
|
void secret_item_delete (SecretItem *self
,GCancellable *cancellable
,GAsyncReadyCallback callback
,gpointer user_data
);
Delete this item.
This method returns immediately and completes asynchronously. The secret
service may prompt the user. secret_service_prompt()
will be used to handle
any prompts that show up.
|
an item |
|
optional cancellation object |
|
called when the operation completes |
|
data to pass to the callback |
gboolean secret_item_delete_finish (SecretItem *self
,GAsyncResult *result
,GError **error
);
Complete asynchronous operation to delete the secret item.
|
an item |
|
asynchronous result passed to the callback |
|
location to place an error on failure |
Returns : |
whether the item was successfully deleted or not |
gboolean secret_item_delete_sync (SecretItem *self
,GCancellable *cancellable
,GError **error
);
Delete this secret item.
This method may block indefinitely and should not be used in user
interface threads. The secret service may prompt the user.
secret_service_prompt()
will be used to handle any prompts that show up.
|
an item |
|
optional cancellation object |
|
location to place an error on failure |
Returns : |
whether the item was successfully deleted or not |
GHashTable * secret_item_get_attributes (SecretItem *self
);
Set the attributes of this item.
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 attributes returned by this method. Use
secret_item_set_attributes()
instead.
|
an item |
Returns : |
a new reference to the attributes, which should
not be modified, and released with g_hash_table_unref() . [transfer full]
|
void secret_item_set_attributes (SecretItem *self
,GHashTable *attributes
,GCancellable *cancellable
,GAsyncReadyCallback callback
,gpointer user_data
);
Set the attributes of this item.
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.
This function returns immediately and completes asynchronously.
|
an item |
|
a new set of attributes. [element-type utf8 utf8] |
|
optional cancellation object |
|
called when the asynchronous operation completes |
|
data to pass to the callback |
gboolean secret_item_set_attributes_finish (SecretItem *self
,GAsyncResult *result
,GError **error
);
Complete operation to set the attributes of this item.
|
an item |
|
asynchronous result passed to the callback |
|
location to place error on failure |
Returns : |
whether the change was successful or not |
gboolean secret_item_set_attributes_sync (SecretItem *self
,GHashTable *attributes
,GCancellable *cancellable
,GError **error
);
Set the attributes of this item.
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.
This function may block indefinetely. Use the asynchronous version in user interface threads.
|
an item |
|
a new set of attributes. [element-type utf8 utf8] |
|
optional cancellation object |
|
location to place error on failure |
Returns : |
whether the change was successful or not |
guint64 secret_item_get_created (SecretItem *self
);
Get the created date and time of the item. The return value is the number of seconds since the unix epoch, January 1st 1970.
|
an item |
Returns : |
the created date and time |
gchar * secret_item_get_label (SecretItem *self
);
Get the label of this item.
|
an item |
Returns : |
the label, which should be freed with g_free() . [transfer full]
|
void secret_item_set_label (SecretItem *self
,const gchar *label
,GCancellable *cancellable
,GAsyncReadyCallback callback
,gpointer user_data
);
Set the label of this item.
This function returns immediately and completes asynchronously.
|
an item |
|
a new label |
|
optional cancellation object |
|
called when the operation completes |
|
data to pass to the callback |
gboolean secret_item_set_label_finish (SecretItem *self
,GAsyncResult *result
,GError **error
);
Complete asynchronous operation to set the label of this collection.
|
an item |
|
asynchronous result passed to callback |
|
location to place error on failure |
Returns : |
whether the change was successful or not |
gboolean secret_item_set_label_sync (SecretItem *self
,const gchar *label
,GCancellable *cancellable
,GError **error
);
Set the label of this item.
This function may block indefinetely. Use the asynchronous version in user interface threads.
|
an item |
|
a new label |
|
optional cancellation object |
|
location to place error on failure |
Returns : |
whether the change was successful or not |
gboolean secret_item_get_locked (SecretItem *self
);
Get whether the item is locked or not.
Depending on the secret service an item may not be able to be locked independently from the collection that it is in.
|
an item |
Returns : |
whether the item is locked or not |
guint64 secret_item_get_modified (SecretItem *self
);
Get the modified date and time of the item. The return value is the number of seconds since the unix epoch, January 1st 1970.
|
an item |
Returns : |
the modified date and time |
SecretService * secret_item_get_service (SecretItem *self
);
Get the Secret Service object that this item was created with.
|
an item |
Returns : |
the Secret Service object. [transfer none] |
void secret_item_get_secret (SecretItem *self
,GCancellable *cancellable
,GAsyncReadyCallback callback
,gpointer user_data
);
Get the secret value of this item.
Each item has a single secret which might be a password or some other secret binary value.
This function returns immediately and completes asynchronously.
|
an item |
|
optional cancellation object |
|
called when the operation completes |
|
data to pass to the callback |
SecretValue * secret_item_get_secret_finish (SecretItem *self
,GAsyncResult *result
,GError **error
);
Get the secret value of this item.
Complete asynchronous operation to get the secret value of this item.
|
an item |
|
asynchronous result passed to callback |
|
location to place error on failure |
Returns : |
the newly allocated secret value in this
item, which should be released with secret_value_unref() . [transfer full]
|
SecretValue * secret_item_get_secret_sync (SecretItem *self
,GCancellable *cancellable
,GError **error
);
Get the secret value of this item.
Each item has a single secret which might be a password or some other secret binary value.
This function may block indefinetely. Use the asynchronous version in user interface threads.
|
an item |
|
optional cancellation object |
|
location to place error on failure |
Returns : |
the newly allocated secret value in this
item, which should be released with secret_value_unref() . [transfer full]
|
void secret_item_set_secret (SecretItem *self
,SecretValue *value
,GCancellable *cancellable
,GAsyncReadyCallback callback
,gpointer user_data
);
Set the secret value of this item.
Each item has a single secret which might be a password or some other secret binary value.
This function returns immediately and completes asynchronously.
|
an item |
|
a new secret value |
|
optional cancellation object |
|
called when the operation completes |
|
data to pass to the callback |
gboolean secret_item_set_secret_finish (SecretItem *self
,GAsyncResult *result
,GError **error
);
Complete asynchronous operation to set the secret value of this item.
|
an item |
|
asynchronous result passed to callback |
|
location to place error on failure |
Returns : |
whether the change was successful or not |
gboolean secret_item_set_secret_sync (SecretItem *self
,SecretValue *value
,GCancellable *cancellable
,GError **error
);
Set the secret value of this item.
Each item has a single secret which might be a password or some other secret binary value.
This function may block indefinetely. Use the asynchronous version in user interface threads.
|
an item |
|
a new secret value |
|
optional cancellation object |
|
location to place error on failure |
Returns : |
whether the change was successful or not |
void secret_item_refresh (SecretItem *self
);
Refresh the properties on this item. 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.
|
the collection |
"attributes"
property "attributes" GHashTable* : Read / Write
The attributes set on this item. Attributes are used to locate an item. They are not guaranteed to be stored or transferred securely.
"created"
property "created" guint64 : Read / Write
The date and time (in seconds since the UNIX epoch) that this item was created.
Default value: 0
"label"
property "label" gchar* : Read / Write
The human readable label for the item.
Setting this property will result in the label of the item being
set asynchronously. To properly track the changing of the label use the
secret_item_set_label()
function.
Default value: NULL
"locked"
property "locked" gboolean : Read
Whether the item is locked or not. An item may not be independently lockable separate from other items in its collection.
To lock or unlock a item use the secret_service_lock()
or
secret_service_unlock()
functions.
Default value: TRUE
"modified"
property "modified" guint64 : Read / Write
The date and time (in seconds since the UNIX epoch) that this item was last modified.
Default value: 0
"service"
property"service" SecretService* : Read / Write / Construct Only
The SecretService object that this item is associated with and uses to interact with the actual D-Bus Secret Service.