Core functionality for GNUNET Decentralized Identifier. More...
#include "platform.h"
#include "gnunet_util_lib.h"
#include "gnunet_namestore_service.h"
#include "gnunet_gns_service.h"
#include "gnunet_gnsrecord_lib.h"
#include "gnunet_identity_service.h"
#include "did_helper.h"
#include "jansson.h"
Go to the source code of this file.
Macros | |
#define | DID_DOCUMENT_LABEL "didd" |
#define | DID_DOCUMENT_DEFAULT_EXPIRATION_TIME "365d" |
Typedefs | |
typedef void | DID_resolve_callback(enum GNUNET_GenericReturnValue status, const char *did_document, void *cls) |
Signature of a callback function that is called after a did has been resolved. More... | |
typedef void | DID_action_callback(enum GNUNET_GenericReturnValue status, void *cls) |
Signature of a callback function that is called after a did has been removed status = 0 if action was successful status = 1 if action failed. More... | |
Core functionality for GNUNET Decentralized Identifier.
Definition in file did_core.h.
#define DID_DOCUMENT_LABEL "didd" |
Definition at line 37 of file did_core.h.
#define DID_DOCUMENT_DEFAULT_EXPIRATION_TIME "365d" |
Definition at line 38 of file did_core.h.
typedef void DID_resolve_callback(enum GNUNET_GenericReturnValue status, const char *did_document, void *cls) |
Signature of a callback function that is called after a did has been resolved.
did_document contains an Error message if DID can not be resolved. Calls the given callback function with the resolved DID Document and the given closure. If the did can not be resolved did_document is NULL.
status | Equals GNUNET_OK if DID Document has been resolved |
did_document | resolved DID Document |
cls | previously given closure |
Definition at line 50 of file did_core.h.
typedef void DID_action_callback(enum GNUNET_GenericReturnValue status, void *cls) |
Signature of a callback function that is called after a did has been removed status = 0 if action was successful status = 1 if action failed.
status | status of the perfermormed action. |
cls | previously given closure |
Definition at line 62 of file did_core.h.
enum GNUNET_GenericReturnValue DID_resolve | ( | const char * | did, |
struct GNUNET_GNS_Handle * | gns_handle, | ||
DID_resolve_callback * | cont, | ||
void * | cls | ||
) |
Resolve a DID.
Calls the given callback function with the resolved DID Document and the given closure. If the did can not be resolved did_document is NULL.
did | DID that is resolved |
gns_handle | pointer to gns handle. |
cont | callback function |
cls | closure |
Calls the given callback function with the resolved DID Document and the given closure. If the did can not be resolved did_document is NULL.
did | DID that is resolve |
Definition at line 89 of file did_core.c.
References DID_resolve_return::cb, DID_resolve_return::cls, did, DID_did_to_pkey(), DID_DOCUMENT_LABEL, DID_resolve_gns_lookup_cb(), gns_handle, GNUNET_GNS_LO_DEFAULT, GNUNET_GNS_lookup(), GNUNET_GNSRECORD_TYPE_DID_DOCUMENT, GNUNET_malloc, GNUNET_NO, GNUNET_OK, and pkey.
Referenced by resolve_did().
enum GNUNET_GenericReturnValue DID_remove | ( | const struct GNUNET_IDENTITY_Ego * | ego, |
struct GNUNET_CONFIGURATION_Handle * | cfg_handle, | ||
struct GNUNET_NAMESTORE_Handle * | namestore_handle, | ||
DID_action_callback * | cont, | ||
void * | cls | ||
) |
Removes the DID Document from namestore.
Ego is not removed. Calls the callback function with status and the given closure.
ego | ego which controls the DID |
cfg_handle | pointer to configuration handle |
namestore_handle | pointer to namestore handle |
cont | callback function |
cls | closure |
enum GNUNET_GenericReturnValue DID_create | ( | const struct GNUNET_IDENTITY_Ego * | ego, |
const char * | did_document, | ||
const struct GNUNET_TIME_Relative * | expire_time, | ||
struct GNUNET_NAMESTORE_Handle * | namestore_handle, | ||
DID_action_callback * | cont, | ||
void * | cls | ||
) |
Creates a DID and saves DID Document in Namestore.
ego | ego for which the DID should be created. |
did_document | did_document that should be saved in namestore. If did_document==NULL -> Default DID document is created. |
expire_time | |
namestore_handle | |
cont | callback function |
cls | closure |
ego | ego for which the DID should be created. |
did_document | did_document that should be saved in namestore. If did_document==NULL -> Default DID document is created. |
namestore_handle | |
cont | callback function |
cls | closure |
Definition at line 226 of file did_core.c.
References DID_action_return::cb, DID_action_return::cls, DID_create_namestore_lookup_cb(), DID_create_namestore_lookup_closure::did_document, DID_DOCUMENT_LABEL, DID_create_namestore_lookup_closure::expire_time, GNUNET_GNSRECORD_TYPE_EDKEY, GNUNET_IDENTITY_ego_get_private_key(), GNUNET_IDENTITY_ego_get_public_key(), GNUNET_malloc, GNUNET_NAMESTORE_records_lookup(), GNUNET_NO, GNUNET_OK, namestore_handle, DID_create_namestore_lookup_closure::namestore_handle, pkey, and DID_create_namestore_lookup_closure::ret.
Referenced by create_did_ego_lockup_cb().
enum GNUNET_GenericReturnValue DID_replace | ( | struct GNUNET_IDENTITY_Ego * | ego, |
char * | did_document, | ||
const struct GNUNET_CONFIGURATION_Handle * | cfg_handle, | ||
struct GNUNET_IDENTITY_Handle * | identity_handle, | ||
struct GNUNET_NAMESTORE_Handle * | namestore_handle, | ||
DID_action_callback * | cont, | ||
void * | cls | ||
) |
Replace the DID Document of a DID.
ego | ego for which the DID Document should be replaced |
did_document | new DID Document |
cfg_handle | pointer to configuration handle |
identity_handle | pointer to configuration handle |
namestore_handle | pointer to namestore handle |
cont | callback function |
cls | closure |