Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add support for base64url strings #3711

Open
marvinruder opened this issue Aug 16, 2024 · 0 comments · May be fixed by #3712
Open

Add support for base64url strings #3711

marvinruder opened this issue Aug 16, 2024 · 0 comments · May be fixed by #3712

Comments

@marvinruder
Copy link

marvinruder commented Aug 16, 2024

The .base64() function validates strings that contain binary information encoded in Base 64. A modification of Base 64 that can safely be used in URLs and filenames is given by the base64url standard specified in RFC 4648 § 5. As summarized here,

it uses the same algorithm as the main standard, but differs in the following:

  • Replaces “+” by “-” (minus)
  • Replaces “/” by “_” (underline)
  • Does not require a padding character
  • Forbids line separators

I propose a method .base64url() that is similar to .base64(), but instead matches against a regular expression that describes base64url-encoded values.

marvinruder added a commit to marvinruder/zod that referenced this issue Aug 16, 2024
Fixes colinhacks#3711

Signed-off-by: Marvin A. Ruder <signed@mruder.dev>
@marvinruder marvinruder linked a pull request Aug 16, 2024 that will close this issue
marvinruder added a commit to marvinruder/zod that referenced this issue Aug 30, 2024
Fixes colinhacks#3711

Signed-off-by: Marvin A. Ruder <signed@mruder.dev>
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant