Refactor/removal of typed object form endpoint#421
Merged
Conversation
zurekz
requested changes
May 6, 2026
Comment on lines
-114
to
+112
| auto buffer = utils::Utils::stringify(data); | ||
| auto buffer = utils::Utils::stringifyVar(data.toJSON()); |
Member
There was a problem hiding this comment.
My suggestion here would be to rename T.toJSON() to T.toJSONObj(), since the function returns an object. Additionally, I would extend type T with a Buffer T.serialize() function (that whould use toJSONObj() internally), which would simplify this function (and similar ones):
Pson::BinaryString getSign(const T& data, const privmx::crypto::PrivateKey& privKey) {
auto buffer = utils::Utils::stringify(data);
auto buffer = utils::Utils::stringifyVar(data.toJSON());
return Pson::BinaryString(privKey.signToCompactSignatureWithHash(buffer));
}to the following form:
Pson::BinaryString getSign(const T& data, const privmx::crypto::PrivateKey& privKey) {
return Pson::BinaryString(privKey.signToCompactSignatureWithHash(data.serialize()));
}The toJSONObj() function would still remain part of the interface, since it is needed in many places, but its name would also be more descriptive.
Member
Author
There was a problem hiding this comment.
Create seperated issue with adding hepler metods 'serialize' and 'deserialize' for JSON_STRUCT
| core::DecryptedModuleDataV4() | ||
| ); | ||
|
|
||
| template<typename ModuleStructAsTypedObj> |
| core::DecryptedModuleDataV5() | ||
| ); | ||
|
|
||
| template<typename ModuleStructAsTypedObj> |
| DECLARE_ENDPOINT_EXCEPTION(EndpointLibException, OperationCancelledException, "Operation canceled", 0x0005) | ||
| DECLARE_ENDPOINT_EXCEPTION(EndpointLibException, NotImplementedException, "Not implemented", 0x0006) | ||
| DECLARE_ENDPOINT_EXCEPTION(EndpointLibException, InvalidVersionFormatException, "Invalid version format", 0x0007); | ||
| DECLARE_ENDPOINT_EXCEPTION(EndpointLibException, JSONParseException, "JSON Parse", 0x0008); |
| DECLARE_ENDPOINT_EXCEPTION(EndpointCoreException, UnknownModuleFormatException, "Unknown module format", 0x0023) | ||
| DECLARE_ENDPOINT_EXCEPTION(EndpointCoreException, InvalidSubscriptionQueryException, "Invalid subscriptionQuery", 0x00024) | ||
| DECLARE_ENDPOINT_EXCEPTION(EndpointCoreException, InvalidSingletonsHolderStateException, "Invalid Singletons Holder state", 0x00025) | ||
| DECLARE_ENDPOINT_EXCEPTION(EndpointCoreException, MissingBridgeIdentityException, "Missing Bridge Identity Exception", 0x00026) |
Member
There was a problem hiding this comment.
Should not have "Exception" word in description.
Comment on lines
+297
to
+298
| server::ThreadMessageGetModel model; | ||
| model.messageId = messageId; |
Comment on lines
+311
to
+312
| server::ThreadMessagesGetModel model; | ||
| model.threadId = threadId; |
Comment on lines
+360
to
+361
| server::ThreadMessageDeleteModel model; | ||
| model.messageId = messageId; |
Comment on lines
+371
to
+372
| server::ThreadMessageGetModel model; | ||
| model.messageId = messageId; |
Comment on lines
+1174
to
+1176
| thread::server::ThreadGetModel params; | ||
| params.threadId = moduleId; | ||
| auto thread = _serverApi.threadGet(params).thread; |
zurekz
approved these changes
May 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.