Commit 9e483e4b authored by Stan Kladko's avatar Stan Kladko

Adding ZeroMQ

parent 84d9a87c
...@@ -11,5 +11,7 @@ Json::Value BLSSignReqMessage::process() { ...@@ -11,5 +11,7 @@ Json::Value BLSSignReqMessage::process() {
auto hash = getStringRapid("mh"); auto hash = getStringRapid("mh");
auto t = getUint64Rapid("t"); auto t = getUint64Rapid("t");
auto n = getUint64Rapid("n"); auto n = getUint64Rapid("n");
return SGXWalletServer::blsSignMessageHashImpl(keyName, hash, t, n); auto result = SGXWalletServer::blsSignMessageHashImpl(keyName, hash, t, n);
result["type"] = ZMQMessage::BLS_SIGN_RSP;
return result;
} }
\ No newline at end of file
...@@ -13,5 +13,7 @@ Json::Value ECDSASignReqMessage::process() { ...@@ -13,5 +13,7 @@ Json::Value ECDSASignReqMessage::process() {
auto base = getUint64Rapid("bs"); auto base = getUint64Rapid("bs");
auto keyName = getStringRapid("kn"); auto keyName = getStringRapid("kn");
auto hash = getStringRapid("mh"); auto hash = getStringRapid("mh");
return SGXWalletServer::ecdsaSignMessageHashImpl(base, keyName, hash); auto result = SGXWalletServer::ecdsaSignMessageHashImpl(base, keyName, hash);
result["type"] = ZMQMessage::ECDSA_SIGN_RSP;
return result;
} }
\ No newline at end of file
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include <jsonrpccpp/client.h> #include <jsonrpccpp/client.h>
#include "ZMQMessage.h"
class ZMQClient { class ZMQClient {
...@@ -17,7 +18,7 @@ class ZMQClient { ...@@ -17,7 +18,7 @@ class ZMQClient {
Json::Value blsSignMessageHash(const std::string& keyShareName, const std::string& messageHash, int t, int n) Json::Value blsSignMessageHash(const std::string& keyShareName, const std::string& messageHash, int t, int n)
{ {
Json::Value p; Json::Value p;
p["method"] = "blsSignMessageHash"; p["type"] = ZMQMessage::BLS_SIGN_REQ;
p["keyShareName"] = keyShareName; p["keyShareName"] = keyShareName;
p["messageHash"] = messageHash; p["messageHash"] = messageHash;
p["n"] = n; p["n"] = n;
...@@ -34,7 +35,7 @@ class ZMQClient { ...@@ -34,7 +35,7 @@ class ZMQClient {
Json::Value ecdsaSignMessageHash(int base, const std::string& keyName, const std::string& messageHash) Json::Value ecdsaSignMessageHash(int base, const std::string& keyName, const std::string& messageHash)
{ {
Json::Value p; Json::Value p;
p["method"] = "ecdsaSignMessageHash"; p["type"] = ZMQMessage::ECDSA_SIGN_REQ;
p["base"] = base; p["base"] = base;
p["keyName"] = keyName; p["keyName"] = keyName;
p["messageHash"] = messageHash; p["messageHash"] = messageHash;
......
...@@ -38,16 +38,18 @@ class ZMQMessage { ...@@ -38,16 +38,18 @@ class ZMQMessage {
shared_ptr<rapidjson::Document> d; shared_ptr<rapidjson::Document> d;
static constexpr const char *BLS_SIGN_REQ = "BLSSignReq";
static constexpr const char *BLS_SIGN_RSP = "BLSSignRsp";
static constexpr const char *ECDSA_SIGN_REQ = "ECDSASignReq";
static constexpr const char *ECDSA_SIGN_RSP = "ECDSASignRsp";
protected: protected:
public: public:
static constexpr const char *BLS_SIGN_REQ = "BLSSignReq";
static constexpr const char *BLS_SIGN_RSP = "BLSSignRsp";
static constexpr const char *ECDSA_SIGN_REQ = "ECDSASignReq";
static constexpr const char *ECDSA_SIGN_RSP = "ECDSASignRsp";
explicit ZMQMessage(shared_ptr<rapidjson::Document> &_d) : d(_d) { explicit ZMQMessage(shared_ptr<rapidjson::Document> &_d) : d(_d) {
}; };
......
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