Skip to main content

multibase_to_bytes

Function multibase_to_bytes 

Source
pub fn multibase_to_bytes(multibase: &str) -> Result<Vec<u8>, MultibaseError>
Expand description

Decode a supported multibase string to raw bytes.

The multibase prefix is the first Unicode scalar value, which may be more than one byte. We therefore split on a character boundary via the char iterator rather than a byte index: slicing at byte 1 would panic on any input whose first character is multi-byte (e.g. "é"), and this function is reached with untrusted input through parse_multikey.