Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Include support for base64url #51

Open
mightybyte opened this issue Oct 15, 2020 · 3 comments
Open

Include support for base64url #51

mightybyte opened this issue Oct 15, 2020 · 3 comments

Comments

@mightybyte
Copy link

What do you think about adding support for the base64url encoding to this package? The only difference between base64url and base64 is the encoding of the 62nd and 63rd alphabet characters (https://tools.ietf.org/html/rfc4648#page-7). It seems a shame to do a whole separate pass over the string just to make this small change (as is done here https://github.com/joaquimserafim/base64-url/blob/master/index.js#L10).

@davidchambers
Copy link
Owner

That sounds good to me, @mightybyte, provided the changes are backwards-compatible.

Do you have a suggestion as to how the package should expose the new functionality? The current API is as follows:

{ btoa :: String -> String, atob :: String -> String }

@mightybyte
Copy link
Author

mightybyte commented Oct 15, 2020

I don't have anything in mind. I figured you would have more opinions about it than me. Since we don't have to match the existing atob and btoa API it seems like there's a good bit more flexibility. Maybe call them encodeBase64Url and decodeBase64Url or something?

@davidchambers
Copy link
Owner

If someone is interested in making this change, I will gladly review a pull request. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants