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

Portable evidence for one nondeterministic or canonical boundary.

The envelope wraps existing typed receipt payloads; it does not replace
their domain-specific validation. Identity is deterministic, so a sink can
make append retries idempotent after an acknowledgement is lost.

# `kind`

```elixir
@type kind() :: atom()
```

# `privacy`

```elixir
@type privacy() :: :public | :internal | :confidential | :restricted
```

# `t`

```elixir
@type t() :: %Spectre.Receipt.Envelope{
  attempt_id: term(),
  canonical_revision: term(),
  causation_id: term(),
  closure_digest: term(),
  control_revision: term(),
  correlation_id: term(),
  definition_ref: term(),
  id: term(),
  inference_id: term(),
  instance_ref: term(),
  invocation_id: term(),
  kind: term(),
  manifest_digest: term(),
  metadata: term(),
  payload: term(),
  payload_digest: term(),
  payload_ref: term(),
  payload_schema_ref: term(),
  post_state_digest: term(),
  pre_state_digest: term(),
  privacy: term(),
  recorded_at: term(),
  run_id: term(),
  run_revision: term(),
  schema_version: term(),
  stream_epoch: term()
}
```

# `digest`

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

Returns the deterministic digest of the complete portable envelope.

# `kinds`

```elixir
@spec kinds() :: [kind()]
```

Returns kinds defined by the core receipt schema.

# `new`

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

Builds and validates a deterministic receipt envelope.

# `new!`

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

Builds an envelope or raises with the stable validation reason.

# `to_data`

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

Returns portable canonical data suitable for an external sink.

---

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