paragonie / paseto

Platform-Agnostic Security Tokens
https://paseto.io
Other
3.24k stars 108 forks source link

Builder: fix toString that return JSON array if claims is empty #120

Closed shuLhan closed 3 years ago

shuLhan commented 3 years ago

Section 6 of RFC draft v01 said that "All PASETO payloads MUST be a JSON object [RFC8259].", but when builder->toString() called without any claims it will store the claims as JSON array instead of object.

This commit fix the json_encode by adding parameter JSON_FORCE_OBJECT when encoding claims on method sign().

Fix #119