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

Closed, portable material that a person must evaluate before approval.

The value is stored as a plain string-keyed map inside Candidate, Decision
and Act records. `data_digest` is the canonical SHA-256 digest of the data
represented by a Presentation; the data itself need not be duplicated in an
Act. Purpose is repeated here deliberately and must match the Candidate's
authoritative purpose fields.

# `t`

```elixir
@type t() :: %{required(String.t()) =&gt; term()}
```

# `data_digest`

```elixir
@spec data_digest(term()) :: {:ok, String.t()} | {:error, term()}
```

Returns the canonical SHA-256 digest used to bind presented data.

# `new`

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

Builds the canonical consent value and rejects unknown or missing fields.

# `validate_purpose`

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

Checks that the duplicated purpose is the Candidate's current purpose.

---

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