2012-02-01 12:34:08 +00:00
|
|
|
/* libsecret - GLib wrapper for Secret Service
|
2011-09-25 06:22:36 +00:00
|
|
|
*
|
|
|
|
* Copyright 2011 Collabora Ltd.
|
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-03-24 06:52:12 +00:00
|
|
|
#error "Only <secret/secret.h> or <secret/secret-unstable.h> can be included directly."
|
2012-02-02 12:40:47 +00:00
|
|
|
#endif
|
|
|
|
|
2012-02-01 12:34:08 +00:00
|
|
|
#ifndef __SECRET_SERVICE_H__
|
|
|
|
#define __SECRET_SERVICE_H__
|
2011-09-25 06:22:36 +00:00
|
|
|
|
|
|
|
#include <gio/gio.h>
|
|
|
|
|
2012-02-01 12:34:08 +00:00
|
|
|
#include "secret-prompt.h"
|
2012-03-11 08:06:40 +00:00
|
|
|
#include "secret-schema.h"
|
2012-02-01 12:34:08 +00:00
|
|
|
#include "secret-types.h"
|
|
|
|
#include "secret-value.h"
|
2011-11-12 07:08:12 +00:00
|
|
|
|
2011-09-25 06:22:36 +00:00
|
|
|
G_BEGIN_DECLS
|
|
|
|
|
2012-01-25 13:26:52 +00:00
|
|
|
typedef enum {
|
2012-07-05 17:08:09 +00:00
|
|
|
SECRET_SERVICE_NONE = 0,
|
2012-02-01 12:34:08 +00:00
|
|
|
SECRET_SERVICE_OPEN_SESSION = 1 << 1,
|
|
|
|
SECRET_SERVICE_LOAD_COLLECTIONS = 1 << 2,
|
|
|
|
} SecretServiceFlags;
|
|
|
|
|
2012-07-05 17:08:09 +00:00
|
|
|
typedef enum {
|
|
|
|
SECRET_SEARCH_NONE = 0,
|
|
|
|
SECRET_SEARCH_ALL = 1 << 1,
|
|
|
|
SECRET_SEARCH_UNLOCK = 1 << 2,
|
|
|
|
SECRET_SEARCH_LOAD_SECRETS = 1 << 3,
|
|
|
|
} SecretSearchFlags;
|
|
|
|
|
2012-02-01 12:34:08 +00:00
|
|
|
#define SECRET_TYPE_SERVICE (secret_service_get_type ())
|
|
|
|
#define SECRET_SERVICE(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), SECRET_TYPE_SERVICE, SecretService))
|
|
|
|
#define SECRET_SERVICE_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), SECRET_TYPE_SERVICE, SecretServiceClass))
|
|
|
|
#define SECRET_IS_SERVICE(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), SECRET_TYPE_SERVICE))
|
|
|
|
#define SECRET_IS_SERVICE_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), SECRET_TYPE_SERVICE))
|
|
|
|
#define SECRET_SERVICE_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), SECRET_TYPE_SERVICE, SecretServiceClass))
|
|
|
|
|
|
|
|
typedef struct _SecretServiceClass SecretServiceClass;
|
|
|
|
typedef struct _SecretServicePrivate SecretServicePrivate;
|
|
|
|
|
|
|
|
struct _SecretService {
|
2012-01-20 14:10:35 +00:00
|
|
|
GDBusProxy parent;
|
2012-02-02 13:59:59 +00:00
|
|
|
|
|
|
|
/*< private >*/
|
2012-02-01 12:34:08 +00:00
|
|
|
SecretServicePrivate *pv;
|
2012-01-20 14:10:35 +00:00
|
|
|
};
|
|
|
|
|
2012-02-01 12:34:08 +00:00
|
|
|
struct _SecretServiceClass {
|
2011-09-25 06:22:36 +00:00
|
|
|
GDBusProxyClass parent_class;
|
|
|
|
|
2012-01-20 14:10:35 +00:00
|
|
|
GType collection_gtype;
|
|
|
|
GType item_gtype;
|
|
|
|
|
2012-04-29 19:34:40 +00:00
|
|
|
GVariant * (* prompt_sync) (SecretService *self,
|
2012-02-01 12:34:08 +00:00
|
|
|
SecretPrompt *prompt,
|
2012-01-11 06:44:32 +00:00
|
|
|
GCancellable *cancellable,
|
2012-04-29 19:34:40 +00:00
|
|
|
const GVariantType *return_type,
|
2012-01-11 06:44:32 +00:00
|
|
|
GError **error);
|
2011-09-25 06:22:36 +00:00
|
|
|
|
2012-04-29 19:34:40 +00:00
|
|
|
void (* prompt_async) (SecretService *self,
|
2012-02-01 12:34:08 +00:00
|
|
|
SecretPrompt *prompt,
|
2012-01-11 06:44:32 +00:00
|
|
|
GCancellable *cancellable,
|
|
|
|
GAsyncReadyCallback callback,
|
|
|
|
gpointer user_data);
|
|
|
|
|
2012-04-29 19:34:40 +00:00
|
|
|
GVariant * (* prompt_finish) (SecretService *self,
|
2012-01-11 06:44:32 +00:00
|
|
|
GAsyncResult *result,
|
2012-04-29 19:34:40 +00:00
|
|
|
const GVariantType *return_type,
|
2012-01-11 06:44:32 +00:00
|
|
|
GError **error);
|
2011-09-25 06:22:36 +00:00
|
|
|
|
2012-02-02 13:59:59 +00:00
|
|
|
/*< private >*/
|
2012-01-20 14:10:35 +00:00
|
|
|
gpointer padding[16];
|
2011-09-25 06:22:36 +00:00
|
|
|
};
|
|
|
|
|
2012-02-01 12:34:08 +00:00
|
|
|
GType secret_service_get_type (void) G_GNUC_CONST;
|
2012-01-20 14:10:35 +00:00
|
|
|
|
2012-02-01 12:34:08 +00:00
|
|
|
void secret_service_get (SecretServiceFlags flags,
|
2012-02-02 12:40:47 +00:00
|
|
|
GCancellable *cancellable,
|
|
|
|
GAsyncReadyCallback callback,
|
|
|
|
gpointer user_data);
|
2012-01-20 14:10:35 +00:00
|
|
|
|
2012-02-02 12:40:47 +00:00
|
|
|
SecretService * secret_service_get_finish (GAsyncResult *result,
|
|
|
|
GError **error);
|
2012-01-20 14:10:35 +00:00
|
|
|
|
2012-02-02 12:40:47 +00:00
|
|
|
SecretService * secret_service_get_sync (SecretServiceFlags flags,
|
|
|
|
GCancellable *cancellable,
|
|
|
|
GError **error);
|
2012-01-20 14:10:35 +00:00
|
|
|
|
2012-07-05 21:14:50 +00:00
|
|
|
void secret_service_disconnect (void);
|
|
|
|
|
2012-06-27 09:45:09 +00:00
|
|
|
void secret_service_new (GType service_gtype,
|
|
|
|
const gchar *service_bus_name,
|
2012-02-02 12:40:47 +00:00
|
|
|
SecretServiceFlags flags,
|
|
|
|
GCancellable *cancellable,
|
|
|
|
GAsyncReadyCallback callback,
|
|
|
|
gpointer user_data);
|
2012-01-25 13:26:52 +00:00
|
|
|
|
2012-02-02 12:40:47 +00:00
|
|
|
SecretService * secret_service_new_finish (GAsyncResult *result,
|
|
|
|
GError **error);
|
2012-01-25 13:26:52 +00:00
|
|
|
|
2012-06-27 09:45:09 +00:00
|
|
|
SecretService * secret_service_new_sync (GType service_gtype,
|
|
|
|
const gchar *service_bus_name,
|
2012-02-02 12:40:47 +00:00
|
|
|
SecretServiceFlags flags,
|
|
|
|
GCancellable *cancellable,
|
|
|
|
GError **error);
|
2012-01-25 13:26:52 +00:00
|
|
|
|
2012-02-02 12:40:47 +00:00
|
|
|
SecretServiceFlags secret_service_get_flags (SecretService *self);
|
2012-01-25 13:26:52 +00:00
|
|
|
|
2012-02-01 12:34:08 +00:00
|
|
|
const gchar * secret_service_get_session_algorithms (SecretService *self);
|
2012-01-20 14:10:35 +00:00
|
|
|
|
2012-02-01 12:34:08 +00:00
|
|
|
GList * secret_service_get_collections (SecretService *self);
|
2012-01-23 16:20:18 +00:00
|
|
|
|
2012-02-01 12:34:08 +00:00
|
|
|
void secret_service_ensure_session (SecretService *self,
|
2012-02-02 12:40:47 +00:00
|
|
|
GCancellable *cancellable,
|
|
|
|
GAsyncReadyCallback callback,
|
|
|
|
gpointer user_data);
|
2012-01-20 14:10:35 +00:00
|
|
|
|
2012-07-06 07:01:20 +00:00
|
|
|
gboolean secret_service_ensure_session_finish (SecretService *self,
|
2012-02-02 12:40:47 +00:00
|
|
|
GAsyncResult *result,
|
|
|
|
GError **error);
|
2012-01-20 14:10:35 +00:00
|
|
|
|
2012-07-06 07:01:20 +00:00
|
|
|
gboolean secret_service_ensure_session_sync (SecretService *self,
|
2012-02-02 12:40:47 +00:00
|
|
|
GCancellable *cancellable,
|
|
|
|
GError **error);
|
2012-01-20 14:10:35 +00:00
|
|
|
|
2012-07-05 19:26:20 +00:00
|
|
|
void secret_service_load_collections (SecretService *self,
|
2012-02-02 12:40:47 +00:00
|
|
|
GCancellable *cancellable,
|
|
|
|
GAsyncReadyCallback callback,
|
|
|
|
gpointer user_data);
|
2012-01-23 16:20:18 +00:00
|
|
|
|
2012-07-05 19:26:20 +00:00
|
|
|
gboolean secret_service_load_collections_finish (SecretService *self,
|
2012-02-02 12:40:47 +00:00
|
|
|
GAsyncResult *result,
|
|
|
|
GError **error);
|
2012-01-23 16:20:18 +00:00
|
|
|
|
2012-07-05 19:26:20 +00:00
|
|
|
gboolean secret_service_load_collections_sync (SecretService *self,
|
2012-02-02 12:40:47 +00:00
|
|
|
GCancellable *cancellable,
|
|
|
|
GError **error);
|
2012-01-23 16:20:18 +00:00
|
|
|
|
2012-07-05 21:14:50 +00:00
|
|
|
GVariant * secret_service_prompt_sync (SecretService *self,
|
|
|
|
SecretPrompt *prompt,
|
|
|
|
GCancellable *cancellable,
|
|
|
|
const GVariantType *return_type,
|
|
|
|
GError **error);
|
|
|
|
|
|
|
|
void secret_service_prompt (SecretService *self,
|
|
|
|
SecretPrompt *prompt,
|
|
|
|
GCancellable *cancellable,
|
|
|
|
GAsyncReadyCallback callback,
|
|
|
|
gpointer user_data);
|
|
|
|
|
|
|
|
GVariant * secret_service_prompt_finish (SecretService *self,
|
|
|
|
GAsyncResult *result,
|
|
|
|
const GVariantType *return_type,
|
|
|
|
GError **error);
|
|
|
|
|
|
|
|
void secret_service_search (SecretService *service,
|
2012-07-05 18:29:28 +00:00
|
|
|
const SecretSchema *schema,
|
2012-02-02 12:40:47 +00:00
|
|
|
GHashTable *attributes,
|
2012-07-05 17:08:09 +00:00
|
|
|
SecretSearchFlags flags,
|
2012-02-02 12:40:47 +00:00
|
|
|
GCancellable *cancellable,
|
|
|
|
GAsyncReadyCallback callback,
|
|
|
|
gpointer user_data);
|
2012-01-20 14:10:35 +00:00
|
|
|
|
2012-07-05 21:14:50 +00:00
|
|
|
GList * secret_service_search_finish (SecretService *service,
|
2012-02-02 12:40:47 +00:00
|
|
|
GAsyncResult *result,
|
|
|
|
GError **error);
|
2012-01-20 14:10:35 +00:00
|
|
|
|
2012-07-05 21:14:50 +00:00
|
|
|
GList * secret_service_search_sync (SecretService *service,
|
2012-07-05 18:29:28 +00:00
|
|
|
const SecretSchema *schema,
|
2012-02-02 12:40:47 +00:00
|
|
|
GHashTable *attributes,
|
2012-07-05 17:08:09 +00:00
|
|
|
SecretSearchFlags flags,
|
2012-02-02 12:40:47 +00:00
|
|
|
GCancellable *cancellable,
|
|
|
|
GError **error);
|
2012-01-20 14:10:35 +00:00
|
|
|
|
2012-07-05 21:14:50 +00:00
|
|
|
void secret_service_lock (SecretService *service,
|
2012-02-02 12:40:47 +00:00
|
|
|
GList *objects,
|
|
|
|
GCancellable *cancellable,
|
|
|
|
GAsyncReadyCallback callback,
|
|
|
|
gpointer user_data);
|
2012-01-20 14:10:35 +00:00
|
|
|
|
2012-07-05 21:14:50 +00:00
|
|
|
gint secret_service_lock_finish (SecretService *service,
|
2012-02-02 12:40:47 +00:00
|
|
|
GAsyncResult *result,
|
|
|
|
GList **locked,
|
|
|
|
GError **error);
|
2012-01-20 14:10:35 +00:00
|
|
|
|
2012-07-05 21:14:50 +00:00
|
|
|
gint secret_service_lock_sync (SecretService *service,
|
2012-02-02 12:40:47 +00:00
|
|
|
GList *objects,
|
|
|
|
GCancellable *cancellable,
|
|
|
|
GList **locked,
|
|
|
|
GError **error);
|
2012-01-20 14:10:35 +00:00
|
|
|
|
2012-07-05 21:14:50 +00:00
|
|
|
void secret_service_unlock (SecretService *service,
|
2012-02-02 12:40:47 +00:00
|
|
|
GList *objects,
|
|
|
|
GCancellable *cancellable,
|
|
|
|
GAsyncReadyCallback callback,
|
|
|
|
gpointer user_data);
|
2012-01-20 14:10:35 +00:00
|
|
|
|
2012-07-05 21:14:50 +00:00
|
|
|
gint secret_service_unlock_finish (SecretService *service,
|
2012-02-02 12:40:47 +00:00
|
|
|
GAsyncResult *result,
|
|
|
|
GList **unlocked,
|
|
|
|
GError **error);
|
2012-01-20 14:10:35 +00:00
|
|
|
|
2012-07-05 21:14:50 +00:00
|
|
|
gint secret_service_unlock_sync (SecretService *service,
|
2012-02-02 12:40:47 +00:00
|
|
|
GList *objects,
|
|
|
|
GCancellable *cancellable,
|
|
|
|
GList **unlocked,
|
|
|
|
GError **error);
|
2012-01-20 14:10:35 +00:00
|
|
|
|
2012-07-05 21:14:50 +00:00
|
|
|
void secret_service_store (SecretService *service,
|
2012-02-02 12:40:47 +00:00
|
|
|
const SecretSchema *schema,
|
|
|
|
GHashTable *attributes,
|
|
|
|
const gchar *collection_path,
|
|
|
|
const gchar *label,
|
|
|
|
SecretValue *value,
|
|
|
|
GCancellable *cancellable,
|
|
|
|
GAsyncReadyCallback callback,
|
|
|
|
gpointer user_data);
|
2012-01-20 14:10:35 +00:00
|
|
|
|
2012-07-05 21:14:50 +00:00
|
|
|
gboolean secret_service_store_finish (SecretService *service,
|
2012-02-02 12:40:47 +00:00
|
|
|
GAsyncResult *result,
|
|
|
|
GError **error);
|
2012-01-20 14:10:35 +00:00
|
|
|
|
2012-07-05 21:14:50 +00:00
|
|
|
gboolean secret_service_store_sync (SecretService *service,
|
2012-02-02 12:40:47 +00:00
|
|
|
const SecretSchema *schema,
|
|
|
|
GHashTable *attributes,
|
|
|
|
const gchar *collection_path,
|
|
|
|
const gchar *label,
|
|
|
|
SecretValue *value,
|
|
|
|
GCancellable *cancellable,
|
|
|
|
GError **error);
|
2012-01-20 14:10:35 +00:00
|
|
|
|
2012-07-05 21:14:50 +00:00
|
|
|
void secret_service_lookup (SecretService *service,
|
2012-02-02 12:40:47 +00:00
|
|
|
const SecretSchema *schema,
|
|
|
|
GHashTable *attributes,
|
|
|
|
GCancellable *cancellable,
|
|
|
|
GAsyncReadyCallback callback,
|
|
|
|
gpointer user_data);
|
|
|
|
|
2012-07-05 21:14:50 +00:00
|
|
|
SecretValue * secret_service_lookup_finish (SecretService *service,
|
2012-02-02 12:40:47 +00:00
|
|
|
GAsyncResult *result,
|
|
|
|
GError **error);
|
|
|
|
|
2012-07-05 21:14:50 +00:00
|
|
|
SecretValue * secret_service_lookup_sync (SecretService *service,
|
2012-02-02 12:40:47 +00:00
|
|
|
const SecretSchema *schema,
|
|
|
|
GHashTable *attributes,
|
|
|
|
GCancellable *cancellable,
|
|
|
|
GError **error);
|
2012-01-20 14:10:35 +00:00
|
|
|
|
2012-07-05 21:14:50 +00:00
|
|
|
void secret_service_remove (SecretService *service,
|
2012-02-02 12:40:47 +00:00
|
|
|
const SecretSchema *schema,
|
|
|
|
GHashTable *attributes,
|
|
|
|
GCancellable *cancellable,
|
|
|
|
GAsyncReadyCallback callback,
|
|
|
|
gpointer user_data);
|
2012-01-20 14:10:35 +00:00
|
|
|
|
2012-07-05 21:14:50 +00:00
|
|
|
gboolean secret_service_remove_finish (SecretService *service,
|
2012-02-02 12:40:47 +00:00
|
|
|
GAsyncResult *result,
|
|
|
|
GError **error);
|
2012-01-20 14:10:35 +00:00
|
|
|
|
2012-07-05 21:14:50 +00:00
|
|
|
gboolean secret_service_remove_sync (SecretService *service,
|
2012-02-02 12:40:47 +00:00
|
|
|
const SecretSchema *schema,
|
|
|
|
GHashTable *attributes,
|
|
|
|
GCancellable *cancellable,
|
|
|
|
GError **error);
|
2011-09-25 06:22:36 +00:00
|
|
|
|
2012-07-05 21:14:50 +00:00
|
|
|
void secret_service_read_alias (SecretService *service,
|
2012-06-23 12:09:50 +00:00
|
|
|
const gchar *alias,
|
|
|
|
GCancellable *cancellable,
|
|
|
|
GAsyncReadyCallback callback,
|
|
|
|
gpointer user_data);
|
|
|
|
|
2012-07-05 21:14:50 +00:00
|
|
|
SecretCollection * secret_service_read_alias_finish (SecretService *service,
|
2012-06-23 12:09:50 +00:00
|
|
|
GAsyncResult *result,
|
|
|
|
GError **error);
|
|
|
|
|
2012-07-05 21:14:50 +00:00
|
|
|
SecretCollection * secret_service_read_alias_sync (SecretService *service,
|
2012-06-23 12:09:50 +00:00
|
|
|
const gchar *alias,
|
|
|
|
GCancellable *cancellable,
|
|
|
|
GError **error);
|
|
|
|
|
2012-07-05 21:14:50 +00:00
|
|
|
void secret_service_set_alias (SecretService *service,
|
2012-06-23 12:09:50 +00:00
|
|
|
const gchar *alias,
|
|
|
|
SecretCollection *collection,
|
|
|
|
GCancellable *cancellable,
|
|
|
|
GAsyncReadyCallback callback,
|
|
|
|
gpointer user_data);
|
|
|
|
|
2012-07-05 21:14:50 +00:00
|
|
|
gboolean secret_service_set_alias_finish (SecretService *service,
|
2012-06-23 12:09:50 +00:00
|
|
|
GAsyncResult *result,
|
|
|
|
GError **error);
|
|
|
|
|
2012-07-05 21:14:50 +00:00
|
|
|
gboolean secret_service_set_alias_sync (SecretService *service,
|
2012-06-23 12:09:50 +00:00
|
|
|
const gchar *alias,
|
|
|
|
SecretCollection *collection,
|
|
|
|
GCancellable *cancellable,
|
|
|
|
GError **error);
|
|
|
|
|
2011-09-25 06:22:36 +00:00
|
|
|
G_END_DECLS
|
|
|
|
|
2012-02-01 12:34:08 +00:00
|
|
|
#endif /* __SECRET_SERVICE_H___ */
|