cadrumo.core.base64_codec module¶
Strict base64 codec for persisted byte fields.
The one home for the ASCII base64 round-trip this project persists byte
material through. Decoding is strict: validate=True refuses any character
outside the base64 alphabet rather than silently discarding it, so a corrupted
or hand-edited record fails at the boundary instead of yielding shorter bytes
that still parse.
Lives in core because its callers sit in two packages that must not
import each other — the shared-master key surface and the per-profile custody
surface — and a primitive shared by both belongs beneath both rather than in
either. Duplicating a two-line wrapper to avoid that dependency would put the
same encoding decision in two places, where only one of them would be fixed.
- b64_decode(text)[source]¶
Return the bytes of a strict ASCII base64 string.
- Raises:
binascii.Error – When
textcarries any character outside the base64 alphabet, or is not correctly padded.- Return type:
- Parameters:
text (str)