aboutsummaryrefslogtreecommitdiff
path: root/src/reclaim/reclaim_api.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/reclaim/reclaim_api.c')
-rw-r--r--src/reclaim/reclaim_api.c46
1 files changed, 46 insertions, 0 deletions
diff --git a/src/reclaim/reclaim_api.c b/src/reclaim/reclaim_api.c
index 7d4d7588a..988650450 100644
--- a/src/reclaim/reclaim_api.c
+++ b/src/reclaim/reclaim_api.c
@@ -925,6 +925,52 @@ GNUNET_RECLAIM_attribute_delete (
925 return op; 925 return op;
926} 926}
927 927
928/**
929 * Store an attestation. If the attestation is already present,
930 * it is replaced with the new attestation.
931 *
932 * @param h handle to the re:claimID service
933 * @param pkey private key of the identity
934 * @param attr the attestation value
935 * @param exp_interval the relative expiration interval for the attestation
936 * @param cont continuation to call when done
937 * @param cont_cls closure for @a cont
938 * @return handle to abort the request
939 */
940struct GNUNET_RECLAIM_Operation *
941GNUNET_RECLAIM_attestation_store (
942 struct GNUNET_RECLAIM_Handle *h,
943 const struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey,
944 const struct GNUNET_RECLAIM_ATTESTATION_Claim *attr,
945 const struct GNUNET_TIME_Relative *exp_interval,
946 GNUNET_RECLAIM_ContinuationWithStatus cont,
947 void *cont_cls)
948{
949 struct GNUNET_RECLAIM_Operation *op;
950 struct AttributeStoreMessage *sam;
951 size_t attr_len;
952
953 op = GNUNET_new (struct GNUNET_RECLAIM_Operation);
954 op->h = h;
955 op->as_cb = cont;
956 op->cls = cont_cls;
957 op->r_id = h->r_id_gen++;
958 GNUNET_CONTAINER_DLL_insert_tail (h->op_head, h->op_tail, op);
959 attr_len = GNUNET_RECLAIM_ATTESTATION_serialize_get_size (attr);
960 op->env = GNUNET_MQ_msg_extra (sam,
961 attr_len,
962 GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_STORE);
963 sam->identity = *pkey;
964 sam->id = htonl (op->r_id);
965 sam->exp = GNUNET_htonll (exp_interval->rel_value_us);
966
967 GNUNET_RECLAIM_ATTESTATION_serialize (attr, (char *) &sam[1]);
968
969 sam->attr_len = htons (attr_len);
970 if (NULL != h->mq)
971 GNUNET_MQ_send_copy (h->mq, op->env);
972 return op;
973}
928 974
929/** 975/**
930 * List all attributes for a local identity. 976 * List all attributes for a local identity.