SKALE-3951 add rsp methods

parent ddf62aa0
......@@ -61,6 +61,10 @@ public:
importECDSARspMessage(shared_ptr<rapidjson::Document>& _d) : ZMQMessage(_d) {};
virtual Json::Value process();
string getECDSAPublicKey() {
return getStringRapid("publicKey");
}
};
......@@ -69,6 +73,14 @@ public:
generateECDSARspMessage(shared_ptr<rapidjson::Document>& _d) : ZMQMessage(_d) {};
virtual Json::Value process();
string getECDSAPublicKey() {
return getStringRapid("publicKey");
}
string getKeyName() {
return getStringRapid("keyName");
}
};
......@@ -77,6 +89,10 @@ public:
getPublicECDSARspMessage(shared_ptr<rapidjson::Document>& _d) : ZMQMessage(_d) {};
virtual Json::Value process();
string getECDSAPublicKey() {
return getStringRapid("publicKey");
}
};
......@@ -93,6 +109,10 @@ public:
getVerificationVectorRspMessage(shared_ptr<rapidjson::Document>& _d) : ZMQMessage(_d) {};
virtual Json::Value process();
Json::Value getVerificationVector() {
return getJsonValueRapid("verificationVector");
}
};
......@@ -101,6 +121,10 @@ public:
getSecretShareRspMessage(shared_ptr<rapidjson::Document>& _d) : ZMQMessage(_d) {};
virtual Json::Value process();
string getSecretShare() {
return getStringRapid("secretShare");
}
};
......@@ -109,6 +133,10 @@ public:
dkgVerificationRspMessage(shared_ptr<rapidjson::Document>& _d) : ZMQMessage(_d) {};
virtual Json::Value process();
bool isCorrect() {
return getBoolRapid("result");
}
};
......@@ -125,6 +153,10 @@ public:
getBLSPublicRspMessage(shared_ptr<rapidjson::Document>& _d) : ZMQMessage(_d) {};
virtual Json::Value process();
Json::Value getBLSPublicKey() {
return getJsonValueRapid("blsPublicKeyShare");
}
};
......@@ -133,6 +165,10 @@ public:
getAllBLSPublicKeysRspMessage(shared_ptr<rapidjson::Document>& _d) : ZMQMessage(_d) {};
virtual Json::Value process();
Json::Value getPublicKeys() {
return getJsonValueRapid("publicKeys");
}
};
......@@ -141,6 +177,14 @@ public:
complaintResponseRspMessage(shared_ptr<rapidjson::Document>& _d) : ZMQMessage(_d) {};
virtual Json::Value process();
string getDHKey() {
return getStringRapid("dhKey");
}
string getShare() {
return getStringRapid("share*G2");
}
};
......@@ -149,6 +193,10 @@ public:
multG2RspMessage(shared_ptr<rapidjson::Document>& _d) : ZMQMessage(_d) {};
virtual Json::Value process();
Json::Value getResult() {
return getJsonValueRapid("x*G2");
}
};
......@@ -157,6 +205,10 @@ public:
isPolyExistsRspMessage(shared_ptr<rapidjson::Document>& _d) : ZMQMessage(_d) {};
virtual Json::Value process();
bool isExists() {
return getBoolRapid("IsExist");
}
};
......@@ -173,6 +225,10 @@ public:
getServerVersionRspMessage(shared_ptr<rapidjson::Document>& _d) : ZMQMessage(_d) {};
virtual Json::Value process();
string getVesion() {
return getStringRapid("version");
}
};
......@@ -181,6 +237,10 @@ public:
deleteBLSKeyRspMessage(shared_ptr<rapidjson::Document>& _d) : ZMQMessage(_d) {};
virtual Json::Value process();
bool isSuccessful() {
return getBoolRapid("deleted");
}
};
......
......@@ -60,6 +60,14 @@ Json::Value ZMQMessage::getJsonValueRapid(const char *_name) {
return root;
}
bool ZMQMessage::getBoolRapid(const char *_name) {
CHECK_STATE(_name);
CHECK_STATE(d->HasMember(_name));
const rapidjson::Value &a = (*d)[_name];
CHECK_STATE(a.IsBool());
return a.GetBool();
}
string ZMQMessage::getStringRapid(const char *_name) {
CHECK_STATE(_name);
CHECK_STATE(d->HasMember(_name));
......
......@@ -112,6 +112,8 @@ public:
Json::Value getJsonValueRapid(const char *_name);
bool getBoolRapid(const char *_name);
uint64_t getStatus() {
return getUint64Rapid("status");
}
......
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