1 /* libsecret - GLib wrapper for Secret Service
3 * Copyright 2011 Collabora Ltd.
4 * Copyright 2012 Red Hat Inc.
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU Lesser General Public License as published
8 * by the Free Software Foundation; either version 2.1 of the licence or (at
9 * your option) any later version.
11 * See the included COPYING file for more information.
13 * Author: Stef Walter <stefw@gnome.org>
16 #if !defined (__SECRET_INSIDE_HEADER__) && !defined (SECRET_COMPILATION)
17 #error "Only <libsecret/secret.h> or <libsecret/secret-unstable.h> can be included directly."
20 #ifndef __SECRET_SERVICE_H__
21 #define __SECRET_SERVICE_H__
25 #include "secret-prompt.h"
26 #include "secret-schema.h"
27 #include "secret-types.h"
28 #include "secret-value.h"
33 SECRET_SERVICE_NONE = 0,
34 SECRET_SERVICE_OPEN_SESSION = 1 << 1,
35 SECRET_SERVICE_LOAD_COLLECTIONS = 1 << 2,
38 #define SECRET_TYPE_SERVICE (secret_service_get_type ())
39 #define SECRET_SERVICE(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), SECRET_TYPE_SERVICE, SecretService))
40 #define SECRET_SERVICE_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), SECRET_TYPE_SERVICE, SecretServiceClass))
41 #define SECRET_IS_SERVICE(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), SECRET_TYPE_SERVICE))
42 #define SECRET_IS_SERVICE_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), SECRET_TYPE_SERVICE))
43 #define SECRET_SERVICE_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), SECRET_TYPE_SERVICE, SecretServiceClass))
45 typedef struct _SecretServiceClass SecretServiceClass;
46 typedef struct _SecretServicePrivate SecretServicePrivate;
48 struct _SecretService {
52 SecretServicePrivate *pv;
55 struct _SecretServiceClass {
56 GDBusProxyClass parent_class;
58 GType collection_gtype;
61 GVariant * (* prompt_sync) (SecretService *self,
63 GCancellable *cancellable,
64 const GVariantType *return_type,
67 void (* prompt_async) (SecretService *self,
69 GCancellable *cancellable,
70 GAsyncReadyCallback callback,
73 GVariant * (* prompt_finish) (SecretService *self,
75 const GVariantType *return_type,
82 GType secret_service_get_type (void) G_GNUC_CONST;
84 void secret_service_get (SecretServiceFlags flags,
85 GCancellable *cancellable,
86 GAsyncReadyCallback callback,
89 SecretService * secret_service_get_finish (GAsyncResult *result,
92 SecretService * secret_service_get_sync (SecretServiceFlags flags,
93 GCancellable *cancellable,
96 void secret_service_disconnect (void);
98 void secret_service_new (GType service_gtype,
99 const gchar *service_bus_name,
100 SecretServiceFlags flags,
101 GCancellable *cancellable,
102 GAsyncReadyCallback callback,
105 SecretService * secret_service_new_finish (GAsyncResult *result,
108 SecretService * secret_service_new_sync (GType service_gtype,
109 const gchar *service_bus_name,
110 SecretServiceFlags flags,
111 GCancellable *cancellable,
114 SecretServiceFlags secret_service_get_flags (SecretService *self);
116 const gchar * secret_service_get_session_algorithms (SecretService *self);
118 GList * secret_service_get_collections (SecretService *self);
120 void secret_service_ensure_session (SecretService *self,
121 GCancellable *cancellable,
122 GAsyncReadyCallback callback,
125 gboolean secret_service_ensure_session_finish (SecretService *self,
126 GAsyncResult *result,
129 gboolean secret_service_ensure_session_sync (SecretService *self,
130 GCancellable *cancellable,
133 void secret_service_load_collections (SecretService *self,
134 GCancellable *cancellable,
135 GAsyncReadyCallback callback,
138 gboolean secret_service_load_collections_finish (SecretService *self,
139 GAsyncResult *result,
142 gboolean secret_service_load_collections_sync (SecretService *self,
143 GCancellable *cancellable,
146 GVariant * secret_service_prompt_sync (SecretService *self,
147 SecretPrompt *prompt,
148 GCancellable *cancellable,
149 const GVariantType *return_type,
152 void secret_service_prompt (SecretService *self,
153 SecretPrompt *prompt,
154 GCancellable *cancellable,
155 GAsyncReadyCallback callback,
158 GVariant * secret_service_prompt_finish (SecretService *self,
159 GAsyncResult *result,
160 const GVariantType *return_type,
163 void secret_service_search (SecretService *service,
164 const SecretSchema *schema,
165 GHashTable *attributes,
166 SecretSearchFlags flags,
167 GCancellable *cancellable,
168 GAsyncReadyCallback callback,
171 GList * secret_service_search_finish (SecretService *service,
172 GAsyncResult *result,
175 GList * secret_service_search_sync (SecretService *service,
176 const SecretSchema *schema,
177 GHashTable *attributes,
178 SecretSearchFlags flags,
179 GCancellable *cancellable,
182 void secret_service_lock (SecretService *service,
184 GCancellable *cancellable,
185 GAsyncReadyCallback callback,
188 gint secret_service_lock_finish (SecretService *service,
189 GAsyncResult *result,
193 gint secret_service_lock_sync (SecretService *service,
195 GCancellable *cancellable,
199 void secret_service_unlock (SecretService *service,
201 GCancellable *cancellable,
202 GAsyncReadyCallback callback,
205 gint secret_service_unlock_finish (SecretService *service,
206 GAsyncResult *result,
210 gint secret_service_unlock_sync (SecretService *service,
212 GCancellable *cancellable,
216 void secret_service_store (SecretService *service,
217 const SecretSchema *schema,
218 GHashTable *attributes,
219 const gchar *collection,
222 GCancellable *cancellable,
223 GAsyncReadyCallback callback,
226 gboolean secret_service_store_finish (SecretService *service,
227 GAsyncResult *result,
230 gboolean secret_service_store_sync (SecretService *service,
231 const SecretSchema *schema,
232 GHashTable *attributes,
233 const gchar *collection,
236 GCancellable *cancellable,
239 void secret_service_lookup (SecretService *service,
240 const SecretSchema *schema,
241 GHashTable *attributes,
242 GCancellable *cancellable,
243 GAsyncReadyCallback callback,
246 SecretValue * secret_service_lookup_finish (SecretService *service,
247 GAsyncResult *result,
250 SecretValue * secret_service_lookup_sync (SecretService *service,
251 const SecretSchema *schema,
252 GHashTable *attributes,
253 GCancellable *cancellable,
256 void secret_service_remove (SecretService *service,
257 const SecretSchema *schema,
258 GHashTable *attributes,
259 GCancellable *cancellable,
260 GAsyncReadyCallback callback,
263 gboolean secret_service_remove_finish (SecretService *service,
264 GAsyncResult *result,
267 gboolean secret_service_remove_sync (SecretService *service,
268 const SecretSchema *schema,
269 GHashTable *attributes,
270 GCancellable *cancellable,
273 void secret_service_set_alias (SecretService *service,
275 SecretCollection *collection,
276 GCancellable *cancellable,
277 GAsyncReadyCallback callback,
280 gboolean secret_service_set_alias_finish (SecretService *service,
281 GAsyncResult *result,
284 gboolean secret_service_set_alias_sync (SecretService *service,
286 SecretCollection *collection,
287 GCancellable *cancellable,
292 #endif /* __SECRET_SERVICE_H___ */