diff options
author | Markus Voggenreiter <Markus.Voggenreiter@tum.de> | 2019-10-13 16:31:17 +0200 |
---|---|---|
committer | Schanzenbach, Martin <mschanzenbach@posteo.de> | 2020-01-13 13:31:02 +0100 |
commit | 2c65283b0bd97a8719f4c71aee8cc091a491129a (patch) | |
tree | 61f1644f36c111342edbd1d19dfd3212b659da04 /src/reclaim/reclaim_api.c | |
parent | d5178cdc05a0d91293d9ee2cef45ab9a1c515bac (diff) | |
download | gnunet-2c65283b0bd97a8719f4c71aee8cc091a491129a.tar.gz gnunet-2c65283b0bd97a8719f4c71aee8cc091a491129a.zip |
Add Attestations via Reclaim Service
Diffstat (limited to 'src/reclaim/reclaim_api.c')
-rw-r--r-- | src/reclaim/reclaim_api.c | 46 |
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 | */ | ||
940 | struct GNUNET_RECLAIM_Operation * | ||
941 | GNUNET_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. |