pub struct Headers<'a> {
pub substrate: &'a str,
pub receipt: &'a str,
pub algorithms: &'a str,
pub timestamp_ms: u64,
}Expand description
Zero-allocation view of the four substrate headers.
Construct with Self::from_strs when you have already extracted
the raw string values, or enable the reqwest-support feature to
use [Self::from_reqwest] for one-line extraction from a
reqwest::Response.
Fields§
§substrate: &'a strValue of X-H33-Substrate — 64 lowercase hex chars.
receipt: &'a strValue of X-H33-Receipt — 84 lowercase hex chars.
algorithms: &'a strValue of X-H33-Algorithms — comma-separated algorithm identifiers.
timestamp_ms: u64Value of X-H33-Substrate-Ts — already parsed from string to u64.
Implementations§
Source§impl<'a> Headers<'a>
impl<'a> Headers<'a>
Sourcepub const fn from_strs(
substrate: &'a str,
receipt: &'a str,
algorithms: &'a str,
timestamp_ms: u64,
) -> Self
pub const fn from_strs( substrate: &'a str, receipt: &'a str, algorithms: &'a str, timestamp_ms: u64, ) -> Self
Construct from already-extracted string slices. This is the
no_std-friendly constructor that every other constructor
ultimately calls into.
§Examples
use h33_substrate_verifier::Headers;
let headers = Headers::from_strs(
"f3a8b2c1deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef",
"012e891fa4cafebabedeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef\
0000000012345678\
07",
"ML-DSA-65,FALCON-512,SPHINCS+-SHA2-128f",
1_733_942_731_234,
);
assert_eq!(headers.substrate.len(), 64);Sourcepub fn decode_substrate(&self) -> Result<[u8; 32], VerifierError>
pub fn decode_substrate(&self) -> Result<[u8; 32], VerifierError>
Parse the hex-encoded X-H33-Substrate value into the raw 32-byte
SHA3-256 digest it represents. Runs length and hex-character
validation before decoding.
Sourcepub fn algorithm_identifiers(&self) -> impl Iterator<Item = &'a str>
pub fn algorithm_identifiers(&self) -> impl Iterator<Item = &'a str>
Split X-H33-Algorithms into its comma-separated parts, trimming
whitespace. Returns an iterator that is lazy and zero-copy.