Closed cinolt closed 1 year ago
@ukstv suggested using multibase table for naming.
That would likely break backwards compatibility and will require 2.0.
The question is whether it's optimal to have non-padded defaults (base64url). One argument is that multibase uses it but multibase is not really an authority (rfcs are)
multibase is not really an authority (rfcs are)
I would like to provide two arguments in favour of multibase names.
base64url
, most probably it is a reference to multibase base64url
, not the RFC version. It would be really nice to not surprise people working in the field with different names.There is an alternative approach though to changing names in this library (was about to post it in the did-jwt PR, but got unicorned by GitHub). One writes say multibases
library (a successor to now deprecated multibase
) built on top of @scure/base
. It exports all the right names, paddings and casings.
The question is whether it's optimal to have non-padded defaults
One can optimize for different objectives, so this is ambiguous. We can optimize for community interoperability or backward compatibility... or both (by releasing a patch version and a major version bump). Or a new library as suggested. Or we can optimize for minimal effort and do none of the above :)
As a simple user, I'd be pleased with any movement.
I agree that the issue will need to be solved at some point.
The next step for me or anyone else who's willing to dive into this would be to analyze what's being done is competition base64url (etc) libraries and what's their default/non-default behavior.
Methodology: Went here, and either read the docs, source code, or simply ran the code to figure out what it did. I ignored libs with less than 1000 downloads/week, and only looked at the first page.
Thanks Alex, that's very helpful!
So I guess we should make 1.2 with non-padded versions of the functions to mitigate the issue for existing users.
Any ideas on the naming? base64urlnopad
or something? @ukstv @cinolt which formats would you need? Only base64url for now?
The multiformats table seems nice and comprehensive, and the fact most libraries are using non-padded defaults also matters, so for some future 2.0 we should probably switch to the naming from the table.
For 1.2, we could avoid the naming problem by following rfc4648.js's style and adding an optional opts
param. And FWIW I'm only interested in base64url.
Opts will be a problem, since our other encoders are not really using them.
Done, added as base64urlnopad
@paulmillr can you publish an npm release so that base64urlnopad
can be used? thanks so much
will publish the new version soon.
1.1.2 is out folks
RFC4648 states:
An example of a specification that prohibits padding characters is RFC8555:
Therefore, it would be nice if the encoding/decoding functions provided an option to omit padding characters.