2012-02-01 12:34:08 +00:00
|
|
|
/* libsecret - GLib wrapper for Secret Service
|
2011-09-25 06:22:36 +00:00
|
|
|
*
|
2012-01-23 16:20:18 +00:00
|
|
|
* Copyright 2012 Red Hat Inc.
|
2011-09-25 06:22:36 +00:00
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Lesser General Public License as published
|
2012-03-31 13:32:43 +00:00
|
|
|
* by the Free Software Foundation; either version 2.1 of the licence or (at
|
2011-09-25 06:22:36 +00:00
|
|
|
* your option) any later version.
|
|
|
|
*
|
|
|
|
* See the included COPYING file for more information.
|
2012-03-31 13:32:43 +00:00
|
|
|
*
|
|
|
|
* Author: Stef Walter <stefw@gnome.org>
|
2011-09-25 06:22:36 +00:00
|
|
|
*/
|
|
|
|
|
2012-02-02 12:40:47 +00:00
|
|
|
#if !defined (__SECRET_INSIDE_HEADER__) && !defined (SECRET_COMPILATION)
|
2012-07-13 07:04:55 +00:00
|
|
|
#error "Only <secret/secret.h> can be included directly."
|
2012-02-02 12:40:47 +00:00
|
|
|
#endif
|
|
|
|
|
2012-02-01 12:34:08 +00:00
|
|
|
#ifndef __SECRET_ITEM_H__
|
|
|
|
#define __SECRET_ITEM_H__
|
2011-09-25 06:22:36 +00:00
|
|
|
|
|
|
|
#include <gio/gio.h>
|
|
|
|
|
2012-07-13 07:04:55 +00:00
|
|
|
#include "secret-collection.h"
|
2012-02-01 12:34:08 +00:00
|
|
|
#include "secret-item.h"
|
|
|
|
#include "secret-service.h"
|
|
|
|
#include "secret-value.h"
|
2011-09-25 06:22:36 +00:00
|
|
|
|
|
|
|
G_BEGIN_DECLS
|
|
|
|
|
2012-07-05 13:38:38 +00:00
|
|
|
typedef enum {
|
|
|
|
SECRET_ITEM_NONE,
|
|
|
|
SECRET_ITEM_LOAD_SECRET = 1 << 1
|
|
|
|
} SecretItemFlags;
|
|
|
|
|
2012-07-12 11:59:35 +00:00
|
|
|
typedef enum {
|
|
|
|
SECRET_ITEM_CREATE_NONE = 0,
|
|
|
|
SECRET_ITEM_CREATE_REPLACE = 1 << 1
|
|
|
|
} SecretItemCreateFlags;
|
|
|
|
|
2012-02-01 12:34:08 +00:00
|
|
|
#define SECRET_TYPE_ITEM (secret_item_get_type ())
|
|
|
|
#define SECRET_ITEM(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), SECRET_TYPE_ITEM, SecretItem))
|
|
|
|
#define SECRET_ITEM_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), SECRET_TYPE_ITEM, SecretItemClass))
|
|
|
|
#define SECRET_IS_ITEM(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), SECRET_TYPE_ITEM))
|
|
|
|
#define SECRET_IS_ITEM_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), SECRET_TYPE_ITEM))
|
|
|
|
#define SECRET_ITEM_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), SECRET_TYPE_ITEM, SecretItemClass))
|
2011-09-25 06:22:36 +00:00
|
|
|
|
2012-02-01 12:34:08 +00:00
|
|
|
typedef struct _SecretItemClass SecretItemClass;
|
|
|
|
typedef struct _SecretItemPrivate SecretItemPrivate;
|
2011-09-25 06:22:36 +00:00
|
|
|
|
2012-02-01 12:34:08 +00:00
|
|
|
struct _SecretItem {
|
2011-09-25 06:22:36 +00:00
|
|
|
GDBusProxy parent_instance;
|
2012-02-02 13:59:59 +00:00
|
|
|
|
|
|
|
/*< private >*/
|
2012-02-02 12:40:47 +00:00
|
|
|
SecretItemPrivate *pv;
|
2012-01-20 14:10:35 +00:00
|
|
|
};
|
|
|
|
|
2012-02-01 12:34:08 +00:00
|
|
|
struct _SecretItemClass {
|
2012-01-20 14:10:35 +00:00
|
|
|
GDBusProxyClass parent_class;
|
2012-02-02 13:59:59 +00:00
|
|
|
|
|
|
|
/*< private >*/
|
2012-01-20 14:10:35 +00:00
|
|
|
gpointer padding[4];
|
2011-09-25 06:22:36 +00:00
|
|
|
};
|
|
|
|
|
2012-02-01 12:34:08 +00:00
|
|
|
GType secret_item_get_type (void) G_GNUC_CONST;
|
2011-09-25 06:22:36 +00:00
|
|
|
|
2012-02-01 12:34:08 +00:00
|
|
|
void secret_item_refresh (SecretItem *self);
|
2011-09-25 06:22:36 +00:00
|
|
|
|
2012-02-01 12:34:08 +00:00
|
|
|
void secret_item_create (SecretCollection *collection,
|
2012-07-12 10:49:51 +00:00
|
|
|
const SecretSchema *schema,
|
2012-02-02 12:40:47 +00:00
|
|
|
GHashTable *attributes,
|
2012-07-12 10:49:51 +00:00
|
|
|
const gchar *label,
|
2012-02-02 12:40:47 +00:00
|
|
|
SecretValue *value,
|
2012-07-12 11:59:35 +00:00
|
|
|
SecretItemCreateFlags flags,
|
2012-02-02 12:40:47 +00:00
|
|
|
GCancellable *cancellable,
|
|
|
|
GAsyncReadyCallback callback,
|
|
|
|
gpointer user_data);
|
|
|
|
|
|
|
|
SecretItem * secret_item_create_finish (GAsyncResult *result,
|
|
|
|
GError **error);
|
|
|
|
|
|
|
|
SecretItem * secret_item_create_sync (SecretCollection *collection,
|
2012-07-12 10:49:51 +00:00
|
|
|
const SecretSchema *schema,
|
2012-02-02 12:40:47 +00:00
|
|
|
GHashTable *attributes,
|
2012-07-12 10:49:51 +00:00
|
|
|
const gchar *label,
|
2012-02-02 12:40:47 +00:00
|
|
|
SecretValue *value,
|
2012-07-12 11:59:35 +00:00
|
|
|
SecretItemCreateFlags flags,
|
2012-02-02 12:40:47 +00:00
|
|
|
GCancellable *cancellable,
|
|
|
|
GError **error);
|
2012-01-26 17:23:12 +00:00
|
|
|
|
2012-02-01 12:34:08 +00:00
|
|
|
void secret_item_delete (SecretItem *self,
|
2012-02-02 12:40:47 +00:00
|
|
|
GCancellable *cancellable,
|
|
|
|
GAsyncReadyCallback callback,
|
|
|
|
gpointer user_data);
|
2011-09-25 06:22:36 +00:00
|
|
|
|
2012-02-01 12:34:08 +00:00
|
|
|
gboolean secret_item_delete_finish (SecretItem *self,
|
2012-02-02 12:40:47 +00:00
|
|
|
GAsyncResult *result,
|
|
|
|
GError **error);
|
2011-09-25 06:22:36 +00:00
|
|
|
|
2012-02-01 12:34:08 +00:00
|
|
|
gboolean secret_item_delete_sync (SecretItem *self,
|
2012-02-02 12:40:47 +00:00
|
|
|
GCancellable *cancellable,
|
|
|
|
GError **error);
|
2011-09-25 06:22:36 +00:00
|
|
|
|
2012-07-05 13:38:38 +00:00
|
|
|
SecretItemFlags secret_item_get_flags (SecretItem *self);
|
|
|
|
|
2012-06-25 08:17:16 +00:00
|
|
|
SecretService * secret_item_get_service (SecretItem *self);
|
|
|
|
|
2012-07-05 13:38:38 +00:00
|
|
|
SecretValue * secret_item_get_secret (SecretItem *self);
|
|
|
|
|
|
|
|
void secret_item_load_secret (SecretItem *self,
|
2012-02-02 12:40:47 +00:00
|
|
|
GCancellable *cancellable,
|
|
|
|
GAsyncReadyCallback callback,
|
|
|
|
gpointer user_data);
|
2011-09-25 06:22:36 +00:00
|
|
|
|
2012-07-05 13:38:38 +00:00
|
|
|
gboolean secret_item_load_secret_finish (SecretItem *self,
|
2012-02-02 12:40:47 +00:00
|
|
|
GAsyncResult *result,
|
|
|
|
GError **error);
|
2011-09-25 06:22:36 +00:00
|
|
|
|
2012-07-05 13:38:38 +00:00
|
|
|
gboolean secret_item_load_secret_sync (SecretItem *self,
|
2012-02-02 12:40:47 +00:00
|
|
|
GCancellable *cancellable,
|
|
|
|
GError **error);
|
2011-09-25 06:22:36 +00:00
|
|
|
|
2012-07-05 15:11:58 +00:00
|
|
|
void secret_item_load_secrets (GList *items,
|
|
|
|
GCancellable *cancellable,
|
|
|
|
GAsyncReadyCallback callback,
|
|
|
|
gpointer user_data);
|
|
|
|
|
|
|
|
gboolean secret_item_load_secrets_finish (GAsyncResult *result,
|
|
|
|
GError **error);
|
|
|
|
|
|
|
|
gboolean secret_item_load_secrets_sync (GList *items,
|
|
|
|
GCancellable *cancellable,
|
|
|
|
GError **error);
|
|
|
|
|
2012-02-01 12:34:08 +00:00
|
|
|
void secret_item_set_secret (SecretItem *self,
|
2012-02-02 12:40:47 +00:00
|
|
|
SecretValue *value,
|
|
|
|
GCancellable *cancellable,
|
|
|
|
GAsyncReadyCallback callback,
|
|
|
|
gpointer user_data);
|
2012-01-26 17:23:12 +00:00
|
|
|
|
2012-02-01 12:34:08 +00:00
|
|
|
gboolean secret_item_set_secret_finish (SecretItem *self,
|
2012-02-02 12:40:47 +00:00
|
|
|
GAsyncResult *result,
|
|
|
|
GError **error);
|
2012-01-26 17:23:12 +00:00
|
|
|
|
2012-02-01 12:34:08 +00:00
|
|
|
gboolean secret_item_set_secret_sync (SecretItem *self,
|
2012-02-02 12:40:47 +00:00
|
|
|
SecretValue *value,
|
|
|
|
GCancellable *cancellable,
|
|
|
|
GError **error);
|
2012-01-26 17:23:12 +00:00
|
|
|
|
2012-07-12 11:02:14 +00:00
|
|
|
gchar * secret_item_get_schema_name (SecretItem *self);
|
|
|
|
|
2012-02-01 12:34:08 +00:00
|
|
|
GHashTable* secret_item_get_attributes (SecretItem *self);
|
2011-09-25 06:22:36 +00:00
|
|
|
|
2012-02-01 12:34:08 +00:00
|
|
|
void secret_item_set_attributes (SecretItem *self,
|
2012-07-12 10:49:51 +00:00
|
|
|
const SecretSchema *schema,
|
2012-02-02 12:40:47 +00:00
|
|
|
GHashTable *attributes,
|
|
|
|
GCancellable *cancellable,
|
|
|
|
GAsyncReadyCallback callback,
|
|
|
|
gpointer user_data);
|
2011-09-25 06:22:36 +00:00
|
|
|
|
2012-02-01 12:34:08 +00:00
|
|
|
gboolean secret_item_set_attributes_finish (SecretItem *self,
|
2012-02-02 12:40:47 +00:00
|
|
|
GAsyncResult *result,
|
|
|
|
GError **error);
|
2011-09-25 06:22:36 +00:00
|
|
|
|
2012-02-01 12:34:08 +00:00
|
|
|
gboolean secret_item_set_attributes_sync (SecretItem *self,
|
2012-07-12 10:49:51 +00:00
|
|
|
const SecretSchema *schema,
|
2012-02-02 12:40:47 +00:00
|
|
|
GHashTable *attributes,
|
|
|
|
GCancellable *cancellable,
|
|
|
|
GError **error);
|
2011-09-25 06:22:36 +00:00
|
|
|
|
2012-02-01 12:34:08 +00:00
|
|
|
gchar * secret_item_get_label (SecretItem *self);
|
2011-09-25 06:22:36 +00:00
|
|
|
|
2012-02-01 12:34:08 +00:00
|
|
|
void secret_item_set_label (SecretItem *self,
|
2012-02-02 12:40:47 +00:00
|
|
|
const gchar *label,
|
|
|
|
GCancellable *cancellable,
|
|
|
|
GAsyncReadyCallback callback,
|
|
|
|
gpointer user_data);
|
2011-09-25 06:22:36 +00:00
|
|
|
|
2012-02-01 12:34:08 +00:00
|
|
|
gboolean secret_item_set_label_finish (SecretItem *self,
|
2012-02-02 12:40:47 +00:00
|
|
|
GAsyncResult *result,
|
|
|
|
GError **error);
|
2011-09-25 06:22:36 +00:00
|
|
|
|
2012-02-01 12:34:08 +00:00
|
|
|
gboolean secret_item_set_label_sync (SecretItem *self,
|
2012-02-02 12:40:47 +00:00
|
|
|
const gchar *label,
|
|
|
|
GCancellable *cancellable,
|
|
|
|
GError **error);
|
2011-09-25 06:22:36 +00:00
|
|
|
|
2012-02-01 12:34:08 +00:00
|
|
|
gboolean secret_item_get_locked (SecretItem *self);
|
2011-09-25 06:22:36 +00:00
|
|
|
|
2012-02-01 12:34:08 +00:00
|
|
|
guint64 secret_item_get_created (SecretItem *self);
|
2011-09-25 06:22:36 +00:00
|
|
|
|
2012-02-01 12:34:08 +00:00
|
|
|
guint64 secret_item_get_modified (SecretItem *self);
|
2011-09-25 06:22:36 +00:00
|
|
|
|
|
|
|
G_END_DECLS
|
|
|
|
|
2012-02-02 12:40:47 +00:00
|
|
|
#endif /* __SECRET_ITEM_H___ */
|