-
Notifications
You must be signed in to change notification settings - Fork 619
Feature/base64 support #12
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
Conversation
This will need to be rebased after #11 is merged in. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor doc-related comment, otherwise shipit!
const bitsPerByte = 8; | ||
const maxLetterValue = 0b111111; | ||
|
||
export function fromBase64(input: string): Uint8Array { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Were these methods taken from somewhere, or was https://tools.ietf.org/html/rfc4648#section-4 used for the spec? We might want to add a comment reference to the spec for future devs (or in the README)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was based on the spec. I added some documentation blocks for each encoder, and the browser ones include a link to the IETF spec.
|
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread. |
This PR adds cross-platform base64 support, since this isn't something built into the ES spec. In node, this functionality is provided by the
buffer
module, but we're on our own in browserland. For simplicity, this PR does not include support for URL-safe or unpadded b64, as that can be added as a post-processing step if we ever need it in an SDK.