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

Order of JSON keys #44

Open
retog opened this issue Jul 9, 2021 · 0 comments
Open

Order of JSON keys #44

retog opened this issue Jul 9, 2021 · 0 comments

Comments

@retog
Copy link

retog commented Jul 9, 2021

According to RFC8259 specifying the JavaScript Object Notation (JSON) Data Interchange Format:

An object is an unordered collection of zero or more name/value
pairs, where a name is a string and a value is a string, number,
boolean, null, object, or array.

The protocol guide seems however to assume that the keys have an order:

  • The canonical formatting instructions for signing/hashing do not specify an ordering
  • Regarding the signature it says:

It must be the last entry in the dictionary

Possible resolution:

  • Do nothing: "we know what we mean by JSON, it's not what RFC says but we don't care"
  • Explicitly say that this is "ordered JSON" and some additional constraints apply to the ones specified in the RFC
  • Specify how the keys are to be ordered for the canonical serialization and remove the constraint regarding the position of the signature. This could be done with a transition phase or exception for old content in which the order provided in the message is used.
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