pub struct CustomScheme {
pub hash: HashAlg,
pub signature_header: &'static str,
pub timestamp_header: Option<&'static str>,
pub encoding: Encoding,
pub prefix: Option<&'static str>,
pub signed_string: fn(&dyn HeaderMap, &[u8]) -> Vec<u8>,
}Expand description
A user-configured HMAC verification scheme for providers not yet built in
(spec.md §2.2). Also the prototyping shape new built-in providers are
implemented against before promotion into the Provider
enum.
All comparisons are constant-time and all decoding fails closed, exactly as for built-in providers.
PartialEq compares the declarative configuration only; signed_string
is excluded — function pointers have no meaningful or reliable equality.
Fields§
§hash: HashAlgHMAC hash algorithm the sender uses.
signature_header: &'static strName of the header carrying the encoded signature.
timestamp_header: Option<&'static str>Name of the header carrying the unix-seconds timestamp, when the
sender signs one. Setting this enables replay protection with the
shared symmetric tolerance (|now - t| <= max_age, default 300s);
leaving it None disables replay checks for this scheme, mirroring
built-ins like GitHub whose schemes sign no timestamp.
encoding: EncodingEncoding of the signature value in its header.
prefix: Option<&'static str>Literal prefix required before the encoded signature (e.g. "v0="
or "sha256="). When set, a header not starting with it is rejected
as malformed rather than leniently accepted — prevents downgrade
confusion between scheme versions.
signed_string: fn(&dyn HeaderMap, &[u8]) -> Vec<u8>Builds the exact byte string the sender HMACs, from the request
headers and the raw body bytes. Read any additional signed inputs
(timestamps, URL context) out of headers; never re-serialize or
normalize raw_body.