secure_gate/traits/decoding/mod.rs
1//! Decoding traits for explicit string-to-bytes conversion.
2//!
3//! > **Import paths:** `use secure_gate::FromHexStr;` etc. (not `secure_gate::traits::decoding::hex::FromHexStr`)
4//!
5//! All decoding traits return `Vec<u8>` (require `alloc`). For no-alloc targets, use
6//! `Fixed::try_from_hex`, `Fixed::try_from_base64url`, etc. — these decode directly into
7//! a stack-allocated buffer. Treat all input as untrusted. Prefer HRP-validated bech32 methods.
8//! See the [`encoding`](super::encoding) module for the reverse direction.
9//!
10//! Each decoding trait has its own feature gate:
11//!
12//! | Trait | Feature |
13//! |---------------------|---------------------|
14//! | [`FromHexStr`] | `encoding-hex` |
15//! | [`FromBase64UrlStr`]| `encoding-base64` |
16//! | [`FromBech32Str`] | `encoding-bech32` |
17//! | [`FromBech32mStr`] | `encoding-bech32m` |
18pub mod base64_url;
19pub mod bech32;
20#[cfg(feature = "encoding-bech32m")]
21pub mod bech32m;
22pub mod hex;
23
24#[cfg(all(feature = "encoding-base64", feature = "alloc"))]
25pub use base64_url::FromBase64UrlStr;
26#[cfg(all(feature = "encoding-bech32", feature = "alloc"))]
27pub use bech32::FromBech32Str;
28#[cfg(all(feature = "encoding-bech32m", feature = "alloc"))]
29pub use bech32m::FromBech32mStr;
30#[cfg(all(feature = "encoding-hex", feature = "alloc"))]
31pub use hex::FromHexStr;