Diffing, SD-JWTs, JSON Serialization, and batch mode
This release adds four ways to work with tokens:compare two tokens semantically, decode Selective Disclosure JWTs, read JWS and JWE tokens in JSON Serialization, and process many tokens in one run. It also includes the fixes from a security audit of these features.
What's new
jwtd diff. jwtd diff <tokenA> <tokenB> compares two tokens field by field instead of as text.
• Output: added (+), removed (-), and changed (~) header and payload fields. --all also shows unchanged fields.
• Timestamps: iat, exp, nbf, auth_time, and updated_at show signed deltas such as (+1h). The --local/--tz timezone flags apply.
• Keys: --key and --verify-key apply to both tokens. A JWK Set verifies tokens across kid rotations, and encrypted or nested tokens are decrypted before they are compared.
• Scripting: --exit-code exits 1 when the tokens differ. --json emits a machine-readable diff. - reads one of the two tokens from stdin.
• Fails closed: two undecrypted JWEs with different ciphertexts are never reported equal. An SD-JWT whose disclosures do not bind never compares equal to anything.
SD-JWT (RFC 9901). Tilde-separated Selective Disclosure JWTs are detected automatically.
• Disclosures: every disclosure is checked against its digest, recursively and inside arrays, with sha-256, sha-384, or sha-512. The disclosed claims are merged into the payload. A tampered, duplicated, conflicting, or unreferenced disclosure fails with a nonzero exit.
• Key Binding JWTs are checked for typ, an asymmetric alg, the required claims with their types, and sd_hash. Their signature is verified against cnf.jwk only after the issuer signature verified against your --key, because a holder key the issuer did not vouch for proves nothing.
• Works everywhere: claim validation, --claim/--payload, --json, nesting inside a JWE, and jwtd diff all use the reconstructed claims.
JWS and JWE JSON Serialization. Flattened and General JSON Serialization (RFC 7515 / RFC 7516 §7.2) is detected alongside compact tokens. Pretty-printed JSON can be piped in as is.
• JWS: protected and unprotected headers are shown, and every signature is verified on its own. In a multi-signature token, a signature your key does not apply to is reported as not checked instead of INVALID, so one signer's key can verify that signer's signature.
• JWE: the shared and per-recipient headers and the AAD are shown. Multi-recipient tokens are decrypted using each recipient's kid and alg.
• Raw JWS payloads: a compact JWS carrying a non-JSON payload now decodes, verifies, and extracts with --payload. Claim checks and --claim fail on it, because it holds no claims.
--stream. Process newline-delimited tokens from stdin, for example from logs.
• Output: human output separates tokens with ---. --json emits NDJSON. --claim extracts one value per valid token.
• Errors: processing continues past bad lines. Errors and verdicts on stderr name the line they came from. The exit status is nonzero at the end if any token failed.
• Interactive: on a terminal, jwtd --stream prompts in a loop until an empty line, exit, or Ctrl+D.
Behaviour changes
• JWS extensions are refused. jwtd implements no JWS extension, so a token whose header carries crit is rejected, as RFC 7515 §4.1.11 requires. So is an RFC 7797 unencoded payload ("b64":false). Before, such a token's payload was base64url-decoded like any other, so a payload the issuer never signed could verify VALID.
• Tokens nested in a JWE must be clean. A decrypted payload opens as a nested token only when it contains nothing but token characters; surrounding whitespace is trimmed. A line break inside a segment used to parse and reach the terminal raw. Such a payload is now shown as text.
• Deep nesting is indented less. Indentation stops growing at 64 levels in both the regular and the diff output. Deeper content is still printed in full. A 40 KB token nested 5,000 levels deep used to print 50 MB; it now prints 1.3 MB.
• Verdict reasons are always escaped. Every reason printed after a verdict goes through the terminal escaper, so token-supplied text cannot forge a verdict line.
What's Changed
• docs:clear release notes after 5.10.0 by @bsg62 in https://github.com/webcodr/jwtd/pull/45
• feat:add jwtd diff subcommand for semantic token diffing by @bsg62 in https://github.com/webcodr/jwtd/pull/46
• feat:add RFC 9901 SD-JWT decoding, verification, and key binding support by @bsg62 in https://github.com/webcodr/jwtd/pull/47
• feat:support JWS/JWE JSON Serialization and raw non-JSON JWS payloads by @bsg62 in https://github.com/webcodr/jwtd/pull/48
• feat:add --stream mode for newline-delimited batch decoding and interactive loops by @bsg62 in https://github.com/webcodr/jwtd/pull/49
• fix:address security audit findings H1–H5, M2–M4 by @bsg62 in https://github.com/webcodr/jwtd/pull/50
• fix:address remaining security audit findings M1, M5, L1–L6 by @bsg62 in https://github.com/webcodr/jwtd/pull/51
• docs:add 2026-12-01 security audit with resolution status by @bsg62 in https://github.com/webcodr/jwtd/pull/52
• docs:draft release notes and update agents file lists by @bsg62 in https://github.com/webcodr/jwtd/pull/53
• docs:prepare 5.11.0 website by @bsg62 in https://github.com/webcodr/jwtd/pull/54
Full Changelog:https://github.com/webcodr/jwtd/compare/v5.10.0...v5.11.0