aboutsummaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorSchanzenbach, Martin <mschanzenbach@posteo.de>2019-04-14 09:51:33 +0200
committerSchanzenbach, Martin <mschanzenbach@posteo.de>2019-04-14 10:01:24 +0200
commit48b97768c64eb4e2695756b44e95eedacdf21c02 (patch)
tree366c65e27fe09d8cffd1cea3b4ae1e736274b7fa /src/include
parenteb2d072aa1096c9d77cbfde239a1004cab642e64 (diff)
downloadgnunet-48b97768c64eb4e2695756b44e95eedacdf21c02.tar.gz
gnunet-48b97768c64eb4e2695756b44e95eedacdf21c02.zip
RECLAIM: remove sqlite plugin; housekeeping
Diffstat (limited to 'src/include')
-rw-r--r--src/include/gnunet_reclaim_service.h272
1 files changed, 120 insertions, 152 deletions
diff --git a/src/include/gnunet_reclaim_service.h b/src/include/gnunet_reclaim_service.h
index 3029e1f4d..d179485bb 100644
--- a/src/include/gnunet_reclaim_service.h
+++ b/src/include/gnunet_reclaim_service.h
@@ -11,7 +11,7 @@
11 WITHOUT ANY WARRANTY; without even the implied warranty of 11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details. 13 Affero General Public License for more details.
14 14
15 You should have received a copy of the GNU Affero General Public License 15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>. 16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 17
@@ -31,43 +31,47 @@
31#define GNUNET_RECLAIM_SERVICE_H 31#define GNUNET_RECLAIM_SERVICE_H
32 32
33#ifdef __cplusplus 33#ifdef __cplusplus
34extern "C" 34extern "C" {
35{ 35#if 0 /* keep Emacsens' auto-indent happy */
36#if 0 /* keep Emacsens' auto-indent happy */
37} 36}
38#endif 37#endif
39#endif 38#endif
40 39
41#include "gnunet_util_lib.h"
42#include "gnunet_reclaim_attribute_lib.h" 40#include "gnunet_reclaim_attribute_lib.h"
41#include "gnunet_util_lib.h"
43 42
44/** 43/**
45 * Version number of GNUnet Identity Provider API. 44 * Version number of the re:claimID API.
46 */ 45 */
47#define GNUNET_RECLAIM_VERSION 0x00000000 46#define GNUNET_RECLAIM_VERSION 0x00000000
48 47
49/** 48/**
50 * Handle to access the identity service. 49 * Opaque handle to access the service.
51 */ 50 */
52struct GNUNET_RECLAIM_Handle; 51struct GNUNET_RECLAIM_Handle;
53 52
53
54/** 54/**
55 * Handle for a token. 55 * Opaque handle for an operation at the re:claimID service.
56 */ 56 */
57struct GNUNET_RECLAIM_Token; 57struct GNUNET_RECLAIM_Operation;
58
58 59
59/** 60/**
60 * The ticket 61 * The an authorization ticket. This ticket is meant to be transferred
62 * out of band the a relying party.
63 * The contents of a ticket must be protected and should be treated as a
64 * SHARED SECRET between user and relying party.
61 */ 65 */
62struct GNUNET_RECLAIM_Ticket 66struct GNUNET_RECLAIM_Ticket
63{ 67{
64 /** 68 /**
65 * The ticket issuer 69 * The ticket issuer (= the user)
66 */ 70 */
67 struct GNUNET_CRYPTO_EcdsaPublicKey identity; 71 struct GNUNET_CRYPTO_EcdsaPublicKey identity;
68 72
69 /** 73 /**
70 * The ticket audience 74 * The ticket audience (= relying party)
71 */ 75 */
72 struct GNUNET_CRYPTO_EcdsaPublicKey audience; 76 struct GNUNET_CRYPTO_EcdsaPublicKey audience;
73 77
@@ -77,74 +81,77 @@ struct GNUNET_RECLAIM_Ticket
77 uint64_t rnd; 81 uint64_t rnd;
78}; 82};
79 83
80/**
81 * Handle for an operation with the identity provider service.
82 */
83struct GNUNET_RECLAIM_Operation;
84
85 84
86/** 85/**
87 * Connect to the identity provider service. 86 * Method called when a token has been issued.
87 * On success returns a ticket that can be given to the relying party to retrive
88 * the token
88 * 89 *
89 * @param cfg Configuration to contact the identity provider service. 90 * @param cls closure
90 * @return handle to communicate with identity provider service 91 * @param ticket the ticket
91 */ 92 */
92struct GNUNET_RECLAIM_Handle * 93typedef void (*GNUNET_RECLAIM_TicketCallback) (
93GNUNET_RECLAIM_connect (const struct GNUNET_CONFIGURATION_Handle *cfg); 94 void *cls, const struct GNUNET_RECLAIM_Ticket *ticket);
95
94 96
95/** 97/**
96 * Continuation called to notify client about result of the 98 * Continuation called to notify client about result of the
97 * operation. 99 * operation.
98 * 100 *
99 * @param cls closure 101 * @param cls The callback closure
100 * @param success #GNUNET_SYSERR on failure (including timeout/queue drop/failure to validate) 102 * @param success #GNUNET_SYSERR on failure
101 * #GNUNET_NO if content was already there or not found
102 * #GNUNET_YES (or other positive value) on success
103 * @param emsg NULL on success, otherwise an error message 103 * @param emsg NULL on success, otherwise an error message
104 */ 104 */
105typedef void 105typedef void (*GNUNET_RECLAIM_ContinuationWithStatus) (void *cls,
106(*GNUNET_RECLAIM_ContinuationWithStatus) (void *cls, 106 int32_t success,
107 int32_t success, 107 const char *emsg);
108 const char *emsg);
109 108
110 109
111/** 110/**
112 * Store an attribute. If the attribute is already present, 111 * Callback used to notify the client of attribute results.
113 * it is replaced with the new attribute.
114 * 112 *
115 * @param h handle to the identity provider 113 * @param cls The callback closure
116 * @param pkey private key of the identity 114 * @param identity The identity authoritative over the attributes
117 * @param attr the attribute 115 * @param attr The attribute
118 * @param exp_interval the relative expiration interval for the attribute
119 * @param cont continuation to call when done
120 * @param cont_cls closure for @a cont
121 * @return handle to abort the request
122 */ 116 */
123struct GNUNET_RECLAIM_Operation * 117typedef void (*GNUNET_RECLAIM_AttributeResult) (
124GNUNET_RECLAIM_attribute_store (struct GNUNET_RECLAIM_Handle *h, 118 void *cls, const struct GNUNET_CRYPTO_EcdsaPublicKey *identity,
125 const struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey, 119 const struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr);
126 const struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr,
127 const struct GNUNET_TIME_Relative *exp_interval,
128 GNUNET_RECLAIM_ContinuationWithStatus cont,
129 void *cont_cls);
130 120
131 121
132/** 122/**
133 * Process an attribute that was stored in the idp. 123 * Connect to the re:claimID service.
134 * 124 *
135 * @param cls closure 125 * @param cfg Configuration to contact the re:claimID service.
136 * @param identity the identity 126 * @return handle to communicate with the service
137 * @param attr the attribute
138 */ 127 */
139typedef void 128struct GNUNET_RECLAIM_Handle *
140(*GNUNET_RECLAIM_AttributeResult) (void *cls, 129GNUNET_RECLAIM_connect (const struct GNUNET_CONFIGURATION_Handle *cfg);
141 const struct GNUNET_CRYPTO_EcdsaPublicKey *identity, 130
142 const struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr);
143 131
132/**
133 * Store an attribute. If the attribute is already present,
134 * it is replaced with the new attribute.
135 *
136 * @param h handle to the re:claimID service
137 * @param pkey Private key of the identity to add an attribute to
138 * @param attr The attribute
139 * @param exp_interval The relative expiration interval for the attribute
140 * @param cont Continuation to call when done
141 * @param cont_cls Closure for @a cont
142 * @return handle Used to to abort the request
143 */
144struct GNUNET_RECLAIM_Operation *
145GNUNET_RECLAIM_attribute_store (
146 struct GNUNET_RECLAIM_Handle *h,
147 const struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey,
148 const struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr,
149 const struct GNUNET_TIME_Relative *exp_interval,
150 GNUNET_RECLAIM_ContinuationWithStatus cont, void *cont_cls);
144 151
145 152
146/** 153/**
147 * List all attributes for a local identity. 154 * List all attributes for a local identity.
148 * This MUST lock the `struct GNUNET_RECLAIM_Handle` 155 * This MUST lock the `struct GNUNET_RECLAIM_Handle`
149 * for any other calls than #GNUNET_RECLAIM_get_attributes_next() and 156 * for any other calls than #GNUNET_RECLAIM_get_attributes_next() and
150 * #GNUNET_RECLAIM_get_attributes_stop. @a proc will be called once 157 * #GNUNET_RECLAIM_get_attributes_stop. @a proc will be called once
@@ -155,87 +162,76 @@ typedef void
155 * On normal completion, @a finish_cb proc will be 162 * On normal completion, @a finish_cb proc will be
156 * invoked. 163 * invoked.
157 * 164 *
158 * @param h handle to the idp 165 * @param h Handle to the re:claimID service
159 * @param identity identity to access 166 * @param identity Identity to iterate over
160 * @param error_cb function to call on error (i.e. disconnect), 167 * @param error_cb Function to call on error (i.e. disconnect),
161 * the handle is afterwards invalid 168 * the handle is afterwards invalid
162 * @param error_cb_cls closure for @a error_cb 169 * @param error_cb_cls Closure for @a error_cb
163 * @param proc function to call on each attribute; it 170 * @param proc Function to call on each attribute
164 * will be called repeatedly with a value (if available) 171 * @param proc_cls Closure for @a proc
165 * @param proc_cls closure for @a proc 172 * @param finish_cb Function to call on completion
166 * @param finish_cb function to call on completion
167 * the handle is afterwards invalid 173 * the handle is afterwards invalid
168 * @param finish_cb_cls closure for @a finish_cb 174 * @param finish_cb_cls Closure for @a finish_cb
169 * @return an iterator handle to use for iteration 175 * @return an iterator Handle to use for iteration
170 */ 176 */
171struct GNUNET_RECLAIM_AttributeIterator * 177struct GNUNET_RECLAIM_AttributeIterator *
172GNUNET_RECLAIM_get_attributes_start (struct GNUNET_RECLAIM_Handle *h, 178GNUNET_RECLAIM_get_attributes_start (
173 const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity, 179 struct GNUNET_RECLAIM_Handle *h,
174 GNUNET_SCHEDULER_TaskCallback error_cb, 180 const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity,
175 void *error_cb_cls, 181 GNUNET_SCHEDULER_TaskCallback error_cb, void *error_cb_cls,
176 GNUNET_RECLAIM_AttributeResult proc, 182 GNUNET_RECLAIM_AttributeResult proc, void *proc_cls,
177 void *proc_cls, 183 GNUNET_SCHEDULER_TaskCallback finish_cb, void *finish_cb_cls);
178 GNUNET_SCHEDULER_TaskCallback finish_cb,
179 void *finish_cb_cls);
180 184
181 185
182/** 186/**
183 * Calls the record processor specified in #GNUNET_RECLAIM_get_attributes_start 187 * Calls the record processor specified in #GNUNET_RECLAIM_get_attributes_start
184 * for the next record. 188 * for the next record.
185 * 189 *
186 * @param it the iterator 190 * @param it The iterator
187 */ 191 */
188void 192void
189GNUNET_RECLAIM_get_attributes_next (struct GNUNET_RECLAIM_AttributeIterator *it); 193GNUNET_RECLAIM_get_attributes_next (
194 struct GNUNET_RECLAIM_AttributeIterator *it);
190 195
191 196
192/** 197/**
193 * Stops iteration and releases the idp handle for further calls. Must 198 * Stops iteration and releases the handle for further calls. Must
194 * be called on any iteration that has not yet completed prior to calling 199 * be called on any iteration that has not yet completed prior to calling
195 * #GNUNET_RECLAIM_disconnect. 200 * #GNUNET_RECLAIM_disconnect.
196 * 201 *
197 * @param it the iterator 202 * @param it the iterator
198 */ 203 */
199void 204void
200GNUNET_RECLAIM_get_attributes_stop (struct GNUNET_RECLAIM_AttributeIterator *it); 205GNUNET_RECLAIM_get_attributes_stop (
206 struct GNUNET_RECLAIM_AttributeIterator *it);
201 207
202 208
203/** 209/**
204 * Method called when a token has been issued. 210 * Issues a ticket to a relying party. The identity may use
205 * On success returns a ticket that can be given to the audience to retrive the
206 * token
207 *
208 * @param cls closure
209 * @param ticket the ticket
210 */
211typedef void
212(*GNUNET_RECLAIM_TicketCallback)(void *cls,
213 const struct GNUNET_RECLAIM_Ticket *ticket);
214
215/**
216 * Issues a ticket to another identity. The identity may use
217 * GNUNET_RECLAIM_ticket_consume to consume the ticket 211 * GNUNET_RECLAIM_ticket_consume to consume the ticket
218 * and retrieve the attributes specified in the AttributeList. 212 * and retrieve the attributes specified in the attribute list.
219 * 213 *
220 * @param h the identity provider to use 214 * @param h the identity provider to use
221 * @param iss the issuing identity 215 * @param iss the issuing identity (= the user)
222 * @param rp the subject of the ticket (the relying party) 216 * @param rp the subject of the ticket (= the relying party)
223 * @param attrs the attributes that the relying party is given access to 217 * @param attrs the attributes that the relying party is given access to
224 * @param cb the callback 218 * @param cb the callback
225 * @param cb_cls the callback closure 219 * @param cb_cls the callback closure
226 * @return handle to abort the operation 220 * @return handle to abort the operation
227 */ 221 */
228struct GNUNET_RECLAIM_Operation * 222struct GNUNET_RECLAIM_Operation *
229GNUNET_RECLAIM_ticket_issue (struct GNUNET_RECLAIM_Handle *h, 223GNUNET_RECLAIM_ticket_issue (
230 const struct GNUNET_CRYPTO_EcdsaPrivateKey *iss, 224 struct GNUNET_RECLAIM_Handle *h,
231 const struct GNUNET_CRYPTO_EcdsaPublicKey *rp, 225 const struct GNUNET_CRYPTO_EcdsaPrivateKey *iss,
232 const struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs, 226 const struct GNUNET_CRYPTO_EcdsaPublicKey *rp,
233 GNUNET_RECLAIM_TicketCallback cb, 227 const struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs,
234 void *cb_cls); 228 GNUNET_RECLAIM_TicketCallback cb, void *cb_cls);
235 229
236/** 230/**
237 * Revoked an issued ticket. The relying party will be unable to retrieve 231 * Revoked an issued ticket. The relying party will be unable to retrieve
238 * updated attributes. 232 * attributes. Other issued tickets remain unaffected.
233 * This includes tickets issued to other relying parties as well as to
234 * other tickets issued to the audience specified in this ticket.
239 * 235 *
240 * @param h the identity provider to use 236 * @param h the identity provider to use
241 * @param identity the issuing identity 237 * @param identity the issuing identity
@@ -245,31 +241,31 @@ GNUNET_RECLAIM_ticket_issue (struct GNUNET_RECLAIM_Handle *h,
245 * @return handle to abort the operation 241 * @return handle to abort the operation
246 */ 242 */
247struct GNUNET_RECLAIM_Operation * 243struct GNUNET_RECLAIM_Operation *
248GNUNET_RECLAIM_ticket_revoke (struct GNUNET_RECLAIM_Handle *h, 244GNUNET_RECLAIM_ticket_revoke (
249 const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity, 245 struct GNUNET_RECLAIM_Handle *h,
250 const struct GNUNET_RECLAIM_Ticket *ticket, 246 const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity,
251 GNUNET_RECLAIM_ContinuationWithStatus cb, 247 const struct GNUNET_RECLAIM_Ticket *ticket,
252 void *cb_cls); 248 GNUNET_RECLAIM_ContinuationWithStatus cb, void *cb_cls);
253
254 249
255 250
256/** 251/**
257 * Consumes an issued ticket. The ticket is persisted 252 * Consumes an issued ticket. The ticket is used to retrieve identity
258 * and used to retrieve identity information from the issuer 253 * information from the issuer
259 * 254 *
260 * @param h the identity provider to use 255 * @param h the identity provider to use
261 * @param identity the identity that is the subject of the issued ticket (the audience) 256 * @param identity the identity that is the subject of the issued ticket (the
257 * relying party)
262 * @param ticket the issued ticket to consume 258 * @param ticket the issued ticket to consume
263 * @param cb the callback to call 259 * @param cb the callback to call
264 * @param cb_cls the callback closure 260 * @param cb_cls the callback closure
265 * @return handle to abort the operation 261 * @return handle to abort the operation
266 */ 262 */
267struct GNUNET_RECLAIM_Operation * 263struct GNUNET_RECLAIM_Operation *
268GNUNET_RECLAIM_ticket_consume (struct GNUNET_RECLAIM_Handle *h, 264GNUNET_RECLAIM_ticket_consume (
269 const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity, 265 struct GNUNET_RECLAIM_Handle *h,
270 const struct GNUNET_RECLAIM_Ticket *ticket, 266 const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity,
271 GNUNET_RECLAIM_AttributeResult cb, 267 const struct GNUNET_RECLAIM_Ticket *ticket,
272 void *cb_cls); 268 GNUNET_RECLAIM_AttributeResult cb, void *cb_cls);
273 269
274/** 270/**
275 * Lists all tickets that have been issued to remote 271 * Lists all tickets that have been issued to remote
@@ -289,45 +285,17 @@ GNUNET_RECLAIM_ticket_consume (struct GNUNET_RECLAIM_Handle *h,
289 * @return an iterator handle to use for iteration 285 * @return an iterator handle to use for iteration
290 */ 286 */
291struct GNUNET_RECLAIM_TicketIterator * 287struct GNUNET_RECLAIM_TicketIterator *
292GNUNET_RECLAIM_ticket_iteration_start (struct GNUNET_RECLAIM_Handle *h, 288GNUNET_RECLAIM_ticket_iteration_start (
293 const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity, 289 struct GNUNET_RECLAIM_Handle *h,
294 GNUNET_SCHEDULER_TaskCallback error_cb, 290 const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity,
295 void *error_cb_cls, 291 GNUNET_SCHEDULER_TaskCallback error_cb, void *error_cb_cls,
296 GNUNET_RECLAIM_TicketCallback proc, 292 GNUNET_RECLAIM_TicketCallback proc, void *proc_cls,
297 void *proc_cls, 293 GNUNET_SCHEDULER_TaskCallback finish_cb, void *finish_cb_cls);
298 GNUNET_SCHEDULER_TaskCallback finish_cb,
299 void *finish_cb_cls);
300 294
301/**
302 * Lists all tickets that have been issued to remote
303 * identites (relying parties)
304 *
305 * @param h the identity provider to use
306 * @param identity the issuing identity
307 * @param error_cb function to call on error (i.e. disconnect),
308 * the handle is afterwards invalid
309 * @param error_cb_cls closure for @a error_cb
310 * @param proc function to call on each ticket; it
311 * will be called repeatedly with a value (if available)
312 * @param proc_cls closure for @a proc
313 * @param finish_cb function to call on completion
314 * the handle is afterwards invalid
315 * @param finish_cb_cls closure for @a finish_cb
316 * @return an iterator handle to use for iteration
317 */
318struct GNUNET_RECLAIM_TicketIterator *
319GNUNET_RECLAIM_ticket_iteration_start_rp (struct GNUNET_RECLAIM_Handle *h,
320 const struct GNUNET_CRYPTO_EcdsaPublicKey *identity,
321 GNUNET_SCHEDULER_TaskCallback error_cb,
322 void *error_cb_cls,
323 GNUNET_RECLAIM_TicketCallback proc,
324 void *proc_cls,
325 GNUNET_SCHEDULER_TaskCallback finish_cb,
326 void *finish_cb_cls);
327 295
328/** 296/**
329 * Calls the record processor specified in #GNUNET_RECLAIM_ticket_iteration_start 297 * Calls the ticket processor specified in
330 * for the next record. 298 * #GNUNET_RECLAIM_ticket_iteration_start for the next record.
331 * 299 *
332 * @param it the iterator 300 * @param it the iterator
333 */ 301 */
@@ -335,7 +303,7 @@ void
335GNUNET_RECLAIM_ticket_iteration_next (struct GNUNET_RECLAIM_TicketIterator *it); 303GNUNET_RECLAIM_ticket_iteration_next (struct GNUNET_RECLAIM_TicketIterator *it);
336 304
337/** 305/**
338 * Stops iteration and releases the idp handle for further calls. Must 306 * Stops iteration and releases the handle for further calls. Must
339 * be called on any iteration that has not yet completed prior to calling 307 * be called on any iteration that has not yet completed prior to calling
340 * #GNUNET_RECLAIM_disconnect. 308 * #GNUNET_RECLAIM_disconnect.
341 * 309 *
@@ -364,7 +332,7 @@ GNUNET_RECLAIM_disconnect (struct GNUNET_RECLAIM_Handle *h);
364void 332void
365GNUNET_RECLAIM_cancel (struct GNUNET_RECLAIM_Operation *op); 333GNUNET_RECLAIM_cancel (struct GNUNET_RECLAIM_Operation *op);
366 334
367#if 0 /* keep Emacsens' auto-indent happy */ 335#if 0 /* keep Emacsens' auto-indent happy */
368{ 336{
369#endif 337#endif
370#ifdef __cplusplus 338#ifdef __cplusplus