openwallet-foundation-labs / sd-jwt-python

A Python implementation of the Selective Disclosure JWT (SD-JWT) spec.
Apache License 2.0
12 stars 10 forks source link

Python JSON serialization in test cases #2

Open OR13 opened 11 months ago

OR13 commented 11 months ago

Test cases contain JSON serializations that are python specific.

It would be better to ensure compact JSON is used (no extra spaces)... otherwise implementations will need to adjust their JSON serializer to match Python in order to to match the testcases.

Some additional string cases would also help force errors for any brittle reimplementation of python dumps.

{
  "I'm a 🧊, :cool: string": "with 🌶️, and :pepper:"
}

(, and : have spaces after them in the default JSON serialization used)

danielfett commented 10 months ago

Happy to accept PRs for new test cases :-)

I'll look into the JSON serializiation, although there are more parts that may vary, e.g., the order of elements. My expectation is that JSON is not compared as strings, but based on the decoded content.