Skip to content

Commit

Permalink
SKALE-4954 update server method
Browse files Browse the repository at this point in the history
  • Loading branch information
olehnikolaiev committed Feb 7, 2022
1 parent 22c110a commit 82d331f
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 11 deletions.
6 changes: 3 additions & 3 deletions SGXWalletServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -985,7 +985,7 @@ SGXWalletServer::createBLSPrivateKeyV2Impl(const string &_blsKeyName, const stri
RETURN_SUCCESS(result);
}

Json::Value SGXWalletServer::getDecryptionShareImpl(const std::string& blsKeyName, const Json::Value& publicDecryptionValues) {
Json::Value SGXWalletServer::getDecryptionSharesImpl(const std::string& blsKeyName, const Json::Value& publicDecryptionValues) {
spdlog::info("Entering {}", __FUNCTION__);
INIT_RESULT(result)

Expand Down Expand Up @@ -1117,8 +1117,8 @@ SGXWalletServer::createBLSPrivateKeyV2(const string &blsKeyName, const string &e
return createBLSPrivateKeyV2Impl(blsKeyName, ethKeyName, polyName, SecretShare, t, n);
}

Json::Value SGXWalletServer::getDecryptionShare(const std::string& blsKeyName, const Json::Value& publicDecryptionValues) {
return getDecryptionShareImpl(blsKeyName, publicDecryptionValues);
Json::Value SGXWalletServer::getDecryptionShares(const std::string& blsKeyName, const Json::Value& publicDecryptionValues) {
return getDecryptionSharesImpl(blsKeyName, publicDecryptionValues);
}

shared_ptr <string> SGXWalletServer::readFromDb(const string &name, const string &prefix) {
Expand Down
4 changes: 2 additions & 2 deletions SGXWalletServer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ class SGXWalletServer : public AbstractStubServer {

virtual Json::Value createBLSPrivateKeyV2(const std::string& blsKeyName, const std::string& ethKeyName, const std::string& polyName, const std::string & SecretShare, int t, int n);

virtual Json::Value getDecryptionShare(const std::string& KeyName, const Json::Value& publicDecryptionValues);
virtual Json::Value getDecryptionShares(const std::string& KeyName, const Json::Value& publicDecryptionValues);

static shared_ptr<string> readFromDb(const string &name, const string &prefix = "");

Expand Down Expand Up @@ -173,7 +173,7 @@ class SGXWalletServer : public AbstractStubServer {

static Json::Value createBLSPrivateKeyV2Impl(const std::string& blsKeyName, const std::string& ethKeyName, const std::string& polyName, const std::string & SecretShare, int t, int n);

static Json::Value getDecryptionShareImpl(const std::string& KeyName, const Json::Value& publicDecryptionValues);
static Json::Value getDecryptionSharesImpl(const std::string& KeyName, const Json::Value& publicDecryptionValues);

static void printDB();

Expand Down
8 changes: 4 additions & 4 deletions abstractstubserver.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class AbstractStubServer : public jsonrpc::AbstractServer<AbstractStubServer>
this->bindAndAddMethod(jsonrpc::Procedure("dkgVerificationV2", jsonrpc::PARAMS_BY_NAME, jsonrpc::JSON_OBJECT, "publicShares",jsonrpc::JSON_STRING, "ethKeyName",jsonrpc::JSON_STRING, "secretShare",jsonrpc::JSON_STRING,"t",jsonrpc::JSON_INTEGER, "n",jsonrpc::JSON_INTEGER, "index",jsonrpc::JSON_INTEGER, NULL), &AbstractStubServer::dkgVerificationV2I);
this->bindAndAddMethod(jsonrpc::Procedure("createBLSPrivateKeyV2", jsonrpc::PARAMS_BY_NAME, jsonrpc::JSON_OBJECT, "blsKeyName",jsonrpc::JSON_STRING, "ethKeyName",jsonrpc::JSON_STRING, "polyName", jsonrpc::JSON_STRING, "secretShare",jsonrpc::JSON_STRING,"t", jsonrpc::JSON_INTEGER,"n",jsonrpc::JSON_INTEGER, NULL), &AbstractStubServer::createBLSPrivateKeyV2I);

this->bindAndAddMethod(jsonrpc::Procedure("getDecryptionShare", jsonrpc::PARAMS_BY_NAME, jsonrpc::JSON_OBJECT, "blsKeyName",jsonrpc::JSON_STRING,"publicDecryptionValues",jsonrpc::JSON_ARRAY, NULL), &AbstractStubServer::getDecryptionShareI);
this->bindAndAddMethod(jsonrpc::Procedure("getDecryptionShares", jsonrpc::PARAMS_BY_NAME, jsonrpc::JSON_OBJECT, "blsKeyName",jsonrpc::JSON_STRING,"publicDecryptionValues",jsonrpc::JSON_ARRAY, NULL), &AbstractStubServer::getDecryptionSharesI);
}

inline virtual void importBLSKeyShareI(const Json::Value &request, Json::Value &response)
Expand Down Expand Up @@ -162,9 +162,9 @@ class AbstractStubServer : public jsonrpc::AbstractServer<AbstractStubServer>
response = this->createBLSPrivateKeyV2(request["blsKeyName"].asString(), request["ethKeyName"].asString(), request["polyName"].asString(),request["secretShare"].asString(),request["t"].asInt(), request["n"].asInt());
}

inline virtual void getDecryptionShareI(const Json::Value &request, Json::Value &response)
inline virtual void getDecryptionSharesI(const Json::Value &request, Json::Value &response)
{
response = this->getDecryptionShare(request["blsKeyName"].asString(), request["publicDecryptionValues"]);
response = this->getDecryptionShares(request["blsKeyName"].asString(), request["publicDecryptionValues"]);
}

virtual Json::Value importBLSKeyShare(const std::string& keyShare, const std::string& keyShareName) = 0;
Expand Down Expand Up @@ -193,7 +193,7 @@ class AbstractStubServer : public jsonrpc::AbstractServer<AbstractStubServer>
virtual Json::Value dkgVerificationV2( const std::string& publicShares, const std::string& ethKeyName, const std::string& SecretShare, int t, int n, int index) = 0;
virtual Json::Value createBLSPrivateKeyV2(const std::string& blsKeyName, const std::string& ethKeyName, const std::string& polyName, const std::string & SecretShare, int t, int n) = 0;

virtual Json::Value getDecryptionShare(const std::string& KeyName, const Json::Value& publicDecryptionValues) = 0;
virtual Json::Value getDecryptionShares(const std::string& KeyName, const Json::Value& publicDecryptionValues) = 0;
};

#endif //JSONRPC_CPP_STUB_ABSTRACTSTUBSERVER_H_
2 changes: 1 addition & 1 deletion stubclient.h
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ class StubClient : public jsonrpc::Client
p["blsKeyName"] = blsKeyName;
p["publicDecryptionValues"] = publicDecryptionValues["publicDecryptionValues"];

Json::Value result = this->CallMethod("getDecryptionShare",p);
Json::Value result = this->CallMethod("getDecryptionShares",p);
if (result.isObject())
return result;
else
Expand Down
2 changes: 1 addition & 1 deletion zmq_src/ReqMessage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ Json::Value GetDecryptionShareReqMessage::process() {
if (checkKeyOwnership && !isKeyByOwner(blsKeyName, getStringRapid("cert"))) {
throw std::invalid_argument("Only owner of the key can access it");
}
auto result = SGXWalletServer::getDecryptionShareImpl(blsKeyName, publicDecryptionValues);
auto result = SGXWalletServer::getDecryptionSharesImpl(blsKeyName, publicDecryptionValues);
result["type"] = ZMQMessage::GET_DECRYPTION_SHARE_RSP;
return result;
}

0 comments on commit 82d331f

Please sign in to comment.