Replace suites deserialization with flattened structs #683
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.
We were using private APIs from serde, which they have now protected.
I tried to copy the serde code that we were using, but it did not work as it required redefining
Content, which is explicitly used by traits like with the__deserialize_content_v1method.The existing code is quite complex (I intend to add some comments in this PR), so I thought it would be good to rely on serde in a more common way. An earlier version of this PR didn't have the
DeserializeCryptographicSuiteMultiplexingtrait which resulted inAnySuitedeserialization having mismatched signatures and options. Which is obviously what the existing code tries to avoid! So I tried to solve the issue using this awkward back and forth between the cryptosuite's associated types and the deserialization process, which means many places (and more are needed) to be patched with a constraint on the trait.I also replaced the use of
Contentwith a JSON "data model". I know the specs don't explicitly say so, but in practice we're only dealing with data that can be represented with JSON types.We're definitely losing in performance and in cleanliness but what do you think? Do you have a better idea?
Close #681
Close #682