1 /* libsecret - GLib wrapper for Secret Service
3 * Copyright 2011 Collabora Ltd.
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU Lesser General Public License as published
7 * by the Free Software Foundation; either version 2.1 of the licence or (at
8 * your option) any later version.
10 * See the included COPYING file for more information.
12 * Author: Stef Walter <stefw@gnome.org>
15 #ifndef __SECRET_PRIVATE_H__
16 #define __SECRET_PRIVATE_H__
20 #include "secret-item.h"
21 #include "secret-service.h"
22 #include "secret-value.h"
28 GMainContext *context;
32 typedef struct _SecretSession SecretSession;
34 #define SECRET_ALIAS_PREFIX "/org/freedesktop/secrets/aliases/"
36 #define SECRET_SERVICE_PATH "/org/freedesktop/secrets"
38 #define SECRET_SERVICE_BUS_NAME "org.freedesktop.secrets"
40 #define SECRET_ITEM_INTERFACE "org.freedesktop.Secret.Item"
41 #define SECRET_COLLECTION_INTERFACE "org.freedesktop.Secret.Collection"
42 #define SECRET_PROMPT_INTERFACE "org.freedesktop.Secret.Prompt"
43 #define SECRET_SERVICE_INTERFACE "org.freedesktop.Secret.Service"
45 #define SECRET_SIGNAL_COLLECTION_CREATED "CollectionCreated"
46 #define SECRET_SIGNAL_COLLECTION_CHANGED "CollectionChanged"
47 #define SECRET_SIGNAL_COLLECTION_DELETED "CollectionDeleted"
48 #define SECRET_SIGNAL_ITEM_CREATED "ItemCreated"
49 #define SECRET_SIGNAL_ITEM_CHANGED "ItemChanged"
50 #define SECRET_SIGNAL_ITEM_DELETED "ItemDeleted"
51 #define SECRET_PROMPT_SIGNAL_COMPLETED "Completed"
53 #define SECRET_PROPERTIES_INTERFACE "org.freedesktop.DBus.Properties"
55 SecretSync * _secret_sync_new (void);
57 void _secret_sync_free (gpointer data);
59 void _secret_sync_on_result (GObject *source,
63 SecretPrompt * _secret_prompt_instance (SecretService *service,
64 const gchar *prompt_path);
66 void _secret_util_strip_remote_error (GError **error);
68 gboolean _secret_util_propagate_error (GSimpleAsyncResult *async,
71 gchar * _secret_util_parent_path (const gchar *path);
73 gboolean _secret_util_empty_path (const gchar *path);
75 gchar * _secret_util_collection_to_path (const gchar *collection);
77 gint _secret_util_array_index_of (GVariant *array,
80 GType _secret_list_get_type (void) G_GNUC_CONST;
82 GVariant * _secret_attributes_to_variant (GHashTable *attributes,
83 const gchar *schema_name);
85 GHashTable * _secret_attributes_for_variant (GVariant *variant);
87 GHashTable * _secret_attributes_copy (GHashTable *attributes);
89 gboolean _secret_attributes_validate (const SecretSchema *schema,
90 GHashTable *attributes,
91 const gchar *pretty_function,
94 GVariant * _secret_util_variant_for_properties (GHashTable *properties);
96 void _secret_util_get_properties (GDBusProxy *proxy,
98 GCancellable *cancellable,
99 GAsyncReadyCallback callback,
102 gboolean _secret_util_get_properties_finish (GDBusProxy *proxy,
104 GAsyncResult *result,
107 void _secret_util_set_property (GDBusProxy *proxy,
108 const gchar *property,
111 GCancellable *cancellable,
112 GAsyncReadyCallback callback,
115 gboolean _secret_util_set_property_finish (GDBusProxy *proxy,
117 GAsyncResult *result,
120 gboolean _secret_util_set_property_sync (GDBusProxy *proxy,
121 const gchar *property,
123 GCancellable *cancellable,
126 gboolean _secret_util_have_cached_properties (GDBusProxy *proxy);
128 SecretSession * _secret_service_get_session (SecretService *self);
130 void _secret_service_take_session (SecretService *self,
131 SecretSession *session);
133 void _secret_service_delete_path (SecretService *self,
134 const gchar *object_path,
136 GCancellable *cancellable,
137 GAsyncReadyCallback callback,
140 gboolean _secret_service_delete_path_finish (SecretService *self,
141 GAsyncResult *result,
144 void _secret_service_search_for_paths_variant (SecretService *self,
145 GVariant *attributes,
146 GCancellable *cancellable,
147 GAsyncReadyCallback callback,
150 SecretItem * _secret_service_find_item_instance (SecretService *self,
151 const gchar *item_path);
153 SecretCollection * _secret_service_find_collection_instance (SecretService *self,
154 const gchar *collection_path);
156 SecretValue * _secret_service_decode_get_secrets_first (SecretService *self,
159 GHashTable * _secret_service_decode_get_secrets_all (SecretService *self,
162 void _secret_service_xlock_paths_async (SecretService *self,
165 GCancellable *cancellable,
166 GAsyncReadyCallback callback,
169 gint _secret_service_xlock_paths_finish (SecretService *self,
170 GAsyncResult *result,
174 void _secret_service_create_item_dbus_path_finish_raw (GAsyncResult *result,
177 GHashTable * _secret_collection_properties_new (const gchar *label);
179 SecretItem * _secret_collection_find_item_instance (SecretCollection *self,
180 const gchar *item_path);
182 gchar * _secret_value_unref_to_password (SecretValue *value);
184 gchar * _secret_value_unref_to_string (SecretValue *value);
186 void _secret_session_free (gpointer data);
188 const gchar * _secret_session_get_algorithms (SecretSession *session);
190 const gchar * _secret_session_get_path (SecretSession *session);
192 void _secret_session_open (SecretService *service,
193 GCancellable *cancellable,
194 GAsyncReadyCallback callback,
197 gboolean _secret_session_open_finish (GAsyncResult *result,
200 GVariant * _secret_session_encode_secret (SecretSession *session,
203 SecretValue * _secret_session_decode_secret (SecretSession *session,
206 void _secret_item_set_cached_secret (SecretItem *self,
209 const SecretSchema * _secret_schema_ref_if_nonstatic (const SecretSchema *schema);
211 void _secret_schema_unref_if_nonstatic (const SecretSchema *schema);
215 #endif /* __SECRET_PRIVATE_H___ */