-
Notifications
You must be signed in to change notification settings - Fork 0
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
ES6 Compatible Parsing & Serialization #50
Comments
@rmannibucau Commented |
@cyberphone Commented
https://tools.ietf.org/id/draft-erdtman-jose-cleartext-jws-00.html depends on both features. Predictive property ordering a la ES6 requires something like: JSON Number serialization is an awkward chapter, not even JDK's JavaScript engine (Nashorn) follows the ECMAScript standard. MSFT is currently working on getting their counterpart ES6 compatible. |
@rmannibucau Commented Ordering is deterministic and predictable as mentionned in previous mail and should in any case be enforced by the user if needed with the related API (order annotation). The primitive serialization is handled by json-p accoring to json spec. |
@cyberphone Commented It would be interesting hearing your opinion on this matter because a draft is just a draft :-) |
@rmannibucau Commented |
@cyberphone Commented
For my poor understanding only: Does this mean that the Java APIs in question by default are unable parsing JSON Numbers or JSON Strings produced by Browsers and Node.js? |
@rmannibucau Commented |
@cyberphone Commented The remaining hurdle (property ordering), would in your case already be fixed (-minus some minor spec work) if the IETF signature scheme in the workings, would be revised to rather depend of lexicographic than on predictive ordering. Well, there is this I-JSON thing as well, but as shown by the following Twitter message
the industry have already found "solutions" 😂 |
@cyberphone Commented 4.2 Customizing Property Order Here is the "problem": |
@cyberphone Commented That effectively leaves us (me) with a single option: Add an item CANONICALIZED to the PropertyOrderStrategy set which implies the following:
|
|
ES6 (EcmaScript version 6) and forward specifies very specific rules for serialization including "predictive property" order. This may appear strange but for a human creating the properties A, B, C and getting them serialized as A, C, B is slightly awkward, although completely compatible with JSON.
In addition, ES6 also specifies strict rules for serializing numbers which are quite different from what native Java does.
Anyway, a huge advantage with ES6 parsing and serialization is that it makes it possible creating very elegant "crypto safe" objects as described here: https://cyberphone.github.io/doc/security/jsonsignatures.html
This is currently supported by an open source library of mine (https://github.com/cyberphone/openkeystore#openkeystore) but it would be even cooler if ES6 compatible parsing and serialization would be a part of JSON-B or at least of your reference implementation. This should be coordinated with your JavaScript engine since the very same scheme must be running there already.
The text was updated successfully, but these errors were encountered: