#include "platform.h"
#include "gnunet_util_lib.h"
#include "gnunet_namestore_service.h"
#include "gnunet_identity_service.h"
#include "gnunet_gns_service.h"
#include "gnunet_gnsrecord_lib.h"
#include "did_helper.h"
#include "did_core.h"
#include "jansson.h"
Go to the source code of this file.
Data Structures | |
struct | Event |
A Structure containing a cont and cls. More... | |
Macros | |
#define | GNUNET_DID_DEFAULT_DID_DOCUMENT_EXPIRATION_TIME "1d" |
Typedefs | |
typedef void(* | remove_did_document_callback) (void *cls) |
Signature of a callback function that is called after a did has been removed. More... | |
Functions | |
static void | cleanup (void *cls) |
Disconnect and shutdown. More... | |
static void | print_did_document (enum GNUNET_GenericReturnValue status, char *did_document, void *cls) |
GNS lookup callback. More... | |
static void | resolve_did () |
Resolve a DID given by the user. More... | |
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 event struct. More... | |
static void | remove_did_document_ego_lookup_cb (void *cls, struct GNUNET_IDENTITY_Ego *ego) |
Callback called after the ego has been locked up. More... | |
static void | remove_did_document (remove_did_document_callback cont, void *cls) |
Remove a DID Document. More... | |
static void | create_did_ego_lockup_cb () |
static void | create_did_cb (enum GNUNET_GenericReturnValue status, void *cls) |
Create a DID(-Document). More... | |
static void | create_did_ego_create_cb (void *cls, const struct GNUNET_IDENTITY_PrivateKey *pk, enum GNUNET_ErrorCode ec) |
Create a DID(-Document) - Called after a new Identity has been created. More... | |
static void | create_did_ego_lockup_cb (void *cls, struct GNUNET_IDENTITY_Ego *ego) |
Create a DID(-Document). More... | |
static void | create_did () |
Create a DID(-Document). More... | |
static void | replace_did_document_ego_lookup_cb (void *cls, struct GNUNET_IDENTITY_Ego *ego) |
Replace a DID Docuemnt. More... | |
static void | replace_did_document_remove_cb (void *cls) |
Replace a DID Document. More... | |
static void | replace_did_document () |
Replace a DID Docuemnt. More... | |
static void | post_ego_iteration (void *cls) |
static void | process_dids (void *cls, struct GNUNET_IDENTITY_Ego *ego, void **ctx, const char *name) |
static void | run (void *cls, char *const *args, const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *c) |
int | main (int argc, char *const argv[]) |
Variables | |
static int | ret |
return value More... | |
static int | replace |
Replace DID Document Flag. More... | |
static int | remove_did |
Remove DID Document Flag. More... | |
static int | get |
Get DID Documement for DID Flag. More... | |
static int | create |
Create DID Document Flag. More... | |
static int | show |
Show DID for Ego Flag. More... | |
static int | show_all |
Show DID for Ego Flag. More... | |
static char * | did |
DID Attribut String. More... | |
static char * | didd |
DID Document Attribut String. More... | |
static char * | egoname |
Ego Attribut String. More... | |
static char * | expire |
DID Document expiration Date Attribut String. More... | |
static struct GNUNET_GNS_Handle * | gns_handle |
static struct GNUNET_NAMESTORE_Handle * | namestore_handle |
static struct GNUNET_IDENTITY_Handle * | identity_handle |
static const struct GNUNET_CONFIGURATION_Handle * | my_cfg |
static int | ego_exists = 0 |
Give ego exists. More... | |
#define GNUNET_DID_DEFAULT_DID_DOCUMENT_EXPIRATION_TIME "1d" |
Definition at line 46 of file gnunet-did.c.
typedef void(* remove_did_document_callback) (void *cls) |
Signature of a callback function that is called after a did has been removed.
Definition at line 204 of file gnunet-did.c.
|
static |
Disconnect and shutdown.
cls | closure |
Definition at line 134 of file gnunet-did.c.
References did, didd, egoname, expire, gns_handle, GNUNET_free, GNUNET_GNS_disconnect(), GNUNET_IDENTITY_disconnect(), GNUNET_NAMESTORE_disconnect(), GNUNET_SCHEDULER_shutdown(), identity_handle, and namestore_handle.
Referenced by create_did(), create_did_cb(), create_did_ego_create_cb(), create_did_ego_lockup_cb(), post_ego_iteration(), print_did_document(), process_dids(), remove_did_document(), remove_did_document_namestore_cb(), replace_did_document(), resolve_did(), and run().
|
static |
GNS lookup callback.
Prints the DID Document to standard out. Fails if there is more than one DID record.
cls | closure |
rd_count | number of records in rd |
rd | the records in the reply |
Definition at line 160 of file gnunet-did.c.
References cleanup(), GNUNET_OK, GNUNET_SCHEDULER_add_now(), ret, and status.
Referenced by resolve_did().
|
static |
Resolve a DID given by the user.
Definition at line 180 of file gnunet-did.c.
References cleanup(), did, DID_resolve(), gns_handle, GNUNET_OK, GNUNET_SCHEDULER_add_now(), print_did_document(), and ret.
Referenced by post_ego_iteration().
|
static |
Implements the GNUNET_NAMESTORE_ContinuationWithStatus Calls the callback function and cls in the event struct.
cls | closure containing the event struct |
success | |
emgs |
Definition at line 226 of file gnunet-did.c.
References cleanup(), Event::cls, Event::cont, GNUNET_EC_NONE, GNUNET_ErrorCode_get_hint(), GNUNET_SCHEDULER_add_now(), and ret.
Referenced by remove_did_document_ego_lookup_cb().
|
static |
Callback called after the ego has been locked up.
cls | closure |
ego | the ego returned by the identity service |
Definition at line 264 of file gnunet-did.c.
References GNUNET_GNS_EMPTY_LABEL_AT, GNUNET_IDENTITY_ego_get_private_key(), GNUNET_NAMESTORE_records_store(), namestore_handle, and remove_did_document_namestore_cb().
Referenced by remove_did_document().
|
static |
Remove a DID Document.
Definition at line 282 of file gnunet-did.c.
References cleanup(), Event::cls, Event::cont, egoname, GNUNET_IDENTITY_ego_lookup(), GNUNET_SCHEDULER_add_now(), my_cfg, remove_did_document_ego_lookup_cb(), and ret.
Referenced by post_ego_iteration(), and replace_did_document().
|
static |
Referenced by create_did(), and create_did_ego_create_cb().
|
static |
Create a DID(-Document).
Called after DID has been created Prints status and the DID.
Definition at line 315 of file gnunet-did.c.
References cleanup(), Event::cls, GNUNET_OK, GNUNET_SCHEDULER_add_now(), ret, and status.
Referenced by create_did_ego_lockup_cb().
|
static |
Create a DID(-Document) - Called after a new Identity has been created.
Definition at line 337 of file gnunet-did.c.
References cleanup(), create_did_ego_lockup_cb(), egoname, GNUNET_EC_NONE, GNUNET_ErrorCode_get_hint(), GNUNET_IDENTITY_ego_lookup(), GNUNET_SCHEDULER_add_now(), my_cfg, and ret.
Referenced by create_did_ego_lockup_cb().
|
static |
Create a DID(-Document).
Called after ego lookup
Definition at line 360 of file gnunet-did.c.
References cleanup(), Event::cls, create_did_cb(), create_did_ego_create_cb(), did, DID_create(), DID_DOCUMENT_DEFAULT_EXPIRATION_TIME, DID_identity_to_did(), egoname, expire, GNUNET_IDENTITY_create(), GNUNET_IDENTITY_TYPE_EDDSA, GNUNET_OK, GNUNET_SCHEDULER_add_now(), GNUNET_STRINGS_fancy_time_to_relative(), identity_handle, namestore_handle, and ret.
|
static |
Create a DID(-Document).
Definition at line 416 of file gnunet-did.c.
References cleanup(), create_did_ego_lockup_cb(), egoname, GNUNET_IDENTITY_ego_lookup(), GNUNET_SCHEDULER_add_now(), my_cfg, and ret.
Referenced by post_ego_iteration().
|
static |
Replace a DID Docuemnt.
Callback function after ego lockup
cls | |
ego |
Definition at line 441 of file gnunet-did.c.
Referenced by replace_did_document_remove_cb().
|
static |
Replace a DID Document.
Callback functiona after remove
cls |
Definition at line 452 of file gnunet-did.c.
References egoname, GNUNET_IDENTITY_ego_lookup(), my_cfg, and replace_did_document_ego_lookup_cb().
Referenced by replace_did_document().
|
static |
Replace a DID Docuemnt.
Definition at line 465 of file gnunet-did.c.
References cleanup(), didd, expire, GNUNET_SCHEDULER_add_now(), remove_did_document(), replace_did_document_remove_cb(), and ret.
Referenced by post_ego_iteration().
|
static |
Definition at line 481 of file gnunet-did.c.
References cleanup(), create, create_did(), get, GNUNET_SCHEDULER_add_now(), remove_did, remove_did_document(), replace, replace_did_document(), and resolve_did().
Referenced by process_dids().
|
static |
Definition at line 509 of file gnunet-did.c.
References cleanup(), DID_identity_to_did(), ego_exists, egoname, GNUNET_free, GNUNET_SCHEDULER_add_now(), name, post_ego_iteration(), show, and show_all.
Referenced by run().
|
static |
Definition at line 547 of file gnunet-did.c.
References cleanup(), gns_handle, GNUNET_GNS_connect(), GNUNET_IDENTITY_connect(), GNUNET_NAMESTORE_connect(), GNUNET_SCHEDULER_add_now(), identity_handle, my_cfg, namestore_handle, process_dids(), and ret.
Referenced by main().
int main | ( | int | argc, |
char *const | argv[] | ||
) |
Definition at line 581 of file gnunet-did.c.
References create, did, didd, egoname, expire, get, gettext_noop, GNUNET_GETOPT_OPTION_END, GNUNET_GETOPT_option_flag(), GNUNET_GETOPT_option_string(), GNUNET_OK, GNUNET_PROGRAM_run(), options, remove_did, replace, ret, run(), show, and show_all.
|
static |
return value
Definition at line 51 of file gnunet-did.c.
Referenced by create_did(), create_did_cb(), create_did_ego_create_cb(), create_did_ego_lockup_cb(), main(), print_did_document(), remove_did_document(), remove_did_document_namestore_cb(), replace_did_document(), resolve_did(), and run().
|
static |
Replace DID Document Flag.
Definition at line 56 of file gnunet-did.c.
Referenced by main(), post_ego_iteration(), httpdomain.autohttp.flask_base::quickref_directive(), replace_char(), try_ifconfig(), and try_ip().
|
static |
Remove DID Document Flag.
Definition at line 61 of file gnunet-did.c.
Referenced by main(), and post_ego_iteration().
|
static |
Get DID Documement for DID Flag.
Definition at line 66 of file gnunet-did.c.
Referenced by httpdomain.httpdomain.HTTPResource::add_target_and_index(), httpdomain.autohttp.flask_base.AutoflaskBase::blueprints(), check_dht_local_get_result_seen(), check_get(), httpdomain.autohttp.bottle.AutobottleDirective::endpoints(), httpdomain.autohttp.flask_base.AutoflaskBase::endpoints(), httpdomain.autohttp.tornado.AutoTornadoDirective::endpoints(), handle_dht_p2p_get(), main(), httpdomain.autohttp.flask_base.AutoflaskBase::modules(), httpdomain.autohttp.flask_base.AutoflaskBase::order(), post_ego_iteration(), httpdomain.httpdomain.HTTPDomain::resolve_xref(), typescriptdomain.TypeScriptDefinition::run(), httpdomain.autohttp.flask_base.AutoflaskBase::undoc_blueprints(), httpdomain.autohttp.bottle.AutobottleDirective::undoc_endpoints(), httpdomain.autohttp.flask_base.AutoflaskBase::undoc_endpoints(), httpdomain.autohttp.tornado.AutoTornadoDirective::undoc_endpoints(), and httpdomain.autohttp.flask_base.AutoflaskBase::undoc_modules().
|
static |
Create DID Document Flag.
Definition at line 71 of file gnunet-did.c.
Referenced by GCP_get(), GCP_get_tunnel(), GNUNET_SERVER_set_callbacks(), main(), and post_ego_iteration().
|
static |
Show DID for Ego Flag.
Definition at line 76 of file gnunet-did.c.
Referenced by main(), and process_dids().
|
static |
Show DID for Ego Flag.
Definition at line 81 of file gnunet-did.c.
Referenced by main(), and process_dids().
|
static |
DID Attribut String.
Definition at line 86 of file gnunet-did.c.
Referenced by cleanup(), create_did_ego_lockup_cb(), main(), and resolve_did().
|
static |
DID Document Attribut String.
Definition at line 91 of file gnunet-did.c.
Referenced by cleanup(), main(), and replace_did_document().
|
static |
Ego Attribut String.
Definition at line 96 of file gnunet-did.c.
Referenced by cleanup(), create_did(), create_did_ego_create_cb(), create_did_ego_lockup_cb(), ego_create(), ego_get_name(), main(), namestore_add_or_update(), namestore_delete(), namestore_get(), namestore_import(), process_dids(), remove_did_document(), and replace_did_document_remove_cb().
|
static |
DID Document expiration Date Attribut String.
Definition at line 101 of file gnunet-did.c.
Referenced by add_address_to_hello(), cleanup(), create_did_ego_lockup_cb(), dispatch_job(), dispatch_job_monitor(), GNUNET_HELLO_iterate_addresses(), handle_monitor_event(), handle_record(), main(), replace_did_document(), run_edkey(), and run_pkey().
|
static |
Definition at line 106 of file gnunet-did.c.
Referenced by cleanup(), resolve_did(), and run().
|
static |
Definition at line 111 of file gnunet-did.c.
Referenced by cleanup(), create_did_ego_lockup_cb(), DID_create(), remove_did_document_ego_lookup_cb(), and run().
|
static |
Definition at line 116 of file gnunet-did.c.
Referenced by cleanup(), create_did_ego_lockup_cb(), and run().
|
static |
Definition at line 122 of file gnunet-did.c.
Referenced by create_did(), create_did_ego_create_cb(), remove_did_document(), replace_did_document_remove_cb(), and run().
|
static |