Concordium / concordium-dapp-libraries

A coherent set of building blocks for making it as easy as possible for developers to build web-based dApps.
Apache License 2.0
7 stars 5 forks source link

Do not require padding on schema #63

Closed orhoj closed 6 months ago

orhoj commented 6 months ago

Purpose

Allow schema to not have base64 padding.

Changes

Checklist

abizjak commented 6 months ago

I find it unfortunate that we need to support this. Our tools should only produce base64 with padding (see https://datatracker.ietf.org/doc/html/rfc4648#section-3.2).

I think the leniency of the decoder in JavaScript is the exception, not the norm. So if users try to use the strings in other contexts, it's likely that they'll run into decoding errors and have to add padding anyway.

In many other contexts you have a choice of whether to require padding or not when parsing. For our use of base64 there is no value in padding so it is needlessly disruptive to require it.

It is in fact the choice to arbitrarily require padding that is unfortunate. It has no semantic meaning in our context.