pub trait FromBech32Str {
// Required methods
fn try_from_bech32(&self) -> Result<(String, Vec<u8>), Bech32Error>;
fn try_from_bech32_expect_hrp(
&self,
expected_hrp: &str,
) -> Result<Vec<u8>, Bech32Error>;
}Expand description
Extension trait for decoding Bech32 strings to byte data.
Input should be treated as untrusted; use fallible methods.
§Security Warning
Decoding input from untrusted sources should use fallible try_ methods.
Invalid input may indicate tampering or errors.
Required Methods§
Sourcefn try_from_bech32(&self) -> Result<(String, Vec<u8>), Bech32Error>
fn try_from_bech32(&self) -> Result<(String, Vec<u8>), Bech32Error>
Fallibly decode a Bech32 string to (HRP, bytes).
Sourcefn try_from_bech32_expect_hrp(
&self,
expected_hrp: &str,
) -> Result<Vec<u8>, Bech32Error>
fn try_from_bech32_expect_hrp( &self, expected_hrp: &str, ) -> Result<Vec<u8>, Bech32Error>
Fallibly decode a Bech32 string, expecting the specified HRP, returning bytes.