aboutsummaryrefslogtreecommitdiff
path: root/src/service/reclaim/did_core.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/service/reclaim/did_core.c')
-rw-r--r--src/service/reclaim/did_core.c25
1 files changed, 15 insertions, 10 deletions
diff --git a/src/service/reclaim/did_core.c b/src/service/reclaim/did_core.c
index ce3336b91..5804a0d7e 100644
--- a/src/service/reclaim/did_core.c
+++ b/src/service/reclaim/did_core.c
@@ -27,7 +27,6 @@
27// TODO: DID documents do not have an expiration date. Still we add one 27// TODO: DID documents do not have an expiration date. Still we add one
28// TODO: Store DID document with empty label and own type (maybe DID-Document or JSON??) 28// TODO: Store DID document with empty label and own type (maybe DID-Document or JSON??)
29 29
30#include "platform.h"
31#include "did_core.h" 30#include "did_core.h"
32 31
33struct DID_resolve_return 32struct DID_resolve_return
@@ -66,7 +65,8 @@ DID_resolve_gns_lookup_cb (
66 void *cls_did_resolve_cb = ((struct DID_resolve_return *) cls)->cls; 65 void *cls_did_resolve_cb = ((struct DID_resolve_return *) cls)->cls;
67 free (cls); 66 free (cls);
68 67
69 for (int i = 0; i < rd_count; i++) { 68 for (int i = 0; i < rd_count; i++)
69 {
70 if (rd[i].record_type != GNUNET_GNSRECORD_TYPE_DID_DOCUMENT) 70 if (rd[i].record_type != GNUNET_GNSRECORD_TYPE_DID_DOCUMENT)
71 continue; 71 continue;
72 did_document = (char *) rd[i].data; 72 did_document = (char *) rd[i].data;
@@ -77,6 +77,7 @@ DID_resolve_gns_lookup_cb (
77 cls_did_resolve_cb); 77 cls_did_resolve_cb);
78} 78}
79 79
80
80/** 81/**
81 * @brief Resolve a DID. 82 * @brief Resolve a DID.
82 * Calls the given callback function with the resolved DID Document and the given closure. 83 * Calls the given callback function with the resolved DID Document and the given closure.
@@ -116,6 +117,7 @@ DID_resolve (const char *did,
116 return GNUNET_OK; 117 return GNUNET_OK;
117} 118}
118 119
120
119// ------------------------------------------------ // 121// ------------------------------------------------ //
120// -------------------- Create -------------------- // 122// -------------------- Create -------------------- //
121// ------------------------------------------------ // 123// ------------------------------------------------ //
@@ -140,6 +142,7 @@ DID_create_did_store_cb (void *cls,
140 } 142 }
141} 143}
142 144
145
143struct DID_create_namestore_lookup_closure 146struct DID_create_namestore_lookup_closure
144{ 147{
145 const char *did_document; 148 const char *did_document;
@@ -178,7 +181,8 @@ DID_create_namestore_lookup_cb (void *cls,
178 printf ("Ego already has a DID Document. Abort.\n"); 181 printf ("Ego already has a DID Document. Abort.\n");
179 cls_record_store_cb->cb (GNUNET_NO, cls_record_store_cb->cls); 182 cls_record_store_cb->cb (GNUNET_NO, cls_record_store_cb->cls);
180 } 183 }
181 else { 184 else
185 {
182 // Get public key 186 // Get public key
183 GNUNET_CRYPTO_key_get_public (zone, &pkey); 187 GNUNET_CRYPTO_key_get_public (zone, &pkey);
184 188
@@ -197,16 +201,17 @@ DID_create_namestore_lookup_cb (void *cls,
197 record_data.flags = GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION; 201 record_data.flags = GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION;
198 202
199 // Store record 203 // Store record
200 GNUNET_NAMESTORE_records_store (namestore_handle, 204 GNUNET_NAMESTORE_record_set_store (namestore_handle,
201 zone, 205 zone,
202 DID_DOCUMENT_LABEL, 206 DID_DOCUMENT_LABEL,
203 1, // FIXME what if GNUNET_GNS_EMPTY_LABEL_AT has records 207 1, // FIXME what if GNUNET_GNS_EMPTY_LABEL_AT has records
204 &record_data, 208 &record_data,
205 &DID_create_did_store_cb, 209 &DID_create_did_store_cb,
206 (void *) cls_record_store_cb); 210 (void *) cls_record_store_cb);
207 } 211 }
208} 212}
209 213
214
210/** 215/**
211 * @brief Creates a DID and saves DID Document in Namestore. 216 * @brief Creates a DID and saves DID Document in Namestore.
212 * 217 *