# Base64 Codec Lessons

Date: 2026-06-10
Issue: #55

## What Happened

The Base64 slice landed as focused codec APIs instead of a broad binary/text
utility bag. The implementation uses the maintained Rust `base64` crate and
wraps decode failures in a project-owned error enum so public callers do not
depend on upstream error variants directly.

## What Surprised Us

Padding policy needs explicit tests. The upstream padded engines use canonical
padding requirements, while no-padding engines reject any `=` padding. Without
tests for both missing required padding and unexpected padding, the public
function names could overpromise behavior.

## Next Time

- Keep alphabet and padding choices visible in function names.
- Use maintained codec crates for standardized encodings when they provide
  strict engines and typed errors; do not hand-roll Base64.
- Keep Base58 and Base62 in their own issue (#63), because their compatibility
  and alphabet choices deserve a separate review.
- If #62 merges before #55, rebase carefully around codec README and Rustdoc
  wording instead of dropping either PR's examples.
