github / webauthn-json

🔏 A small WebAuthn API wrapper that translates to/from pure JSON using base64url.
https://github.github.com/webauthn-json/demo/
MIT License
757 stars 60 forks source link

Use shorter code for `base64url.ts` #4

Closed lgarron closed 4 years ago

lgarron commented 5 years ago

base64urlToBuffer() and bufferToBase64url() take up a significant part of the build size. It would be nice to make them as small as possible. I believe there are shorter implementations we could use, especially taking into account that the expected data is only on the order of a hundred bytes.

Note that the minified code size matters the most (not the source code size)!

lgarron commented 4 years ago

I looked into this a while back, and I was unable to use any clever tricks to shrink the size by more than a few bytes. I don't think there are significant gains to be made by simple code changes, unless browsers add more conversion functions.