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

Add support for canonical encoding #103

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open

Conversation

rotemh
Copy link

@rotemh rotemh commented Jan 25, 2019

In some cases, it is important to enable canonical encoding where the encoded value always results in the same sequence of bytes.
In most cases it's, in fact, the case but JS objects' spec has no guarantees with respect to the intrinsic order of the keys. As a result, the encoding depends on the browser implementation.

This PR adds a new option - canonical:true which always encodes in the object keys in alphabetical order and ensures canonical representation.

Please accept this RP.

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

Successfully merging this pull request may close these issues.

None yet

2 participants