New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix serde implementation for serde_json #146
Conversation
Interesting. Perhaps we should also consider using this in the https://github.com/RustCrypto/signatures/blob/76008e8/ed25519/src/lib.rs#L282-L332 |
The CI error seems to be unrelated to this PR.
I don't know. Basically, it is a choice between to serialize as Currently there are two main issues:
My suggestion would be to merge this PR first, as it fixes json without introducing breaking changes. The we can figure out what is the long term approach, which would definitely require a breaking change. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @xu-cheng, thanks for the PRs. (And thanks @tarcieri for the input.)
Let me see if I understood this correctly:
- We had inconsistent types in the various serde impls (
&[u8]
versus[u8; N]
). - One of these types (which one???) is breaking the ability to interface with serde-json.
- This API fixes the inconsistency in a completely backwards compatible way (i.e. it should be fine to merge for ed25519-dalek version 1.0.1).
- Later we should decide if we want to use (de-)serialisers which are optimised towards either formats like CBOR which store the length or formats like JSON which do not.
Did I understand everything correctly?
FWIW I believe this is a breaking change by upgrading bincode, since the Infinite
struct went away.
Also, yes, the CI failure was due to #145; it should be fixed now. |
* Upgrade bincode to 1.0 * Add more serde tests including json serialization.
We use the [serde_bytes](https://github.com/serde-rs/bytes) crate for serialization implementations, which simplifies codes and fixes issues for serde_json.
It is
bincode is a develop dependency, which is only used in tests. So updating it should be fine.
Yes. So currently,
|
@xu-cheng Thanks! I'm not sure which way to go in the future, but this looks like a good start to at least get JSON working. Thanks so much for fixing this! |
Based on discussion in #140.
We use the serde_bytes crate for serialization implementations, which simplifies codes and fixes issues for serde_json.