libsecret/library/secret-service.h

553 lines
36 KiB
C
Raw Normal View History

/* libsecret - GLib wrapper for Secret Service
*
* Copyright 2011 Collabora Ltd.
* Copyright 2012 Red Hat Inc.
*
* 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
* by the Free Software Foundation; either version 2.1 of the licence or (at
* your option) any later version.
*
* See the included COPYING file for more information.
*
* Author: Stef Walter <stefw@gnome.org>
*/
2012-02-02 12:40:47 +00:00
#if !defined (__SECRET_INSIDE_HEADER__) && !defined (SECRET_COMPILATION)
#error "Only <secret/secret.h> or <secret/secret-unstable.h> can be included directly."
2012-02-02 12:40:47 +00:00
#endif
#ifndef __SECRET_SERVICE_H__
#define __SECRET_SERVICE_H__
#include <gio/gio.h>
#include "secret-prompt.h"
#include "secret-schema.h"
#include "secret-types.h"
#include "secret-value.h"
G_BEGIN_DECLS
typedef enum {
SECRET_SERVICE_NONE,
SECRET_SERVICE_OPEN_SESSION = 1 << 1,
SECRET_SERVICE_LOAD_COLLECTIONS = 1 << 2,
} SecretServiceFlags;
#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 {
GDBusProxy parent;
2012-02-02 13:59:59 +00:00
/*< private >*/
SecretServicePrivate *pv;
};
struct _SecretServiceClass {
GDBusProxyClass parent_class;
GType collection_gtype;
GType item_gtype;
GVariant * (* prompt_sync) (SecretService *self,
SecretPrompt *prompt,
2012-01-11 06:44:32 +00:00
GCancellable *cancellable,
const GVariantType *return_type,
2012-01-11 06:44:32 +00:00
GError **error);
void (* prompt_async) (SecretService *self,
SecretPrompt *prompt,
2012-01-11 06:44:32 +00:00
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
GVariant * (* prompt_finish) (SecretService *self,
2012-01-11 06:44:32 +00:00
GAsyncResult *result,
const GVariantType *return_type,
2012-01-11 06:44:32 +00:00
GError **error);
2012-02-02 13:59:59 +00:00
/*< private >*/
gpointer padding[16];
};
GType secret_service_get_type (void) G_GNUC_CONST;
void secret_service_get (SecretServiceFlags flags,
2012-02-02 12:40:47 +00:00
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
2012-02-02 12:40:47 +00:00
SecretService * secret_service_get_finish (GAsyncResult *result,
GError **error);
2012-02-02 12:40:47 +00:00
SecretService * secret_service_get_sync (SecretServiceFlags flags,
GCancellable *cancellable,
GError **error);
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-02-02 12:40:47 +00:00
SecretService * secret_service_new_finish (GAsyncResult *result,
GError **error);
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-02-02 12:40:47 +00:00
SecretServiceFlags secret_service_get_flags (SecretService *self);
const gchar * secret_service_get_session_algorithms (SecretService *self);
const gchar * secret_service_get_session_path (SecretService *self);
GList * secret_service_get_collections (SecretService *self);
void secret_service_ensure_session (SecretService *self,
2012-02-02 12:40:47 +00:00
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
const gchar * secret_service_ensure_session_finish (SecretService *self,
2012-02-02 12:40:47 +00:00
GAsyncResult *result,
GError **error);
const gchar * secret_service_ensure_session_sync (SecretService *self,
2012-02-02 12:40:47 +00:00
GCancellable *cancellable,
GError **error);
void secret_service_ensure_collections (SecretService *self,
2012-02-02 12:40:47 +00:00
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
gboolean secret_service_ensure_collections_finish (SecretService *self,
2012-02-02 12:40:47 +00:00
GAsyncResult *result,
GError **error);
gboolean secret_service_ensure_collections_sync (SecretService *self,
2012-02-02 12:40:47 +00:00
GCancellable *cancellable,
GError **error);
void secret_service_search (SecretService *self,
2012-02-02 12:40:47 +00:00
GHashTable *attributes,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
gboolean secret_service_search_finish (SecretService *self,
2012-02-02 12:40:47 +00:00
GAsyncResult *result,
GList **unlocked,
GList **locked,
GError **error);
gboolean secret_service_search_sync (SecretService *self,
2012-02-02 12:40:47 +00:00
GHashTable *attributes,
GCancellable *cancellable,
GList **unlocked,
GList **locked,
GError **error);
void secret_service_search_for_paths (SecretService *self,
2012-02-02 12:40:47 +00:00
GHashTable *attributes,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
gboolean secret_service_search_for_paths_finish (SecretService *self,
2012-02-02 12:40:47 +00:00
GAsyncResult *result,
gchar ***unlocked,
gchar ***locked,
GError **error);
gboolean secret_service_search_for_paths_sync (SecretService *self,
2012-02-02 12:40:47 +00:00
GHashTable *attributes,
GCancellable *cancellable,
gchar ***unlocked,
gchar ***locked,
GError **error);
void secret_service_get_secret_for_path (SecretService *self,
2012-02-02 12:40:47 +00:00
const gchar *item_path,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
2012-02-02 12:40:47 +00:00
SecretValue * secret_service_get_secret_for_path_finish (SecretService *self,
GAsyncResult *result,
GError **error);
2012-02-02 12:40:47 +00:00
SecretValue * secret_service_get_secret_for_path_sync (SecretService *self,
const gchar *item_path,
GCancellable *cancellable,
GError **error);
void secret_service_get_secrets_for_paths (SecretService *self,
2012-02-02 12:40:47 +00:00
const gchar **item_paths,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
GHashTable * secret_service_get_secrets_for_paths_finish (SecretService *self,
2012-02-02 12:40:47 +00:00
GAsyncResult *result,
GError **error);
GHashTable * secret_service_get_secrets_for_paths_sync (SecretService *self,
2012-02-02 12:40:47 +00:00
const gchar **item_paths,
GCancellable *cancellable,
GError **error);
void secret_service_get_secrets (SecretService *self,
2012-02-02 12:40:47 +00:00
GList *items,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
GHashTable * secret_service_get_secrets_finish (SecretService *self,
2012-02-02 12:40:47 +00:00
GAsyncResult *result,
GError **error);
GHashTable * secret_service_get_secrets_sync (SecretService *self,
2012-02-02 12:40:47 +00:00
GList *items,
GCancellable *cancellable,
GError **error);
void secret_service_lock (SecretService *self,
2012-02-02 12:40:47 +00:00
GList *objects,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
gint secret_service_lock_finish (SecretService *self,
2012-02-02 12:40:47 +00:00
GAsyncResult *result,
GList **locked,
GError **error);
gint secret_service_lock_sync (SecretService *self,
2012-02-02 12:40:47 +00:00
GList *objects,
GCancellable *cancellable,
GList **locked,
GError **error);
gint secret_service_lock_paths_sync (SecretService *self,
2012-02-02 12:40:47 +00:00
const gchar **paths,
GCancellable *cancellable,
gchar ***locked,
GError **error);
void secret_service_lock_paths (SecretService *self,
2012-02-02 12:40:47 +00:00
const gchar **paths,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
gint secret_service_lock_paths_finish (SecretService *self,
2012-02-02 12:40:47 +00:00
GAsyncResult *result,
gchar ***locked,
GError **error);
void secret_service_unlock (SecretService *self,
2012-02-02 12:40:47 +00:00
GList *objects,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
gint secret_service_unlock_finish (SecretService *self,
2012-02-02 12:40:47 +00:00
GAsyncResult *result,
GList **unlocked,
GError **error);
gint secret_service_unlock_sync (SecretService *self,
2012-02-02 12:40:47 +00:00
GList *objects,
GCancellable *cancellable,
GList **unlocked,
GError **error);
gint secret_service_unlock_paths_sync (SecretService *self,
2012-02-02 12:40:47 +00:00
const gchar **paths,
GCancellable *cancellable,
gchar ***unlocked,
GError **error);
void secret_service_unlock_paths (SecretService *self,
2012-02-02 12:40:47 +00:00
const gchar **paths,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
gint secret_service_unlock_paths_finish (SecretService *self,
2012-02-02 12:40:47 +00:00
GAsyncResult *result,
gchar ***unlocked,
GError **error);
GVariant * secret_service_prompt_sync (SecretService *self,
2012-02-02 12:40:47 +00:00
SecretPrompt *prompt,
GCancellable *cancellable,
const GVariantType *return_type,
2012-02-02 12:40:47 +00:00
GError **error);
void secret_service_prompt (SecretService *self,
2012-02-02 12:40:47 +00:00
SecretPrompt *prompt,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
GVariant * secret_service_prompt_finish (SecretService *self,
2012-02-02 12:40:47 +00:00
GAsyncResult *result,
const GVariantType *return_type,
GError **error);
GVariant * secret_service_prompt_path_sync (SecretService *self,
const gchar *prompt_path,
GCancellable *cancellable,
const GVariantType *return_type,
GError **error);
void secret_service_prompt_path (SecretService *self,
const gchar *prompt_path,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
GVariant * secret_service_prompt_path_finish (SecretService *self,
GAsyncResult *result,
const GVariantType *return_type,
2012-02-02 12:40:47 +00:00
GError **error);
void secret_service_store (SecretService *self,
2012-02-02 12:40:47 +00:00
const SecretSchema *schema,
const gchar *collection_path,
const gchar *label,
SecretValue *value,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data,
...) G_GNUC_NULL_TERMINATED;
void secret_service_storev (SecretService *self,
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);
gboolean secret_service_store_finish (SecretService *self,
2012-02-02 12:40:47 +00:00
GAsyncResult *result,
GError **error);
gboolean secret_service_store_sync (SecretService *self,
2012-02-02 12:40:47 +00:00
const SecretSchema *schema,
const gchar *collection_path,
const gchar *label,
SecretValue *value,
GCancellable *cancellable,
GError **error,
...) G_GNUC_NULL_TERMINATED;
gboolean secret_service_storev_sync (SecretService *self,
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);
void secret_service_lookup (SecretService *self,
2012-02-02 12:40:47 +00:00
const SecretSchema *schema,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data,
...) G_GNUC_NULL_TERMINATED;
void secret_service_lookupv (SecretService *self,
2012-02-02 12:40:47 +00:00
const SecretSchema *schema,
GHashTable *attributes,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
SecretValue * secret_service_lookup_finish (SecretService *self,
GAsyncResult *result,
GError **error);
SecretValue * secret_service_lookup_sync (SecretService *self,
const SecretSchema *schema,
GCancellable *cancellable,
GError **error,
...) G_GNUC_NULL_TERMINATED;
SecretValue * secret_service_lookupv_sync (SecretService *self,
const SecretSchema *schema,
GHashTable *attributes,
GCancellable *cancellable,
GError **error);
void secret_service_delete_path (SecretService *self,
2012-02-02 12:40:47 +00:00
const gchar *item_path,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
gboolean secret_service_delete_path_finish (SecretService *self,
2012-02-02 12:40:47 +00:00
GAsyncResult *result,
GError **error);
gboolean secret_service_delete_path_sync (SecretService *self,
2012-02-02 12:40:47 +00:00
const gchar *item_path,
GCancellable *cancellable,
GError **error);
void secret_service_remove (SecretService *self,
2012-02-02 12:40:47 +00:00
const SecretSchema *schema,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data,
...) G_GNUC_NULL_TERMINATED;
void secret_service_removev (SecretService *self,
2012-02-02 12:40:47 +00:00
const SecretSchema *schema,
GHashTable *attributes,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
gboolean secret_service_remove_finish (SecretService *self,
2012-02-02 12:40:47 +00:00
GAsyncResult *result,
GError **error);
gboolean secret_service_remove_sync (SecretService *self,
2012-02-02 12:40:47 +00:00
const SecretSchema* schema,
GCancellable *cancellable,
GError **error,
...) G_GNUC_NULL_TERMINATED;
gboolean secret_service_removev_sync (SecretService *self,
2012-02-02 12:40:47 +00:00
const SecretSchema *schema,
GHashTable *attributes,
GCancellable *cancellable,
GError **error);
void secret_service_create_collection_path (SecretService *self,
2012-02-02 12:40:47 +00:00
GHashTable *properties,
const gchar *alias,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
gchar * secret_service_create_collection_path_finish (SecretService *self,
2012-02-02 12:40:47 +00:00
GAsyncResult *result,
GError **error);
gchar * secret_service_create_collection_path_sync (SecretService *self,
2012-02-02 12:40:47 +00:00
GHashTable *properties,
const gchar *alias,
GCancellable *cancellable,
GError **error);
void secret_service_create_item_path (SecretService *self,
2012-02-02 12:40:47 +00:00
const gchar *collection_path,
GHashTable *properties,
SecretValue *value,
gboolean replace,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
gchar * secret_service_create_item_path_finish (SecretService *self,
2012-02-02 12:40:47 +00:00
GAsyncResult *result,
GError **error);
gchar * secret_service_create_item_path_sync (SecretService *self,
2012-02-02 12:40:47 +00:00
const gchar *collection_path,
GHashTable *properties,
SecretValue *value,
gboolean replace,
GCancellable *cancellable,
GError **error);
void secret_service_read_alias (SecretService *self,
const gchar *alias,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
SecretCollection * secret_service_read_alias_finish (SecretService *self,
GAsyncResult *result,
GError **error);
SecretCollection * secret_service_read_alias_sync (SecretService *self,
const gchar *alias,
GCancellable *cancellable,
GError **error);
void secret_service_read_alias_path (SecretService *self,
const gchar *alias,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
gchar * secret_service_read_alias_path_finish (SecretService *self,
GAsyncResult *result,
GError **error);
gchar * secret_service_read_alias_path_sync (SecretService *self,
const gchar *alias,
GCancellable *cancellable,
GError **error);
void secret_service_set_alias (SecretService *self,
const gchar *alias,
SecretCollection *collection,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
gboolean secret_service_set_alias_finish (SecretService *self,
GAsyncResult *result,
GError **error);
gboolean secret_service_set_alias_sync (SecretService *self,
const gchar *alias,
SecretCollection *collection,
GCancellable *cancellable,
GError **error);
void secret_service_set_alias_path (SecretService *self,
const gchar *alias,
const gchar *collection_path,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
gboolean secret_service_set_alias_path_finish (SecretService *self,
GAsyncResult *result,
GError **error);
gboolean secret_service_set_alias_path_sync (SecretService *self,
const gchar *alias,
const gchar *collection_path,
GCancellable *cancellable,
GError **error);
G_END_DECLS
#endif /* __SECRET_SERVICE_H___ */