diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..91e7bad --- /dev/null +++ b/.gitignore @@ -0,0 +1,11 @@ +* + +!.gitignore +!Makefile +!**/ + +*.o +.cproject +.project +.settings/language.settings.xml + diff --git a/cmd/ipfs/init.c b/cmd/ipfs/init.c index 3f5e22e..38670ac 100644 --- a/cmd/ipfs/init.c +++ b/cmd/ipfs/init.c @@ -22,6 +22,11 @@ int init_pre_run(struct Request* request) { return 1; } +/** + * This actually opens the repo and gets things set up + * @param repo_root the root of the repository + * @returns true(1) on success + */ int initialize_ipns_keyspace(char* repo_root) { //TODO: open fs repo struct FSRepo repo; @@ -33,7 +38,7 @@ int initialize_ipns_keyspace(char* repo_root) { struct Context* ctx; struct BuildCfg* bld_cfg; //TODO: see line 185 of init.go, what does core.BldCfg{Repo: r} do? BldCfg is a structure - retVal = core_builder_new_node(ctx, bld_cfg, ipfs_node); + retVal = ipfs_core_builder_new_node(ctx, bld_cfg, ipfs_node); //return namesys_initialize_keyspace(ctx, ipfs_node->DAG, ipfs_node->Namesys, ipfs_node->pinning, ipfs_node->private_key); return retVal; } diff --git a/core/builder.c b/core/builder.c index 3a5beea..9f2482e 100644 --- a/core/builder.c +++ b/core/builder.c @@ -8,7 +8,7 @@ #include "ipfs/core/builder.h" -int core_builder_new_node(struct Context* context, struct BuildCfg* build_cfg, struct IpfsNode* buildConfig) { - // TODO: Implement this methods +int ipfs_core_builder_new_node(struct Context* context, struct BuildCfg* build_cfg, struct IpfsNode* buildConfig) { + // TODO: Implement this method return 1; } diff --git a/include/ipfs/core/builder.h b/include/ipfs/core/builder.h index af04382..d971bec 100644 --- a/include/ipfs/core/builder.h +++ b/include/ipfs/core/builder.h @@ -24,6 +24,6 @@ struct BuildCfg { //struct Repo repo; }; -int core_builder_new_node(struct Context* context, struct BuildCfg* build_cfg, struct IpfsNode* buildConfig); +int ipfs_core_builder_new_node(struct Context* context, struct BuildCfg* build_cfg, struct IpfsNode* buildConfig); #endif /* builder_h */ diff --git a/repo/config/identity.c b/repo/config/identity.c index a3cf690..71f5e49 100644 --- a/repo/config/identity.c +++ b/repo/config/identity.c @@ -26,12 +26,17 @@ int repo_config_identity_new(struct Identity* identity, unsigned long num_bits_f if (!crypto_rsa_generate_keypair( &(identity->private_key), num_bits_for_keypair)) return 0; - // TODO: Get ID from public key - // TODO: Store peer id in identity struct + // now the private key (in DER format) is in identity->private_key->der; + // and the public key (also in DER format) is in identity->private_key->public_key_der; + + //TODO: the public key needs to be "pretty printed" and put in a multihash + return 1; } int repo_config_identity_free(struct Identity* identity) { + if (identity->private_key.public_key_der != NULL) + free(identity->private_key.public_key_der); if (identity->private_key.der != NULL) free(identity->private_key.der); return 0;