aboutsummaryrefslogtreecommitdiff
path: root/src/reclaim/plugin_rest_reclaim.c
diff options
context:
space:
mode:
authorSchanzenbach, Martin <mschanzenbach@posteo.de>2020-02-07 21:15:59 +0100
committerSchanzenbach, Martin <mschanzenbach@posteo.de>2020-02-09 20:38:11 +0100
commite8ea1f3e34e2a07cbe2fd4725e7362027d0c51c3 (patch)
tree5b11a525700872147d92d8195615e4352d6d18b1 /src/reclaim/plugin_rest_reclaim.c
parent5f9f9cae1714eb33e0ee9c824f3d88e6aab8cf63 (diff)
downloadgnunet-e8ea1f3e34e2a07cbe2fd4725e7362027d0c51c3.tar.gz
gnunet-e8ea1f3e34e2a07cbe2fd4725e7362027d0c51c3.zip
add expiration
Diffstat (limited to 'src/reclaim/plugin_rest_reclaim.c')
-rw-r--r--src/reclaim/plugin_rest_reclaim.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/src/reclaim/plugin_rest_reclaim.c b/src/reclaim/plugin_rest_reclaim.c
index 8b3aee8ba..780a184d2 100644
--- a/src/reclaim/plugin_rest_reclaim.c
+++ b/src/reclaim/plugin_rest_reclaim.c
@@ -621,21 +621,24 @@ add_attestation_cont (struct GNUNET_REST_RequestHandle *con_handle,
621static void 621static void
622attest_collect (void *cls, 622attest_collect (void *cls,
623 const struct GNUNET_CRYPTO_EcdsaPublicKey *identity, 623 const struct GNUNET_CRYPTO_EcdsaPublicKey *identity,
624 const struct GNUNET_RECLAIM_Attestation *attest, 624 const struct GNUNET_RECLAIM_Attestation *attest)
625 const struct GNUNET_RECLAIM_AttributeList *attrs)
626{ 625{
627 struct RequestHandle *handle = cls; 626 struct RequestHandle *handle = cls;
627 struct GNUNET_RECLAIM_AttributeList *attrs;
628 struct GNUNET_RECLAIM_AttributeListEntry *ale; 628 struct GNUNET_RECLAIM_AttributeListEntry *ale;
629 struct GNUNET_TIME_Absolute exp;
629 json_t *attr_obj; 630 json_t *attr_obj;
630 json_t *attest_obj; 631 json_t *attest_obj;
631 const char *type; 632 const char *type;
632 char *tmp_value; 633 char *tmp_value;
633 char *id_str; 634 char *id_str;
635 char *issuer;
634 636
635 637
636 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Adding attestation: %s\n", 638 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Adding attestation: %s\n",
637 attest->name); 639 attest->name);
638 640 attrs = GNUNET_RECLAIM_attestation_get_attributes (attest);
641 issuer = GNUNET_RECLAIM_attestation_get_issuer (attest);
639 tmp_value = GNUNET_RECLAIM_attestation_value_to_string (attest->type, 642 tmp_value = GNUNET_RECLAIM_attestation_value_to_string (attest->type,
640 attest->data, 643 attest->data,
641 attest->data_size); 644 attest->data_size);
@@ -644,10 +647,21 @@ attest_collect (void *cls,
644 json_object_set_new (attest_obj, "name", json_string (attest->name)); 647 json_object_set_new (attest_obj, "name", json_string (attest->name));
645 type = GNUNET_RECLAIM_attestation_number_to_typename (attest->type); 648 type = GNUNET_RECLAIM_attestation_number_to_typename (attest->type);
646 json_object_set_new (attest_obj, "type", json_string (type)); 649 json_object_set_new (attest_obj, "type", json_string (type));
650 if (NULL != issuer)
651 {
652 json_object_set_new (attest_obj, "issuer", json_string (issuer));
653 GNUNET_free (issuer);
654 }
655 if (GNUNET_OK == GNUNET_RECLAIM_attestation_get_expiration (attest,
656 &exp))
657 {
658 json_object_set_new (attest_obj, "expiration", json_integer (exp.abs_value_us));
659 }
647 id_str = GNUNET_STRINGS_data_to_string_alloc (&attest->id, 660 id_str = GNUNET_STRINGS_data_to_string_alloc (&attest->id,
648 sizeof(attest->id)); 661 sizeof(attest->id));
649 json_object_set_new (attest_obj, "id", json_string (id_str)); 662 json_object_set_new (attest_obj, "id", json_string (id_str));
650 GNUNET_free (tmp_value); 663 GNUNET_free (tmp_value);
664 GNUNET_free (id_str);
651 if (NULL != attrs) 665 if (NULL != attrs)
652 { 666 {
653 json_t *attr_arr = json_array (); 667 json_t *attr_arr = json_array ();
@@ -673,6 +687,7 @@ attest_collect (void *cls,
673 json_object_set_new (attest_obj, "attributes", attr_arr); 687 json_object_set_new (attest_obj, "attributes", attr_arr);
674 } 688 }
675 json_array_append_new (handle->resp_object, attest_obj); 689 json_array_append_new (handle->resp_object, attest_obj);
690 GNUNET_RECLAIM_attribute_list_destroy (attrs);
676 GNUNET_RECLAIM_get_attestations_next (handle->attest_it); 691 GNUNET_RECLAIM_get_attestations_next (handle->attest_it);
677} 692}
678 693