diff options
author | Martin Schanzenbach <mschanzenbach@posteo.de> | 2020-08-19 19:05:23 +0200 |
---|---|---|
committer | Martin Schanzenbach <mschanzenbach@posteo.de> | 2020-08-20 17:59:01 +0200 |
commit | e75869506cc08e08056168383bd4ab02e1f007de (patch) | |
tree | b4617425e38fbd7070f6a6d7cd41544a7f41df5d /src/include | |
parent | 1ca1140d4602dcc5c66da0d1ab1b082db9258ead (diff) | |
download | gnunet-e75869506cc08e08056168383bd4ab02e1f007de.tar.gz gnunet-e75869506cc08e08056168383bd4ab02e1f007de.zip |
- towards separation between credentials and presentations thereof, wip, ftbfs
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/gnunet_protocols.h | 12 | ||||
-rw-r--r-- | src/include/gnunet_reclaim_lib.h | 394 | ||||
-rw-r--r-- | src/include/gnunet_reclaim_plugin.h | 187 | ||||
-rw-r--r-- | src/include/gnunet_reclaim_service.h | 61 |
4 files changed, 508 insertions, 146 deletions
diff --git a/src/include/gnunet_protocols.h b/src/include/gnunet_protocols.h index 4526b75d9..d9821ffe8 100644 --- a/src/include/gnunet_protocols.h +++ b/src/include/gnunet_protocols.h | |||
@@ -2900,17 +2900,17 @@ extern "C" { | |||
2900 | 2900 | ||
2901 | #define GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_DELETE 976 | 2901 | #define GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_DELETE 976 |
2902 | 2902 | ||
2903 | #define GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_STORE 977 | 2903 | #define GNUNET_MESSAGE_TYPE_RECLAIM_CREDENTIAL_STORE 977 |
2904 | 2904 | ||
2905 | #define GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_DELETE 978 | 2905 | #define GNUNET_MESSAGE_TYPE_RECLAIM_CREDENTIAL_DELETE 978 |
2906 | 2906 | ||
2907 | #define GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_RESULT 979 | 2907 | #define GNUNET_MESSAGE_TYPE_RECLAIM_CREDENTIAL_RESULT 979 |
2908 | 2908 | ||
2909 | #define GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_ITERATION_START 980 | 2909 | #define GNUNET_MESSAGE_TYPE_RECLAIM_CREDENTIAL_ITERATION_START 980 |
2910 | 2910 | ||
2911 | #define GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_ITERATION_STOP 981 | 2911 | #define GNUNET_MESSAGE_TYPE_RECLAIM_CREDENTIAL_ITERATION_STOP 981 |
2912 | 2912 | ||
2913 | #define GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_ITERATION_NEXT 982 | 2913 | #define GNUNET_MESSAGE_TYPE_RECLAIM_CREDENTIAL_ITERATION_NEXT 982 |
2914 | 2914 | ||
2915 | 2915 | ||
2916 | /************************************************** | 2916 | /************************************************** |
diff --git a/src/include/gnunet_reclaim_lib.h b/src/include/gnunet_reclaim_lib.h index 7d521ffa8..f5c3d3864 100644 --- a/src/include/gnunet_reclaim_lib.h +++ b/src/include/gnunet_reclaim_lib.h | |||
@@ -39,26 +39,34 @@ extern "C" { | |||
39 | 39 | ||
40 | #include "gnunet_util_lib.h" | 40 | #include "gnunet_util_lib.h" |
41 | 41 | ||
42 | enum GNUNET_RECLAIM_AttributeType { | ||
43 | /** | ||
44 | * No value attribute. | ||
45 | */ | ||
46 | GNUNET_RECLAIM_ATTRIBUTE_TYPE_NONE = 0, | ||
42 | 47 | ||
43 | /** | 48 | /** |
44 | * No value attribute. | 49 | * String attribute. |
45 | */ | 50 | */ |
46 | #define GNUNET_RECLAIM_ATTRIBUTE_TYPE_NONE 0 | 51 | GNUNET_RECLAIM_ATTRIBUTE_TYPE_STRING = 1 |
52 | }; | ||
47 | 53 | ||
48 | /** | 54 | enum GNUNET_RECLAIM_CredentialType { |
49 | * String attribute. | 55 | /** |
50 | */ | 56 | * No value credential. |
51 | #define GNUNET_RECLAIM_ATTRIBUTE_TYPE_STRING 1 | 57 | */ |
58 | GNUNET_RECLAIM_CREDENTIAL_TYPE_NONE = 0, | ||
52 | 59 | ||
53 | /** | 60 | /** |
54 | * No value attestation. | 61 | * A JSON Web Token credential. |
55 | */ | 62 | */ |
56 | #define GNUNET_RECLAIM_ATTESTATION_TYPE_NONE 10 | 63 | GNUNET_RECLAIM_CREDENTIAL_TYPE_JWT = 1, |
57 | 64 | ||
58 | /** | 65 | /** |
59 | * A JSON Web Token attestation. | 66 | * libpabc credential |
60 | */ | 67 | */ |
61 | #define GNUNET_RECLAIM_ATTESTATION_TYPE_JWT 11 | 68 | GNUNET_RECLAIM_CREDENTIAL_TYPE_PABC = 2 |
69 | }; | ||
62 | 70 | ||
63 | /** | 71 | /** |
64 | * We want an ID to be a 256-bit symmetric key | 72 | * We want an ID to be a 256-bit symmetric key |
@@ -107,9 +115,10 @@ struct GNUNET_RECLAIM_Attribute | |||
107 | struct GNUNET_RECLAIM_Identifier id; | 115 | struct GNUNET_RECLAIM_Identifier id; |
108 | 116 | ||
109 | /** | 117 | /** |
110 | * Referenced ID of Attestation (may be 0 if self-attested) | 118 | * Referenced ID of credential |
119 | * (may be GNUNET_RECLAIM_ID_ZERO if self-creded) | ||
111 | */ | 120 | */ |
112 | struct GNUNET_RECLAIM_Identifier attestation; | 121 | struct GNUNET_RECLAIM_Identifier credential; |
113 | 122 | ||
114 | /** | 123 | /** |
115 | * Type of Claim | 124 | * Type of Claim |
@@ -141,9 +150,9 @@ struct GNUNET_RECLAIM_Attribute | |||
141 | }; | 150 | }; |
142 | 151 | ||
143 | /** | 152 | /** |
144 | * An attestation. | 153 | * A credential. |
145 | */ | 154 | */ |
146 | struct GNUNET_RECLAIM_Attestation | 155 | struct GNUNET_RECLAIM_Credential |
147 | { | 156 | { |
148 | /** | 157 | /** |
149 | * ID | 158 | * ID |
@@ -161,7 +170,7 @@ struct GNUNET_RECLAIM_Attestation | |||
161 | uint32_t flag; | 170 | uint32_t flag; |
162 | 171 | ||
163 | /** | 172 | /** |
164 | * The name of the attribute. Note "name" must never be individually | 173 | * The name of the credential. Note: must never be individually |
165 | * free'd | 174 | * free'd |
166 | */ | 175 | */ |
167 | const char *name; | 176 | const char *name; |
@@ -172,7 +181,36 @@ struct GNUNET_RECLAIM_Attestation | |||
172 | size_t data_size; | 181 | size_t data_size; |
173 | 182 | ||
174 | /** | 183 | /** |
175 | * Binary value stored as attribute value. Note: "data" must never | 184 | * Binary value stored as credential value. Note: "data" must never |
185 | * be individually 'malloc'ed, but instead always points into some | ||
186 | * existing data area. | ||
187 | */ | ||
188 | const void *data; | ||
189 | }; | ||
190 | |||
191 | |||
192 | /** | ||
193 | * A credential presentation. | ||
194 | */ | ||
195 | struct GNUNET_RECLAIM_Presentation | ||
196 | { | ||
197 | /** | ||
198 | * The credential id of which this is a presentation. | ||
199 | */ | ||
200 | struct GNUNET_RECLAIM_Identifier credential_id; | ||
201 | |||
202 | /** | ||
203 | * Type/Format of Claim | ||
204 | */ | ||
205 | uint32_t type; | ||
206 | |||
207 | /** | ||
208 | * Number of bytes in @e data. | ||
209 | */ | ||
210 | size_t data_size; | ||
211 | |||
212 | /** | ||
213 | * Binary value stored as presentation value. Note: "data" must never | ||
176 | * be individually 'malloc'ed, but instead always points into some | 214 | * be individually 'malloc'ed, but instead always points into some |
177 | * existing data area. | 215 | * existing data area. |
178 | */ | 216 | */ |
@@ -180,6 +218,7 @@ struct GNUNET_RECLAIM_Attestation | |||
180 | }; | 218 | }; |
181 | 219 | ||
182 | 220 | ||
221 | |||
183 | /** | 222 | /** |
184 | * A list of GNUNET_RECLAIM_Attribute structures. | 223 | * A list of GNUNET_RECLAIM_Attribute structures. |
185 | */ | 224 | */ |
@@ -217,56 +256,94 @@ struct GNUNET_RECLAIM_AttributeListEntry | |||
217 | }; | 256 | }; |
218 | 257 | ||
219 | /** | 258 | /** |
220 | * A list of GNUNET_RECLAIM_Attestation structures. | 259 | * A list of GNUNET_RECLAIM_Credential structures. |
221 | */ | 260 | */ |
222 | struct GNUNET_RECLAIM_AttestationList | 261 | struct GNUNET_RECLAIM_CredentialList |
223 | { | 262 | { |
224 | /** | 263 | /** |
225 | * List head | 264 | * List head |
226 | */ | 265 | */ |
227 | struct GNUNET_RECLAIM_AttestationListEntry *list_head; | 266 | struct GNUNET_RECLAIM_CredentialListEntry *list_head; |
228 | 267 | ||
229 | /** | 268 | /** |
230 | * List tail | 269 | * List tail |
231 | */ | 270 | */ |
232 | struct GNUNET_RECLAIM_AttestationListEntry *list_tail; | 271 | struct GNUNET_RECLAIM_CredentialListEntry *list_tail; |
233 | }; | 272 | }; |
234 | 273 | ||
235 | 274 | ||
236 | struct GNUNET_RECLAIM_AttestationListEntry | 275 | struct GNUNET_RECLAIM_CredentialListEntry |
237 | { | 276 | { |
238 | /** | 277 | /** |
239 | * DLL | 278 | * DLL |
240 | */ | 279 | */ |
241 | struct GNUNET_RECLAIM_AttestationListEntry *prev; | 280 | struct GNUNET_RECLAIM_CredentialListEntry *prev; |
242 | 281 | ||
243 | /** | 282 | /** |
244 | * DLL | 283 | * DLL |
245 | */ | 284 | */ |
246 | struct GNUNET_RECLAIM_AttestationListEntry *next; | 285 | struct GNUNET_RECLAIM_CredentialListEntry *next; |
247 | 286 | ||
248 | /** | 287 | /** |
249 | * The attestation | 288 | * The credential |
250 | */ | 289 | */ |
251 | struct GNUNET_RECLAIM_Attestation *attestation; | 290 | struct GNUNET_RECLAIM_Credential *credential; |
252 | 291 | ||
253 | }; | 292 | }; |
254 | 293 | ||
255 | 294 | ||
256 | /** | 295 | /** |
296 | * A list of GNUNET_RECLAIM_Presentation structures. | ||
297 | */ | ||
298 | struct GNUNET_RECLAIM_PresentationList | ||
299 | { | ||
300 | /** | ||
301 | * List head | ||
302 | */ | ||
303 | struct GNUNET_RECLAIM_PresentationListEntry *list_head; | ||
304 | |||
305 | /** | ||
306 | * List tail | ||
307 | */ | ||
308 | struct GNUNET_RECLAIM_PresentationListEntry *list_tail; | ||
309 | }; | ||
310 | |||
311 | |||
312 | struct GNUNET_RECLAIM_PresentationListEntry | ||
313 | { | ||
314 | /** | ||
315 | * DLL | ||
316 | */ | ||
317 | struct GNUNET_RECLAIM_PresentationListEntry *prev; | ||
318 | |||
319 | /** | ||
320 | * DLL | ||
321 | */ | ||
322 | struct GNUNET_RECLAIM_PresentationListEntry *next; | ||
323 | |||
324 | /** | ||
325 | * The credential | ||
326 | */ | ||
327 | struct GNUNET_RECLAIM_Presentation *presentation; | ||
328 | |||
329 | }; | ||
330 | |||
331 | |||
332 | |||
333 | /** | ||
257 | * Create a new attribute claim. | 334 | * Create a new attribute claim. |
258 | * | 335 | * |
259 | * @param attr_name the attribute name | 336 | * @param attr_name the attribute name |
260 | * @param attestation ID of the attestation (may be NULL) | 337 | * @param credential ID of the credential (may be NULL) |
261 | * @param type the attribute type | 338 | * @param type the attribute type |
262 | * @param data the attribute value. Must be the mapped name if attestation not NULL | 339 | * @param data the attribute value. Must be #attr_name if credential not NULL |
263 | * @param data_size the attribute value size | 340 | * @param data_size the attribute value size |
264 | * @return the new attribute | 341 | * @return the new attribute |
265 | */ | 342 | */ |
266 | struct GNUNET_RECLAIM_Attribute * | 343 | struct GNUNET_RECLAIM_Attribute * |
267 | GNUNET_RECLAIM_attribute_new (const char *attr_name, | 344 | GNUNET_RECLAIM_attribute_new (const char *attr_name, |
268 | const struct | 345 | const struct |
269 | GNUNET_RECLAIM_Identifier *attestation, | 346 | GNUNET_RECLAIM_Identifier *credential, |
270 | uint32_t type, | 347 | uint32_t type, |
271 | const void *data, | 348 | const void *data, |
272 | size_t data_size); | 349 | size_t data_size); |
@@ -298,7 +375,7 @@ GNUNET_RECLAIM_attribute_list_destroy ( | |||
298 | * | 375 | * |
299 | * @param attrs the attribute list to add to | 376 | * @param attrs the attribute list to add to |
300 | * @param attr_name the name of the new attribute claim | 377 | * @param attr_name the name of the new attribute claim |
301 | * @param attestation attestation ID (may be NULL) | 378 | * @param credential credential ID (may be NULL) |
302 | * @param type the type of the claim | 379 | * @param type the type of the claim |
303 | * @param data claim payload | 380 | * @param data claim payload |
304 | * @param data_size claim payload size | 381 | * @param data_size claim payload size |
@@ -307,7 +384,7 @@ void | |||
307 | GNUNET_RECLAIM_attribute_list_add ( | 384 | GNUNET_RECLAIM_attribute_list_add ( |
308 | struct GNUNET_RECLAIM_AttributeList *attrs, | 385 | struct GNUNET_RECLAIM_AttributeList *attrs, |
309 | const char *attr_name, | 386 | const char *attr_name, |
310 | const struct GNUNET_RECLAIM_Identifier *attestation, | 387 | const struct GNUNET_RECLAIM_Identifier *credential, |
311 | uint32_t type, | 388 | uint32_t type, |
312 | const void *data, | 389 | const void *data, |
313 | size_t data_size); | 390 | size_t data_size); |
@@ -439,8 +516,8 @@ GNUNET_RECLAIM_attribute_number_to_typename (uint32_t type); | |||
439 | * @return the required buffer size | 516 | * @return the required buffer size |
440 | */ | 517 | */ |
441 | size_t | 518 | size_t |
442 | GNUNET_RECLAIM_attestation_list_serialize_get_size ( | 519 | GNUNET_RECLAIM_credential_list_serialize_get_size ( |
443 | const struct GNUNET_RECLAIM_AttestationList *attestations); | 520 | const struct GNUNET_RECLAIM_CredentialList *credentials); |
444 | 521 | ||
445 | 522 | ||
446 | /** | 523 | /** |
@@ -449,8 +526,8 @@ GNUNET_RECLAIM_attestation_list_serialize_get_size ( | |||
449 | * @param attrs list to destroy | 526 | * @param attrs list to destroy |
450 | */ | 527 | */ |
451 | void | 528 | void |
452 | GNUNET_RECLAIM_attestation_list_destroy ( | 529 | GNUNET_RECLAIM_credential_list_destroy ( |
453 | struct GNUNET_RECLAIM_AttestationList *attestations); | 530 | struct GNUNET_RECLAIM_CredentialList *credentials); |
454 | 531 | ||
455 | 532 | ||
456 | /** | 533 | /** |
@@ -462,8 +539,8 @@ GNUNET_RECLAIM_attestation_list_destroy ( | |||
462 | * @param data_size claim payload size | 539 | * @param data_size claim payload size |
463 | */ | 540 | */ |
464 | void | 541 | void |
465 | GNUNET_RECLAIM_attestation_list_add ( | 542 | GNUNET_RECLAIM_credential_list_add ( |
466 | struct GNUNET_RECLAIM_AttestationList *attrs, | 543 | struct GNUNET_RECLAIM_CredentialList *attrs, |
467 | const char *att_name, | 544 | const char *att_name, |
468 | uint32_t type, | 545 | uint32_t type, |
469 | const void *data, | 546 | const void *data, |
@@ -478,8 +555,8 @@ GNUNET_RECLAIM_attestation_list_add ( | |||
478 | * @return length of serialized data | 555 | * @return length of serialized data |
479 | */ | 556 | */ |
480 | size_t | 557 | size_t |
481 | GNUNET_RECLAIM_attestation_list_serialize ( | 558 | GNUNET_RECLAIM_credential_list_serialize ( |
482 | const struct GNUNET_RECLAIM_AttestationList *attrs, | 559 | const struct GNUNET_RECLAIM_CredentialList *attrs, |
483 | char *result); | 560 | char *result); |
484 | 561 | ||
485 | 562 | ||
@@ -490,75 +567,75 @@ GNUNET_RECLAIM_attestation_list_serialize ( | |||
490 | * @param data_size the length of the serialized data | 567 | * @param data_size the length of the serialized data |
491 | * @return a GNUNET_IDENTITY_PROVIDER_AttributeList, must be free'd by caller | 568 | * @return a GNUNET_IDENTITY_PROVIDER_AttributeList, must be free'd by caller |
492 | */ | 569 | */ |
493 | struct GNUNET_RECLAIM_AttestationList * | 570 | struct GNUNET_RECLAIM_CredentialList * |
494 | GNUNET_RECLAIM_attestation_list_deserialize (const char *data, | 571 | GNUNET_RECLAIM_credential_list_deserialize (const char *data, |
495 | size_t data_size); | 572 | size_t data_size); |
496 | 573 | ||
497 | 574 | ||
498 | /** | 575 | /** |
499 | * @param attestation the attestation to serialize | 576 | * @param credential the credential to serialize |
500 | * @return the required buffer size | 577 | * @return the required buffer size |
501 | */ | 578 | */ |
502 | size_t | 579 | size_t |
503 | GNUNET_RECLAIM_attestation_serialize_get_size ( | 580 | GNUNET_RECLAIM_credential_serialize_get_size ( |
504 | const struct GNUNET_RECLAIM_Attestation *attestation); | 581 | const struct GNUNET_RECLAIM_Credential *credential); |
505 | 582 | ||
506 | 583 | ||
507 | /** | 584 | /** |
508 | * Serialize an attestation | 585 | * Serialize an credential |
509 | * | 586 | * |
510 | * @param attestation the attestation to serialize | 587 | * @param credential the credential to serialize |
511 | * @param result the serialized attestation | 588 | * @param result the serialized credential |
512 | * @return length of serialized data | 589 | * @return length of serialized data |
513 | */ | 590 | */ |
514 | size_t | 591 | size_t |
515 | GNUNET_RECLAIM_attestation_serialize ( | 592 | GNUNET_RECLAIM_credential_serialize ( |
516 | const struct GNUNET_RECLAIM_Attestation *attestation, | 593 | const struct GNUNET_RECLAIM_Credential *credential, |
517 | char *result); | 594 | char *result); |
518 | 595 | ||
519 | 596 | ||
520 | /** | 597 | /** |
521 | * Deserialize an attestation | 598 | * Deserialize an credential |
522 | * | 599 | * |
523 | * @param data the serialized attestation | 600 | * @param data the serialized credential |
524 | * @param data_size the length of the serialized data | 601 | * @param data_size the length of the serialized data |
525 | * | 602 | * |
526 | * @return a GNUNET_IDENTITY_PROVIDER_Attribute, must be free'd by caller | 603 | * @return a GNUNET_IDENTITY_PROVIDER_Attribute, must be free'd by caller |
527 | */ | 604 | */ |
528 | struct GNUNET_RECLAIM_Attestation * | 605 | struct GNUNET_RECLAIM_Credential * |
529 | GNUNET_RECLAIM_attestation_deserialize (const char *data, size_t data_size); | 606 | GNUNET_RECLAIM_credential_deserialize (const char *data, size_t data_size); |
530 | 607 | ||
531 | 608 | ||
532 | /** | 609 | /** |
533 | * Create a new attestation. | 610 | * Create a new credential. |
534 | * | 611 | * |
535 | * @param name the attestation name | 612 | * @param name the credential name |
536 | * @param type the attestation type | 613 | * @param type the credential type |
537 | * @param data the attestation value | 614 | * @param data the credential value |
538 | * @param data_size the attestation value size | 615 | * @param data_size the credential value size |
539 | * @return the new attestation | 616 | * @return the new credential |
540 | */ | 617 | */ |
541 | struct GNUNET_RECLAIM_Attestation * | 618 | struct GNUNET_RECLAIM_Credential * |
542 | GNUNET_RECLAIM_attestation_new (const char *name, | 619 | GNUNET_RECLAIM_credential_new (const char *name, |
543 | uint32_t type, | 620 | uint32_t type, |
544 | const void *data, | 621 | const void *data, |
545 | size_t data_size); | 622 | size_t data_size); |
546 | 623 | ||
547 | /** | 624 | /** |
548 | * Convert the 'claim' of an attestation to a string | 625 | * Convert the 'claim' of an credential to a string |
549 | * | 626 | * |
550 | * @param type the type of attestation | 627 | * @param type the type of credential |
551 | * @param data claim in binary encoding | 628 | * @param data claim in binary encoding |
552 | * @param data_size number of bytes in @a data | 629 | * @param data_size number of bytes in @a data |
553 | * @return NULL on error, otherwise human-readable representation of the claim | 630 | * @return NULL on error, otherwise human-readable representation of the claim |
554 | */ | 631 | */ |
555 | char * | 632 | char * |
556 | GNUNET_RECLAIM_attestation_value_to_string (uint32_t type, | 633 | GNUNET_RECLAIM_credential_value_to_string (uint32_t type, |
557 | const void *data, | 634 | const void *data, |
558 | size_t data_size); | 635 | size_t data_size); |
559 | 636 | ||
560 | /** | 637 | /** |
561 | * Convert human-readable version of a 'claim' of an attestation to the binary | 638 | * Convert human-readable version of a 'claim' of an credential to the binary |
562 | * representation | 639 | * representation |
563 | * | 640 | * |
564 | * @param type type of the claim | 641 | * @param type type of the claim |
@@ -568,48 +645,199 @@ GNUNET_RECLAIM_attestation_value_to_string (uint32_t type, | |||
568 | * @return #GNUNET_OK on success | 645 | * @return #GNUNET_OK on success |
569 | */ | 646 | */ |
570 | int | 647 | int |
571 | GNUNET_RECLAIM_attestation_string_to_value (uint32_t type, | 648 | GNUNET_RECLAIM_credential_string_to_value (uint32_t type, |
572 | const char *s, | 649 | const char *s, |
573 | void **data, | 650 | void **data, |
574 | size_t *data_size); | 651 | size_t *data_size); |
575 | 652 | ||
576 | /** | 653 | /** |
577 | * Convert an attestation type number to the corresponding attestation type string | 654 | * Convert an credential type number to the corresponding credential type string |
578 | * | 655 | * |
579 | * @param type number of a type | 656 | * @param type number of a type |
580 | * @return corresponding typestring, NULL on error | 657 | * @return corresponding typestring, NULL on error |
581 | */ | 658 | */ |
582 | const char * | 659 | const char * |
583 | GNUNET_RECLAIM_attestation_number_to_typename (uint32_t type); | 660 | GNUNET_RECLAIM_credential_number_to_typename (uint32_t type); |
584 | 661 | ||
585 | /** | 662 | /** |
586 | * Convert an attestation type name to the corresponding number | 663 | * Convert an credential type name to the corresponding number |
587 | * | 664 | * |
588 | * @param typename name to convert | 665 | * @param typename name to convert |
589 | * @return corresponding number, UINT32_MAX on error | 666 | * @return corresponding number, UINT32_MAX on error |
590 | */ | 667 | */ |
591 | uint32_t | 668 | uint32_t |
592 | GNUNET_RECLAIM_attestation_typename_to_number (const char *typename); | 669 | GNUNET_RECLAIM_credential_typename_to_number (const char *typename); |
593 | 670 | ||
594 | /** | 671 | /** |
595 | * Convert an attestation type name to the corresponding number | 672 | * Convert an credential type name to the corresponding number |
596 | * | 673 | * |
597 | * @param typename name to convert | 674 | * @param typename name to convert |
598 | * @return corresponding number, UINT32_MAX on error | 675 | * @return corresponding number, UINT32_MAX on error |
599 | */ | 676 | */ |
600 | struct GNUNET_RECLAIM_AttributeList* | 677 | struct GNUNET_RECLAIM_AttributeList* |
601 | GNUNET_RECLAIM_attestation_get_attributes (const struct | 678 | GNUNET_RECLAIM_credential_get_attributes (const struct |
602 | GNUNET_RECLAIM_Attestation *attest); | 679 | GNUNET_RECLAIM_Credential *cred); |
603 | 680 | ||
604 | char* | 681 | char* |
605 | GNUNET_RECLAIM_attestation_get_issuer (const struct | 682 | GNUNET_RECLAIM_credential_get_issuer (const struct |
606 | GNUNET_RECLAIM_Attestation *attest); | 683 | GNUNET_RECLAIM_Credential *cred); |
607 | 684 | ||
608 | int | 685 | int |
609 | GNUNET_RECLAIM_attestation_get_expiration (const struct | 686 | GNUNET_RECLAIM_credential_get_expiration (const struct |
610 | GNUNET_RECLAIM_Attestation *attest, | 687 | GNUNET_RECLAIM_Credential *cred, |
611 | struct GNUNET_TIME_Absolute *exp); | 688 | struct GNUNET_TIME_Absolute *exp); |
612 | 689 | ||
690 | /** | ||
691 | * Get required size for serialization buffer | ||
692 | * | ||
693 | * @param presentations the presentation list to serialize | ||
694 | * @return the required buffer size | ||
695 | */ | ||
696 | size_t | ||
697 | GNUNET_RECLAIM_presentation_list_serialize_get_size ( | ||
698 | const struct GNUNET_RECLAIM_PresentationList *presentations); | ||
699 | |||
700 | |||
701 | /** | ||
702 | * Destroy presentations list | ||
703 | * | ||
704 | * @param presentations list to destroy | ||
705 | */ | ||
706 | void | ||
707 | GNUNET_RECLAIM_presentation_list_destroy ( | ||
708 | struct GNUNET_RECLAIM_PresentationList *presentations); | ||
709 | |||
710 | |||
711 | /** | ||
712 | * Serialize a presentation list | ||
713 | * | ||
714 | * @param presentations the attribute list to serialize | ||
715 | * @param result the serialized list | ||
716 | * @return length of serialized data | ||
717 | */ | ||
718 | size_t | ||
719 | GNUNET_RECLAIM_presentation_list_serialize ( | ||
720 | const struct GNUNET_RECLAIM_PresentationList *presentations, | ||
721 | char *result); | ||
722 | |||
723 | |||
724 | /** | ||
725 | * Deserialize a presentation list | ||
726 | * | ||
727 | * @param data the serialized list | ||
728 | * @param data_size the length of the serialized data | ||
729 | * @return a GNUNET_RECLAIM_PresentationList, must be free'd by caller | ||
730 | */ | ||
731 | struct GNUNET_RECLAIM_PresentationList * | ||
732 | GNUNET_RECLAIM_presentation_list_deserialize (const char *data, | ||
733 | size_t data_size); | ||
734 | |||
735 | |||
736 | /** | ||
737 | * @param presentation the presentation to serialize | ||
738 | * @return the required buffer size | ||
739 | */ | ||
740 | size_t | ||
741 | GNUNET_RECLAIM_presentation_serialize_get_size ( | ||
742 | const struct GNUNET_RECLAIM_Presentation *presentation); | ||
743 | |||
744 | |||
745 | /** | ||
746 | * Serialize a presentation. | ||
747 | * | ||
748 | * @param presentation the presentation to serialize | ||
749 | * @param result the serialized presentation | ||
750 | * @return length of serialized data | ||
751 | */ | ||
752 | size_t | ||
753 | GNUNET_RECLAIM_presentation_serialize ( | ||
754 | const struct GNUNET_RECLAIM_Presentation *presentation, | ||
755 | char *result); | ||
756 | |||
757 | |||
758 | /** | ||
759 | * Deserialize a presentation | ||
760 | * | ||
761 | * @param data the serialized presentation | ||
762 | * @param data_size the length of the serialized data | ||
763 | * | ||
764 | * @return a GNUNET_RECLAIM_Presentation, must be free'd by caller | ||
765 | */ | ||
766 | struct GNUNET_RECLAIM_Presentation * | ||
767 | GNUNET_RECLAIM_presentation_deserialize (const char *data, size_t data_size); | ||
768 | |||
769 | |||
770 | /** | ||
771 | * Convert the 'claim' of a presentation to a string | ||
772 | * | ||
773 | * @param type the type of presentation | ||
774 | * @param data presentation in binary encoding | ||
775 | * @param data_size number of bytes in @a data | ||
776 | * @return NULL on error, otherwise human-readable representation of the claim | ||
777 | */ | ||
778 | char * | ||
779 | GNUNET_RECLAIM_presentation_value_to_string (uint32_t type, | ||
780 | const void *data, | ||
781 | size_t data_size); | ||
782 | |||
783 | /** | ||
784 | * Convert human-readable version of a 'claim' of a presentation to the binary | ||
785 | * representation | ||
786 | * | ||
787 | * @param type type of the presentation | ||
788 | * @param s human-readable string | ||
789 | * @param data set to value in binary encoding (will be allocated) | ||
790 | * @param data_size set to number of bytes in @a data | ||
791 | * @return #GNUNET_OK on success | ||
792 | */ | ||
793 | int | ||
794 | GNUNET_RECLAIM_presentation_string_to_value (uint32_t type, | ||
795 | const char *s, | ||
796 | void **data, | ||
797 | size_t *data_size); | ||
798 | |||
799 | /** | ||
800 | * Convert a presentation type number to the corresponding credential type | ||
801 | * string. | ||
802 | * | ||
803 | * @param type number of a type | ||
804 | * @return corresponding typestring, NULL on error | ||
805 | */ | ||
806 | const char * | ||
807 | GNUNET_RECLAIM_presentation_number_to_typename (uint32_t type); | ||
808 | |||
809 | struct GNUNET_RECLAIM_AttributeList* | ||
810 | GNUNET_RECLAIM_presentation_get_attributes (const struct | ||
811 | GNUNET_RECLAIM_Presentation *cred); | ||
812 | |||
813 | char* | ||
814 | GNUNET_RECLAIM_presentation_get_issuer (const struct | ||
815 | GNUNET_RECLAIM_Presentation *cred); | ||
816 | |||
817 | int | ||
818 | GNUNET_RECLAIM_presentation_get_expiration (const struct | ||
819 | GNUNET_RECLAIM_Presentation *cred, | ||
820 | struct GNUNET_TIME_Absolute *exp); | ||
821 | |||
822 | |||
823 | |||
824 | /** | ||
825 | * Create a presentation from a credential and a lift of (selected) | ||
826 | * attributes in the credential. | ||
827 | * FIXME not yet implemented | ||
828 | * | ||
829 | * @param cred the credential to use | ||
830 | * @param attrs the attributes to present from the credential | ||
831 | * @return the credential presentation presenting the attributes according | ||
832 | * to the presentation mechanism of the credential | ||
833 | * or NULL on error. | ||
834 | */ | ||
835 | struct GNUNET_RECLAIM_Presentation* | ||
836 | GNUNET_RECLAIM_credential_get_presentation ( | ||
837 | const struct GNUNET_RECLAIM_Credential *cred, | ||
838 | const struct GNUNET_RECLAIM_AttributeList *attrs); | ||
839 | |||
840 | |||
613 | #if 0 /* keep Emacsens' auto-indent happy */ | 841 | #if 0 /* keep Emacsens' auto-indent happy */ |
614 | { | 842 | { |
615 | #endif | 843 | #endif |
diff --git a/src/include/gnunet_reclaim_plugin.h b/src/include/gnunet_reclaim_plugin.h index 7ee9e730f..af6c74e0b 100644 --- a/src/include/gnunet_reclaim_plugin.h +++ b/src/include/gnunet_reclaim_plugin.h | |||
@@ -27,8 +27,8 @@ | |||
27 | * @defgroup reclaim-attribute-plugin reclaim plugin API for attributes/claims | 27 | * @defgroup reclaim-attribute-plugin reclaim plugin API for attributes/claims |
28 | * @{ | 28 | * @{ |
29 | */ | 29 | */ |
30 | #ifndef GNUNET_RECLAIM_AttributePLUGIN_H | 30 | #ifndef GNUNET_RECLAIM_PLUGIN_H |
31 | #define GNUNET_RECLAIM_AttributePLUGIN_H | 31 | #define GNUNET_RECLAIM_PLUGIN_H |
32 | 32 | ||
33 | #include "gnunet_util_lib.h" | 33 | #include "gnunet_util_lib.h" |
34 | #include "gnunet_reclaim_lib.h" | 34 | #include "gnunet_reclaim_lib.h" |
@@ -113,7 +113,7 @@ typedef const char *(*GNUNET_RECLAIM_AttributeNumberToTypenameFunction) ( | |||
113 | * @param data_size number of bytes in @a data | 113 | * @param data_size number of bytes in @a data |
114 | * @return NULL on error, otherwise human-readable representation of the value | 114 | * @return NULL on error, otherwise human-readable representation of the value |
115 | */ | 115 | */ |
116 | typedef char *(*GNUNET_RECLAIM_AttestationValueToStringFunction) ( | 116 | typedef char *(*GNUNET_RECLAIM_CredentialValueToStringFunction) ( |
117 | void *cls, | 117 | void *cls, |
118 | uint32_t type, | 118 | uint32_t type, |
119 | const void *data, | 119 | const void *data, |
@@ -132,7 +132,7 @@ typedef char *(*GNUNET_RECLAIM_AttestationValueToStringFunction) ( | |||
132 | * @param data_size set to number of bytes in @a data | 132 | * @param data_size set to number of bytes in @a data |
133 | * @return #GNUNET_OK on success | 133 | * @return #GNUNET_OK on success |
134 | */ | 134 | */ |
135 | typedef int (*GNUNET_RECLAIM_AttestationStringToValueFunction) ( | 135 | typedef int (*GNUNET_RECLAIM_CredentialStringToValueFunction) ( |
136 | void *cls, | 136 | void *cls, |
137 | uint32_t type, | 137 | uint32_t type, |
138 | const char *s, | 138 | const char *s, |
@@ -148,7 +148,7 @@ typedef int (*GNUNET_RECLAIM_AttestationStringToValueFunction) ( | |||
148 | * @param typename name to convert | 148 | * @param typename name to convert |
149 | * @return corresponding number, UINT32_MAX on error | 149 | * @return corresponding number, UINT32_MAX on error |
150 | */ | 150 | */ |
151 | typedef uint32_t (*GNUNET_RECLAIM_AttestationTypenameToNumberFunction) ( | 151 | typedef uint32_t (*GNUNET_RECLAIM_CredentialTypenameToNumberFunction) ( |
152 | void *cls, | 152 | void *cls, |
153 | const char *typename); | 153 | const char *typename); |
154 | 154 | ||
@@ -161,45 +161,144 @@ typedef uint32_t (*GNUNET_RECLAIM_AttestationTypenameToNumberFunction) ( | |||
161 | * @param type number of a type to convert | 161 | * @param type number of a type to convert |
162 | * @return corresponding typestring, NULL on error | 162 | * @return corresponding typestring, NULL on error |
163 | */ | 163 | */ |
164 | typedef const char *(*GNUNET_RECLAIM_AttestationNumberToTypenameFunction) ( | 164 | typedef const char *(*GNUNET_RECLAIM_CredentialNumberToTypenameFunction) ( |
165 | void *cls, | 165 | void *cls, |
166 | uint32_t type); | 166 | uint32_t type); |
167 | 167 | ||
168 | /** | 168 | /** |
169 | * Function called to extract attributes from an attestation | 169 | * Function called to extract attributes from a credential |
170 | * | 170 | * |
171 | * @param cls closure | 171 | * @param cls closure |
172 | * @param attest the attestation object | 172 | * @param cred the credential object |
173 | * @return an attribute list | 173 | * @return an attribute list |
174 | */ | 174 | */ |
175 | typedef struct | 175 | typedef struct |
176 | GNUNET_RECLAIM_AttributeList *(* | 176 | GNUNET_RECLAIM_AttributeList *(* |
177 | GNUNET_RECLAIM_AttestationGetAttributesFunction) ( | 177 | GNUNET_RECLAIM_CredentialGetAttributesFunction) ( |
178 | void *cls, | 178 | void *cls, |
179 | const struct GNUNET_RECLAIM_Attestation *attest); | 179 | const struct GNUNET_RECLAIM_Credential *cred); |
180 | 180 | ||
181 | /** | 181 | /** |
182 | * Function called to get the issuer of the attestation (as string) | 182 | * Function called to get the issuer of the credential (as string) |
183 | * | 183 | * |
184 | * @param cls closure | 184 | * @param cls closure |
185 | * @param attest the attestation object | 185 | * @param cred the credential object |
186 | * @return corresponding issuer string | 186 | * @return corresponding issuer string |
187 | */ | 187 | */ |
188 | typedef char *(*GNUNET_RECLAIM_AttestationGetIssuerFunction) ( | 188 | typedef char *(*GNUNET_RECLAIM_CredentialGetIssuerFunction) ( |
189 | void *cls, | 189 | void *cls, |
190 | const struct GNUNET_RECLAIM_Attestation *attest); | 190 | const struct GNUNET_RECLAIM_Credential *cred); |
191 | 191 | ||
192 | /** | 192 | /** |
193 | * Function called to get the expiration of the attestation | 193 | * Function called to get the expiration of the credential |
194 | * | 194 | * |
195 | * @param cls closure | 195 | * @param cls closure |
196 | * @param attest the attestation object | 196 | * @param cred the credential object |
197 | * @param where to write the value | 197 | * @param where to write the value |
198 | * @return GNUNET_OK if successful | 198 | * @return GNUNET_OK if successful |
199 | */ | 199 | */ |
200 | typedef int (*GNUNET_RECLAIM_AttestationGetExpirationFunction) ( | 200 | typedef int (*GNUNET_RECLAIM_CredentialGetExpirationFunction) ( |
201 | void *cls, | 201 | void *cls, |
202 | const struct GNUNET_RECLAIM_Attestation *attest, | 202 | const struct GNUNET_RECLAIM_Credential *cred, |
203 | struct GNUNET_TIME_Absolute *expiration); | ||
204 | |||
205 | /** | ||
206 | * Function called to convert the binary value @a data of an attribute of | ||
207 | * type @a type to a human-readable string. | ||
208 | * | ||
209 | * @param cls closure | ||
210 | * @param type type of the attribute | ||
211 | * @param data value in binary encoding | ||
212 | * @param data_size number of bytes in @a data | ||
213 | * @return NULL on error, otherwise human-readable representation of the value | ||
214 | */ | ||
215 | typedef char *(*GNUNET_RECLAIM_PresentationValueToStringFunction) ( | ||
216 | void *cls, | ||
217 | uint32_t type, | ||
218 | const void *data, | ||
219 | size_t data_size); | ||
220 | |||
221 | |||
222 | /** | ||
223 | * Function called to convert human-readable version of the value @a s | ||
224 | * of an attribute of type @a type to the respective binary | ||
225 | * representation. | ||
226 | * | ||
227 | * @param cls closure | ||
228 | * @param type type of the attribute | ||
229 | * @param s human-readable string | ||
230 | * @param data set to value in binary encoding (will be allocated) | ||
231 | * @param data_size set to number of bytes in @a data | ||
232 | * @return #GNUNET_OK on success | ||
233 | */ | ||
234 | typedef int (*GNUNET_RECLAIM_PresentationStringToValueFunction) ( | ||
235 | void *cls, | ||
236 | uint32_t type, | ||
237 | const char *s, | ||
238 | void **data, | ||
239 | size_t *data_size); | ||
240 | |||
241 | |||
242 | /** | ||
243 | * Function called to convert a type name to the | ||
244 | * corresponding number. | ||
245 | * | ||
246 | * @param cls closure | ||
247 | * @param typename name to convert | ||
248 | * @return corresponding number, UINT32_MAX on error | ||
249 | */ | ||
250 | typedef uint32_t (*GNUNET_RECLAIM_PresentationTypenameToNumberFunction) ( | ||
251 | void *cls, | ||
252 | const char *typename); | ||
253 | |||
254 | |||
255 | /** | ||
256 | * Function called to convert a type number (i.e. 1) to the | ||
257 | * corresponding type string | ||
258 | * | ||
259 | * @param cls closure | ||
260 | * @param type number of a type to convert | ||
261 | * @return corresponding typestring, NULL on error | ||
262 | */ | ||
263 | typedef const char *(*GNUNET_RECLAIM_PresentationNumberToTypenameFunction) ( | ||
264 | void *cls, | ||
265 | uint32_t type); | ||
266 | |||
267 | /** | ||
268 | * Function called to extract attributes from a credential | ||
269 | * | ||
270 | * @param cls closure | ||
271 | * @param cred the credential object | ||
272 | * @return an attribute list | ||
273 | */ | ||
274 | typedef struct | ||
275 | GNUNET_RECLAIM_AttributeList *(* | ||
276 | GNUNET_RECLAIM_PresentationGetAttributesFunction) ( | ||
277 | void *cls, | ||
278 | const struct GNUNET_RECLAIM_Presentation *cred); | ||
279 | |||
280 | /** | ||
281 | * Function called to get the issuer of the credential (as string) | ||
282 | * | ||
283 | * @param cls closure | ||
284 | * @param cred the credential object | ||
285 | * @return corresponding issuer string | ||
286 | */ | ||
287 | typedef char *(*GNUNET_RECLAIM_PresentationGetIssuerFunction) ( | ||
288 | void *cls, | ||
289 | const struct GNUNET_RECLAIM_Presentation *cred); | ||
290 | |||
291 | /** | ||
292 | * Function called to get the expiration of the credential | ||
293 | * | ||
294 | * @param cls closure | ||
295 | * @param cred the credential object | ||
296 | * @param where to write the value | ||
297 | * @return GNUNET_OK if successful | ||
298 | */ | ||
299 | typedef int (*GNUNET_RECLAIM_PresentationGetExpirationFunction) ( | ||
300 | void *cls, | ||
301 | const struct GNUNET_RECLAIM_Presentation *cred, | ||
203 | struct GNUNET_TIME_Absolute *expiration); | 302 | struct GNUNET_TIME_Absolute *expiration); |
204 | 303 | ||
205 | 304 | ||
@@ -240,7 +339,7 @@ struct GNUNET_RECLAIM_AttributePluginFunctions | |||
240 | * Each plugin is required to return a pointer to a struct of this | 339 | * Each plugin is required to return a pointer to a struct of this |
241 | * type as the return value from its entry point. | 340 | * type as the return value from its entry point. |
242 | */ | 341 | */ |
243 | struct GNUNET_RECLAIM_AttestationPluginFunctions | 342 | struct GNUNET_RECLAIM_CredentialPluginFunctions |
244 | { | 343 | { |
245 | /** | 344 | /** |
246 | * Closure for all of the callbacks. | 345 | * Closure for all of the callbacks. |
@@ -250,37 +349,73 @@ struct GNUNET_RECLAIM_AttestationPluginFunctions | |||
250 | /** | 349 | /** |
251 | * Conversion to string. | 350 | * Conversion to string. |
252 | */ | 351 | */ |
253 | GNUNET_RECLAIM_AttestationValueToStringFunction value_to_string; | 352 | GNUNET_RECLAIM_CredentialValueToStringFunction value_to_string; |
353 | |||
354 | /** | ||
355 | * Conversion to binary. | ||
356 | */ | ||
357 | GNUNET_RECLAIM_CredentialStringToValueFunction string_to_value; | ||
358 | |||
359 | /** | ||
360 | * Typename to number. | ||
361 | */ | ||
362 | GNUNET_RECLAIM_CredentialTypenameToNumberFunction typename_to_number; | ||
363 | |||
364 | /** | ||
365 | * Number to typename. | ||
366 | */ | ||
367 | GNUNET_RECLAIM_CredentialNumberToTypenameFunction number_to_typename; | ||
368 | |||
369 | /** | ||
370 | * Attesation attributes. | ||
371 | */ | ||
372 | GNUNET_RECLAIM_CredentialGetAttributesFunction get_attributes; | ||
373 | |||
374 | /** | ||
375 | * Attesation issuer. | ||
376 | */ | ||
377 | GNUNET_RECLAIM_CredentialGetIssuerFunction get_issuer; | ||
378 | |||
379 | /** | ||
380 | * Expiration. | ||
381 | */ | ||
382 | GNUNET_RECLAIM_CredentialGetExpirationFunction get_expiration; | ||
383 | |||
384 | /** | ||
385 | * Conversion to string. | ||
386 | */ | ||
387 | GNUNET_RECLAIM_PresentationValueToStringFunction value_to_string_p; | ||
254 | 388 | ||
255 | /** | 389 | /** |
256 | * Conversion to binary. | 390 | * Conversion to binary. |
257 | */ | 391 | */ |
258 | GNUNET_RECLAIM_AttestationStringToValueFunction string_to_value; | 392 | GNUNET_RECLAIM_PresentationStringToValueFunction string_to_value_p; |
259 | 393 | ||
260 | /** | 394 | /** |
261 | * Typename to number. | 395 | * Typename to number. |
262 | */ | 396 | */ |
263 | GNUNET_RECLAIM_AttestationTypenameToNumberFunction typename_to_number; | 397 | GNUNET_RECLAIM_PresentationTypenameToNumberFunction typename_to_number_p; |
264 | 398 | ||
265 | /** | 399 | /** |
266 | * Number to typename. | 400 | * Number to typename. |
267 | */ | 401 | */ |
268 | GNUNET_RECLAIM_AttestationNumberToTypenameFunction number_to_typename; | 402 | GNUNET_RECLAIM_PresentationNumberToTypenameFunction number_to_typename_p; |
269 | 403 | ||
270 | /** | 404 | /** |
271 | * Attesation attributes. | 405 | * Attesation attributes. |
272 | */ | 406 | */ |
273 | GNUNET_RECLAIM_AttestationGetAttributesFunction get_attributes; | 407 | GNUNET_RECLAIM_PresentationGetAttributesFunction get_attributes_p; |
274 | 408 | ||
275 | /** | 409 | /** |
276 | * Attesation issuer. | 410 | * Attesation issuer. |
277 | */ | 411 | */ |
278 | GNUNET_RECLAIM_AttestationGetIssuerFunction get_issuer; | 412 | GNUNET_RECLAIM_PresentationGetIssuerFunction get_issuer_p; |
279 | 413 | ||
280 | /** | 414 | /** |
281 | * Expiration. | 415 | * Expiration. |
282 | */ | 416 | */ |
283 | GNUNET_RECLAIM_AttestationGetExpirationFunction get_expiration; | 417 | GNUNET_RECLAIM_PresentationGetExpirationFunction get_expiration_p; |
418 | |||
284 | }; | 419 | }; |
285 | 420 | ||
286 | 421 | ||
diff --git a/src/include/gnunet_reclaim_service.h b/src/include/gnunet_reclaim_service.h index 139c44ae7..8387c79b0 100644 --- a/src/include/gnunet_reclaim_service.h +++ b/src/include/gnunet_reclaim_service.h | |||
@@ -113,7 +113,6 @@ typedef void (*GNUNET_RECLAIM_ContinuationWithStatus) (void *cls, | |||
113 | * @param cls The callback closure | 113 | * @param cls The callback closure |
114 | * @param identity The identity authoritative over the attributes | 114 | * @param identity The identity authoritative over the attributes |
115 | * @param attr The attribute | 115 | * @param attr The attribute |
116 | * @param attestation The attestation for the attribute (may be NULL) | ||
117 | */ | 116 | */ |
118 | typedef void (*GNUNET_RECLAIM_AttributeResult) ( | 117 | typedef void (*GNUNET_RECLAIM_AttributeResult) ( |
119 | void *cls, const struct GNUNET_CRYPTO_EcdsaPublicKey *identity, | 118 | void *cls, const struct GNUNET_CRYPTO_EcdsaPublicKey *identity, |
@@ -125,25 +124,25 @@ typedef void (*GNUNET_RECLAIM_AttributeResult) ( | |||
125 | * @param cls The callback closure | 124 | * @param cls The callback closure |
126 | * @param identity The identity authoritative over the attributes | 125 | * @param identity The identity authoritative over the attributes |
127 | * @param attr The attribute | 126 | * @param attr The attribute |
128 | * @param attestation The attestation for the attribute (may be NULL) | 127 | * @param presentation The presentation for the credential (may be NULL) |
129 | */ | 128 | */ |
130 | typedef void (*GNUNET_RECLAIM_AttributeTicketResult) ( | 129 | typedef void (*GNUNET_RECLAIM_AttributeTicketResult) ( |
131 | void *cls, const struct GNUNET_CRYPTO_EcdsaPublicKey *identity, | 130 | void *cls, const struct GNUNET_CRYPTO_EcdsaPublicKey *identity, |
132 | const struct GNUNET_RECLAIM_Attribute *attr, | 131 | const struct GNUNET_RECLAIM_Attribute *attr, |
133 | const struct GNUNET_RECLAIM_Attestation *attestation); | 132 | const struct GNUNET_RECLAIM_Presentation *presentation); |
134 | 133 | ||
135 | 134 | ||
136 | /** | 135 | /** |
137 | * Callback used to notify the client of attestation results. | 136 | * Callback used to notify the client of credential results. |
138 | * | 137 | * |
139 | * @param cls The callback closure | 138 | * @param cls The callback closure |
140 | * @param identity The identity authoritative over the attributes | 139 | * @param identity The identity authoritative over the attributes |
141 | * @param attestation The attestation | 140 | * @param credential The credential |
142 | * @param attributes the parsed attributes | 141 | * @param attributes the parsed attributes |
143 | */ | 142 | */ |
144 | typedef void (*GNUNET_RECLAIM_AttestationResult) ( | 143 | typedef void (*GNUNET_RECLAIM_CredentialResult) ( |
145 | void *cls, const struct GNUNET_CRYPTO_EcdsaPublicKey *identity, | 144 | void *cls, const struct GNUNET_CRYPTO_EcdsaPublicKey *identity, |
146 | const struct GNUNET_RECLAIM_Attestation *attestation); | 145 | const struct GNUNET_RECLAIM_Credential *credential); |
147 | 146 | ||
148 | 147 | ||
149 | /** | 148 | /** |
@@ -178,22 +177,22 @@ GNUNET_RECLAIM_attribute_store ( | |||
178 | 177 | ||
179 | 178 | ||
180 | /** | 179 | /** |
181 | * Store an attestation. If the attestation is already present, | 180 | * Store a credential. If the credential is already present, |
182 | * it is replaced with the new attestation. | 181 | * it is replaced with the new credential. |
183 | * | 182 | * |
184 | * @param h handle to the re:claimID service | 183 | * @param h handle to the re:claimID service |
185 | * @param pkey private key of the identity | 184 | * @param pkey private key of the identity |
186 | * @param attr the attestation value | 185 | * @param attr the credential value |
187 | * @param exp_interval the relative expiration interval for the attestation | 186 | * @param exp_interval the relative expiration interval for the credential |
188 | * @param cont continuation to call when done | 187 | * @param cont continuation to call when done |
189 | * @param cont_cls closure for @a cont | 188 | * @param cont_cls closure for @a cont |
190 | * @return handle to abort the request | 189 | * @return handle to abort the request |
191 | */ | 190 | */ |
192 | struct GNUNET_RECLAIM_Operation * | 191 | struct GNUNET_RECLAIM_Operation * |
193 | GNUNET_RECLAIM_attestation_store ( | 192 | GNUNET_RECLAIM_credential_store ( |
194 | struct GNUNET_RECLAIM_Handle *h, | 193 | struct GNUNET_RECLAIM_Handle *h, |
195 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey, | 194 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey, |
196 | const struct GNUNET_RECLAIM_Attestation *attestation, | 195 | const struct GNUNET_RECLAIM_Credential *credential, |
197 | const struct GNUNET_TIME_Relative *exp_interval, | 196 | const struct GNUNET_TIME_Relative *exp_interval, |
198 | GNUNET_RECLAIM_ContinuationWithStatus cont, | 197 | GNUNET_RECLAIM_ContinuationWithStatus cont, |
199 | void *cont_cls); | 198 | void *cont_cls); |
@@ -218,21 +217,21 @@ GNUNET_RECLAIM_attribute_delete ( | |||
218 | GNUNET_RECLAIM_ContinuationWithStatus cont, void *cont_cls); | 217 | GNUNET_RECLAIM_ContinuationWithStatus cont, void *cont_cls); |
219 | 218 | ||
220 | /** | 219 | /** |
221 | * Delete an attestation. Tickets used to share this attestation are updated | 220 | * Delete a credential. Tickets used to share use a presentation of this |
222 | * accordingly. | 221 | * credential are updated accordingly. |
223 | * | 222 | * |
224 | * @param h handle to the re:claimID service | 223 | * @param h handle to the re:claimID service |
225 | * @param pkey Private key of the identity to add an attribute to | 224 | * @param pkey Private key of the identity to add an attribute to |
226 | * @param attr The attestation | 225 | * @param cred The credential |
227 | * @param cont Continuation to call when done | 226 | * @param cont Continuation to call when done |
228 | * @param cont_cls Closure for @a cont | 227 | * @param cont_cls Closure for @a cont |
229 | * @return handle Used to to abort the request | 228 | * @return handle Used to to abort the request |
230 | */ | 229 | */ |
231 | struct GNUNET_RECLAIM_Operation * | 230 | struct GNUNET_RECLAIM_Operation * |
232 | GNUNET_RECLAIM_attestation_delete ( | 231 | GNUNET_RECLAIM_credential_delete ( |
233 | struct GNUNET_RECLAIM_Handle *h, | 232 | struct GNUNET_RECLAIM_Handle *h, |
234 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey, | 233 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey, |
235 | const struct GNUNET_RECLAIM_Attestation *attr, | 234 | const struct GNUNET_RECLAIM_Credential *cred, |
236 | GNUNET_RECLAIM_ContinuationWithStatus cont, | 235 | GNUNET_RECLAIM_ContinuationWithStatus cont, |
237 | void *cont_cls); | 236 | void *cont_cls); |
238 | 237 | ||
@@ -293,12 +292,12 @@ GNUNET_RECLAIM_get_attributes_stop ( | |||
293 | 292 | ||
294 | 293 | ||
295 | /** | 294 | /** |
296 | * List all attestations for a local identity. | 295 | * List all credentials for a local identity. |
297 | * This MUST lock the `struct GNUNET_RECLAIM_Handle` | 296 | * This MUST lock the `struct GNUNET_RECLAIM_Handle` |
298 | * for any other calls than #GNUNET_RECLAIM_get_attestations_next() and | 297 | * for any other calls than #GNUNET_RECLAIM_get_credentials_next() and |
299 | * #GNUNET_RECLAIM_get_attestations_stop. @a proc will be called once | 298 | * #GNUNET_RECLAIM_get_credentials_stop. @a proc will be called once |
300 | * immediately, and then again after | 299 | * immediately, and then again after |
301 | * #GNUNET_RECLAIM_get_attestations_next() is invoked. | 300 | * #GNUNET_RECLAIM_get_credentials_next() is invoked. |
302 | * | 301 | * |
303 | * On error (disconnect), @a error_cb will be invoked. | 302 | * On error (disconnect), @a error_cb will be invoked. |
304 | * On normal completion, @a finish_cb proc will be | 303 | * On normal completion, @a finish_cb proc will be |
@@ -309,34 +308,34 @@ GNUNET_RECLAIM_get_attributes_stop ( | |||
309 | * @param error_cb Function to call on error (i.e. disconnect), | 308 | * @param error_cb Function to call on error (i.e. disconnect), |
310 | * the handle is afterwards invalid | 309 | * the handle is afterwards invalid |
311 | * @param error_cb_cls Closure for @a error_cb | 310 | * @param error_cb_cls Closure for @a error_cb |
312 | * @param proc Function to call on each attestation | 311 | * @param proc Function to call on each credential |
313 | * @param proc_cls Closure for @a proc | 312 | * @param proc_cls Closure for @a proc |
314 | * @param finish_cb Function to call on completion | 313 | * @param finish_cb Function to call on completion |
315 | * the handle is afterwards invalid | 314 | * the handle is afterwards invalid |
316 | * @param finish_cb_cls Closure for @a finish_cb | 315 | * @param finish_cb_cls Closure for @a finish_cb |
317 | * @return an iterator Handle to use for iteration | 316 | * @return an iterator Handle to use for iteration |
318 | */ | 317 | */ |
319 | struct GNUNET_RECLAIM_AttestationIterator * | 318 | struct GNUNET_RECLAIM_CredentialIterator * |
320 | GNUNET_RECLAIM_get_attestations_start ( | 319 | GNUNET_RECLAIM_get_credentials_start ( |
321 | struct GNUNET_RECLAIM_Handle *h, | 320 | struct GNUNET_RECLAIM_Handle *h, |
322 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity, | 321 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity, |
323 | GNUNET_SCHEDULER_TaskCallback error_cb, | 322 | GNUNET_SCHEDULER_TaskCallback error_cb, |
324 | void *error_cb_cls, | 323 | void *error_cb_cls, |
325 | GNUNET_RECLAIM_AttestationResult proc, | 324 | GNUNET_RECLAIM_CredentialResult proc, |
326 | void *proc_cls, | 325 | void *proc_cls, |
327 | GNUNET_SCHEDULER_TaskCallback finish_cb, | 326 | GNUNET_SCHEDULER_TaskCallback finish_cb, |
328 | void *finish_cb_cls); | 327 | void *finish_cb_cls); |
329 | 328 | ||
330 | 329 | ||
331 | /** | 330 | /** |
332 | * Calls the record processor specified in #GNUNET_RECLAIM_get_attestation_start | 331 | * Calls the record processor specified in #GNUNET_RECLAIM_get_credentials_start |
333 | * for the next record. | 332 | * for the next record. |
334 | * | 333 | * |
335 | * @param it the iterator | 334 | * @param it the iterator |
336 | */ | 335 | */ |
337 | void | 336 | void |
338 | GNUNET_RECLAIM_get_attestations_next (struct | 337 | GNUNET_RECLAIM_get_credentials_next ( |
339 | GNUNET_RECLAIM_AttestationIterator *ait); | 338 | struct GNUNET_RECLAIM_CredentialIterator *ait); |
340 | 339 | ||
341 | 340 | ||
342 | /** | 341 | /** |
@@ -347,8 +346,8 @@ GNUNET_RECLAIM_get_attestations_next (struct | |||
347 | * @param it the iterator | 346 | * @param it the iterator |
348 | */ | 347 | */ |
349 | void | 348 | void |
350 | GNUNET_RECLAIM_get_attestations_stop (struct | 349 | GNUNET_RECLAIM_get_credentials_stop ( |
351 | GNUNET_RECLAIM_AttestationIterator *ait); | 350 | struct GNUNET_RECLAIM_CredentialIterator *ait); |
352 | 351 | ||
353 | 352 | ||
354 | /** | 353 | /** |