You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Decouple encode and decode padding policies for asymmetric protocols #9
policy::Padded and policy::Unpadded in bases/src/policy.rs currently control encoding and decoding together: Padded emits and requires canonical = padding, while Unpadded omits and rejects =. Several real-world wire protocols require asymmetric behavior: for example, gRPC HTTP/2 binary metadata specifies that senders should omit padding while receivers must accept both padded and unpadded Base64, and many JWT/OAuth2 implementations accept optional canonical padding on decode. Notably, Base16<Case, DecodeCase> and Base32<Alphabet, Padding, Case, DecodeCase> already separate encode output case from decode case policy.
Considerations
Keep the existing ten strict crate-root profiles unchanged as the default contract.
Evaluate separating encode padding emission from decode padding acceptance (or adding an explicit policy::Indifferent decode padding marker) on Base64 and Base32.
Keep padding acceptance orthogonal to whitespace skipping or non-zero trailing-bit tolerance; specs that bundle all three (such as WHATWG forgiving-base64) have distinct contracts and should not be conflated into a generic lenient mode.
Activity
feat: support both output forms with optional padding
tisonkun commentedon Nov 18, 2026
Resolved by #21.