Skip to content
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

Replace serde with direct encoding implementation. #1

Open
cobward opened this issue Oct 3, 2022 · 0 comments
Open

Replace serde with direct encoding implementation. #1

cobward opened this issue Oct 3, 2022 · 0 comments
Assignees

Comments

@cobward
Copy link
Collaborator

cobward commented Oct 3, 2022

I've been looking into the canonicalisation recommendations for cbor, and realised it's going to be very difficult to implement those restrictions with serde. Also in my opinion using serde implies that you can encode and decode the data structures to any format, when really we want to just limit it to cbor. For that reason I think just implementing a to_cbor_bytes and from_cbor_bytes method on each struct would be best.

I've been looking at this crate as a good option to implement this:
https://twittner.gitlab.io/cbor-codec/cbor/index.html

The GenericDecoder appears to handle cbor canonicalisation properly, for example erroring if duplicate keys are found in a map.

@cobward cobward self-assigned this Oct 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant