···3030 critical JOSE header extensions.
3131- Reject JWTs with `b64: false` using the new `UnsupportedUnencodedPayload`
3232 error, as ywt does not support unencoded JWS payloads.
3333+- Reject padded, whitespace-containing, or otherwise non-base64url JWT compact
3434+ segments and JWK binary/integer fields before decoding them.
3335- Handle duplicate JSON object members consistently for decoded JWT protected
3436 headers and claim sets by keeping the lexically last value, matching
3537 JavaScript's `JSON.parse` behavior on all targets.
···88import gleam/string
99import ywt/algorithm.{type Algorithm}
1010import ywt/claim.{type Claim}
1111+import ywt/internal/base64url
1112import ywt/internal/core.{type Error}
1213import ywt/internal/jose_json
1314import ywt/sign_key.{type SignKey}
···124125 // following the restriction that no line breaks, whitespace, or
125126 // other additional characters have been used.
126127 use signature <- result.try(
127127- bit_array.base64_url_decode(raw_signature)
128128+ base64url.decode(raw_signature)
128129 |> result.replace_error(core.InvalidSignatureEncoding),
129130 )
130131···214215 // restriction that no line breaks, whitespace, or other additional
215216 // characters have been used.
216217 use decoded <- result.try(
217217- bit_array.base64_url_decode(part)
218218+ base64url.decode(part)
218219 |> result.replace_error(encoding_error),
219220 )
220221