pub fn decode_base64_or_hex(input: &str) -> Result<Bytes, CoreError>Expand description
Decodes data that may be either base64 or hex encoded. Tries base64 first, then falls back to hex.
This matches the Go implementation’s permissive decoding behavior.
§Warning: Ambiguous inputs
Strings that are valid in both base64 and hex will always be decoded as
base64. For example, "AABB" is valid hex ([0xAA, 0xBB]) and valid
base64 ([0x00, 0x00, 0x1B]). Because base64 is tried first, the base64
interpretation wins. This is intentional — the Go SDK uses the same
heuristic. Callers who know the encoding should use decode_base64 or
decode_hex directly.
§Arguments
input- The encoded string (base64 or hex)
§Returns
The decoded bytes as Bytes.