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.
|
|
|
|
*
|
|
|
|
* 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-03-31 13:32:43 +00:00
|
|
|
|
2012-02-01 12:34:08 +00:00
|
|
|
#ifndef __SECRET_PRIVATE_H__
|
|
|
|
#define __SECRET_PRIVATE_H__
|
2011-09-25 06:22:36 +00:00
|
|
|
|
|
|
|
#include <gio/gio.h>
|
|
|
|
|
2012-02-01 12:34:08 +00:00
|
|
|
#include "secret-service.h"
|
|
|
|
#include "secret-value.h"
|
2011-09-25 06:22:36 +00:00
|
|
|
|
|
|
|
G_BEGIN_DECLS
|
|
|
|
|
2011-11-12 07:08:12 +00:00
|
|
|
typedef struct {
|
2012-01-20 14:10:35 +00:00
|
|
|
GAsyncResult *result;
|
|
|
|
GMainContext *context;
|
|
|
|
GMainLoop *loop;
|
2012-02-01 12:34:08 +00:00
|
|
|
} SecretSync;
|
2011-11-12 07:08:12 +00:00
|
|
|
|
2012-02-01 12:34:08 +00:00
|
|
|
typedef struct _SecretSession SecretSession;
|
2012-01-23 16:20:18 +00:00
|
|
|
|
2012-03-11 08:41:13 +00:00
|
|
|
#define SECRET_SERVICE_PATH "/org/freedesktop/secrets"
|
2011-09-25 16:39:03 +00:00
|
|
|
|
2012-03-25 10:24:34 +00:00
|
|
|
#define SECRET_SERVICE_BUS_NAME "org.freedesktop.secrets"
|
2011-09-25 16:39:03 +00:00
|
|
|
|
2012-03-11 08:41:13 +00:00
|
|
|
#define SECRET_ITEM_INTERFACE "org.freedesktop.Secret.Item"
|
|
|
|
#define SECRET_COLLECTION_INTERFACE "org.freedesktop.Secret.Collection"
|
|
|
|
#define SECRET_PROMPT_INTERFACE "org.freedesktop.Secret.Prompt"
|
|
|
|
#define SECRET_SERVICE_INTERFACE "org.freedesktop.Secret.Service"
|
2011-09-25 16:39:03 +00:00
|
|
|
|
2012-02-19 12:09:07 +00:00
|
|
|
#define SECRET_SIGNAL_COLLECTION_CREATED "CollectionCreated"
|
|
|
|
#define SECRET_SIGNAL_COLLECTION_CHANGED "CollectionChanged"
|
|
|
|
#define SECRET_SIGNAL_COLLECTION_DELETED "CollectionDeleted"
|
|
|
|
#define SECRET_SIGNAL_ITEM_CREATED "ItemCreated"
|
|
|
|
#define SECRET_SIGNAL_ITEM_CHANGED "ItemChanged"
|
|
|
|
#define SECRET_SIGNAL_ITEM_DELETED "ItemDeleted"
|
|
|
|
#define SECRET_PROMPT_SIGNAL_COMPLETED "Completed"
|
2011-09-25 06:22:36 +00:00
|
|
|
|
2012-03-11 08:41:13 +00:00
|
|
|
#define SECRET_PROPERTIES_INTERFACE "org.freedesktop.DBus.Properties"
|
2012-01-16 14:08:46 +00:00
|
|
|
|
2012-03-11 08:41:13 +00:00
|
|
|
SecretSync * _secret_sync_new (void);
|
2011-11-12 07:08:12 +00:00
|
|
|
|
2012-03-11 08:41:13 +00:00
|
|
|
void _secret_sync_free (gpointer data);
|
2012-01-20 14:10:35 +00:00
|
|
|
|
2012-03-11 08:41:13 +00:00
|
|
|
void _secret_sync_on_result (GObject *source,
|
2012-02-02 12:40:47 +00:00
|
|
|
GAsyncResult *result,
|
|
|
|
gpointer user_data);
|
2011-11-12 07:08:12 +00:00
|
|
|
|
2012-03-11 08:41:13 +00:00
|
|
|
SecretPrompt * _secret_prompt_instance (SecretService *service,
|
2012-02-02 12:40:47 +00:00
|
|
|
const gchar *prompt_path);
|
2012-01-11 06:44:32 +00:00
|
|
|
|
2012-07-09 06:44:50 +00:00
|
|
|
void _secret_util_strip_remote_error (GError **error);
|
|
|
|
|
2012-03-11 08:41:13 +00:00
|
|
|
gchar * _secret_util_parent_path (const gchar *path);
|
2011-09-25 06:22:36 +00:00
|
|
|
|
2012-03-11 08:41:13 +00:00
|
|
|
gboolean _secret_util_empty_path (const gchar *path);
|
2012-01-11 06:44:32 +00:00
|
|
|
|
2012-07-06 07:42:08 +00:00
|
|
|
gchar * _secret_util_collection_to_path (const gchar *collection);
|
|
|
|
|
2012-02-19 12:09:07 +00:00
|
|
|
gint _secret_util_array_index_of (GVariant *array,
|
|
|
|
GVariant *value);
|
|
|
|
|
2012-03-11 08:41:13 +00:00
|
|
|
GType _secret_list_get_type (void) G_GNUC_CONST;
|
2012-01-20 14:10:35 +00:00
|
|
|
|
2012-06-28 11:15:06 +00:00
|
|
|
GVariant * _secret_attributes_to_variant (GHashTable *attributes,
|
2012-03-18 18:04:44 +00:00
|
|
|
const gchar *schema_name);
|
2011-11-05 20:50:01 +00:00
|
|
|
|
2012-06-28 11:15:06 +00:00
|
|
|
GHashTable * _secret_attributes_for_variant (GVariant *variant);
|
2012-01-16 14:08:29 +00:00
|
|
|
|
2012-06-28 11:15:06 +00:00
|
|
|
GHashTable * _secret_attributes_copy (GHashTable *attributes);
|
2012-01-11 06:44:32 +00:00
|
|
|
|
2012-06-28 11:15:06 +00:00
|
|
|
gboolean _secret_attributes_validate (const SecretSchema *schema,
|
2012-03-11 08:06:40 +00:00
|
|
|
GHashTable *attributes);
|
|
|
|
|
2012-03-11 08:41:13 +00:00
|
|
|
GVariant * _secret_util_variant_for_properties (GHashTable *properties);
|
2012-01-26 17:23:12 +00:00
|
|
|
|
2012-03-11 08:41:13 +00:00
|
|
|
void _secret_util_get_properties (GDBusProxy *proxy,
|
2012-02-02 12:40:47 +00:00
|
|
|
gpointer result_tag,
|
|
|
|
GCancellable *cancellable,
|
|
|
|
GAsyncReadyCallback callback,
|
|
|
|
gpointer user_data);
|
2012-01-20 14:10:35 +00:00
|
|
|
|
2012-03-11 08:41:13 +00:00
|
|
|
gboolean _secret_util_get_properties_finish (GDBusProxy *proxy,
|
2012-02-02 12:40:47 +00:00
|
|
|
gpointer result_tag,
|
|
|
|
GAsyncResult *result,
|
|
|
|
GError **error);
|
2012-01-20 14:10:35 +00:00
|
|
|
|
2012-03-11 08:41:13 +00:00
|
|
|
void _secret_util_set_property (GDBusProxy *proxy,
|
2012-02-02 12:40:47 +00:00
|
|
|
const gchar *property,
|
|
|
|
GVariant *value,
|
|
|
|
gpointer result_tag,
|
|
|
|
GCancellable *cancellable,
|
|
|
|
GAsyncReadyCallback callback,
|
|
|
|
gpointer user_data);
|
2012-01-16 14:08:29 +00:00
|
|
|
|
2012-03-11 08:41:13 +00:00
|
|
|
gboolean _secret_util_set_property_finish (GDBusProxy *proxy,
|
2012-02-02 12:40:47 +00:00
|
|
|
gpointer result_tag,
|
|
|
|
GAsyncResult *result,
|
|
|
|
GError **error);
|
2012-01-16 14:08:29 +00:00
|
|
|
|
2012-03-11 08:41:13 +00:00
|
|
|
gboolean _secret_util_set_property_sync (GDBusProxy *proxy,
|
2012-02-02 12:40:47 +00:00
|
|
|
const gchar *property,
|
|
|
|
GVariant *value,
|
|
|
|
GCancellable *cancellable,
|
|
|
|
GError **error);
|
2012-01-16 14:08:29 +00:00
|
|
|
|
2012-03-11 08:41:13 +00:00
|
|
|
gboolean _secret_util_have_cached_properties (GDBusProxy *proxy);
|
2012-01-23 16:20:18 +00:00
|
|
|
|
2012-03-11 08:41:13 +00:00
|
|
|
void _secret_service_set_default_bus_name (const gchar *bus_name);
|
2012-01-11 06:44:32 +00:00
|
|
|
|
2012-03-11 08:41:13 +00:00
|
|
|
SecretSession * _secret_service_get_session (SecretService *self);
|
2011-09-25 06:22:36 +00:00
|
|
|
|
2012-03-11 08:41:13 +00:00
|
|
|
void _secret_service_take_session (SecretService *self,
|
2012-02-02 12:40:47 +00:00
|
|
|
SecretSession *session);
|
2011-09-25 06:22:36 +00:00
|
|
|
|
2012-03-11 08:41:13 +00:00
|
|
|
void _secret_service_delete_path (SecretService *self,
|
2012-02-02 12:40:47 +00:00
|
|
|
const gchar *object_path,
|
|
|
|
gboolean is_an_item,
|
|
|
|
GCancellable *cancellable,
|
|
|
|
GAsyncReadyCallback callback,
|
2012-03-18 18:04:44 +00:00
|
|
|
gpointer user_data);
|
|
|
|
|
2012-07-06 07:01:20 +00:00
|
|
|
gboolean _secret_service_delete_path_finish (SecretService *self,
|
|
|
|
GAsyncResult *result,
|
|
|
|
GError **error);
|
|
|
|
|
2012-03-18 18:04:44 +00:00
|
|
|
void _secret_service_search_for_paths_variant (SecretService *self,
|
|
|
|
GVariant *attributes,
|
|
|
|
GCancellable *cancellable,
|
|
|
|
GAsyncReadyCallback callback,
|
2012-02-02 12:40:47 +00:00
|
|
|
gpointer user_data);
|
2012-01-26 13:34:37 +00:00
|
|
|
|
2012-03-11 08:41:13 +00:00
|
|
|
SecretItem * _secret_service_find_item_instance (SecretService *self,
|
2012-02-02 12:40:47 +00:00
|
|
|
const gchar *item_path);
|
2012-01-20 14:10:35 +00:00
|
|
|
|
2012-06-23 12:09:50 +00:00
|
|
|
SecretCollection * _secret_service_find_collection_instance (SecretService *self,
|
|
|
|
const gchar *collection_path);
|
|
|
|
|
2012-07-05 14:41:28 +00:00
|
|
|
SecretValue * _secret_service_decode_get_secrets_first (SecretService *self,
|
|
|
|
GVariant *out);
|
|
|
|
|
|
|
|
GHashTable * _secret_service_decode_get_secrets_all (SecretService *self,
|
|
|
|
GVariant *out);
|
|
|
|
|
2012-07-05 17:03:37 +00:00
|
|
|
void _secret_service_xlock_paths_async (SecretService *self,
|
|
|
|
const gchar *method,
|
|
|
|
const gchar **paths,
|
|
|
|
GCancellable *cancellable,
|
|
|
|
GAsyncReadyCallback callback,
|
|
|
|
gpointer user_data);
|
|
|
|
|
|
|
|
gint _secret_service_xlock_paths_finish (SecretService *self,
|
|
|
|
GAsyncResult *result,
|
|
|
|
gchar ***xlocked,
|
|
|
|
GError **error);
|
|
|
|
|
2012-03-11 08:41:13 +00:00
|
|
|
SecretItem * _secret_collection_find_item_instance (SecretCollection *self,
|
2012-02-02 12:40:47 +00:00
|
|
|
const gchar *item_path);
|
2012-01-20 14:10:35 +00:00
|
|
|
|
2012-03-11 08:41:13 +00:00
|
|
|
gchar * _secret_value_unref_to_password (SecretValue *value);
|
2012-01-16 14:08:29 +00:00
|
|
|
|
2012-03-11 08:41:13 +00:00
|
|
|
gchar * _secret_value_unref_to_string (SecretValue *value);
|
2012-03-11 08:06:40 +00:00
|
|
|
|
2012-03-11 08:41:13 +00:00
|
|
|
void _secret_session_free (gpointer data);
|
2012-01-23 16:20:18 +00:00
|
|
|
|
2012-03-11 08:41:13 +00:00
|
|
|
const gchar * _secret_session_get_algorithms (SecretSession *session);
|
2012-01-23 16:20:18 +00:00
|
|
|
|
2012-03-11 08:41:13 +00:00
|
|
|
const gchar * _secret_session_get_path (SecretSession *session);
|
2012-01-23 16:20:18 +00:00
|
|
|
|
2012-03-11 08:41:13 +00:00
|
|
|
void _secret_session_open (SecretService *service,
|
2012-02-02 12:40:47 +00:00
|
|
|
GCancellable *cancellable,
|
|
|
|
GAsyncReadyCallback callback,
|
|
|
|
gpointer user_data);
|
2012-01-23 16:20:18 +00:00
|
|
|
|
2012-03-11 08:41:13 +00:00
|
|
|
gboolean _secret_session_open_finish (GAsyncResult *result,
|
2012-02-02 12:40:47 +00:00
|
|
|
GError **error);
|
2012-01-23 16:20:18 +00:00
|
|
|
|
2012-03-11 08:41:13 +00:00
|
|
|
GVariant * _secret_session_encode_secret (SecretSession *session,
|
2012-02-02 12:40:47 +00:00
|
|
|
SecretValue *value);
|
2012-01-23 16:20:18 +00:00
|
|
|
|
2012-03-11 08:41:13 +00:00
|
|
|
SecretValue * _secret_session_decode_secret (SecretSession *session,
|
2012-02-02 12:40:47 +00:00
|
|
|
GVariant *encoded);
|
2012-01-23 16:20:18 +00:00
|
|
|
|
2012-07-05 13:38:38 +00:00
|
|
|
void _secret_item_set_cached_secret (SecretItem *self,
|
|
|
|
SecretValue *value);
|
|
|
|
|
2012-03-11 08:41:13 +00:00
|
|
|
const SecretSchema * _secret_schema_ref_if_nonstatic (const SecretSchema *schema);
|
|
|
|
|
|
|
|
void _secret_schema_unref_if_nonstatic (const SecretSchema *schema);
|
|
|
|
|
2011-09-25 06:22:36 +00:00
|
|
|
G_END_DECLS
|
|
|
|
|
2012-02-02 12:40:47 +00:00
|
|
|
#endif /* __SECRET_PRIVATE_H___ */
|