Closed typeofweb closed 8 months ago
That's unfortunately how the different means to base64url decode work. In node the parser is very relaxed, while in the Web based APIs implementation it's more strict.
Anyway, your use of https://www.rfc-editor.org/rfc/rfc7797 is incorrect, if you want to process unencoded payloads then your JOSE Header MUST also include "crit": ["b64"]
in order to recognize that extension and in such case the library also accepts your "payload" to be an instance of Uint8Array.
What happened?
Running the code (below) in Node.js results in a successful validation but a failure in Cloudflare Workers.
Here's a full reproduction: https://github.com/mmiszy/jose-bug-reproduction
Version
5.2.2
Runtime
Other (I will specify below)
Runtime Details
Node.js 20.11.1 and Wrangler 3.28.3
Code to reproduce
Required