Extract base64 encoding/decoding to exported functions