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_SERVICE_PATH "/org/freedesktop/secrets"
36 #define SECRET_SERVICE_BUS_NAME "org.freedesktop.secrets"
38 #define SECRET_ITEM_INTERFACE "org.freedesktop.Secret.Item"
39 #define SECRET_COLLECTION_INTERFACE "org.freedesktop.Secret.Collection"
40 #define SECRET_PROMPT_INTERFACE "org.freedesktop.Secret.Prompt"
41 #define SECRET_SERVICE_INTERFACE "org.freedesktop.Secret.Service"
43 #define SECRET_SIGNAL_COLLECTION_CREATED "CollectionCreated"
44 #define SECRET_SIGNAL_COLLECTION_CHANGED "CollectionChanged"
45 #define SECRET_SIGNAL_COLLECTION_DELETED "CollectionDeleted"
46 #define SECRET_SIGNAL_ITEM_CREATED "ItemCreated"
47 #define SECRET_SIGNAL_ITEM_CHANGED "ItemChanged"
48 #define SECRET_SIGNAL_ITEM_DELETED "ItemDeleted"
49 #define SECRET_PROMPT_SIGNAL_COMPLETED "Completed"
51 #define SECRET_PROPERTIES_INTERFACE "org.freedesktop.DBus.Properties"
53 SecretSync * _secret_sync_new (void);
55 void _secret_sync_free (gpointer data);
57 void _secret_sync_on_result (GObject *source,
61 SecretPrompt * _secret_prompt_instance (SecretService *service,
62 const gchar *prompt_path);
64 void _secret_util_strip_remote_error (GError **error);
66 gchar * _secret_util_parent_path (const gchar *path);
68 gboolean _secret_util_empty_path (const gchar *path);
70 gchar * _secret_util_collection_to_path (const gchar *collection);
72 gint _secret_util_array_index_of (GVariant *array,
75 GType _secret_list_get_type (void) G_GNUC_CONST;
77 GVariant * _secret_attributes_to_variant (GHashTable *attributes,
78 const gchar *schema_name);
80 GHashTable * _secret_attributes_for_variant (GVariant *variant);
82 GHashTable * _secret_attributes_copy (GHashTable *attributes);
84 gboolean _secret_attributes_validate (const SecretSchema *schema,
85 GHashTable *attributes,
86 const gchar *pretty_function,
89 GVariant * _secret_util_variant_for_properties (GHashTable *properties);
91 void _secret_util_get_properties (GDBusProxy *proxy,
93 GCancellable *cancellable,
94 GAsyncReadyCallback callback,
97 gboolean _secret_util_get_properties_finish (GDBusProxy *proxy,
102 void _secret_util_set_property (GDBusProxy *proxy,
103 const gchar *property,
106 GCancellable *cancellable,
107 GAsyncReadyCallback callback,
110 gboolean _secret_util_set_property_finish (GDBusProxy *proxy,
112 GAsyncResult *result,
115 gboolean _secret_util_set_property_sync (GDBusProxy *proxy,
116 const gchar *property,
118 GCancellable *cancellable,
121 gboolean _secret_util_have_cached_properties (GDBusProxy *proxy);
123 void _secret_service_set_default_bus_name (const gchar *bus_name);
125 SecretSession * _secret_service_get_session (SecretService *self);
127 void _secret_service_take_session (SecretService *self,
128 SecretSession *session);
130 void _secret_service_delete_path (SecretService *self,
131 const gchar *object_path,
133 GCancellable *cancellable,
134 GAsyncReadyCallback callback,
137 gboolean _secret_service_delete_path_finish (SecretService *self,
138 GAsyncResult *result,
141 void _secret_service_search_for_paths_variant (SecretService *self,
142 GVariant *attributes,
143 GCancellable *cancellable,
144 GAsyncReadyCallback callback,
147 SecretItem * _secret_service_find_item_instance (SecretService *self,
148 const gchar *item_path);
150 SecretCollection * _secret_service_find_collection_instance (SecretService *self,
151 const gchar *collection_path);
153 SecretValue * _secret_service_decode_get_secrets_first (SecretService *self,
156 GHashTable * _secret_service_decode_get_secrets_all (SecretService *self,
159 void _secret_service_xlock_paths_async (SecretService *self,
162 GCancellable *cancellable,
163 GAsyncReadyCallback callback,
166 gint _secret_service_xlock_paths_finish (SecretService *self,
167 GAsyncResult *result,
171 SecretItem * _secret_collection_find_item_instance (SecretCollection *self,
172 const gchar *item_path);
174 gchar * _secret_value_unref_to_password (SecretValue *value);
176 gchar * _secret_value_unref_to_string (SecretValue *value);
178 void _secret_session_free (gpointer data);
180 const gchar * _secret_session_get_algorithms (SecretSession *session);
182 const gchar * _secret_session_get_path (SecretSession *session);
184 void _secret_session_open (SecretService *service,
185 GCancellable *cancellable,
186 GAsyncReadyCallback callback,
189 gboolean _secret_session_open_finish (GAsyncResult *result,
192 GVariant * _secret_session_encode_secret (SecretSession *session,
195 SecretValue * _secret_session_decode_secret (SecretSession *session,
198 void _secret_item_set_cached_secret (SecretItem *self,
201 const SecretSchema * _secret_schema_ref_if_nonstatic (const SecretSchema *schema);
203 void _secret_schema_unref_if_nonstatic (const SecretSchema *schema);
207 #endif /* __SECRET_PRIVATE_H___ */