# `Spectre.Gate.Receipt`
[🔗](https://github.com/elchemista/spectre/blob/0.4.0/lib/spectre/gate/receipt.ex#L1)

Content-addressed evidence emitted by one trusted governance checker.

Receipts bind the immutable proposal, both Definition identities, execution
closure, evaluation corpus, checker version, profile, result, provenance,
and validity window. Passing a struct does not grant trust: activation reads
the receipt back from the configured Definition Store by `Receipt.Ref`.

# `gate_class`

```elixir
@type gate_class() :: Spectre.Governance.CandidateState.gate_class() | :approval
```

# `t`

```elixir
@type t() :: %Spectre.Gate.Receipt{
  candidate_definition_ref: String.t(),
  candidate_digest: String.t(),
  checker_id: String.t(),
  checker_version: pos_integer(),
  closure_digest: String.t(),
  evaluation_cases_digest: String.t(),
  expires_at: non_neg_integer() | nil,
  gate_class: gate_class(),
  issued_at: non_neg_integer(),
  parent_definition_ref: String.t(),
  profile_ref: String.t() | nil,
  provenance: map(),
  result_digest: String.t(),
  schema_version: pos_integer(),
  status: :passed | :failed
}
```

# `decode`

```elixir
@spec decode(binary()) :: {:ok, t()} | {:error, term()}
```

Decodes and revalidates a receipt.

# `digest`

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

Returns the canonical receipt digest.

# `encode`

```elixir
@spec encode(t()) :: {:ok, binary()} | {:error, term()}
```

Encodes a receipt with the production canonical codec.

# `new`

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

Builds and validates one gate receipt.

# `new!`

```elixir
@spec new!(map() | keyword()) :: t()
```

Builds a receipt or raises with the stable validation reason.

# `ref`

```elixir
@spec ref(t()) :: Spectre.Gate.Receipt.Ref.t()
```

Returns the receipt's content Ref.

# `to_data`

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

Returns canonical portable receipt data.

# `verify`

```elixir
@spec verify(t(), Spectre.Governance.CandidateState.t(), keyword()) ::
  :ok | {:error, term()}
```

Verifies receipt binding, freshness, status, and optional checker policy.

# `verify_binding`

```elixir
@spec verify_binding(t(), Spectre.Governance.CandidateState.t()) ::
  :ok | {:error, term()}
```

Verifies immutable proposal binding without interpreting gate outcome.

---

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