# `Spectre.GAM.SubmissionContext`
[🔗](https://github.com/elchemista/spectre/blob/0.4.0/lib/spectre/gam/submission_context.ex#L1)

Authenticated ingress context supplied separately from a candidate.

Only the ingress adapter declared by the running Domain may produce a trusted
context. The Sequencer authenticates through that adapter and adds a
generation-bound, process-local seal. Scope opening, resumption and Candidate
submission verify the seal as well as the fixed `ingress_ref`; merely building
this public data structure does not cross the ingress boundary.

The seal is deliberately excluded from the canonical representation. It is a
live fencing mechanism, not durable Evidence or part of the Domain history.
The context identifies the authenticated principal and host generation
without carrying reusable source credentials. Authentication narrows mandate
eligibility; it never creates authority.

# `t`

```elixir
@type t() :: %Spectre.GAM.SubmissionContext{
  authenticated_principal_ref: String.t(),
  authentication_ref: String.t(),
  channel_ref: String.t() | nil,
  domain_ref: String.t(),
  host_generation: non_neg_integer(),
  ingress_ref: String.t(),
  ref: String.t(),
  schema_version: 1,
  scope_ref: String.t(),
  seal: String.t() | nil,
  session_ref: String.t() | nil
}
```

# `canonical`

```elixir
@spec canonical(t()) :: map()
```

Returns the plain, string-keyed representation suitable for a decision record.

# `content_ref`

```elixir
@spec content_ref(t()) :: String.t()
```

Returns the content-derived reference, independent of an assigned `ref`.

# `decision_bindings`

```elixir
@spec decision_bindings(t()) :: map()
```

Returns the trusted ingress fields frozen into a durable Decision.

# `digest`

```elixir
@spec digest(t()) :: String.t()
```

Returns the stable digest of the complete context.

# `evidence_bindings`

```elixir
@spec evidence_bindings(t()) :: map()
```

Returns the exact trusted context fields embedded in scoped Evidence.

# `extract_evidence_context`

```elixir
@spec extract_evidence_context(map()) :: {:ok, t() | nil} | {:error, term()}
```

Returns the complete scoped context in Evidence bindings, or `nil` when unscoped.

# `from_canonical`

```elixir
@spec from_canonical(map()) :: {:ok, t()} | {:error, term()}
```

Restores a context from its canonical map.

# `from_decision`

```elixir
@spec from_decision(Spectre.GAM.Decision.t()) :: {:ok, t()} | {:error, term()}
```

Restores the trusted ingress context frozen in a durable Decision.

# `from_evidence_bindings`

```elixir
@spec from_evidence_bindings(map()) :: {:ok, t()} | {:error, term()}
```

Restores and verifies a context from the trusted portion of Evidence bindings.

# `merge_evidence_bindings`

```elixir
@spec merge_evidence_bindings(t(), map()) :: {:ok, map()} | {:error, term()}
```

Adds application bindings without permitting trusted context fields to be supplied.

# `new`

```elixir
@spec new(map() | keyword() | t()) :: {:ok, t()} | {:error, term()}
```

Builds and validates an authenticated submission context.

# `validate_evidence_bindings`

```elixir
@spec validate_evidence_bindings(t(), map()) :: :ok | {:error, term()}
```

Checks that scoped Evidence carries exactly this trusted context.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
