http_message_signatures/component
RFC 9421 §2 component identifiers, canonicalization, and signature base assembly.
Covers: §2.1 (HTTP fields), §2.2.1-§2.2.9 (derived components, origin-form
@request-target only), and §2.5 (signature base creation). Structured-field
component parameters (sf, key, bs), trailer fields (tr), and
request-response binding (req) are out of scope — see the README.
Types
pub type ComponentError {
HeaderNotFound(String)
QueryParamNotFound(String)
NotARequestComponent(DerivedComponent)
NotAResponseComponent
InvalidTargetUri(String)
}
Constructors
-
HeaderNotFound(String) -
QueryParamNotFound(String) -
NotARequestComponent(DerivedComponent) -
NotAResponseComponent -
InvalidTargetUri(String)
pub type ComponentIdentifier {
Derived(DerivedComponent)
Field(name: String)
}
Constructors
-
Derived(DerivedComponent) -
Field(name: String)
pub type DerivedComponent {
Method
TargetUri
Authority
Scheme
RequestTarget
Path
Query
QueryParam(name: String)
Status
}
Constructors
-
Method -
TargetUri -
Authority -
Scheme -
RequestTarget -
Path -
Query -
QueryParam(name: String) -
Status
Values
pub fn component_value(
id: ComponentIdentifier,
message: message.Message,
) -> Result(String, ComponentError)
Resolves a component identifier to its canonicalized string value for the given message, per RFC 9421 §2.1 (HTTP fields) and §2.2 (derived components).
pub fn identifier_to_element(
id: ComponentIdentifier,
) -> types.Element
Renders a component identifier as a Structured Fields Element, per RFC
9421 §2.5 — the component name as a BareString Item, with any component
parameters (only ;name= for @query-param is supported).
pub fn identifier_to_string(id: ComponentIdentifier) -> String
The strict Structured Fields serialization of a component identifier,
e.g. "@method" or "@query-param";name="baz".
pub fn signature_base(
components: List(ComponentIdentifier),
message: message.Message,
signature_params_element: types.Element,
) -> Result(String, ComponentError)
Assembles the signature base (RFC 9421 §2.5): one line per covered
component, identifier: value, followed by the @signature-params line,
joined with \n (no trailing newline).