Unverified Commit a1e1185e authored by svetaro's avatar svetaro

SKALE-1955 Add getServerStatus to stubclient

parent 161369f5
...@@ -26,6 +26,7 @@ class StubClient : public jsonrpc::Client ...@@ -26,6 +26,7 @@ class StubClient : public jsonrpc::Client
else else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
} }
Json::Value blsSignMessageHash(const std::string& keyShareName, const std::string& messageHash, int t, int n, int signerIndex) throw (jsonrpc::JsonRpcException) Json::Value blsSignMessageHash(const std::string& keyShareName, const std::string& messageHash, int t, int n, int signerIndex) throw (jsonrpc::JsonRpcException)
{ {
Json::Value p; Json::Value p;
...@@ -40,6 +41,7 @@ class StubClient : public jsonrpc::Client ...@@ -40,6 +41,7 @@ class StubClient : public jsonrpc::Client
else else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
} }
Json::Value importECDSAKey(const std::string& key, const std::string& keyName) throw (jsonrpc::JsonRpcException) Json::Value importECDSAKey(const std::string& key, const std::string& keyName) throw (jsonrpc::JsonRpcException)
{ {
Json::Value p; Json::Value p;
...@@ -51,6 +53,7 @@ class StubClient : public jsonrpc::Client ...@@ -51,6 +53,7 @@ class StubClient : public jsonrpc::Client
else else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
} }
Json::Value generateECDSAKey() throw (jsonrpc::JsonRpcException) Json::Value generateECDSAKey() throw (jsonrpc::JsonRpcException)
{ {
Json::Value p; Json::Value p;
...@@ -61,6 +64,7 @@ class StubClient : public jsonrpc::Client ...@@ -61,6 +64,7 @@ class StubClient : public jsonrpc::Client
else else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
} }
Json::Value renameECDSAKey(const std::string& KeyName, const std::string& tempKeyName) throw (jsonrpc::JsonRpcException) Json::Value renameECDSAKey(const std::string& KeyName, const std::string& tempKeyName) throw (jsonrpc::JsonRpcException)
{ {
Json::Value p; Json::Value p;
...@@ -72,6 +76,7 @@ class StubClient : public jsonrpc::Client ...@@ -72,6 +76,7 @@ class StubClient : public jsonrpc::Client
else else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
} }
Json::Value getPublicECDSAKey(const std::string& keyName) throw (jsonrpc::JsonRpcException) Json::Value getPublicECDSAKey(const std::string& keyName) throw (jsonrpc::JsonRpcException)
{ {
Json::Value p; Json::Value p;
...@@ -82,6 +87,7 @@ class StubClient : public jsonrpc::Client ...@@ -82,6 +87,7 @@ class StubClient : public jsonrpc::Client
else else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
} }
Json::Value ecdsaSignMessageHash(int base, const std::string& keyName, const std::string& messageHash) throw (jsonrpc::JsonRpcException) Json::Value ecdsaSignMessageHash(int base, const std::string& keyName, const std::string& messageHash) throw (jsonrpc::JsonRpcException)
{ {
Json::Value p; Json::Value p;
...@@ -94,6 +100,7 @@ class StubClient : public jsonrpc::Client ...@@ -94,6 +100,7 @@ class StubClient : public jsonrpc::Client
else else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
} }
Json::Value generateDKGPoly(const std::string& polyName, int t) throw (jsonrpc::JsonRpcException) Json::Value generateDKGPoly(const std::string& polyName, int t) throw (jsonrpc::JsonRpcException)
{ {
Json::Value p; Json::Value p;
...@@ -105,98 +112,112 @@ class StubClient : public jsonrpc::Client ...@@ -105,98 +112,112 @@ class StubClient : public jsonrpc::Client
else else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
} }
Json::Value getVerificationVector(const std::string& polyName, int t, int n) throw (jsonrpc::JsonRpcException)
{ Json::Value getVerificationVector(const std::string& polyName, int t, int n) throw (jsonrpc::JsonRpcException)
Json::Value p; {
p["polyName"] = polyName; Json::Value p;
p["n"] = n; p["polyName"] = polyName;
p["t"] = t; p["n"] = n;
Json::Value result = this->CallMethod("getVerificationVector",p); p["t"] = t;
if (result.isObject()) Json::Value result = this->CallMethod("getVerificationVector",p);
return result; if (result.isObject())
else return result;
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); else
} throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
Json::Value getSecretShare(const std::string& polyName, const Json::Value& publicKeys, int t, int n) throw (jsonrpc::JsonRpcException) }
{
Json::Value p; Json::Value getSecretShare(const std::string& polyName, const Json::Value& publicKeys, int t, int n) throw (jsonrpc::JsonRpcException)
p["polyName"] = polyName; {
p["publicKeys"] = publicKeys; Json::Value p;
p["n"] = n; p["polyName"] = polyName;
p["t"] = t; p["publicKeys"] = publicKeys;
Json::Value result = this->CallMethod("getSecretShare",p); p["n"] = n;
if (result.isObject()) p["t"] = t;
return result; Json::Value result = this->CallMethod("getSecretShare",p);
else if (result.isObject())
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); return result;
} else
Json::Value DKGVerification(const std::string& publicShares, const std::string& EthKeyName, const std::string& SecretShare, int t, int n, int index) throw (jsonrpc::JsonRpcException) throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
{ }
Json::Value p;
p["EthKeyName"] = EthKeyName; Json::Value DKGVerification(const std::string& publicShares, const std::string& EthKeyName, const std::string& SecretShare, int t, int n, int index) throw (jsonrpc::JsonRpcException)
p["SecretShare"] = SecretShare; {
p["index"] = index; Json::Value p;
p["n"] = n; p["EthKeyName"] = EthKeyName;
p["publicShares"] = publicShares; p["SecretShare"] = SecretShare;
p["t"] = t; p["index"] = index;
Json::Value result = this->CallMethod("DKGVerification",p); p["n"] = n;
if (result.isObject()) p["publicShares"] = publicShares;
return result; p["t"] = t;
else Json::Value result = this->CallMethod("DKGVerification",p);
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); if (result.isObject())
} return result;
Json::Value CreateBLSPrivateKey(const std::string & BLSKeyName, const std::string& EthKeyName, const std::string& polyName, const std::string& SecretShare, int t, int n) throw (jsonrpc::JsonRpcException) else
{ throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
Json::Value p; }
p["BLSKeyName"] = BLSKeyName;
p["EthKeyName"] = EthKeyName; Json::Value CreateBLSPrivateKey(const std::string & BLSKeyName, const std::string& EthKeyName, const std::string& polyName, const std::string& SecretShare, int t, int n) throw (jsonrpc::JsonRpcException)
p["polyName"] = polyName; {
p["SecretShare"] = SecretShare; Json::Value p;
p["n"] = n; p["BLSKeyName"] = BLSKeyName;
p["t"] = t; p["EthKeyName"] = EthKeyName;
Json::Value result = this->CallMethod("CreateBLSPrivateKey",p); p["polyName"] = polyName;
if (result.isObject()) p["SecretShare"] = SecretShare;
return result; p["n"] = n;
else p["t"] = t;
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); Json::Value result = this->CallMethod("CreateBLSPrivateKey",p);
} if (result.isObject())
return result;
Json::Value GetBLSPublicKeyShare(const std::string & BLSKeyName) throw (jsonrpc::JsonRpcException) else
{ throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
Json::Value p; }
p["BLSKeyName"] = BLSKeyName;
Json::Value GetBLSPublicKeyShare(const std::string & BLSKeyName) throw (jsonrpc::JsonRpcException)
Json::Value result = this->CallMethod("GetBLSPublicKeyShare",p); {
if (result.isObject()) Json::Value p;
return result; p["BLSKeyName"] = BLSKeyName;
else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); Json::Value result = this->CallMethod("GetBLSPublicKeyShare",p);
} if (result.isObject())
return result;
Json::Value ComplaintResponse(const std::string& polyName, int ind) throw (jsonrpc::JsonRpcException) else
{ throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
Json::Value p; }
p["polyName"] = polyName;
p["ind"] = ind; Json::Value ComplaintResponse(const std::string& polyName, int ind) throw (jsonrpc::JsonRpcException)
Json::Value result = this->CallMethod("ComplaintResponse",p); {
if (result.isObject()) Json::Value p;
return result; p["polyName"] = polyName;
else p["ind"] = ind;
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); Json::Value result = this->CallMethod("ComplaintResponse",p);
} if (result.isObject())
Json::Value MultG2(const std::string & x) throw (jsonrpc::JsonRpcException)
{
Json::Value p;
p["x"] = x;
Json::Value result = this->CallMethod("MultG2",p);
if (result.isObject())
return result; return result;
else else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
} }
Json::Value MultG2(const std::string & x) throw (jsonrpc::JsonRpcException)
{
Json::Value p;
p["x"] = x;
Json::Value result = this->CallMethod("MultG2",p);
if (result.isObject())
return result;
else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
}
Json::Value getServerStatus() throw (jsonrpc::JsonRpcException)
{
Json::Value p;
p = Json::nullValue;
Json::Value result = this->CallMethod("getServerStatus",p);
if (result.isObject())
return result;
else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
}
}; };
#endif //JSONRPC_CPP_STUB_STUBCLIENT_H_ #endif //JSONRPC_CPP_STUB_STUBCLIENT_H_
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment