diff options
author | Tristan Schwieren <tristan.schwieren@tum.de> | 2022-06-29 16:47:44 +0200 |
---|---|---|
committer | Tristan Schwieren <tristan.schwieren@tum.de> | 2022-06-29 16:47:44 +0200 |
commit | b50b97b20e986129f2da30eb0754a9921b80c4b3 (patch) | |
tree | 52aaa8b5fcc2ccb4c2d48322fafc65bdad1c3612 /src/reclaim | |
parent | d3de2f84f551501f70851c8df4fbd8e5779f248e (diff) | |
download | gnunet-b50b97b20e986129f2da30eb0754a9921b80c4b3.tar.gz gnunet-b50b97b20e986129f2da30eb0754a9921b80c4b3.zip |
- non working DID lib create func
Diffstat (limited to 'src/reclaim')
-rw-r--r-- | src/reclaim/did_core.c | 99 | ||||
-rw-r--r-- | src/reclaim/did_core.h | 4 | ||||
-rw-r--r-- | src/reclaim/gnunet-did.c | 212 |
3 files changed, 157 insertions, 158 deletions
diff --git a/src/reclaim/did_core.c b/src/reclaim/did_core.c index 0690a654b..dea1c82c3 100644 --- a/src/reclaim/did_core.c +++ b/src/reclaim/did_core.c | |||
@@ -113,9 +113,26 @@ DID_resolve (const char *did, | |||
113 | // ------------------------------------------------ // | 113 | // ------------------------------------------------ // |
114 | 114 | ||
115 | static void | 115 | static void |
116 | DID_create_did_store_cb () | 116 | DID_create_did_store_cb (void *cls, |
117 | int32_t success, | ||
118 | const char *emsg) | ||
117 | { | 119 | { |
118 | return; | 120 | if (GNUNET_OK == success) |
121 | { | ||
122 | // TEST | ||
123 | struct GNUNET_IDENTITY_PublicKey *pkey_test; | ||
124 | GNUNET_IDENTITY_ego_get_public_key ((struct GNUNET_IDENTITY_Ego *) closure, | ||
125 | pkey_test); | ||
126 | printf ("pkey1: %s\n", GNUNET_IDENTITY_public_key_to_string (pkey_test)); | ||
127 | |||
128 | printf ("cls3: %s\n", (char *) closure); | ||
129 | action_cb (GNUNET_OK, closure); | ||
130 | } | ||
131 | else | ||
132 | { | ||
133 | printf ("%s\n", emsg); | ||
134 | action_cb (GNUNET_NO, closure); | ||
135 | } | ||
119 | } | 136 | } |
120 | 137 | ||
121 | /** | 138 | /** |
@@ -126,37 +143,43 @@ DID_create_did_store_cb () | |||
126 | */ | 143 | */ |
127 | static enum GNUNET_GenericReturnValue | 144 | static enum GNUNET_GenericReturnValue |
128 | DID_create_did_store (struct GNUNET_NAMESTORE_Handle *namestore_handle, | 145 | DID_create_did_store (struct GNUNET_NAMESTORE_Handle *namestore_handle, |
129 | char *didd_str, struct GNUNET_IDENTITY_Ego *ego) | 146 | char *didd_str, struct GNUNET_IDENTITY_Ego *ego) |
130 | { | 147 | { |
131 | 148 | ||
132 | struct GNUNET_TIME_Relative expire_time; | 149 | struct GNUNET_TIME_Relative expire_time; |
133 | struct GNUNET_GNSRECORD_Data record_data; | 150 | struct GNUNET_GNSRECORD_Data record_data; |
134 | const struct GNUNET_IDENTITY_PrivateKey *skey; | 151 | const struct GNUNET_IDENTITY_PrivateKey *skey; |
135 | 152 | ||
136 | if (GNUNET_STRINGS_fancy_time_to_relative ((GNUNET_OK == | 153 | if (GNUNET_OK != GNUNET_STRINGS_fancy_time_to_relative ( |
137 | DID_DOCUMENT_DEFAULT_EXPIRATION_TIME), | 154 | DID_DOCUMENT_DEFAULT_EXPIRATION_TIME, &expire_time)) |
138 | &expire_time)) | ||
139 | { | 155 | { |
140 | record_data.data = didd_str; | ||
141 | record_data.expiration_time = expire_time.rel_value_us; | ||
142 | record_data.data_size = strlen (didd_str) + 1; | ||
143 | record_data.record_type = GNUNET_GNSRECORD_typename_to_number ("TXT"), | ||
144 | record_data.flags = GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION; | ||
145 | |||
146 | skey = GNUNET_IDENTITY_ego_get_private_key (ego); | ||
147 | |||
148 | GNUNET_NAMESTORE_records_store (namestore_handle, | ||
149 | skey, | ||
150 | GNUNET_GNS_EMPTY_LABEL_AT, | ||
151 | 1, // FIXME what if GNUNET_GNS_EMPTY_LABEL_AT has records | ||
152 | &record_data, | ||
153 | &DID_create_did_store_cb, | ||
154 | NULL); | ||
155 | } | ||
156 | else { | ||
157 | printf ("Failed to read given expiration time\n"); | 156 | printf ("Failed to read given expiration time\n"); |
158 | return GNUNET_NO; | 157 | return GNUNET_NO; |
159 | } | 158 | } |
159 | |||
160 | record_data.data = didd_str; | ||
161 | record_data.expiration_time = expire_time.rel_value_us; | ||
162 | record_data.data_size = strlen (didd_str) + 1; | ||
163 | record_data.record_type = GNUNET_GNSRECORD_typename_to_number ("TXT"), | ||
164 | record_data.flags = GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION; | ||
165 | |||
166 | skey = GNUNET_IDENTITY_ego_get_private_key (ego); | ||
167 | |||
168 | // TEST | ||
169 | struct GNUNET_IDENTITY_PublicKey *pkey_test; | ||
170 | GNUNET_IDENTITY_ego_get_public_key ((struct GNUNET_IDENTITY_Ego *) closure, | ||
171 | pkey_test); | ||
172 | printf ("pkey1: %s\n", GNUNET_IDENTITY_public_key_to_string (pkey_test)); | ||
173 | |||
174 | GNUNET_NAMESTORE_records_store (namestore_handle, | ||
175 | skey, | ||
176 | DID_DOCUMENT_LABEL, | ||
177 | 1, // FIXME what if GNUNET_GNS_EMPTY_LABEL_AT has records | ||
178 | &record_data, | ||
179 | &DID_create_did_store_cb, | ||
180 | NULL); | ||
181 | |||
182 | return GNUNET_OK; | ||
160 | } | 183 | } |
161 | 184 | ||
162 | // TODO: Expiration time missing | 185 | // TODO: Expiration time missing |
@@ -165,10 +188,8 @@ DID_create_did_store (struct GNUNET_NAMESTORE_Handle *namestore_handle, | |||
165 | * @brief Creates a DID and saves DID Document in Namestore. | 188 | * @brief Creates a DID and saves DID Document in Namestore. |
166 | * | 189 | * |
167 | * @param ego ego for which the DID should be created. | 190 | * @param ego ego for which the DID should be created. |
168 | * If ego==NULL a new ego is created | ||
169 | * @param did_document did_document that should be saved in namestore. | 191 | * @param did_document did_document that should be saved in namestore. |
170 | * If ego==NULL did_document can also be NULL. | 192 | * If did_document==NULL -> Default DID document is created. |
171 | * Default DID document is created. | ||
172 | * @param cfg_handle pointer to configuration handle | 193 | * @param cfg_handle pointer to configuration handle |
173 | * @param identity_hanlde pointer to identity handle. Can be NULL if ego!=NULL | 194 | * @param identity_hanlde pointer to identity handle. Can be NULL if ego!=NULL |
174 | * @param namestore_handle | 195 | * @param namestore_handle |
@@ -178,7 +199,7 @@ DID_create_did_store (struct GNUNET_NAMESTORE_Handle *namestore_handle, | |||
178 | enum GNUNET_GenericReturnValue | 199 | enum GNUNET_GenericReturnValue |
179 | DID_create (const struct GNUNET_IDENTITY_Ego *ego, | 200 | DID_create (const struct GNUNET_IDENTITY_Ego *ego, |
180 | const char *did_document, | 201 | const char *did_document, |
181 | struct GNUNET_CONFIGURATION_Handle *cfg_handle, | 202 | const struct GNUNET_CONFIGURATION_Handle *cfg_handle, |
182 | struct GNUNET_IDENTITY_Handle *identity_handle, | 203 | struct GNUNET_IDENTITY_Handle *identity_handle, |
183 | struct GNUNET_NAMESTORE_Handle *namestore_handle, | 204 | struct GNUNET_NAMESTORE_Handle *namestore_handle, |
184 | DID_action_callback *cont, | 205 | DID_action_callback *cont, |
@@ -188,15 +209,27 @@ DID_create (const struct GNUNET_IDENTITY_Ego *ego, | |||
188 | 209 | ||
189 | GNUNET_IDENTITY_ego_get_public_key (ego, &pkey); | 210 | GNUNET_IDENTITY_ego_get_public_key (ego, &pkey); |
190 | 211 | ||
191 | if (did_document != NULL) | 212 | if (ntohl (pkey.type) != GNUNET_GNSRECORD_TYPE_EDKEY) |
192 | { | 213 | { |
193 | printf ( | 214 | printf ("The EGO has to have an EDDSA key pair\n"); |
194 | "DID Docuement is read from \"did-document\" argument (EXPERIMENTAL)\n"); | 215 | return GNUNET_NO; |
195 | } | 216 | } |
217 | |||
218 | if (did_document != NULL) | ||
219 | printf ( | ||
220 | "DID Docuement is read from \"DID-document\" argument (EXPERIMENTAL)\n"); | ||
196 | else | 221 | else |
197 | { | ||
198 | did_document = DID_pkey_to_did_document (&pkey); | 222 | did_document = DID_pkey_to_did_document (&pkey); |
199 | } | ||
200 | 223 | ||
201 | return GNUNET_OK; | 224 | |
225 | // TEST | ||
226 | struct GNUNET_IDENTITY_PublicKey *pkey_test; | ||
227 | GNUNET_IDENTITY_ego_get_public_key ((struct GNUNET_IDENTITY_Ego *) cls, | ||
228 | pkey_test); | ||
229 | printf ("pkey1: %s\n", GNUNET_IDENTITY_public_key_to_string (pkey_test)); | ||
230 | |||
231 | action_cb = cont; | ||
232 | closure = cls; | ||
233 | |||
234 | return DID_create_did_store (namestore_handle, did_document, ego); | ||
202 | } | 235 | } |
diff --git a/src/reclaim/did_core.h b/src/reclaim/did_core.h index ba5aaf09c..8b4837e59 100644 --- a/src/reclaim/did_core.h +++ b/src/reclaim/did_core.h | |||
@@ -109,7 +109,7 @@ DID_remove (const struct GNUNET_IDENTITY_Ego *ego, | |||
109 | enum GNUNET_GenericReturnValue | 109 | enum GNUNET_GenericReturnValue |
110 | DID_create (const struct GNUNET_IDENTITY_Ego *ego, | 110 | DID_create (const struct GNUNET_IDENTITY_Ego *ego, |
111 | const char *did_document, | 111 | const char *did_document, |
112 | struct GNUNET_CONFIGURATION_Handle *cfg_handle, | 112 | const struct GNUNET_CONFIGURATION_Handle *cfg_handle, |
113 | struct GNUNET_IDENTITY_Handle *identity_handle, | 113 | struct GNUNET_IDENTITY_Handle *identity_handle, |
114 | struct GNUNET_NAMESTORE_Handle *namestore_handle, | 114 | struct GNUNET_NAMESTORE_Handle *namestore_handle, |
115 | DID_action_callback *cont, | 115 | DID_action_callback *cont, |
@@ -130,7 +130,7 @@ DID_create (const struct GNUNET_IDENTITY_Ego *ego, | |||
130 | enum GNUNET_GenericReturnValue | 130 | enum GNUNET_GenericReturnValue |
131 | DID_replace (struct GNUNET_IDENTITY_Ego *ego, | 131 | DID_replace (struct GNUNET_IDENTITY_Ego *ego, |
132 | char *did_document, | 132 | char *did_document, |
133 | struct GNUNET_CONFIGURATION_Handle *cfg_handle, | 133 | const struct GNUNET_CONFIGURATION_Handle *cfg_handle, |
134 | struct GNUNET_IDENTITY_Handle *identity_handle, | 134 | struct GNUNET_IDENTITY_Handle *identity_handle, |
135 | struct GNUNET_NAMESTORE_Handle *namestore_handle, | 135 | struct GNUNET_NAMESTORE_Handle *namestore_handle, |
136 | DID_action_callback *cont, | 136 | DID_action_callback *cont, |
diff --git a/src/reclaim/gnunet-did.c b/src/reclaim/gnunet-did.c index 3629c22f8..18b171486 100644 --- a/src/reclaim/gnunet-did.c +++ b/src/reclaim/gnunet-did.c | |||
@@ -205,16 +205,16 @@ get_did_for_ego () | |||
205 | * @param rd the records in the reply | 205 | * @param rd the records in the reply |
206 | */ | 206 | */ |
207 | static void | 207 | static void |
208 | print_did_document( | 208 | print_did_document ( |
209 | enum GNUNET_GenericReturnValue status, | 209 | enum GNUNET_GenericReturnValue status, |
210 | char *did_document, | 210 | char *did_document, |
211 | void *cls | 211 | void *cls |
212 | ) | 212 | ) |
213 | { | 213 | { |
214 | if (GNUNET_OK == status) | 214 | if (GNUNET_OK == status) |
215 | printf("%s\n", did_document); | 215 | printf ("%s\n", did_document); |
216 | else | 216 | else |
217 | printf("An error occured: %s\n", did_document); | 217 | printf ("An error occured: %s\n", did_document); |
218 | 218 | ||
219 | GNUNET_SCHEDULER_add_now (cleanup, NULL); | 219 | GNUNET_SCHEDULER_add_now (cleanup, NULL); |
220 | ret = 0; | 220 | ret = 0; |
@@ -225,7 +225,7 @@ print_did_document( | |||
225 | * @brief Resolve a DID given by the user. | 225 | * @brief Resolve a DID given by the user. |
226 | */ | 226 | */ |
227 | static void | 227 | static void |
228 | resolve_did_document () | 228 | resolve_did () |
229 | { | 229 | { |
230 | struct GNUNET_IDENTITY_PublicKey pkey; | 230 | struct GNUNET_IDENTITY_PublicKey pkey; |
231 | 231 | ||
@@ -237,10 +237,10 @@ resolve_did_document () | |||
237 | return; | 237 | return; |
238 | } | 238 | } |
239 | 239 | ||
240 | if (GNUNET_OK != DID_resolve(did, gns_handle, print_did_document, NULL)) | 240 | if (GNUNET_OK != DID_resolve (did, gns_handle, print_did_document, NULL)) |
241 | { | 241 | { |
242 | printf("An error occured while resoling the DID\n"); | 242 | printf ("An error occured while resoling the DID\n"); |
243 | GNUNET_SCHEDULER_add_now(cleanup, NULL); | 243 | GNUNET_SCHEDULER_add_now (cleanup, NULL); |
244 | ret = 0; | 244 | ret = 0; |
245 | return; | 245 | return; |
246 | } | 246 | } |
@@ -354,64 +354,53 @@ remove_did_document (remove_did_document_callback cont, void *cls) | |||
354 | } | 354 | } |
355 | } | 355 | } |
356 | 356 | ||
357 | static void create_did (); | ||
357 | 358 | ||
358 | /** | 359 | /** |
359 | * @brief Create a DID. Store DID in Namestore cb | 360 | * @brief Create a DID(-Document). Called after DID has been created |
360 | * | 361 | * |
361 | */ | 362 | */ |
362 | static void | 363 | static void |
363 | create_did_store_cb (void *cls, int32_t success, const char *emsg) | 364 | create_did_cb (enum GNUNET_GenericReturnValue status, void *cls) |
364 | { | 365 | { |
366 | struct GNUNET_IDENTITY_Ego *ego; | ||
367 | // char *did; | ||
368 | |||
369 | if (GNUNET_OK == status) | ||
370 | { | ||
371 | printf ("DID has been created\n"); | ||
372 | // ego = (struct GNUNET_IDENTITY_Ego *) cls; | ||
373 | // did = DID_identity_to_did(ego); | ||
374 | printf ("cls4: %s\n", (char *) cls); | ||
375 | } | ||
376 | else | ||
377 | printf ("An error occured while creating the DID\n"), ret = 1; | ||
378 | |||
365 | GNUNET_SCHEDULER_add_now (&cleanup, NULL); | 379 | GNUNET_SCHEDULER_add_now (&cleanup, NULL); |
366 | ret = 0; | ||
367 | return; | 380 | return; |
368 | } | 381 | } |
369 | 382 | ||
370 | /** | 383 | /** |
371 | * @brief Create a did. Store DID in Namestore | 384 | * @brief Create a DID(-Document) - Called after a new Identity has been created. |
372 | * | ||
373 | * @param didd_str String endoced DID Docuement | ||
374 | * @param ego Identity whos DID Document is stored | ||
375 | */ | 385 | */ |
376 | static void | 386 | static void |
377 | create_did_store (char *didd_str, struct GNUNET_IDENTITY_Ego *ego) | 387 | create_did_ego_create_cb (void *cls, |
388 | const struct GNUNET_IDENTITY_PrivateKey *pk, | ||
389 | const char *emsg) | ||
378 | { | 390 | { |
379 | 391 | if (emsg != NULL) | |
380 | struct GNUNET_TIME_Relative expire_time; | ||
381 | struct GNUNET_GNSRECORD_Data record_data; | ||
382 | const struct GNUNET_IDENTITY_PrivateKey *skey; | ||
383 | |||
384 | if (GNUNET_STRINGS_fancy_time_to_relative ((NULL != expire) ? | ||
385 | expire : | ||
386 | GNUNET_DID_DEFAULT_DID_DOCUMENT_EXPIRATION_TIME, | ||
387 | &expire_time) == GNUNET_OK) | ||
388 | { | 392 | { |
389 | record_data.data = didd_str; | 393 | printf ("%s\n", emsg); |
390 | record_data.expiration_time = expire_time.rel_value_us; | ||
391 | record_data.data_size = strlen (didd_str) + 1; | ||
392 | record_data.record_type = GNUNET_GNSRECORD_typename_to_number ("TXT"), | ||
393 | record_data.flags = GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION; | ||
394 | |||
395 | skey = GNUNET_IDENTITY_ego_get_private_key (ego); | ||
396 | |||
397 | GNUNET_NAMESTORE_records_store (namestore_handle, | ||
398 | skey, | ||
399 | GNUNET_GNS_EMPTY_LABEL_AT, | ||
400 | 1, // FIXME what if GNUNET_GNS_EMPTY_LABEL_AT has records | ||
401 | &record_data, | ||
402 | &create_did_store_cb, | ||
403 | NULL); | ||
404 | } | ||
405 | else { | ||
406 | printf ("Failed to read given expiration time\n"); | ||
407 | GNUNET_SCHEDULER_add_now (&cleanup, NULL); | 394 | GNUNET_SCHEDULER_add_now (&cleanup, NULL); |
408 | ret = 1; | 395 | ret = 1; |
409 | return; | 396 | return; |
410 | } | 397 | } |
398 | |||
399 | create_did (); | ||
411 | } | 400 | } |
412 | 401 | ||
413 | /** | 402 | /** |
414 | * @brief Create a did ego lockup cb | 403 | * @brief Create a DID(-Document). Called after ego lookup |
415 | * | 404 | * |
416 | * @param cls | 405 | * @param cls |
417 | * @param ego | 406 | * @param ego |
@@ -419,96 +408,71 @@ create_did_store (char *didd_str, struct GNUNET_IDENTITY_Ego *ego) | |||
419 | static void | 408 | static void |
420 | create_did_ego_lockup_cb (void *cls, struct GNUNET_IDENTITY_Ego *ego) | 409 | create_did_ego_lockup_cb (void *cls, struct GNUNET_IDENTITY_Ego *ego) |
421 | { | 410 | { |
422 | struct GNUNET_IDENTITY_PublicKey pkey; | 411 | // struct GNUNET_IDENTITY_Ego *ego_test; |
423 | char *didd_str; | 412 | struct GNUNET_IDENTITY_PublicKey *pkey_test; |
413 | printf("test3\n"); | ||
424 | 414 | ||
425 | if (ego == NULL) | 415 | if (ego == NULL) |
426 | { | 416 | { |
427 | printf ("EGO not found\n"); | 417 | // If Ego was not found. Create new one first |
428 | GNUNET_SCHEDULER_add_now (&cleanup, NULL); | 418 | printf ("Ego was not found. Creating new one.\n"); |
429 | ret = 1; | ||
430 | return; | ||
431 | } | ||
432 | 419 | ||
433 | GNUNET_IDENTITY_ego_get_public_key (ego, &pkey); | 420 | GNUNET_IDENTITY_create (identity_handle, |
434 | 421 | egoname, | |
435 | if (ntohl (pkey.type) != GNUNET_GNSRECORD_TYPE_EDKEY) | 422 | NULL, |
436 | { | 423 | GNUNET_IDENTITY_TYPE_EDDSA, |
437 | printf ("The EGO has to have an EDDSA key pair\n"); | 424 | &create_did_ego_create_cb, |
438 | GNUNET_SCHEDULER_add_now (&cleanup, NULL); | 425 | egoname); |
439 | ret = 1; | ||
440 | return; | ||
441 | } | 426 | } |
442 | 427 | else | |
443 | if (didd != NULL) | ||
444 | { | 428 | { |
445 | printf ( | 429 | printf("test1\n"); |
446 | "DID Docuement is read from \"did-document\" argument (EXPERIMENTAL)\n"); | 430 | cls = (void *) ego; |
447 | didd_str = strdup (didd); | ||
448 | } | ||
449 | else { | ||
450 | // Generate DID Docuement from public key | ||
451 | didd_str = DID_pkey_to_did_document (&pkey); | ||
452 | } | ||
453 | 431 | ||
454 | // Print DID Document to stdout | 432 | // TEST |
455 | printf ("%s\n", didd_str); | 433 | // ego_test = (struct GNUNET_IDENTITY_Ego *) cls; |
434 | GNUNET_IDENTITY_ego_get_public_key (ego, pkey_test); | ||
435 | printf ("pkey1: %s\n", GNUNET_IDENTITY_public_key_to_string (pkey_test)); | ||
436 | printf("test4\n"); | ||
456 | 437 | ||
457 | // Store the DID Document | 438 | // TODO: Check if ego already has a DID document |
458 | create_did_store (didd_str, ego); | 439 | // DO a resolve |
459 | 440 | ||
460 | // Save DID Document String to GNS | 441 | DID_create (ego, NULL, my_cfg, identity_handle, namestore_handle, |
461 | free (didd_str); | 442 | create_did_cb, cls); |
443 | } | ||
462 | } | 444 | } |
463 | 445 | ||
464 | /** | 446 | /** |
465 | * @brief Create a did document - Create a new identity first | 447 | * @brief Create a DID(-Document). |
448 | * | ||
466 | */ | 449 | */ |
467 | static void | 450 | static void |
468 | create_did_document_ego_create_cb (void *cls, | 451 | create_did () |
469 | const struct GNUNET_IDENTITY_PrivateKey *pk, | ||
470 | const char *emsg) | ||
471 | { | 452 | { |
472 | 453 | if (expire == NULL) | |
473 | if (emsg != NULL) | ||
474 | { | 454 | { |
475 | printf ("%s\n", emsg); | 455 | printf ( |
456 | "Set the Expiration-time argument to create a new DID(-Document)\n"); | ||
476 | GNUNET_SCHEDULER_add_now (&cleanup, NULL); | 457 | GNUNET_SCHEDULER_add_now (&cleanup, NULL); |
477 | ret = 1; | 458 | ret = 1; |
478 | return; | 459 | return; |
479 | } | 460 | } |
480 | 461 | ||
481 | GNUNET_IDENTITY_ego_lookup (my_cfg, | 462 | if (egoname == NULL) |
482 | egoname, | ||
483 | &create_did_ego_lockup_cb, | ||
484 | NULL); | ||
485 | } | ||
486 | |||
487 | /** | ||
488 | * @brief Create a did document | ||
489 | * | ||
490 | */ | ||
491 | static void | ||
492 | create_did_document () | ||
493 | { | ||
494 | if ((egoname != NULL) && (expire != NULL)) | ||
495 | { | 463 | { |
496 | // TODO: Check if ego already has a DID document | 464 | printf ("Set the Ego argument to create a new DID(-Document)\n"); |
497 | |||
498 | GNUNET_IDENTITY_create (identity_handle, | ||
499 | egoname, | ||
500 | NULL, | ||
501 | GNUNET_IDENTITY_TYPE_EDDSA, | ||
502 | &create_did_document_ego_create_cb, | ||
503 | egoname); | ||
504 | } | ||
505 | else { | ||
506 | printf ( | ||
507 | "Set the EGO and the Expiration-time argument to create a new DID(-Document)\n"); | ||
508 | GNUNET_SCHEDULER_add_now (&cleanup, NULL); | 465 | GNUNET_SCHEDULER_add_now (&cleanup, NULL); |
509 | ret = 1; | 466 | ret = 1; |
510 | return; | 467 | return; |
511 | } | 468 | } |
469 | |||
470 | printf("test2\n"); | ||
471 | |||
472 | GNUNET_IDENTITY_ego_lookup (my_cfg, | ||
473 | egoname, | ||
474 | &create_did_ego_lockup_cb, | ||
475 | NULL); | ||
512 | } | 476 | } |
513 | 477 | ||
514 | 478 | ||
@@ -521,7 +485,7 @@ create_did_document () | |||
521 | static void | 485 | static void |
522 | replace_did_document_ego_lookup_cb (void *cls, struct GNUNET_IDENTITY_Ego *ego) | 486 | replace_did_document_ego_lookup_cb (void *cls, struct GNUNET_IDENTITY_Ego *ego) |
523 | { | 487 | { |
524 | create_did_store (didd, ego); | 488 | // create_did_store (didd, ego); |
525 | } | 489 | } |
526 | 490 | ||
527 | /** | 491 | /** |
@@ -567,7 +531,7 @@ post_ego_iteration (void *cls) | |||
567 | } | 531 | } |
568 | else if (1 == get) | 532 | else if (1 == get) |
569 | { | 533 | { |
570 | resolve_did_document (); | 534 | resolve_did (); |
571 | } | 535 | } |
572 | else if (1 == remove_did) | 536 | else if (1 == remove_did) |
573 | { | 537 | { |
@@ -575,7 +539,7 @@ post_ego_iteration (void *cls) | |||
575 | } | 539 | } |
576 | else if (1 == create) | 540 | else if (1 == create) |
577 | { | 541 | { |
578 | create_did_document (); | 542 | create_did (); |
579 | } | 543 | } |
580 | else { | 544 | else { |
581 | // No Argument found | 545 | // No Argument found |
@@ -600,16 +564,18 @@ process_dids (void *cls, struct GNUNET_IDENTITY_Ego *ego, | |||
600 | GNUNET_SCHEDULER_add_now (&post_ego_iteration, NULL); | 564 | GNUNET_SCHEDULER_add_now (&post_ego_iteration, NULL); |
601 | return; | 565 | return; |
602 | } | 566 | } |
603 | if (NULL == name) | 567 | |
604 | return; | 568 | // if (NULL == name) |
605 | if ((1 == create) && | 569 | // return; |
606 | (0 == strncmp (name, egoname, strlen (egoname))) && | 570 | // if ((1 == create) && |
607 | (1 != ego_exists)) | 571 | // (0 == strncmp (name, egoname, strlen (egoname))) && |
608 | { | 572 | // (1 != ego_exists)) |
609 | fprintf (stderr, "%s already exists!\n", egoname); | 573 | // { |
610 | ego_exists = 1; | 574 | // fprintf (stderr, "%s already exists!\n", egoname); |
611 | return; | 575 | // ego_exists = 1; |
612 | } | 576 | // return; |
577 | // } | ||
578 | |||
613 | if (1 == show_all) | 579 | if (1 == show_all) |
614 | { | 580 | { |
615 | did_str = DID_identity_to_did (ego); | 581 | did_str = DID_identity_to_did (ego); |