Skip to main content

decode_multikey

Function decode_multikey 

Source
pub fn decode_multikey(
    multibase: &str,
    expected_codec: &[u8; 2],
) -> Result<Vec<u8>>
Expand description

Decode a Multikey publicKeyMultibase string into raw key bytes, verifying the base58btc multibase prefix (z) and the expected multicodec header.

Returns the payload with the multicodec prefix stripped (variable length; the caller validates the key length for its algorithm). For the fixed 32-byte Ed25519 case, prefer decode_ed25519_multikey.

Returns Err for a wrong multibase, an undecodable base58, or a multicodec prefix that does not match expected_codec.