Spectre.Input.Source (Spectre v0.3.2)

Copy Markdown View Source

Provider-neutral origin attached to a normalized Spectre input.

Optional channel and protocol packages use kind as their namespace and mount as the concrete configured endpoint. Identifiers remain opaque to the core. Trust is explicit and defaults to :untrusted; authentication evidence and provenance never promote content on their own.

Summary

Functions

Returns the closed trust classes understood by the core.

Validates source evidence at trust and persistence boundaries.

Types

t()

@type t() :: %Spectre.Input.Source{
  actor_id: term(),
  authenticity: map(),
  conversation_id: term(),
  kind: atom() | String.t(),
  metadata: map(),
  mount: term(),
  provenance: map(),
  reply_to: term(),
  trust: :untrusted | :trusted | :system
}

Functions

new(source)

@spec new(t() | map() | keyword()) :: t()

trust_classes()

@spec trust_classes() :: [:untrusted | :trusted | :system]

Returns the closed trust classes understood by the core.

validate(source)

@spec validate(term()) :: :ok | {:error, term()}

Validates source evidence at trust and persistence boundaries.

This is intentionally separate from new/1: checkpoint decoding can reconstruct a struct without invoking its constructor, so consumers must be able to re-establish the same invariants without raising.