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> 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,
39 SECRET_SEARCH_NONE
= 0,
40 SECRET_SEARCH_ALL
= 1 << 1,
41 SECRET_SEARCH_UNLOCK
= 1 << 2,
42 SECRET_SEARCH_LOAD_SECRETS
= 1 << 3,
45 #define SECRET_TYPE_SERVICE (secret_service_get_type ())
46 #define SECRET_SERVICE(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), SECRET_TYPE_SERVICE, SecretService))
47 #define SECRET_SERVICE_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), SECRET_TYPE_SERVICE, SecretServiceClass))
48 #define SECRET_IS_SERVICE(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), SECRET_TYPE_SERVICE))
49 #define SECRET_IS_SERVICE_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), SECRET_TYPE_SERVICE))
50 #define SECRET_SERVICE_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), SECRET_TYPE_SERVICE, SecretServiceClass))
52 typedef struct _SecretCollection SecretCollection
;
53 typedef struct _SecretService SecretService
;
54 typedef struct _SecretServiceClass SecretServiceClass
;
55 typedef struct _SecretServicePrivate SecretServicePrivate
;
57 struct _SecretService
{
61 SecretServicePrivate
*pv
;
64 struct _SecretServiceClass
{
65 GDBusProxyClass parent_class
;
67 GType collection_gtype
;
70 GVariant
* (* prompt_sync
) (SecretService
*self
,
72 GCancellable
*cancellable
,
73 const GVariantType
*return_type
,
76 void (* prompt_async
) (SecretService
*self
,
78 const GVariantType
*return_type
,
79 GCancellable
*cancellable
,
80 GAsyncReadyCallback callback
,
83 GVariant
* (* prompt_finish
) (SecretService
*self
,
87 GType (* get_collection_gtype
) (SecretService
*self
);
89 GType (* get_item_gtype
) (SecretService
*self
);
95 GType
secret_service_get_type (void) G_GNUC_CONST
;
97 GType
secret_service_get_collection_gtype (SecretService
*self
);
99 GType
secret_service_get_item_gtype (SecretService
*self
);
101 void secret_service_get (SecretServiceFlags flags
,
102 GCancellable
*cancellable
,
103 GAsyncReadyCallback callback
,
106 SecretService
* secret_service_get_finish (GAsyncResult
*result
,
109 SecretService
* secret_service_get_sync (SecretServiceFlags flags
,
110 GCancellable
*cancellable
,
113 void secret_service_disconnect (void);
115 void secret_service_open (GType service_gtype
,
116 const gchar
*service_bus_name
,
117 SecretServiceFlags flags
,
118 GCancellable
*cancellable
,
119 GAsyncReadyCallback callback
,
122 SecretService
* secret_service_open_finish (GAsyncResult
*result
,
125 SecretService
* secret_service_open_sync (GType service_gtype
,
126 const gchar
*service_bus_name
,
127 SecretServiceFlags flags
,
128 GCancellable
*cancellable
,
131 SecretServiceFlags
secret_service_get_flags (SecretService
*self
);
133 const gchar
* secret_service_get_session_algorithms (SecretService
*self
);
135 GList
* secret_service_get_collections (SecretService
*self
);
137 void secret_service_ensure_session (SecretService
*self
,
138 GCancellable
*cancellable
,
139 GAsyncReadyCallback callback
,
142 gboolean
secret_service_ensure_session_finish (SecretService
*self
,
143 GAsyncResult
*result
,
146 gboolean
secret_service_ensure_session_sync (SecretService
*self
,
147 GCancellable
*cancellable
,
150 void secret_service_load_collections (SecretService
*self
,
151 GCancellable
*cancellable
,
152 GAsyncReadyCallback callback
,
155 gboolean
secret_service_load_collections_finish (SecretService
*self
,
156 GAsyncResult
*result
,
159 gboolean
secret_service_load_collections_sync (SecretService
*self
,
160 GCancellable
*cancellable
,
163 GVariant
* secret_service_prompt_sync (SecretService
*self
,
164 SecretPrompt
*prompt
,
165 GCancellable
*cancellable
,
166 const GVariantType
*return_type
,
169 void secret_service_prompt (SecretService
*self
,
170 SecretPrompt
*prompt
,
171 const GVariantType
*return_type
,
172 GCancellable
*cancellable
,
173 GAsyncReadyCallback callback
,
176 GVariant
* secret_service_prompt_finish (SecretService
*self
,
177 GAsyncResult
*result
,
180 void secret_service_search (SecretService
*service
,
181 const SecretSchema
*schema
,
182 GHashTable
*attributes
,
183 SecretSearchFlags flags
,
184 GCancellable
*cancellable
,
185 GAsyncReadyCallback callback
,
188 GList
* secret_service_search_finish (SecretService
*service
,
189 GAsyncResult
*result
,
192 GList
* secret_service_search_sync (SecretService
*service
,
193 const SecretSchema
*schema
,
194 GHashTable
*attributes
,
195 SecretSearchFlags flags
,
196 GCancellable
*cancellable
,
199 void secret_service_lock (SecretService
*service
,
201 GCancellable
*cancellable
,
202 GAsyncReadyCallback callback
,
205 gint
secret_service_lock_finish (SecretService
*service
,
206 GAsyncResult
*result
,
210 gint
secret_service_lock_sync (SecretService
*service
,
212 GCancellable
*cancellable
,
216 void secret_service_unlock (SecretService
*service
,
218 GCancellable
*cancellable
,
219 GAsyncReadyCallback callback
,
222 gint
secret_service_unlock_finish (SecretService
*service
,
223 GAsyncResult
*result
,
227 gint
secret_service_unlock_sync (SecretService
*service
,
229 GCancellable
*cancellable
,
233 void secret_service_store (SecretService
*service
,
234 const SecretSchema
*schema
,
235 GHashTable
*attributes
,
236 const gchar
*collection
,
239 GCancellable
*cancellable
,
240 GAsyncReadyCallback callback
,
243 gboolean
secret_service_store_finish (SecretService
*service
,
244 GAsyncResult
*result
,
247 gboolean
secret_service_store_sync (SecretService
*service
,
248 const SecretSchema
*schema
,
249 GHashTable
*attributes
,
250 const gchar
*collection
,
253 GCancellable
*cancellable
,
256 void secret_service_lookup (SecretService
*service
,
257 const SecretSchema
*schema
,
258 GHashTable
*attributes
,
259 GCancellable
*cancellable
,
260 GAsyncReadyCallback callback
,
263 SecretValue
* secret_service_lookup_finish (SecretService
*service
,
264 GAsyncResult
*result
,
267 SecretValue
* secret_service_lookup_sync (SecretService
*service
,
268 const SecretSchema
*schema
,
269 GHashTable
*attributes
,
270 GCancellable
*cancellable
,
273 void secret_service_clear (SecretService
*service
,
274 const SecretSchema
*schema
,
275 GHashTable
*attributes
,
276 GCancellable
*cancellable
,
277 GAsyncReadyCallback callback
,
280 gboolean
secret_service_clear_finish (SecretService
*service
,
281 GAsyncResult
*result
,
284 gboolean
secret_service_clear_sync (SecretService
*service
,
285 const SecretSchema
*schema
,
286 GHashTable
*attributes
,
287 GCancellable
*cancellable
,
290 void secret_service_set_alias (SecretService
*service
,
292 SecretCollection
*collection
,
293 GCancellable
*cancellable
,
294 GAsyncReadyCallback callback
,
297 gboolean
secret_service_set_alias_finish (SecretService
*service
,
298 GAsyncResult
*result
,
301 gboolean
secret_service_set_alias_sync (SecretService
*service
,
303 SecretCollection
*collection
,
304 GCancellable
*cancellable
,
309 #endif /* __SECRET_SERVICE_H___ */