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

Refactor (and consider moving) base64 and utf8 utils #147

Open
larabr opened this issue Jul 21, 2022 · 1 comment
Open

Refactor (and consider moving) base64 and utf8 utils #147

larabr opened this issue Jul 21, 2022 · 1 comment
Milestone

Comments

@larabr
Copy link
Collaborator

larabr commented Jul 21, 2022

We should review if these utils are needed in the library, otherwise move them over to the clients monorepo.

Regardless, the following refactoring should be done:

  • Remove the binary string variants encodeUtf8 and decodeUtf8
  • Accept/return Uint8Arrays for base64 encoding/decoding
  • Remove encodeUtf8Base64 and decodeUtf8Base64 (they can just chain two functions)

decodeBase64 (or base64ToBytes/Array) should return a Uint8Array, and then utf8BytesToString should take a Uint8Array and return a string, so that utf8BytesToString ∘ base64ToBytes == decodeUtf8Base64.

And then if binary strings are needed in some cases, binaryStringToArray / arrayToBinaryString can be used.

@paulmillr
Copy link

just use scure-base which is independently audited, minimal, 0-dep base64 lib.

@larabr larabr added this to the v8 milestone Mar 20, 2023
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