method names standardized

This commit is contained in:
John Jones 2016-11-10 16:36:34 -05:00
parent 32d187faa4
commit f42c92ea63
5 changed files with 27 additions and 6 deletions

11
.gitignore vendored Normal file
View file

@ -0,0 +1,11 @@
*
!.gitignore
!Makefile
!**/
*.o
.cproject
.project
.settings/language.settings.xml

View file

@ -22,6 +22,11 @@ int init_pre_run(struct Request* request) {
return 1; 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) { int initialize_ipns_keyspace(char* repo_root) {
//TODO: open fs repo //TODO: open fs repo
struct FSRepo repo; struct FSRepo repo;
@ -33,7 +38,7 @@ int initialize_ipns_keyspace(char* repo_root) {
struct Context* ctx; struct Context* ctx;
struct BuildCfg* bld_cfg; struct BuildCfg* bld_cfg;
//TODO: see line 185 of init.go, what does core.BldCfg{Repo: r} do? BldCfg is a structure //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 namesys_initialize_keyspace(ctx, ipfs_node->DAG, ipfs_node->Namesys, ipfs_node->pinning, ipfs_node->private_key);
return retVal; return retVal;
} }

View file

@ -8,7 +8,7 @@
#include "ipfs/core/builder.h" #include "ipfs/core/builder.h"
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) {
// TODO: Implement this methods // TODO: Implement this method
return 1; return 1;
} }

View file

@ -24,6 +24,6 @@ struct BuildCfg {
//struct Repo repo; //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 */ #endif /* builder_h */

View file

@ -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)) if (!crypto_rsa_generate_keypair( &(identity->private_key), num_bits_for_keypair))
return 0; return 0;
// TODO: Get ID from public key // now the private key (in DER format) is in identity->private_key->der;
// TODO: Store peer id in identity struct // 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; return 1;
} }
int repo_config_identity_free(struct Identity* identity) { 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) if (identity->private_key.der != NULL)
free(identity->private_key.der); free(identity->private_key.der);
return 0; return 0;