pub struct Bech32String { /* private fields */ }Expand description
Validated Bech32/Bech32m string wrapper for secret data.
Implementations§
Source§impl Bech32String
impl Bech32String
Sourcepub fn new(s: String) -> Result<Self, &'static str>
pub fn new(s: String) -> Result<Self, &'static str>
Create a new Bech32String from a String, validating and normalizing it.
Accepts mixed-case input (normalized to lowercase for storage).
§Security Note
Invalid inputs are only securely zeroized if the zeroize feature is enabled.
Without zeroize, rejected bytes may remain in memory until the String is dropped
normally. Enable the zeroize feature for secure wiping of invalid inputs.
Sourcepub fn is_bech32m(&self) -> bool
pub fn is_bech32m(&self) -> bool
Check if this is a Bech32m encoding.
Sourcepub fn byte_len(&self) -> usize
pub fn byte_len(&self) -> usize
Exact number of bytes the decoded payload represents (allocation-free).
Sourcepub fn variant(&self) -> EncodingVariant
pub fn variant(&self) -> EncodingVariant
Get the detected encoding variant.
Sourcepub fn into_bytes(self) -> Vec<u8> ⓘ
pub fn into_bytes(self) -> Vec<u8> ⓘ
Decode the validated Bech32/Bech32m string into raw bytes, consuming the wrapper.
Source§impl Bech32String
impl Bech32String
pub fn expose_secret(&self) -> Bech32StringView<'_>
Trait Implementations§
Source§impl Debug for Bech32String
Debug implementation (always redacted).
impl Debug for Bech32String
Debug implementation (always redacted).
Source§impl PartialEq for Bech32String
Available on crate feature ct-eq only.Constant-time equality (prevents timing attacks when comparing encoded secrets).
impl PartialEq for Bech32String
ct-eq only.Constant-time equality (prevents timing attacks when comparing encoded secrets).
impl Eq for Bech32String
Equality implementation.