RequestSeal.TransportFacts (RequestSeal v0.2.0)

Copy Markdown View Source

Enumerated caller declarations about HTTP transport.

new/1 accepts :http_version (:unknown, :http1_0, :http1_1, :http2, :http3) and :tls (:unknown, :plain, :tls). Both default to :unknown. :evidence is always :declared; attempts to supply observed or verified evidence reject. No arbitrary metadata, addresses, or forwarded fields are accepted. A declaration cannot prove a connection's security prerequisites.

iex> {:ok, facts} = RequestSeal.TransportFacts.new(%{http_version: :http2, tls: :tls})
iex> facts.evidence
:declared
iex> RequestSeal.TransportFacts.new(%{evidence: :observed})
{:error, %RequestSeal.Message.Error{reason: :invalid_transport}}

Summary

Functions

Construct enumerated declarations or return :invalid_transport.

Recheck the declaration boundary, including manually modified structs.

Types

t()

@type t() :: %RequestSeal.TransportFacts{
  evidence: :declared,
  http_version: :unknown | :http1_0 | :http1_1 | :http2 | :http3,
  tls: :unknown | :plain | :tls
}

Functions

new(attrs)

@spec new(map()) :: {:ok, t()} | {:error, RequestSeal.Message.Error.t()}

Construct enumerated declarations or return :invalid_transport.

validate(facts)

@spec validate(term()) :: :ok | {:error, RequestSeal.Message.Error.t()}

Recheck the declaration boundary, including manually modified structs.