42#define GNUNET_DID_DEFAULT_DID_DOCUMENT_EXPIRATION_TIME "1d"
159 const char *did_document,
164 printf (
"%s\n", did_document);
166 printf (
"An error occurred: %s\n", did_document);
183 printf (
"Set DID option to resolve DID\n");
191 printf (
"An error occurred while resoling the DID\n");
232 if (event->
cont != NULL)
234 event->cont (event->
cls);
247 printf (
"Something went wrong when deleting the DID Document\n");
290 printf (
"Remove requires an ego option\n");
297 event = malloc (
sizeof(*event));
324 printf (
"DID has been created.\n%s\n", (
char *)
cls);
330 printf (
"An error occurred while creating the DID.\n");
372 printf (
"Ego was not found. Creating new one.\n");
397 printf (
"Failed to read given expiration time\n");
404 strcpy (cls_tmp, did_tmp);
413 printf (
"An error occurred while creating the DID.\n");
434 printf (
"Set the Ego argument to create a new DID(-Document)\n");
489 "Set the DID Document and expiration time argument to replace the DID Document\n");
547 printf (
"%s:\n\t%s\n",
name, did_str);
556 printf (
"%s:\n\t%s\n",
name, did_str);
600main (
int argc,
char *
const argv[])
606 "Create a DID Document and display its DID"),
611 "Get the DID Document associated with the given DID"),
634 "The Decentralized Identity (DID)"),
640 "The DID Document to store in GNUNET"),
651 "The time until the DID Document is going to expire (e.g. 5d)"),
662 "Manage Decentralized Identities (DIDs)",
struct GNUNET_GETOPT_CommandLineOption GNUNET_GETOPT_OPTION_END
struct GNUNET_GETOPT_CommandLineOption options[]
enum GNUNET_GenericReturnValue DID_resolve(const char *did, struct GNUNET_GNS_Handle *gns_handle, DID_resolve_callback *cont, void *cls)
Resolve a DID.
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.
Core functionality for GNUNET Decentralized Identifier.
#define DID_DOCUMENT_DEFAULT_EXPIRATION_TIME
char * DID_identity_to_did(struct GNUNET_IDENTITY_Ego *ego)
Generate a DID for a given gnunet EGO.
#define gettext_noop(String)
static int replace
Replace DID Document Flag.
static struct GNUNET_GNS_Handle * gns_handle
static char * egoname
Ego Attribute String.
static char * didd
DID Document Attribute String.
static void replace_did_document_remove_cb(void *cls)
Replace a DID Document.
static int show_all
Show DID for Ego Flag.
static char * expire
DID Document expiration Date Attribute String.
static void remove_did_document_ego_lookup_cb(void *cls, struct GNUNET_IDENTITY_Ego *ego)
Callback called after the ego has been locked up.
static void cleanup(void *cls)
Disconnect and shutdown.
static void create_did_cb(enum GNUNET_GenericReturnValue status, void *cls)
Create a DID(-Document).
static int remove_did
Remove DID Document Flag.
static int ego_exists
Give ego exists.
static struct GNUNET_NAMESTORE_Handle * namestore_handle
static const struct GNUNET_CONFIGURATION_Handle * my_cfg
static int ret
return value
static void remove_did_document_namestore_cb(void *cls, enum GNUNET_ErrorCode ec)
Implements the GNUNET_NAMESTORE_ContinuationWithStatus Calls the callback function and cls in the eve...
static void post_ego_iteration(void *cls)
static void remove_did_document(remove_did_document_callback cont, void *cls)
Remove a DID Document.
static void replace_did_document_ego_lookup_cb(void *cls, struct GNUNET_IDENTITY_Ego *ego)
Replace a DID Document.
static void run(void *cls, char *const *args, const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *c)
void(* remove_did_document_callback)(void *cls)
Signature of a callback function that is called after a did has been removed.
static int show
Show DID for Ego Flag.
static int get
Get DID Documement for DID Flag.
static int create
Create DID Document Flag.
static void resolve_did()
Resolve a DID given by the user.
static void replace_did_document()
Replace a DID Document.
static void create_did_ego_create_cb(void *cls, const struct GNUNET_CRYPTO_PrivateKey *pk, enum GNUNET_ErrorCode ec)
Create a DID(-Document) - Called after a new Identity has been created.
static struct GNUNET_IDENTITY_Handle * identity_handle
static void print_did_document(enum GNUNET_GenericReturnValue status, const char *did_document, void *cls)
GNS lookup callback.
static void process_dids(void *cls, struct GNUNET_IDENTITY_Ego *ego, void **ctx, const char *name)
static void create_did()
Create a DID(-Document).
static char * did
DID Attribute String.
static void create_did_ego_lockup_cb(void *cls, struct GNUNET_IDENTITY_Ego *ego)
Create a DID(-Document).
int main(int argc, char *const argv[])
static struct GNUNET_FS_Handle * ctx
struct GNUNET_CRYPTO_PrivateKey pk
Private key from command line option, or NULL.
static char * name
Name (label) of the records to list.
static int status
The program status; 0 for success.
API that can be used to manipulate GNS record data.
Identity service; implements identity management for GNUnet.
API that can be used to store naming information on a GNUnet node;.
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.
void GNUNET_GNS_disconnect(struct GNUNET_GNS_Handle *handle)
Shutdown connection with the GNS service.
struct GNUNET_GNS_Handle * GNUNET_GNS_connect(const struct GNUNET_CONFIGURATION_Handle *cfg)
Initialize the connection with the GNS service.
#define GNUNET_GNS_EMPTY_LABEL_AT
String we use to indicate an empty label (top-level entry in the zone).
struct GNUNET_IDENTITY_Operation * GNUNET_IDENTITY_create(struct GNUNET_IDENTITY_Handle *id, const char *name, const struct GNUNET_CRYPTO_PrivateKey *privkey, enum GNUNET_CRYPTO_KeyType ktype, GNUNET_IDENTITY_CreateContinuation cont, void *cont_cls)
Create a new ego with the given name.
const struct GNUNET_CRYPTO_PrivateKey * GNUNET_IDENTITY_ego_get_private_key(const struct GNUNET_IDENTITY_Ego *ego)
Obtain the ECC key associated with a ego.
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.
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.
void GNUNET_IDENTITY_disconnect(struct GNUNET_IDENTITY_Handle *h)
Disconnect from identity service.
GNUNET_GenericReturnValue
Named constants for return values.
@ GNUNET_PUBLIC_KEY_TYPE_EDDSA
EDDSA identity.
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
#define GNUNET_malloc(size)
Wrapper around malloc.
#define GNUNET_free(ptr)
Wrapper around free.
struct GNUNET_NAMESTORE_QueueEntry * GNUNET_NAMESTORE_record_set_store(struct GNUNET_NAMESTORE_Handle *h, const struct GNUNET_CRYPTO_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.
void GNUNET_NAMESTORE_disconnect(struct GNUNET_NAMESTORE_Handle *h)
Disconnect from the namestore service (and free associated resources).
struct GNUNET_NAMESTORE_Handle * GNUNET_NAMESTORE_connect(const struct GNUNET_CONFIGURATION_Handle *cfg)
Connect to the namestore service.
const struct GNUNET_OS_ProjectData * GNUNET_OS_project_data_gnunet(void)
Return default project data used by 'libgnunetutil' for GNUnet.
enum GNUNET_GenericReturnValue GNUNET_PROGRAM_run(const struct GNUNET_OS_ProjectData *pd, 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,...
void GNUNET_SCHEDULER_shutdown(void)
Request the shutdown of a scheduler.
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.
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.
const char * GNUNET_ErrorCode_get_hint(enum GNUNET_ErrorCode ec)
Returns a hint for a given error code.
GNUNET_ErrorCode
Taler error codes.
@ GNUNET_EC_NONE
No error (success).
A Structure containing a cont and cls.
remove_did_document_callback cont
A private key for an identity as per LSD0001.
Definition of a command line option.
Connection to the GNS service.
Connection to the NAMESTORE service.
Time for relative time used by GNUnet, in microseconds.