aboutsummaryrefslogtreecommitdiff
path: root/src/reclaim/plugin_rest_reclaim.c
diff options
context:
space:
mode:
authorSchanzenbach, Martin <mschanzenbach@posteo.de>2020-02-04 18:42:04 +0100
committerSchanzenbach, Martin <mschanzenbach@posteo.de>2020-02-09 20:38:10 +0100
commit55f6d26b7424d660c99bc89f3677b20294e87a27 (patch)
treea8080fdcf0d9688c154417e50c58055e364f8b6b /src/reclaim/plugin_rest_reclaim.c
parent5b6bb2ce4d60635b2af950d72b45f12686fd5218 (diff)
downloadgnunet-55f6d26b7424d660c99bc89f3677b20294e87a27.tar.gz
gnunet-55f6d26b7424d660c99bc89f3677b20294e87a27.zip
Refactoring reclaim attestations
Diffstat (limited to 'src/reclaim/plugin_rest_reclaim.c')
-rw-r--r--src/reclaim/plugin_rest_reclaim.c524
1 files changed, 91 insertions, 433 deletions
diff --git a/src/reclaim/plugin_rest_reclaim.c b/src/reclaim/plugin_rest_reclaim.c
index 9a6af6bcf..fcb34e11a 100644
--- a/src/reclaim/plugin_rest_reclaim.c
+++ b/src/reclaim/plugin_rest_reclaim.c
@@ -48,9 +48,9 @@
48#define GNUNET_REST_API_NS_RECLAIM_ATTRIBUTES "/reclaim/attributes" 48#define GNUNET_REST_API_NS_RECLAIM_ATTRIBUTES "/reclaim/attributes"
49 49
50/** 50/**
51 * Attestation namespace 51 * Attestation namespace
52 */ 52 */
53#define GNUNET_REST_API_NS_RECLAIM_ATTESTATION_REFERENCE "/reclaim/attestation" 53#define GNUNET_REST_API_NS_RECLAIM_ATTESTATION "/reclaim/attestation"
54 54
55/** 55/**
56 * Ticket namespace 56 * Ticket namespace
@@ -167,7 +167,7 @@ struct RequestHandle
167 /** 167 /**
168 * Attribute claim list 168 * Attribute claim list
169 */ 169 */
170 struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attr_list; 170 struct GNUNET_RECLAIM_AttributeList *attr_list;
171 171
172 /** 172 /**
173 * IDENTITY Operation 173 * IDENTITY Operation
@@ -190,6 +190,12 @@ struct RequestHandle
190 struct GNUNET_RECLAIM_AttributeIterator *attr_it; 190 struct GNUNET_RECLAIM_AttributeIterator *attr_it;
191 191
192 /** 192 /**
193 * Attribute iterator
194 */
195 struct GNUNET_RECLAIM_AttestationIterator *attest_it;
196
197
198 /**
193 * Ticket iterator 199 * Ticket iterator
194 */ 200 */
195 struct GNUNET_RECLAIM_TicketIterator *ticket_it; 201 struct GNUNET_RECLAIM_TicketIterator *ticket_it;
@@ -247,8 +253,6 @@ struct RequestHandle
247static void 253static void
248cleanup_handle (struct RequestHandle *handle) 254cleanup_handle (struct RequestHandle *handle)
249{ 255{
250 struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry *claim_entry;
251 struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry *claim_tmp;
252 struct EgoEntry *ego_entry; 256 struct EgoEntry *ego_entry;
253 struct EgoEntry *ego_tmp; 257 struct EgoEntry *ego_tmp;
254 258
@@ -261,6 +265,8 @@ cleanup_handle (struct RequestHandle *handle)
261 GNUNET_IDENTITY_disconnect (handle->identity_handle); 265 GNUNET_IDENTITY_disconnect (handle->identity_handle);
262 if (NULL != handle->attr_it) 266 if (NULL != handle->attr_it)
263 GNUNET_RECLAIM_get_attributes_stop (handle->attr_it); 267 GNUNET_RECLAIM_get_attributes_stop (handle->attr_it);
268 if (NULL != handle->attest_it)
269 GNUNET_RECLAIM_get_attestations_stop (handle->attest_it);
264 if (NULL != handle->ticket_it) 270 if (NULL != handle->ticket_it)
265 GNUNET_RECLAIM_ticket_iteration_stop (handle->ticket_it); 271 GNUNET_RECLAIM_ticket_iteration_stop (handle->ticket_it);
266 if (NULL != handle->idp) 272 if (NULL != handle->idp)
@@ -269,19 +275,7 @@ cleanup_handle (struct RequestHandle *handle)
269 GNUNET_free (handle->url); 275 GNUNET_free (handle->url);
270 if (NULL != handle->emsg) 276 if (NULL != handle->emsg)
271 GNUNET_free (handle->emsg); 277 GNUNET_free (handle->emsg);
272 if (NULL != handle->attr_list) 278 GNUNET_RECLAIM_attribute_list_destroy (handle->attr_list);
273 {
274 for (claim_entry = handle->attr_list->list_head; NULL != claim_entry;)
275 {
276 claim_tmp = claim_entry;
277 claim_entry = claim_entry->next;
278 GNUNET_free (claim_tmp->claim);
279 GNUNET_free (claim_tmp->attest);
280 GNUNET_free (claim_tmp->reference);
281 GNUNET_free (claim_tmp);
282 }
283 GNUNET_free (handle->attr_list);
284 }
285 for (ego_entry = handle->ego_head; NULL != ego_entry;) 279 for (ego_entry = handle->ego_head; NULL != ego_entry;)
286 { 280 {
287 ego_tmp = ego_entry; 281 ego_tmp = ego_entry;
@@ -366,6 +360,7 @@ finished_cont (void *cls, int32_t success, const char *emsg)
366 GNUNET_SCHEDULER_add_now (&cleanup_handle_delayed, handle); 360 GNUNET_SCHEDULER_add_now (&cleanup_handle_delayed, handle);
367} 361}
368 362
363
369static void 364static void
370delete_finished_cb (void *cls, int32_t success, const char *emsg) 365delete_finished_cb (void *cls, int32_t success, const char *emsg)
371{ 366{
@@ -382,6 +377,7 @@ delete_finished_cb (void *cls, int32_t success, const char *emsg)
382 GNUNET_SCHEDULER_add_now (&cleanup_handle_delayed, handle); 377 GNUNET_SCHEDULER_add_now (&cleanup_handle_delayed, handle);
383} 378}
384 379
380
385/** 381/**
386 * Return attributes for identity 382 * Return attributes for identity
387 * 383 *
@@ -456,85 +452,6 @@ ticket_collect (void *cls, const struct GNUNET_RECLAIM_Ticket *ticket)
456 452
457 453
458static void 454static void
459add_attestation_ref_cont (struct GNUNET_REST_RequestHandle *con_handle,
460 const char *url,
461 void *cls)
462{
463 struct RequestHandle *handle = cls;
464 const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity_priv;
465 const char *identity;
466 struct EgoEntry *ego_entry;
467 struct GNUNET_RECLAIM_ATTESTATION_REFERENCE *attribute;
468 struct GNUNET_TIME_Relative exp;
469 char term_data[handle->rest_handle->data_size + 1];
470 json_t *data_json;
471 json_error_t err;
472 struct GNUNET_JSON_Specification attrspec[] =
473 { GNUNET_RECLAIM_JSON_spec_claim_attest_ref (&attribute),
474 GNUNET_JSON_spec_end () };
475 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
476 "Adding an attestation reference for %s.\n",
477 handle->url);
478 if (strlen (GNUNET_REST_API_NS_RECLAIM_ATTESTATION_REFERENCE) + strlen (
479 "reference/") + 1 >= strlen (
480 handle->url))
481 {
482 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "No identity given.\n");
483 GNUNET_SCHEDULER_add_now (&do_error, handle);
484 return;
485 }
486 identity = handle->url + strlen (
487 GNUNET_REST_API_NS_RECLAIM_ATTESTATION_REFERENCE) + strlen ("reference/")
488 + 1;
489 for (ego_entry = handle->ego_head; NULL != ego_entry;
490 ego_entry = ego_entry->next)
491 if (0 == strcmp (identity, ego_entry->identifier))
492 break;
493 if (NULL == ego_entry)
494 {
495 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Identity unknown (%s)\n", identity);
496 return;
497 }
498 identity_priv = GNUNET_IDENTITY_ego_get_private_key (ego_entry->ego);
499 if (0 >= handle->rest_handle->data_size)
500 {
501 GNUNET_SCHEDULER_add_now (&do_error, handle);
502 return;
503 }
504
505 term_data[handle->rest_handle->data_size] = '\0';
506 GNUNET_memcpy (term_data,
507 handle->rest_handle->data,
508 handle->rest_handle->data_size);
509 data_json = json_loads (term_data, JSON_DECODE_ANY, &err);
510 GNUNET_assert (GNUNET_OK ==
511 GNUNET_JSON_parse (data_json, attrspec, NULL, NULL));
512 json_decref (data_json);
513 if (NULL == attribute)
514 {
515 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
516 "Unable to parse attestation reference from %s\n",
517 term_data);
518 GNUNET_SCHEDULER_add_now (&do_error, handle);
519 return;
520 }
521 /**
522 * New ID for attribute
523 */
524 if (GNUNET_YES == GNUNET_RECLAIM_id_is_zero (&attribute->id))
525 attribute->id = attribute->id_attest;
526 handle->idp = GNUNET_RECLAIM_connect (cfg);
527 exp = GNUNET_TIME_UNIT_HOURS;
528 handle->idp_op = GNUNET_RECLAIM_attestation_reference_store (handle->idp,
529 identity_priv,
530 attribute,
531 &exp,
532 &finished_cont,
533 handle);
534 GNUNET_JSON_parse_free (attrspec);
535}
536
537static void
538parse_attestation_cont (struct GNUNET_REST_RequestHandle *con_handle, 455parse_attestation_cont (struct GNUNET_REST_RequestHandle *con_handle,
539 const char *url, 456 const char *url,
540 void *cls) 457 void *cls)
@@ -576,16 +493,16 @@ parse_attestation_cont (struct GNUNET_REST_RequestHandle *con_handle,
576 } 493 }
577 if (0 == strcmp (type_str, "JWT")) 494 if (0 == strcmp (type_str, "JWT"))
578 { 495 {
579 // The value is a JWT 496 // The value is a JWT
580 char *decoded_jwt; 497 char *decoded_jwt;
581 char delim[] = "."; 498 char delim[] = ".";
582 char *jwt_body = strtok (val_str, delim); 499 char *jwt_body = strtok (val_str, delim);
583 jwt_body = strtok (NULL, delim); 500 jwt_body = strtok (NULL, delim);
584 GNUNET_STRINGS_base64_decode (jwt_body, strlen (jwt_body), 501 GNUNET_STRINGS_base64_decode (jwt_body, strlen (jwt_body),
585 (void **) &decoded_jwt); 502 (void **) &decoded_jwt);
586 resp = GNUNET_REST_create_response (decoded_jwt); 503 resp = GNUNET_REST_create_response (decoded_jwt);
587 handle->proc (handle->proc_cls, resp, MHD_HTTP_OK); 504 handle->proc (handle->proc_cls, resp, MHD_HTTP_OK);
588 GNUNET_free (decoded_jwt); 505 GNUNET_free (decoded_jwt);
589 } 506 }
590 else 507 else
591 { 508 {
@@ -598,42 +515,31 @@ parse_attestation_cont (struct GNUNET_REST_RequestHandle *con_handle,
598 json_decref (data_json); 515 json_decref (data_json);
599} 516}
600 517
518
601static void 519static void
602add_attestation_cont (struct GNUNET_REST_RequestHandle *con_handle, 520add_attestation_cont (struct GNUNET_REST_RequestHandle *con_handle,
603 const char *url, 521 const char *url,
604 void *cls) 522 void *cls)
605{ 523{
606 struct RequestHandle *handle = cls; 524 struct RequestHandle *handle = cls;
607 /* Check for substring "reference" */ 525 /* Check for substring "parse"
608 if (strlen (GNUNET_REST_API_NS_RECLAIM_ATTESTATION_REFERENCE) < strlen ( 526 * FIXME UGLY! */
527 if (strlen (GNUNET_REST_API_NS_RECLAIM_ATTESTATION) < strlen (
609 handle->url)) 528 handle->url))
610 { 529 {
611 if ( strncmp ("reference/", (handle->url + strlen ( 530 if (strncmp ("parse", (handle->url + strlen (
612 GNUNET_REST_API_NS_RECLAIM_ATTESTATION_REFERENCE) 531 GNUNET_REST_API_NS_RECLAIM_ATTESTATION)
613 + 1), strlen ( 532 + 1), strlen (
614 "reference/")) == 0) 533 "parse")) == 0)
615 { 534 {
616 add_attestation_ref_cont (con_handle,url,cls); 535 parse_attestation_cont (con_handle,url,cls);
617 return; 536 return;
618 } 537 }
619 } 538 }
620 /* Check for substring "parse" */
621 if (strlen (GNUNET_REST_API_NS_RECLAIM_ATTESTATION_REFERENCE) < strlen (
622 handle->url))
623 {
624 if ( strncmp ("parse", (handle->url + strlen (
625 GNUNET_REST_API_NS_RECLAIM_ATTESTATION_REFERENCE)
626 + 1), strlen (
627 "parse")) == 0)
628 {
629 parse_attestation_cont (con_handle,url,cls);
630 return;
631 }
632 }
633 const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity_priv; 539 const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity_priv;
634 const char *identity; 540 const char *identity;
635 struct EgoEntry *ego_entry; 541 struct EgoEntry *ego_entry;
636 struct GNUNET_RECLAIM_ATTESTATION_Claim *attribute; 542 struct GNUNET_RECLAIM_Attestation *attribute;
637 struct GNUNET_TIME_Relative exp; 543 struct GNUNET_TIME_Relative exp;
638 char term_data[handle->rest_handle->data_size + 1]; 544 char term_data[handle->rest_handle->data_size + 1];
639 json_t *data_json; 545 json_t *data_json;
@@ -645,7 +551,7 @@ add_attestation_cont (struct GNUNET_REST_RequestHandle *con_handle,
645 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 551 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
646 "Adding an attestation for %s.\n", 552 "Adding an attestation for %s.\n",
647 handle->url); 553 handle->url);
648 if (strlen (GNUNET_REST_API_NS_RECLAIM_ATTESTATION_REFERENCE) >= strlen ( 554 if (strlen (GNUNET_REST_API_NS_RECLAIM_ATTESTATION) >= strlen (
649 handle->url)) 555 handle->url))
650 { 556 {
651 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "No identity given.\n"); 557 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "No identity given.\n");
@@ -653,7 +559,7 @@ add_attestation_cont (struct GNUNET_REST_RequestHandle *con_handle,
653 return; 559 return;
654 } 560 }
655 identity = handle->url + strlen ( 561 identity = handle->url + strlen (
656 GNUNET_REST_API_NS_RECLAIM_ATTESTATION_REFERENCE) + 1; 562 GNUNET_REST_API_NS_RECLAIM_ATTESTATION) + 1;
657 563
658 for (ego_entry = handle->ego_head; NULL != ego_entry; 564 for (ego_entry = handle->ego_head; NULL != ego_entry;
659 ego_entry = ego_entry->next) 565 ego_entry = ego_entry->next)
@@ -705,104 +611,6 @@ add_attestation_cont (struct GNUNET_REST_RequestHandle *con_handle,
705 GNUNET_JSON_parse_free (attrspec); 611 GNUNET_JSON_parse_free (attrspec);
706} 612}
707 613
708/**
709 * Collect all references for an ego
710 *
711 */
712static void
713ref_collect (void *cls,
714 const struct GNUNET_CRYPTO_EcdsaPublicKey *identity,
715 const struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr,
716 const struct GNUNET_RECLAIM_ATTESTATION_Claim *attest,
717 const struct GNUNET_RECLAIM_ATTESTATION_REFERENCE *reference)
718{
719 struct RequestHandle *handle = cls;
720 json_t *attr_obj;
721 char *id_str;
722 char *id_attest_str;
723
724 if (NULL == reference)
725 {
726 GNUNET_RECLAIM_get_attributes_next (handle->attr_it);
727 return;
728 }
729
730 if ((NULL == reference->name) || (NULL == reference->reference_value))
731 {
732 return;
733 }
734
735 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Adding reference: %s\n",
736 reference->name);
737 attr_obj = json_object ();
738 json_object_set_new (attr_obj, "name", json_string (reference->name));
739 json_object_set_new (attr_obj, "ref_value", json_string (
740 reference->reference_value));
741 id_str = GNUNET_STRINGS_data_to_string_alloc (&reference->id,
742 sizeof(reference->id));
743 id_attest_str = GNUNET_STRINGS_data_to_string_alloc (&reference->id_attest,
744 sizeof(reference->id_attest));
745 json_object_set_new (attr_obj, "id", json_string (id_str));
746 json_object_set_new (attr_obj, "ref_id", json_string (id_attest_str));
747 json_array_append (handle->resp_object, attr_obj);
748 json_decref (attr_obj);
749}
750
751/**
752 * Lists references for identity request
753 *
754 * @param con_handle the connection handle
755 * @param url the url
756 * @param cls the RequestHandle
757 */
758static void
759list_reference_cont (struct GNUNET_REST_RequestHandle *con_handle,
760 const char *url,
761 void *cls)
762{
763 const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv_key;
764 struct RequestHandle *handle = cls;
765 struct EgoEntry *ego_entry;
766 char *identity;
767
768 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
769 "Getting references for %s.\n",
770 handle->url);
771 if (strlen (GNUNET_REST_API_NS_RECLAIM_ATTESTATION_REFERENCE) + strlen (
772 "reference/") + 1 >= strlen (
773 handle->url))
774 {
775 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "No identity given.\n");
776 GNUNET_SCHEDULER_add_now (&do_error, handle);
777 return;
778 }
779 identity = handle->url + strlen (
780 GNUNET_REST_API_NS_RECLAIM_ATTESTATION_REFERENCE) + strlen ("reference/")
781 + 1;
782 for (ego_entry = handle->ego_head; NULL != ego_entry;
783 ego_entry = ego_entry->next)
784 if (0 == strcmp (identity, ego_entry->identifier))
785 break;
786 handle->resp_object = json_array ();
787
788 if (NULL == ego_entry)
789 {
790 // Done
791 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Ego %s not found.\n", identity);
792 GNUNET_SCHEDULER_add_now (&return_response, handle);
793 return;
794 }
795 priv_key = GNUNET_IDENTITY_ego_get_private_key (ego_entry->ego);
796 handle->idp = GNUNET_RECLAIM_connect (cfg);
797 handle->attr_it = GNUNET_RECLAIM_get_attributes_start (handle->idp,
798 priv_key,
799 &collect_error_cb,
800 handle,
801 &ref_collect,
802 handle,
803 &collect_finished_cb,
804 handle);
805}
806 614
807/** 615/**
808 * Collect all attestations for an ego 616 * Collect all attestations for an ego
@@ -811,9 +619,7 @@ list_reference_cont (struct GNUNET_REST_RequestHandle *con_handle,
811static void 619static void
812attest_collect (void *cls, 620attest_collect (void *cls,
813 const struct GNUNET_CRYPTO_EcdsaPublicKey *identity, 621 const struct GNUNET_CRYPTO_EcdsaPublicKey *identity,
814 const struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr, 622 const struct GNUNET_RECLAIM_Attestation *attest)
815 const struct GNUNET_RECLAIM_ATTESTATION_Claim *attest,
816 const struct GNUNET_RECLAIM_ATTESTATION_REFERENCE *reference)
817{ 623{
818 struct RequestHandle *handle = cls; 624 struct RequestHandle *handle = cls;
819 json_t *attr_obj; 625 json_t *attr_obj;
@@ -822,12 +628,6 @@ attest_collect (void *cls,
822 char *id_str; 628 char *id_str;
823 629
824 630
825 if (NULL != reference)
826 {
827 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
828 "Attestation Collection with Reference\n");
829 return;
830 }
831 if (NULL == attest) 631 if (NULL == attest)
832 { 632 {
833 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 633 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -847,15 +647,16 @@ attest_collect (void *cls,
847 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Adding attestation: %s\n", 647 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Adding attestation: %s\n",
848 attest->name); 648 attest->name);
849 649
850 tmp_value = GNUNET_RECLAIM_ATTESTATION_value_to_string (attest->type, 650 tmp_value = GNUNET_RECLAIM_attestation_value_to_string (attest->type,
851 attest->data, 651 attest->data,
852 attest->data_size); 652 attest->data_size);
853 attr_obj = json_object (); 653 attr_obj = json_object ();
854 json_object_set_new (attr_obj, "value", json_string (tmp_value)); 654 json_object_set_new (attr_obj, "value", json_string (tmp_value));
855 json_object_set_new (attr_obj, "name", json_string (attest->name)); 655 json_object_set_new (attr_obj, "name", json_string (attest->name));
856 type = GNUNET_RECLAIM_ATTESTATION_number_to_typename (attest->type); 656 type = GNUNET_RECLAIM_attestation_number_to_typename (attest->type);
857 json_object_set_new (attr_obj, "type", json_string (type)); 657 json_object_set_new (attr_obj, "type", json_string (type));
858 id_str = GNUNET_STRINGS_data_to_string_alloc (&attest->id, sizeof(attest->id)); 658 id_str = GNUNET_STRINGS_data_to_string_alloc (&attest->id,
659 sizeof(attest->id));
859 json_object_set_new (attr_obj, "id", json_string (id_str)); 660 json_object_set_new (attr_obj, "id", json_string (id_str));
860 json_array_append (handle->resp_object, attr_obj); 661 json_array_append (handle->resp_object, attr_obj);
861 json_decref (attr_obj); 662 json_decref (attr_obj);
@@ -877,19 +678,6 @@ list_attestation_cont (struct GNUNET_REST_RequestHandle *con_handle,
877 void *cls) 678 void *cls)
878{ 679{
879 struct RequestHandle *handle = cls; 680 struct RequestHandle *handle = cls;
880 /* Check for substring "reference" */
881 if (strlen (GNUNET_REST_API_NS_RECLAIM_ATTESTATION_REFERENCE) < strlen (
882 handle->url))
883 {
884 if ( strncmp ("reference/", (handle->url + strlen (
885 GNUNET_REST_API_NS_RECLAIM_ATTESTATION_REFERENCE)
886 + 1), strlen (
887 "reference/")) == 0)
888 {
889 list_reference_cont (con_handle,url,cls);
890 return;
891 }
892 }
893 const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv_key; 681 const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv_key;
894 struct EgoEntry *ego_entry; 682 struct EgoEntry *ego_entry;
895 char *identity; 683 char *identity;
@@ -897,7 +685,7 @@ list_attestation_cont (struct GNUNET_REST_RequestHandle *con_handle,
897 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 685 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
898 "Getting attestations for %s.\n", 686 "Getting attestations for %s.\n",
899 handle->url); 687 handle->url);
900 if (strlen (GNUNET_REST_API_NS_RECLAIM_ATTESTATION_REFERENCE) >= strlen ( 688 if (strlen (GNUNET_REST_API_NS_RECLAIM_ATTESTATION) >= strlen (
901 handle->url)) 689 handle->url))
902 { 690 {
903 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "No identity given.\n"); 691 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "No identity given.\n");
@@ -905,7 +693,7 @@ list_attestation_cont (struct GNUNET_REST_RequestHandle *con_handle,
905 return; 693 return;
906 } 694 }
907 identity = handle->url + strlen ( 695 identity = handle->url + strlen (
908 GNUNET_REST_API_NS_RECLAIM_ATTESTATION_REFERENCE) + 1; 696 GNUNET_REST_API_NS_RECLAIM_ATTESTATION) + 1;
909 697
910 for (ego_entry = handle->ego_head; NULL != ego_entry; 698 for (ego_entry = handle->ego_head; NULL != ego_entry;
911 ego_entry = ego_entry->next) 699 ego_entry = ego_entry->next)
@@ -923,109 +711,14 @@ list_attestation_cont (struct GNUNET_REST_RequestHandle *con_handle,
923 } 711 }
924 priv_key = GNUNET_IDENTITY_ego_get_private_key (ego_entry->ego); 712 priv_key = GNUNET_IDENTITY_ego_get_private_key (ego_entry->ego);
925 handle->idp = GNUNET_RECLAIM_connect (cfg); 713 handle->idp = GNUNET_RECLAIM_connect (cfg);
926 handle->attr_it = GNUNET_RECLAIM_get_attributes_start (handle->idp, 714 handle->attest_it = GNUNET_RECLAIM_get_attestations_start (handle->idp,
927 priv_key, 715 priv_key,
928 &collect_error_cb, 716 &collect_error_cb,
929 handle, 717 handle,
930 &attest_collect, 718 &attest_collect,
931 handle, 719 handle,
932 &collect_finished_cb, 720 &collect_finished_cb,
933 handle); 721 handle);
934}
935
936/**
937 * Deletes reference from an identity
938 *
939 * @param con_handle the connection handle
940 * @param url the url
941 * @param cls the RequestHandle
942 */
943static void
944delete_attestation_ref_cont (struct GNUNET_REST_RequestHandle *con_handle,
945 const char *url,
946 void *cls)
947{
948 struct RequestHandle *handle = cls;
949 const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv_key;
950 struct GNUNET_RECLAIM_ATTESTATION_REFERENCE *attr;
951 struct EgoEntry *ego_entry;
952 char *identity;
953 char *identity_id_str;
954 char *id;
955 char term_data[handle->rest_handle->data_size + 1];
956 json_t *data_json;
957 json_error_t err;
958
959 struct GNUNET_JSON_Specification attrspec[] =
960 { GNUNET_RECLAIM_JSON_spec_claim_attest_ref (&attr),
961 GNUNET_JSON_spec_end () };
962 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
963 "Deleting attestation reference.\n");
964 if (strlen (GNUNET_REST_API_NS_RECLAIM_ATTESTATION_REFERENCE) + strlen (
965 "reference/") + 1 >= strlen (
966 handle->url))
967 {
968 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "No identity given.\n");
969 GNUNET_SCHEDULER_add_now (&do_error, handle);
970 return;
971 }
972 identity_id_str = strdup (handle->url + strlen (
973 GNUNET_REST_API_NS_RECLAIM_ATTESTATION_REFERENCE)
974 + strlen ("reference/")
975 + 1);
976 identity = strtok (identity_id_str, "/");
977 id = strtok (NULL, "/");
978
979 if ((NULL == identity) || (NULL == id))
980 {
981 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Malformed request.\n");
982 GNUNET_SCHEDULER_add_now (&do_error, handle);
983 return;
984 }
985 for (ego_entry = handle->ego_head; NULL != ego_entry;
986 ego_entry = ego_entry->next)
987 if (0 == strcmp (identity, ego_entry->identifier))
988 break;
989 handle->resp_object = json_array ();
990 if (NULL == ego_entry)
991 {
992 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Ego %s not found.\n", identity);
993 GNUNET_SCHEDULER_add_now (&return_response, handle);
994 return;
995 }
996 priv_key = GNUNET_IDENTITY_ego_get_private_key (ego_entry->ego);
997 if (0 >= handle->rest_handle->data_size)
998 {
999 GNUNET_SCHEDULER_add_now (&do_error, handle);
1000 return;
1001 }
1002
1003 term_data[handle->rest_handle->data_size] = '\0';
1004 GNUNET_memcpy (term_data,
1005 handle->rest_handle->data,
1006 handle->rest_handle->data_size);
1007 data_json = json_loads (term_data, JSON_DECODE_ANY, &err);
1008 GNUNET_assert (GNUNET_OK ==
1009 GNUNET_JSON_parse (data_json, attrspec, NULL, NULL));
1010 json_decref (data_json);
1011 if (NULL == attr)
1012 {
1013 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
1014 "Unable to parse attestation reference from %s\n",
1015 term_data);
1016 GNUNET_SCHEDULER_add_now (&do_error, handle);
1017 return;
1018 }
1019 GNUNET_STRINGS_string_to_data (id, strlen (id), &attr->id, sizeof(attr->id));
1020
1021 handle->idp = GNUNET_RECLAIM_connect (cfg);
1022 handle->idp_op = GNUNET_RECLAIM_attestation_reference_delete (handle->idp,
1023 priv_key,
1024 attr,
1025 &
1026 delete_finished_cb,
1027 handle);
1028 GNUNET_JSON_parse_free (attrspec);
1029} 722}
1030 723
1031 724
@@ -1042,28 +735,15 @@ delete_attestation_cont (struct GNUNET_REST_RequestHandle *con_handle,
1042 void *cls) 735 void *cls)
1043{ 736{
1044 struct RequestHandle *handle = cls; 737 struct RequestHandle *handle = cls;
1045 /* Check for substring "reference" */
1046 if (strlen (GNUNET_REST_API_NS_RECLAIM_ATTESTATION_REFERENCE) < strlen (
1047 handle->url))
1048 {
1049 if ( strncmp ("reference", (handle->url + strlen (
1050 GNUNET_REST_API_NS_RECLAIM_ATTESTATION_REFERENCE)
1051 + 1), strlen (
1052 "reference")) == 0)
1053 {
1054 delete_attestation_ref_cont (con_handle,url,cls);
1055 return;
1056 }
1057 }
1058 const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv_key; 738 const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv_key;
1059 struct GNUNET_RECLAIM_ATTESTATION_Claim attr; 739 struct GNUNET_RECLAIM_Attestation attr;
1060 struct EgoEntry *ego_entry; 740 struct EgoEntry *ego_entry;
1061 char *identity_id_str; 741 char *identity_id_str;
1062 char *identity; 742 char *identity;
1063 char *id; 743 char *id;
1064 744
1065 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Deleting attestation.\n"); 745 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Deleting attestation.\n");
1066 if (strlen (GNUNET_REST_API_NS_RECLAIM_ATTESTATION_REFERENCE) >= strlen ( 746 if (strlen (GNUNET_REST_API_NS_RECLAIM_ATTESTATION) >= strlen (
1067 handle->url)) 747 handle->url))
1068 { 748 {
1069 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "No identity given.\n"); 749 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "No identity given.\n");
@@ -1072,7 +752,7 @@ delete_attestation_cont (struct GNUNET_REST_RequestHandle *con_handle,
1072 } 752 }
1073 identity_id_str = 753 identity_id_str =
1074 strdup (handle->url + strlen ( 754 strdup (handle->url + strlen (
1075 GNUNET_REST_API_NS_RECLAIM_ATTESTATION_REFERENCE) + 1); 755 GNUNET_REST_API_NS_RECLAIM_ATTESTATION) + 1);
1076 identity = strtok (identity_id_str, "/"); 756 identity = strtok (identity_id_str, "/");
1077 id = strtok (NULL, "/"); 757 id = strtok (NULL, "/");
1078 if ((NULL == identity) || (NULL == id)) 758 if ((NULL == identity) || (NULL == id))
@@ -1098,7 +778,7 @@ delete_attestation_cont (struct GNUNET_REST_RequestHandle *con_handle,
1098 } 778 }
1099 priv_key = GNUNET_IDENTITY_ego_get_private_key (ego_entry->ego); 779 priv_key = GNUNET_IDENTITY_ego_get_private_key (ego_entry->ego);
1100 handle->idp = GNUNET_RECLAIM_connect (cfg); 780 handle->idp = GNUNET_RECLAIM_connect (cfg);
1101 memset (&attr, 0, sizeof(struct GNUNET_RECLAIM_ATTESTATION_Claim)); 781 memset (&attr, 0, sizeof(struct GNUNET_RECLAIM_Attestation));
1102 GNUNET_STRINGS_string_to_data (id, strlen (id), &attr.id, sizeof(attr.id)); 782 GNUNET_STRINGS_string_to_data (id, strlen (id), &attr.id, sizeof(attr.id));
1103 attr.name = ""; 783 attr.name = "";
1104 handle->idp_op = GNUNET_RECLAIM_attestation_delete (handle->idp, 784 handle->idp_op = GNUNET_RECLAIM_attestation_delete (handle->idp,
@@ -1109,6 +789,7 @@ delete_attestation_cont (struct GNUNET_REST_RequestHandle *con_handle,
1109 GNUNET_free (identity_id_str); 789 GNUNET_free (identity_id_str);
1110} 790}
1111 791
792
1112/** 793/**
1113 * List tickets for identity request 794 * List tickets for identity request
1114 * 795 *
@@ -1173,7 +854,7 @@ add_attribute_cont (struct GNUNET_REST_RequestHandle *con_handle,
1173 const char *identity; 854 const char *identity;
1174 struct RequestHandle *handle = cls; 855 struct RequestHandle *handle = cls;
1175 struct EgoEntry *ego_entry; 856 struct EgoEntry *ego_entry;
1176 struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attribute; 857 struct GNUNET_RECLAIM_Attribute *attribute;
1177 struct GNUNET_TIME_Relative exp; 858 struct GNUNET_TIME_Relative exp;
1178 char term_data[handle->rest_handle->data_size + 1]; 859 char term_data[handle->rest_handle->data_size + 1];
1179 json_t *data_json; 860 json_t *data_json;
@@ -1242,20 +923,21 @@ add_attribute_cont (struct GNUNET_REST_RequestHandle *con_handle,
1242 GNUNET_JSON_parse_free (attrspec); 923 GNUNET_JSON_parse_free (attrspec);
1243} 924}
1244 925
926
1245/** 927/**
1246 * Parse a JWT and return the respective claim value as Attribute 928 * Parse a JWT and return the respective claim value as Attribute
1247 * 929 *
1248 * @param attest the jwt attestation 930 * @param attest the jwt attestation
1249 * @param claim the name of the claim in the JWT 931 * @param claim the name of the claim in the JWT
1250 * 932 *
1251 * @return a GNUNET_RECLAIM_ATTRIBUTE_Claim, containing the new value 933 * @return a GNUNET_RECLAIM_Attribute, containing the new value
1252 */ 934 */
1253struct GNUNET_RECLAIM_ATTRIBUTE_Claim * 935struct GNUNET_RECLAIM_Attribute *
1254parse_jwt (const struct GNUNET_RECLAIM_ATTESTATION_Claim *attest, 936parse_jwt (const struct GNUNET_RECLAIM_Attestation *attest,
1255 const char *claim) 937 const char *claim)
1256{ 938{
1257 char *jwt_string; 939 char *jwt_string;
1258 struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr; 940 struct GNUNET_RECLAIM_Attribute *attr;
1259 char delim[] = "."; 941 char delim[] = ".";
1260 const char *type_str = NULL; 942 const char *type_str = NULL;
1261 const char *val_str = NULL; 943 const char *val_str = NULL;
@@ -1267,7 +949,7 @@ parse_jwt (const struct GNUNET_RECLAIM_ATTESTATION_Claim *attest,
1267 json_t *json_val; 949 json_t *json_val;
1268 json_error_t *json_err = NULL; 950 json_error_t *json_err = NULL;
1269 951
1270 jwt_string = GNUNET_RECLAIM_ATTESTATION_value_to_string (attest->type, 952 jwt_string = GNUNET_RECLAIM_attestation_value_to_string (attest->type,
1271 attest->data, 953 attest->data,
1272 attest->data_size); 954 attest->data_size);
1273 char *jwt_body = strtok (jwt_string, delim); 955 char *jwt_body = strtok (jwt_string, delim);
@@ -1284,24 +966,26 @@ parse_jwt (const struct GNUNET_RECLAIM_ATTESTATION_Claim *attest,
1284 } 966 }
1285 } 967 }
1286 type_str = "String"; 968 type_str = "String";
1287 type = GNUNET_RECLAIM_ATTRIBUTE_typename_to_number (type_str); 969 type = GNUNET_RECLAIM_attribute_typename_to_number (type_str);
1288 if (GNUNET_SYSERR ==(GNUNET_RECLAIM_ATTRIBUTE_string_to_value (type,val_str, 970 if (GNUNET_SYSERR == GNUNET_RECLAIM_attribute_string_to_value (type,val_str,
1289 (void **) &data, 971 (void **) &data,
1290 &data_size))) 972 &data_size))
1291 { 973 {
1292 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 974 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1293 "Attribute value from JWT Parser invalid!\n"); 975 "Attribute value from JWT Parser invalid!\n");
1294 GNUNET_RECLAIM_ATTRIBUTE_string_to_value (type, 976 GNUNET_RECLAIM_attribute_string_to_value (type,
1295 "Error: Referenced Claim Name not Found", 977 "Error: Referenced Claim Name not Found",
1296 (void **) &data, 978 (void **) &data,
1297 &data_size); 979 &data_size);
1298 attr = GNUNET_RECLAIM_ATTRIBUTE_claim_new (claim, type, data, data_size); 980 attr = GNUNET_RECLAIM_attribute_new (claim, &attest->id,
981 type, data, data_size);
1299 attr->id = attest->id; 982 attr->id = attest->id;
1300 attr->flag = 1; 983 attr->flag = 1;
1301 } 984 }
1302 else 985 else
1303 { 986 {
1304 attr = GNUNET_RECLAIM_ATTRIBUTE_claim_new (claim, type, data, data_size); 987 attr = GNUNET_RECLAIM_attribute_new (claim, &attest->id,
988 type, data, data_size);
1305 attr->id = attest->id; 989 attr->id = attest->id;
1306 attr->flag = 1; 990 attr->flag = 1;
1307 } 991 }
@@ -1316,53 +1000,34 @@ parse_jwt (const struct GNUNET_RECLAIM_ATTESTATION_Claim *attest,
1316static void 1000static void
1317attr_collect (void *cls, 1001attr_collect (void *cls,
1318 const struct GNUNET_CRYPTO_EcdsaPublicKey *identity, 1002 const struct GNUNET_CRYPTO_EcdsaPublicKey *identity,
1319 const struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr, 1003 const struct GNUNET_RECLAIM_Attribute *attr,
1320 const struct GNUNET_RECLAIM_ATTESTATION_Claim *attest, 1004 const struct GNUNET_RECLAIM_Attestation *attest)
1321 const struct GNUNET_RECLAIM_ATTESTATION_REFERENCE *reference)
1322{ 1005{
1323 struct RequestHandle *handle = cls; 1006 struct RequestHandle *handle = cls;
1324 json_t *attr_obj; 1007 json_t *attr_obj;
1325 const char *type; 1008 const char *type;
1326 char *id_str; 1009 char *id_str;
1327 1010
1328 if ((NULL == attr) && (NULL == reference)) 1011 if (GNUNET_NO == GNUNET_RECLAIM_id_is_zero (&attr->attestation))
1329 { 1012 {
1330 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1013 struct GNUNET_RECLAIM_Attribute *attr2;
1331 "Attribute Collection with empty Attribute/Reference\n"); 1014 attr2 = parse_jwt (attest, attr->data);
1332 GNUNET_RECLAIM_get_attributes_next (handle->attr_it);
1333 return;
1334 }
1335
1336 if (NULL == attr)
1337 {
1338
1339 if ((NULL == reference->name) || (NULL == reference->reference_value))
1340 {
1341 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1342 "Attribute Collection with empty Reference Name/Value\n");
1343 return;
1344 }
1345 struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr2;
1346 attr2 = parse_jwt (attest, reference->reference_value);
1347 if (NULL == attr2) 1015 if (NULL == attr2)
1348 { 1016 {
1349 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1017 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1350 "Attribute Collection with unparsed Attestation\n"); 1018 "Attribute Collection with unparsed Attestation\n");
1351 return; 1019 return;
1352 } 1020 }
1353 attr2->name = reference->name; 1021 attr2->name = attr->name;
1354 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Adding reference as attribute: %s\n",
1355 reference->name);
1356 char *tmp_value; 1022 char *tmp_value;
1357 tmp_value = GNUNET_RECLAIM_ATTRIBUTE_value_to_string (attr2->type, 1023 tmp_value = GNUNET_RECLAIM_attribute_value_to_string (attr2->type,
1358 attr2->data, 1024 attr2->data,
1359 attr2->data_size); 1025 attr2->data_size);
1360 attr_obj = json_object (); 1026 attr_obj = json_object ();
1361
1362 json_object_set_new (attr_obj, "value", json_string (tmp_value)); 1027 json_object_set_new (attr_obj, "value", json_string (tmp_value));
1363 json_object_set_new (attr_obj, "name", json_string (attr2->name)); 1028 json_object_set_new (attr_obj, "name", json_string (attr2->name));
1364 json_object_set_new (attr_obj, "flag", json_string ("1")); 1029 json_object_set_new (attr_obj, "flag", json_string ("1"));
1365 type = GNUNET_RECLAIM_ATTRIBUTE_number_to_typename (attr2->type); 1030 type = GNUNET_RECLAIM_attribute_number_to_typename (attr2->type);
1366 json_object_set_new (attr_obj, "type", json_string (type)); 1031 json_object_set_new (attr_obj, "type", json_string (type));
1367 id_str = GNUNET_STRINGS_data_to_string_alloc (&attr2->id, 1032 id_str = GNUNET_STRINGS_data_to_string_alloc (&attr2->id,
1368 sizeof(attr2->id)); 1033 sizeof(attr2->id));
@@ -1373,18 +1038,11 @@ attr_collect (void *cls,
1373 } 1038 }
1374 else 1039 else
1375 { 1040 {
1376 if ((NULL == attr->name) || (NULL == attr->data))
1377 {
1378 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1379 "Attribute Collection with empty Attribute Name/Value\n");
1380 GNUNET_RECLAIM_get_attributes_next (handle->attr_it);
1381 return;
1382 }
1383 char *tmp_value; 1041 char *tmp_value;
1384 char *flag_str; 1042 char *flag_str;
1385 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Adding attribute: %s\n", attr->name); 1043 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Adding attribute: %s\n", attr->name);
1386 1044
1387 tmp_value = GNUNET_RECLAIM_ATTRIBUTE_value_to_string (attr->type, 1045 tmp_value = GNUNET_RECLAIM_attribute_value_to_string (attr->type,
1388 attr->data, 1046 attr->data,
1389 attr->data_size); 1047 attr->data_size);
1390 1048
@@ -1393,7 +1051,7 @@ attr_collect (void *cls,
1393 json_object_set_new (attr_obj, "name", json_string (attr->name)); 1051 json_object_set_new (attr_obj, "name", json_string (attr->name));
1394 GNUNET_asprintf (&flag_str,"%d",attr->flag); 1052 GNUNET_asprintf (&flag_str,"%d",attr->flag);
1395 json_object_set_new (attr_obj, "flag", json_string (flag_str)); 1053 json_object_set_new (attr_obj, "flag", json_string (flag_str));
1396 type = GNUNET_RECLAIM_ATTRIBUTE_number_to_typename (attr->type); 1054 type = GNUNET_RECLAIM_attribute_number_to_typename (attr->type);
1397 json_object_set_new (attr_obj, "type", json_string (type)); 1055 json_object_set_new (attr_obj, "type", json_string (type));
1398 id_str = GNUNET_STRINGS_data_to_string_alloc (&attr->id, 1056 id_str = GNUNET_STRINGS_data_to_string_alloc (&attr->id,
1399 sizeof(attr->id)); 1057 sizeof(attr->id));
@@ -1405,6 +1063,7 @@ attr_collect (void *cls,
1405 } 1063 }
1406} 1064}
1407 1065
1066
1408/** 1067/**
1409 * List attributes for identity request 1068 * List attributes for identity request
1410 * 1069 *
@@ -1474,7 +1133,7 @@ delete_attribute_cont (struct GNUNET_REST_RequestHandle *con_handle,
1474{ 1133{
1475 const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv_key; 1134 const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv_key;
1476 struct RequestHandle *handle = cls; 1135 struct RequestHandle *handle = cls;
1477 struct GNUNET_RECLAIM_ATTRIBUTE_Claim attr; 1136 struct GNUNET_RECLAIM_Attribute attr;
1478 struct EgoEntry *ego_entry; 1137 struct EgoEntry *ego_entry;
1479 char *identity_id_str; 1138 char *identity_id_str;
1480 char *identity; 1139 char *identity;
@@ -1514,7 +1173,7 @@ delete_attribute_cont (struct GNUNET_REST_RequestHandle *con_handle,
1514 } 1173 }
1515 priv_key = GNUNET_IDENTITY_ego_get_private_key (ego_entry->ego); 1174 priv_key = GNUNET_IDENTITY_ego_get_private_key (ego_entry->ego);
1516 handle->idp = GNUNET_RECLAIM_connect (cfg); 1175 handle->idp = GNUNET_RECLAIM_connect (cfg);
1517 memset (&attr, 0, sizeof(struct GNUNET_RECLAIM_ATTRIBUTE_Claim)); 1176 memset (&attr, 0, sizeof(struct GNUNET_RECLAIM_Attribute));
1518 GNUNET_STRINGS_string_to_data (id, strlen (id), &attr.id, sizeof(attr.id)); 1177 GNUNET_STRINGS_string_to_data (id, strlen (id), &attr.id, sizeof(attr.id));
1519 attr.name = ""; 1178 attr.name = "";
1520 handle->idp_op = GNUNET_RECLAIM_attribute_delete (handle->idp, 1179 handle->idp_op = GNUNET_RECLAIM_attribute_delete (handle->idp,
@@ -1603,9 +1262,8 @@ revoke_ticket_cont (struct GNUNET_REST_RequestHandle *con_handle,
1603static void 1262static void
1604consume_cont (void *cls, 1263consume_cont (void *cls,
1605 const struct GNUNET_CRYPTO_EcdsaPublicKey *identity, 1264 const struct GNUNET_CRYPTO_EcdsaPublicKey *identity,
1606 const struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr, 1265 const struct GNUNET_RECLAIM_Attribute *attr,
1607 const struct GNUNET_RECLAIM_ATTESTATION_Claim *attest, 1266 const struct GNUNET_RECLAIM_Attestation *attest)
1608 const struct GNUNET_RECLAIM_ATTESTATION_REFERENCE *reference)
1609{ 1267{
1610 struct RequestHandle *handle = cls; 1268 struct RequestHandle *handle = cls;
1611 char *val_str; 1269 char *val_str;
@@ -1618,7 +1276,7 @@ consume_cont (void *cls,
1618 } 1276 }
1619 1277
1620 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Adding attribute: %s\n", attr->name); 1278 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Adding attribute: %s\n", attr->name);
1621 val_str = GNUNET_RECLAIM_ATTRIBUTE_value_to_string (attr->type, 1279 val_str = GNUNET_RECLAIM_attribute_value_to_string (attr->type,
1622 attr->data, 1280 attr->data,
1623 attr->data_size); 1281 attr->data_size);
1624 if (NULL == val_str) 1282 if (NULL == val_str)
@@ -1749,13 +1407,13 @@ init_cont (struct RequestHandle *handle)
1749 GNUNET_REST_API_NS_RECLAIM_ATTRIBUTES, 1407 GNUNET_REST_API_NS_RECLAIM_ATTRIBUTES,
1750 &delete_attribute_cont }, 1408 &delete_attribute_cont },
1751 { MHD_HTTP_METHOD_GET, 1409 { MHD_HTTP_METHOD_GET,
1752 GNUNET_REST_API_NS_RECLAIM_ATTESTATION_REFERENCE, 1410 GNUNET_REST_API_NS_RECLAIM_ATTESTATION,
1753 &list_attestation_cont }, 1411 &list_attestation_cont },
1754 { MHD_HTTP_METHOD_POST, 1412 { MHD_HTTP_METHOD_POST,
1755 GNUNET_REST_API_NS_RECLAIM_ATTESTATION_REFERENCE, 1413 GNUNET_REST_API_NS_RECLAIM_ATTESTATION,
1756 &add_attestation_cont }, 1414 &add_attestation_cont },
1757 { MHD_HTTP_METHOD_DELETE, 1415 { MHD_HTTP_METHOD_DELETE,
1758 GNUNET_REST_API_NS_RECLAIM_ATTESTATION_REFERENCE, 1416 GNUNET_REST_API_NS_RECLAIM_ATTESTATION,
1759 &delete_attestation_cont }, 1417 &delete_attestation_cont },
1760 { MHD_HTTP_METHOD_GET, 1418 { MHD_HTTP_METHOD_GET,
1761 GNUNET_REST_API_NS_IDENTITY_TICKETS, 1419 GNUNET_REST_API_NS_IDENTITY_TICKETS,