aboutsummaryrefslogtreecommitdiff
path: root/src/reclaim/gnunet-did.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/reclaim/gnunet-did.c')
-rw-r--r--src/reclaim/gnunet-did.c46
1 files changed, 31 insertions, 15 deletions
diff --git a/src/reclaim/gnunet-did.c b/src/reclaim/gnunet-did.c
index 55eedfbd7..fb9a8e9a1 100644
--- a/src/reclaim/gnunet-did.c
+++ b/src/reclaim/gnunet-did.c
@@ -36,6 +36,7 @@
36#include "platform.h" 36#include "platform.h"
37#include "gnunet_util_lib.h" 37#include "gnunet_util_lib.h"
38#include "gnunet_namestore_service.h" 38#include "gnunet_namestore_service.h"
39#include "gnunet_identity_service.h"
39#include "gnunet_gns_service.h" 40#include "gnunet_gns_service.h"
40#include "gnunet_gnsrecord_lib.h" 41#include "gnunet_gnsrecord_lib.h"
41#include "did_helper.h" 42#include "did_helper.h"
@@ -157,7 +158,7 @@ cleanup (void *cls)
157// get_did_for_ego_lookup_cb (void *cls, struct GNUNET_IDENTITY_Ego *ego) 158// get_did_for_ego_lookup_cb (void *cls, struct GNUNET_IDENTITY_Ego *ego)
158// { 159// {
159// char *did_str; 160// char *did_str;
160// 161//
161// if (ego == NULL) 162// if (ego == NULL)
162// { 163// {
163// printf ("EGO not found\n"); 164// printf ("EGO not found\n");
@@ -166,9 +167,9 @@ cleanup (void *cls)
166// return; 167// return;
167// } 168// }
168// did_str = DID_identity_to_did (ego); 169// did_str = DID_identity_to_did (ego);
169// 170//
170// printf ("%s\n", did_str); 171// printf ("%s\n", did_str);
171// 172//
172// GNUNET_SCHEDULER_add_now (&cleanup, NULL); 173// GNUNET_SCHEDULER_add_now (&cleanup, NULL);
173// ret = 0; 174// ret = 0;
174// return; 175// return;
@@ -426,9 +427,34 @@ create_did_ego_lockup_cb (void *cls, struct GNUNET_IDENTITY_Ego *ego)
426 { 427 {
427 char *did = DID_identity_to_did (ego); 428 char *did = DID_identity_to_did (ego);
428 void *cls = malloc (strlen (did) + 1); 429 void *cls = malloc (strlen (did) + 1);
430 struct GNUNET_TIME_Relative expire_relative;
431
432 if (expire == NULL)
433 {
434 GNUNET_STRINGS_fancy_time_to_relative (
435 DID_DOCUMENT_DEFAULT_EXPIRATION_TIME, &expire_relative);
436 }
437 else if (GNUNET_OK != GNUNET_STRINGS_fancy_time_to_relative (expire,
438 &
439 expire_relative))
440 {
441 printf ("Failed to read given expiration time\n");
442 GNUNET_SCHEDULER_add_now (cleanup, NULL);
443 ret = 1;
444 return;
445 }
446
429 strcpy (cls, did); 447 strcpy (cls, did);
430 // TODO: Add DID_document argument 448 // TODO: Add DID_document argument
431 DID_create (ego, NULL, namestore_handle, create_did_cb, cls); 449 if (GNUNET_OK != DID_create (ego, NULL, &expire_relative, namestore_handle,
450 create_did_cb,
451 cls))
452 {
453 printf ("An error occured while creating the DID.\n");
454 ret = 1;
455 GNUNET_SCHEDULER_add_now (&cleanup, NULL);
456 return;
457 }
432 } 458 }
433} 459}
434 460
@@ -439,16 +465,6 @@ create_did_ego_lockup_cb (void *cls, struct GNUNET_IDENTITY_Ego *ego)
439static void 465static void
440create_did () 466create_did ()
441{ 467{
442 // Expire has to be set
443 if (expire == NULL)
444 {
445 printf (
446 "Set the Expiration-time argument to create a new DID(-Document)\n");
447 GNUNET_SCHEDULER_add_now (&cleanup, NULL);
448 ret = 1;
449 return;
450 }
451
452 // Ego name to be set 468 // Ego name to be set
453 if (egoname == NULL) 469 if (egoname == NULL)
454 { 470 {
@@ -515,7 +531,7 @@ static void
515post_ego_iteration (void *cls) 531post_ego_iteration (void *cls)
516{ 532{
517 // TODO: Check that only one argument is set 533 // TODO: Check that only one argument is set
518 534
519 if (1 == replace) 535 if (1 == replace)
520 { 536 {
521 replace_did_document (); 537 replace_did_document ();