# `Spectre.Definition.Ref`
[🔗](https://github.com/elchemista/spectre/blob/0.3.0/lib/spectre/definition/ref.ex#L1)

Content-addressed identity of one canonical Spectre Definition.

A Ref proves integrity of canonical bytes. It does not prove publisher
identity, trust, approval, or current authority.

# `t`

```elixir
@type t() :: %Spectre.Definition.Ref{
  algorithm: :sha256,
  canonicalization_version: pos_integer(),
  contract_version: pos_integer(),
  digest: String.t()
}
```

# `new`

```elixir
@spec new(Spectre.Definition.Canonical.t()) :: t()
```

Builds the Ref for a canonical Definition.

# `parse`

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

Parses the stable `sha256:<hex>` representation.

# `to_string`

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

Returns the stable textual representation of a Ref.

# `valid?`

```elixir
@spec valid?(term()) :: boolean()
```

Checks the shape and supported algorithm of a Definition Ref.

# `verify`

```elixir
@spec verify(t(), Spectre.Definition.Canonical.t()) :: :ok | {:error, term()}
```

Verifies that a Ref addresses the supplied canonical Definition.

---

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