mirror of
https://github.com/EvernodeXRPL/hpcore.git
synced 2026-04-29 15:37:59 +00:00
@@ -51,7 +51,7 @@ int rekey()
|
||||
if (load_config() != 0)
|
||||
return -1;
|
||||
|
||||
crypto::generate_signing_keys(cfg.pubkey, cfg.seckey);
|
||||
crypto::generate_signing_keys(cfg.pubkey, cfg.seckey, cfg.keytype);
|
||||
if (binpair_to_b64() != 0)
|
||||
return -1;
|
||||
|
||||
@@ -84,7 +84,7 @@ int create_contract()
|
||||
|
||||
//We populate the in-memory struct with default settings and then save it to the file.
|
||||
|
||||
crypto::generate_signing_keys(cfg.pubkey, cfg.seckey);
|
||||
crypto::generate_signing_keys(cfg.pubkey, cfg.seckey, cfg.keytype);
|
||||
if (binpair_to_b64() != 0)
|
||||
return -1;
|
||||
|
||||
@@ -172,6 +172,7 @@ int load_config()
|
||||
|
||||
cfg.pubkeyb64 = d["pubkeyb64"].GetString();
|
||||
cfg.seckeyb64 = d["seckeyb64"].GetString();
|
||||
cfg.keytype = d["keytype"].GetString();
|
||||
cfg.binary = d["binary"].GetString();
|
||||
cfg.binargs = d["binargs"].GetString();
|
||||
cfg.listenip = d["listenip"].GetString();
|
||||
@@ -212,6 +213,7 @@ int save_config()
|
||||
d.AddMember("version", StringRef(util::hp_version), allocator);
|
||||
d.AddMember("pubkeyb64", StringRef(cfg.pubkeyb64.data()), allocator);
|
||||
d.AddMember("seckeyb64", StringRef(cfg.seckeyb64.data()), allocator);
|
||||
d.AddMember("keytype", StringRef(cfg.keytype.data()), allocator);
|
||||
d.AddMember("binary", StringRef(cfg.binary.data()), allocator);
|
||||
d.AddMember("binargs", StringRef(cfg.binargs.data()), allocator);
|
||||
d.AddMember("listenip", StringRef(cfg.listenip.data()), allocator);
|
||||
|
||||
@@ -38,6 +38,7 @@ struct contract_config
|
||||
|
||||
string pubkeyb64; // Contract base64 public key
|
||||
string seckeyb64; // Contract base64 secret key
|
||||
string keytype; // Key generation algorithm used by libsodium
|
||||
string binary; // Full path to the contract binary
|
||||
string binargs; // CLI arguments to pass to the contract binary
|
||||
string listenip; // The IPs to listen on for incoming connections
|
||||
|
||||
@@ -27,7 +27,7 @@ int init()
|
||||
/**
|
||||
* Generates a signing key pair using libsodium and assigns them to the provided strings.
|
||||
*/
|
||||
void generate_signing_keys(string &pubkey, string &seckey)
|
||||
void generate_signing_keys(string &pubkey, string &seckey, string &keytype)
|
||||
{
|
||||
//Generate key pair using libsodium default algorithm. (Currently using ed25519)
|
||||
|
||||
@@ -37,6 +37,7 @@ void generate_signing_keys(string &pubkey, string &seckey)
|
||||
|
||||
pubkey = string((char *)pubkeychars, crypto_sign_PUBLICKEYBYTES);
|
||||
seckey = string((char *)seckeychars, crypto_sign_SECRETKEYBYTES);
|
||||
keytype = crypto_sign_primitive();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace crypto
|
||||
|
||||
int init();
|
||||
|
||||
void generate_signing_keys(string &pubkey, string &seckey);
|
||||
void generate_signing_keys(string &pubkey, string &seckey, string &keytype);
|
||||
|
||||
string sign(const string &msg, const string &seckey);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user