GNUnet  0.11.x
gnunet-did.c
Go to the documentation of this file.
1 /*
2  This file is part of GNUnet.
3  Copyright (C) 2012-2022 GNUnet e.V.
4 
5  GNUnet is free software: you can redistribute it and/or modify it
6  under the terms of the GNU Affero General Public License as published
7  by the Free Software Foundation, either version 3 of the License,
8  or (at your option) any later version.
9 
10  GNUnet is distributed in the hope that it will be useful, but
11  WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  Affero General Public License for more details.
14 
15  You should have received a copy of the GNU Affero General Public License
16  along with this program. If not, see <http://www.gnu.org/licenses/>.
17 
18  SPDX-License-Identifier: AGPL3.0-or-later
19  */
20 
36 #include "platform.h"
37 #include "gnunet_util_lib.h"
39 #include "gnunet_gns_service.h"
40 #include "gnunet_gnsrecord_lib.h"
41 #include "jansson.h"
42 #include "did.h"
43 
44 #define GNUNET_DID_DEFAULT_DID_DOCUMENT_EXPIRATION_TIME "1d"
45 
49 static int ret;
50 
54 static int replace;
55 
59 static int remove_did;
60 
64 static int get;
65 
69 static int create;
70 
74 static int show;
75 
79 static int show_all;
80 
84 static char *did;
85 
89 static char *didd;
90 
94 static char *egoname;
95 
99 static char *expire;
100 
101 /*
102  * Handle to the GNS service
103  */
105 
106 /*
107  * Handle to the NAMESTORE service
108  */
110 
111 /*
112  * Handle to the IDENTITY service
113  */
115 
116 
117 /*
118  * The configuration
119  */
120 const static struct GNUNET_CONFIGURATION_Handle *my_cfg;
121 
125 static int ego_exists = 0;
126 
131 static void
132 cleanup (void *cls)
133 {
134  if (NULL != gns_handle)
136  if (NULL != namestore_handle)
138  if (NULL != identity_handle)
140 
141  GNUNET_free (did);
142  GNUNET_free (didd);
145 
147 }
148 
155 static void
157 {
158  char *did_str;
159 
160  if (ego == NULL)
161  {
162  printf ("EGO not found\n");
164  ret = 1;
165  return;
166  }
167  did_str = DID_ego_to_did (ego);
168 
169  printf ("%s\n", did_str);
170 
172  ret = 0;
173  return;
174 }
175 
180 static void
182 {
183  if (egoname != NULL)
184  {
186  egoname,
188  NULL);
189  }
190  else {
191  printf ("Set the EGO argument to get the DID for a given EGO\n");
193  ret = 1;
194  return;
195  }
196 }
197 
198 
204 static void
206 {
208  {
209  fprintf (stderr, _("Invalid DID `%s'\n"), did);
211  ret = 1;
212  return;
213  }
214 }
215 
224 static void
226  void *cls,
227  uint32_t rd_count,
228  const struct GNUNET_GNSRECORD_Data *rd)
229 {
230  /*
231  * FIXME-MSC: The user may decide to put other records here.
232  * In general I am fine with the constraint here, but not when
233  * we move it to "@"
234  */
235  if (rd_count != 1)
236  {
237  printf ("An ego should only have one DID Document\n");
239  ret = 1;
240  return;
241  }
242 
243  if (rd[0].record_type == GNUNET_DNSPARSER_TYPE_TXT)
244  {
245  printf ("%s\n", (char *) rd[0].data);
246  }
247  else {
248  printf ("DID Document is not a TXT record\n");
249  }
250 
252  ret = 0;
253  return;
254 }
255 
259 static void
261 {
263 
264  if (did == NULL)
265  {
266  printf ("Set DID option to resolve DID\n");
268  ret = 1;
269  return;
270  }
271 
273 
276 }
277 
278 
282 typedef void
283 (*remove_did_document_callback) (void *cls);
284 
289 struct Event
290 {
292  void *cls;
293 };
294 
303 static void
304 remove_did_document_namestore_cb (void *cls, int32_t success, const char *emgs)
305 {
306  struct Event *event;
307 
308  if (success != GNUNET_SYSERR)
309  {
310  event = (struct Event *) cls;
311 
312  if (event->cont != NULL)
313  {
314  event->cont (event->cls);
315  free (event);
316  }
317  else {
318  free (event);
320  ret = 0;
321  return;
322  }
323  } else {
324  printf ("Something went wrong when deleting the DID Document\n");
325 
326  if (emgs != NULL)
327  {
328  printf ("%s\n", emgs);
329  }
330 
332  ret = 0;
333  return;
334  }
335 }
336 
343 static void
345 {
346  const struct GNUNET_IDENTITY_PrivateKey *skey =
348 
350  skey,
352  0,
353  NULL,
355  cls);
356 }
357 
361 static void
363 {
364  struct Event *event;
365 
366  if (egoname == NULL)
367  {
368  printf ("Remove requieres an ego option\n");
370  ret = 1;
371  return;
372  }
373  else {
374  event = malloc (sizeof(*event));
375  event->cont = cont;
376  event->cls = cls;
377 
379  egoname,
381  (void *) event);
382  }
383 }
384 
385 
392 char *
394 {
395  /* FIXME-MSC: I would prefer constants instead of magic numbers */
396  char *pkey_str; // Convert public key to string
397  char did_str[71]; // 58 + 12 + 1 = 71
398  char *didd_str;
399  char verify_id_str[77]; // did_str len + "#key-1" = 71 + 6 = 77
400  char *pkey_multibase_str;
401 
402  /* FIXME-MSC: This screams for a GNUNET_DID_identity_key_to_string() */
403  char *b64;
404  char pkx[34];
405  pkx[0] = 0xed;
406  pkx[1] = 0x01;
407  memcpy (pkx + 2, &(pkey.eddsa_key), sizeof(pkey.eddsa_key));
408  GNUNET_STRINGS_base64_encode (pkx, sizeof(pkx), &b64);
409 
410  GNUNET_asprintf (&pkey_multibase_str, "u%s", b64);
411 
412  json_t *didd;
413  json_t *did_json;
414  json_t *pkey_multibase_json;
415  json_t *context_json;
416  json_t *context_1_json;
417  json_t *context_2_json;
418  json_t *verify_json;
419  json_t *verify_1_json;
420  json_t *verify_1_type_json;
421  json_t *verify_1_id_json;
422  json_t *verify_relative_ref_json;
423  json_t *auth_json;
424  json_t *assert_json;
425 
426  /* FIXME-MSC: This screams for GNUNET_DID_identity_to_did() */
427  pkey_str = GNUNET_IDENTITY_public_key_to_string (&pkey); // Convert public key to string
428  sprintf (did_str, "did:reclaim:%s", pkey_str); // Convert the public key to a DID str
429  sprintf (verify_id_str, "did:reclaim:%s#key-1", pkey_str); // Convert the public key to a DID str
430 
431  // sprintf(pkey_multibase_str, "V%s", pkey_str); // Convert the public key to MultiBase data format
432 
433  /* FIXME-MSC: This is effectively creating a DID Document default template for
434  * the initial document.
435  * Maybe this can be refactored to generate such a template for an identity?
436  * Even if higher layers add/modify it, there should probably still be a
437  * GNUNET_DID_document_template_from_identity()
438  */
439  // Create Json Strings
440  did_json = json_string (did_str);
441  pkey_multibase_json = json_string (pkey_multibase_str);
442 
443  context_1_json = json_string ("https://www.w3.org/ns/did/v1");
444  context_2_json = json_string (
445  "https://w3id.org/security/suites/ed25519-2020/v1");
446  verify_1_id_json = json_string (verify_id_str);
447  verify_1_type_json = json_string ("Ed25519VerificationKey2020");
448 
449  // Add a relative DID URL to reference a verifiation method
450  // https://www.w3.org/TR/did-core/#relative-did-urls`
451  verify_relative_ref_json = json_string ("#key-1");
452 
453  // Create DID Document
454  didd = json_object ();
455 
456  // Add context
457  context_json = json_array ();
458  json_array_append (context_json, context_1_json);
459  json_array_append (context_json, context_2_json);
460  json_object_set (didd, "@context", context_json);
461 
462  // Add id
463  json_object_set (didd, "id", did_json);
464 
465  // Add verification method
466  verify_json = json_array ();
467  verify_1_json = json_object ();
468  json_object_set (verify_1_json, "id", verify_1_id_json);
469  json_object_set (verify_1_json, "type", verify_1_type_json);
470  json_object_set (verify_1_json, "controller", did_json);
471  json_object_set (verify_1_json, "publicKeyMultiBase", pkey_multibase_json);
472  json_array_append (verify_json, verify_1_json);
473  json_object_set (didd, "verificationMethod", verify_json);
474 
475  // Add authentication method
476  auth_json = json_array ();
477  json_array_append (auth_json, verify_relative_ref_json);
478  json_object_set (didd, "authentication", auth_json);
479 
480  // Add assertion method to issue a Verifiable Credential
481  assert_json = json_array ();
482  json_array_append (assert_json, verify_relative_ref_json);
483  json_object_set (didd, "assertionMethod", assert_json);
484 
485  // Encode DID Document as JSON string
486  didd_str = json_dumps (didd, JSON_INDENT (2));
487  if (didd_str == NULL)
488  {
489  printf ("DID Document could not be encoded");
491  ret = 1;
492  return NULL;
493  }
494 
495  // TODO: MORE FREEEEEEEE
496  /* FIXME-MSC: json_t's are free'd using "json_decref". Also json_t usually
497  * keeps a reference counter. Check jansson docs for how to use it.
498  * Also: Use valgrind to find leaks.
499  */
500  free (pkey_multibase_str);
501  free (b64);
502 
503  free (didd);
504  free (did_json);
505  free (pkey_multibase_json);
506  free (context_json);
507  free (context_1_json);
508  free (context_2_json);
509  free (verify_json);
510  free (verify_1_json);
511  free (verify_1_type_json);
512  free (verify_1_id_json);
513  free (auth_json);
514  free (assert_json);
515  free (verify_relative_ref_json);
516 
517  return didd_str;
518 }
519 
524 static void
525 create_did_store_cb (void *cls, int32_t success, const char *emsg)
526 {
528  ret = 0;
529  return;
530 }
531 
538 static void
539 create_did_store (char *didd_str, struct GNUNET_IDENTITY_Ego *ego)
540 {
541 
542  struct GNUNET_TIME_Relative expire_time;
543  struct GNUNET_GNSRECORD_Data record_data;
544  const struct GNUNET_IDENTITY_PrivateKey *skey;
545 
547  expire :
549  &expire_time) == GNUNET_OK)
550  {
551  record_data.data = didd_str;
552  record_data.expiration_time = expire_time.rel_value_us;
553  record_data.data_size = strlen (didd_str) + 1;
554  record_data.record_type = GNUNET_GNSRECORD_typename_to_number ("TXT"),
556 
558 
560  skey,
562  1, //FIXME what if GNUNET_GNS_EMPTY_LABEL_AT has records
563  &record_data,
565  NULL);
566  }
567  else {
568  printf ("Failed to read given expiration time\n");
570  ret = 1;
571  return;
572  }
573 }
574 
581 static void
583 {
585  char *didd_str;
586 
587  if (ego == NULL)
588  {
589  printf ("EGO not found\n");
591  ret = 1;
592  return;
593  }
594 
596 
597  if (ntohl (pkey.type) != GNUNET_GNSRECORD_TYPE_EDKEY)
598  {
599  printf ("The EGO has to have an EDDSA key pair\n");
601  ret = 1;
602  return;
603  }
604 
605  if (didd != NULL)
606  {
607  printf (
608  "DID Docuement is read from \"did-document\" argument (EXPERIMENTAL)\n");
609  didd_str = strdup (didd);
610  }
611  else {
612  // Generate DID Docuement from public key
613  didd_str = create_did_generate (pkey);
614  }
615 
616  // Print DID Document to stdout
617  printf ("%s\n", didd_str);
618 
619  // Store the DID Document
620  create_did_store (didd_str, ego);
621 
622  // Save DID Document String to GNS
623  free (didd_str);
624 }
625 
629 static void
631  const struct GNUNET_IDENTITY_PrivateKey *pk,
632  const char *emsg)
633 {
634 
635  if (emsg != NULL)
636  {
637  printf ("%s\n", emsg);
639  ret = 1;
640  return;
641  }
642 
644  egoname,
646  NULL);
647 }
648 
653 static void
655 {
656  if ((egoname != NULL) && (expire != NULL))
657  {
659  egoname,
660  NULL,
663  egoname);
664  }
665  else {
666  printf (
667  "Set the EGO and the Expiration-time argument to create a new DID(-Document)\n");
669  ret = 1;
670  return;
671  }
672 }
673 
674 
681 static void
683 {
684  create_did_store (didd, ego);
685 }
686 
692 static void
694 {
696  egoname,
698  NULL);
699 }
700 
705 static void
707 {
708  if ((didd != NULL) && (expire != NULL))
709  {
711  }
712  else {
713  printf (
714  "Set the DID Document and expiration time argument to replace the DID Document\n");
716  ret = 1;
717  return;
718  }
719 }
720 
721 static void
723 {
724  if (1 == replace)
725  {
727  }
728  else if (1 == get)
729  {
731  }
732  else if (1 == remove_did)
733  {
734  remove_did_document (NULL, NULL);
735  }
736  else if (1 == create)
737  {
739  }
740  else {
741  // No Argument found
743  return;
744  }
745 }
746 
747 static void
748 process_dids (void *cls, struct GNUNET_IDENTITY_Ego *ego,
749  void **ctx, const char*name)
750 {
751  char *did_str;
752 
753  if (ego == NULL)
754  {
755  if (1 == ego_exists)
756  {
758  return;
759  }
761  return;
762  }
763  if (NULL == name)
764  return;
765  if ((1 == create) &&
766  (0 == strncmp (name, egoname, strlen (egoname))) &&
767  (1 != ego_exists))
768  {
769  fprintf(stderr, "%s already exists!\n", egoname);
770  ego_exists = 1;
771  return;
772  }
773  if (1 == show_all)
774  {
775  did_str = DID_ego_to_did (ego);
776  printf ("%s\n", did_str);
777  GNUNET_free (did_str);
778  return;
779  }
780  if (1 == show)
781  {
782  if (0 == strncmp (name, egoname, strlen (egoname)))
783  {
784  did_str = DID_ego_to_did (ego);
785  printf ("%s\n", did_str);
786  GNUNET_free (did_str);
787  return;
788  }
789  }
790 }
791 
792 
793 
794 static void
795 run (void *cls,
796  char *const *args,
797  const char *cfgfile,
798  const struct GNUNET_CONFIGURATION_Handle *c)
799 {
802  my_cfg = c;
803 
804  // check if GNS_handle could connect
805  if (gns_handle == NULL)
806  {
807  ret = 1;
808  return;
809  }
810 
811  // check if NAMESTORE_handle could connect
812  if (namestore_handle == NULL)
813  {
815  ret = 1;
816  return;
817  }
818 
820  if (identity_handle == NULL)
821  {
823  ret = 1;
824  return;
825  }
826 }
827 
828 int
829 main (int argc, char *const argv[])
830 {
833  "create",
834  gettext_noop (
835  "Create a DID Document and display its DID"),
836  &create),
838  "get",
839  gettext_noop (
840  "Get the DID Document associated with the given DID"),
841  &get),
843  "show",
844  gettext_noop ("Show the DID for a given ego"),
845  &show),
847  "remove",
848  gettext_noop (
849  "Remove the DID"),
850  &remove_did),
852  "replace",
853  gettext_noop ("Replace the DID Document."),
854  &replace),
856  "--show-all",
857  gettext_noop ("Replace the DID Document."),
858  &show_all),
860  "did",
861  "DID",
862  gettext_noop (
863  "The Decentralized Identity (DID)"),
864  &did),
866  "--did-document",
867  "JSON",
868  gettext_noop (
869  "The DID Document to store in GNUNET"),
870  &didd),
872  "ego",
873  "EGO",
874  gettext_noop ("The name of the EGO"),
875  &egoname),
877  "expiration-time",
878  "TIME",
879  gettext_noop (
880  "The time until the DID Document is going to expire (e.g. 5d)"),
881  &expire),
883  };
884 
885  if (GNUNET_OK != GNUNET_PROGRAM_run (argc,
886  argv,
887  "gnunet-did",
888  _ (
889  "Manage Decentralized Identities (DIDs)"),
890  options,
891  &run,
892  NULL))
893  return 1;
894  else
895  return ret;
896 }
struct GNUNET_GETOPT_CommandLineOption GNUNET_GETOPT_OPTION_END
Definition: 002.c:13
struct GNUNET_GETOPT_CommandLineOption options[]
Definition: 002.c:5
char * DID_ego_to_did(struct GNUNET_IDENTITY_Ego *ego)
Create a DID string from an ego in the format did:reclaim:<pubkey>
Definition: did_misc.c:34
enum GNUNET_GenericReturnValue DID_public_key_from_did(const char *did, struct GNUNET_IDENTITY_PublicKey *pk)
Extract the public key from a DID in the format did:reclaim:<pubkey>
Definition: did_misc.c:53
#define gettext_noop(String)
Definition: gettext.h:69
#define GNUNET_GNSRECORD_TYPE_EDKEY
Record type for EDKEY zone delegations.
static int replace
Replace DID Document Flag.
Definition: gnunet-did.c:54
static void create_did_document()
Create a did document.
Definition: gnunet-did.c:654
static struct GNUNET_GNS_Handle * gns_handle
Definition: gnunet-did.c:104
static char * egoname
Ego Attribut String.
Definition: gnunet-did.c:94
static char * didd
DID Document Attribut String.
Definition: gnunet-did.c:89
static void remove_did_document_namestore_cb(void *cls, int32_t success, const char *emgs)
Implements the GNUNET_NAMESTORE_ContinuationWithStatus Calls the callback function and cls in the eve...
Definition: gnunet-did.c:304
static void replace_did_document_remove_cb(void *cls)
Replace a DID Document.
Definition: gnunet-did.c:693
char * create_did_generate(struct GNUNET_IDENTITY_PublicKey pkey)
Create a did generate did object.
Definition: gnunet-did.c:393
static int show_all
Show DID for Ego Flag.
Definition: gnunet-did.c:79
static char * expire
DID Document expiration Date Attribut String.
Definition: gnunet-did.c:99
static void remove_did_document_ego_lookup_cb(void *cls, struct GNUNET_IDENTITY_Ego *ego)
Callback called after the ego has been locked up.
Definition: gnunet-did.c:344
static void cleanup(void *cls)
Disconnect and shutdown.
Definition: gnunet-did.c:132
static int remove_did
Remove DID Document Flag.
Definition: gnunet-did.c:59
static int ego_exists
Give ego exists.
Definition: gnunet-did.c:125
static void get_pkey_from_attr_did(struct GNUNET_IDENTITY_PublicKey *pkey)
Get the public key from did attribute given by the user.
Definition: gnunet-did.c:205
static struct GNUNET_NAMESTORE_Handle * namestore_handle
Definition: gnunet-did.c:109
static const struct GNUNET_CONFIGURATION_Handle * my_cfg
Definition: gnunet-did.c:120
static int ret
return value
Definition: gnunet-did.c:49
static void post_ego_iteration(void *cls)
Definition: gnunet-did.c:722
static void print_did_document(void *cls, uint32_t rd_count, const struct GNUNET_GNSRECORD_Data *rd)
GNS lookup callback.
Definition: gnunet-did.c:225
static void remove_did_document(remove_did_document_callback cont, void *cls)
Remove a DID Document.
Definition: gnunet-did.c:362
static void replace_did_document_ego_lookup_cb(void *cls, struct GNUNET_IDENTITY_Ego *ego)
Replace a DID Docuemnt.
Definition: gnunet-did.c:682
static void run(void *cls, char *const *args, const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *c)
Definition: gnunet-did.c:795
void(* remove_did_document_callback)(void *cls)
Signature of a callback function that is called after a did has been removed.
Definition: gnunet-did.c:283
static int show
Show DID for Ego Flag.
Definition: gnunet-did.c:74
static void resolve_did_document()
Resolve a DID given by the user.
Definition: gnunet-did.c:260
static int get
Get DID Documement for DID Flag.
Definition: gnunet-did.c:64
static int create
Create DID Document Flag.
Definition: gnunet-did.c:69
static void replace_did_document()
Replace a DID Docuemnt.
Definition: gnunet-did.c:706
static void create_did_store_cb(void *cls, int32_t success, const char *emsg)
Create a DID.
Definition: gnunet-did.c:525
static void get_did_for_ego_lookup_cb(void *cls, struct GNUNET_IDENTITY_Ego *ego)
Callback for ego loockup of get_did_for_ego()
Definition: gnunet-did.c:156
static void create_did_store(char *didd_str, struct GNUNET_IDENTITY_Ego *ego)
Create a did.
Definition: gnunet-did.c:539
static struct GNUNET_IDENTITY_Handle * identity_handle
Definition: gnunet-did.c:114
static void process_dids(void *cls, struct GNUNET_IDENTITY_Ego *ego, void **ctx, const char *name)
Definition: gnunet-did.c:748
static void create_did_document_ego_create_cb(void *cls, const struct GNUNET_IDENTITY_PrivateKey *pk, const char *emsg)
Create a did document - Create a new identity first.
Definition: gnunet-did.c:630
#define GNUNET_DID_DEFAULT_DID_DOCUMENT_EXPIRATION_TIME
Definition: gnunet-did.c:44
static char * did
DID Attribut String.
Definition: gnunet-did.c:84
static void get_did_for_ego()
Get the DID for a given EGO.
Definition: gnunet-did.c:181
static void create_did_ego_lockup_cb(void *cls, struct GNUNET_IDENTITY_Ego *ego)
Create a did ego lockup cb.
Definition: gnunet-did.c:582
int main(int argc, char *const argv[])
Definition: gnunet-did.c:829
uint32_t data
The data value.
struct GNUNET_IDENTITY_PrivateKey pk
Private key from command line option, or NULL.
static char * pkey
Public key of the zone to look in, in ASCII.
static struct GNUNET_DNSSTUB_Context * ctx
Context for DNS resolution.
@ GNUNET_OK
Definition: gnunet_common.h:95
@ GNUNET_SYSERR
Definition: gnunet_common.h:93
#define GNUNET_DNSPARSER_TYPE_TXT
struct GNUNET_GETOPT_CommandLineOption GNUNET_GETOPT_option_flag(char shortName, const char *name, const char *description, int *val)
Allow user to specify a flag (which internally means setting an integer to 1/GNUNET_YES/GNUNET_OK.
struct GNUNET_GETOPT_CommandLineOption GNUNET_GETOPT_option_string(char shortName, const char *name, const char *argumentHelp, const char *description, char **str)
Allow user to specify a string.
struct GNUNET_GNS_LookupRequest * GNUNET_GNS_lookup(struct GNUNET_GNS_Handle *handle, const char *name, const struct GNUNET_IDENTITY_PublicKey *zone, uint32_t type, enum GNUNET_GNS_LocalOptions options, GNUNET_GNS_LookupResultProcessor proc, void *proc_cls)
Perform an asynchronous lookup operation on the GNS.
Definition: gns_api.c:412
void GNUNET_GNS_disconnect(struct GNUNET_GNS_Handle *handle)
Shutdown connection with the GNS service.
Definition: gns_api.c:290
struct GNUNET_GNS_Handle * GNUNET_GNS_connect(const struct GNUNET_CONFIGURATION_Handle *cfg)
Initialize the connection with the GNS service.
Definition: gns_api.c:268
#define GNUNET_GNS_EMPTY_LABEL_AT
String we use to indicate an empty label (top-level entry in the zone).
@ GNUNET_GNS_LO_DEFAULT
Defaults, look in cache, then in DHT.
uint32_t GNUNET_GNSRECORD_typename_to_number(const char *dns_typename)
Convert a type name (e.g "AAAA") to the corresponding number.
Definition: gnsrecord.c:217
@ GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION
This expiration time of the record is a relative time (not an absolute time).
const struct GNUNET_IDENTITY_PrivateKey * GNUNET_IDENTITY_ego_get_private_key(const struct GNUNET_IDENTITY_Ego *ego)
Obtain the ECC key associated with a ego.
Definition: identity_api.c:639
struct GNUNET_IDENTITY_Operation * GNUNET_IDENTITY_create(struct GNUNET_IDENTITY_Handle *h, const char *name, const struct GNUNET_IDENTITY_PrivateKey *privkey, enum GNUNET_IDENTITY_KeyType ktype, GNUNET_IDENTITY_CreateContinuation cont, void *cont_cls)
Create a new ego with the given name.
Definition: identity_api.c:757
void GNUNET_IDENTITY_ego_get_public_key(struct GNUNET_IDENTITY_Ego *ego, struct GNUNET_IDENTITY_PublicKey *pk)
Get the identifier (public key) of an ego.
Definition: identity_api.c:652
char * GNUNET_IDENTITY_public_key_to_string(const struct GNUNET_IDENTITY_PublicKey *key)
Creates a (Base32) string representation of the public key.
struct GNUNET_IDENTITY_Handle * GNUNET_IDENTITY_connect(const struct GNUNET_CONFIGURATION_Handle *cfg, GNUNET_IDENTITY_Callback cb, void *cb_cls)
Connect to the identity service.
Definition: identity_api.c:610
void GNUNET_IDENTITY_disconnect(struct GNUNET_IDENTITY_Handle *h)
Disconnect from identity service.
Definition: identity_api.c:921
struct GNUNET_IDENTITY_EgoLookup * GNUNET_IDENTITY_ego_lookup(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *name, GNUNET_IDENTITY_EgoCallback cb, void *cb_cls)
Lookup an ego by name.
@ GNUNET_IDENTITY_TYPE_EDDSA
EDDSA identity.
int int GNUNET_asprintf(char **buf, const char *format,...) __attribute__((format(printf
Like asprintf, just portable.
#define GNUNET_free(ptr)
Wrapper around free.
void GNUNET_NAMESTORE_disconnect(struct GNUNET_NAMESTORE_Handle *h)
Disconnect from the namestore service (and free associated resources).
struct GNUNET_NAMESTORE_QueueEntry * GNUNET_NAMESTORE_records_store(struct GNUNET_NAMESTORE_Handle *h, const struct GNUNET_IDENTITY_PrivateKey *pkey, const char *label, unsigned int rd_count, const struct GNUNET_GNSRECORD_Data *rd, GNUNET_NAMESTORE_ContinuationWithStatus cont, void *cont_cls)
Store an item in the namestore.
struct GNUNET_NAMESTORE_Handle * GNUNET_NAMESTORE_connect(const struct GNUNET_CONFIGURATION_Handle *cfg)
Connect to the namestore service.
enum GNUNET_GenericReturnValue GNUNET_PROGRAM_run(int argc, char *const *argv, const char *binaryName, const char *binaryHelp, const struct GNUNET_GETOPT_CommandLineOption *options, GNUNET_PROGRAM_Main task, void *task_cls)
Run a standard GNUnet command startup sequence (initialize loggers and configuration,...
Definition: program.c:399
void GNUNET_SCHEDULER_shutdown(void)
Request the shutdown of a scheduler.
Definition: scheduler.c:531
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_now(GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run as soon as possible.
Definition: scheduler.c:1296
enum GNUNET_GenericReturnValue GNUNET_STRINGS_fancy_time_to_relative(const char *fancy_time, struct GNUNET_TIME_Relative *rtime)
Convert a given fancy human-readable time to our internal representation.
Definition: strings.c:261
size_t GNUNET_STRINGS_base64_encode(const void *in, size_t len, char **output)
Encode into Base64.
Definition: strings.c:1598
#define _(String)
GNU gettext support macro.
Definition: platform.h:177
const char * name
A Structure containing a cont and cls.
Definition: gnunet-did.c:290
remove_did_document_callback cont
Definition: gnunet-did.c:291
void * cls
Definition: gnunet-did.c:292
Definition of a command line option.
uint32_t record_type
Type of the GNS/DNS record.
const void * data
Binary value stored in the DNS record.
size_t data_size
Number of bytes in data.
enum GNUNET_GNSRECORD_Flags flags
Flags for the record.
uint64_t expiration_time
Expiration time for the DNS record.
Connection to the GNS service.
Definition: gns_api.h:36
Handle for an ego.
Definition: identity.h:37
Handle for the service.
Definition: identity_api.c:96
A private key for an identity as per LSD0001.
An identity key as per LSD0001.
Connection to the NAMESTORE service.
Time for relative time used by GNUnet, in microseconds.
uint64_t rel_value_us
The actual value.