Spectre.Definition.Candidate.Ref (Spectre v0.3.0)

Copy Markdown View Source

Content-addressed identity of a bootstrap Definition Candidate.

A Candidate Ref is intentionally distinct from a Definition.Ref: it binds the exact publication receipt and provenance proposed for activation, while the Definition Ref continues to identify behavior bytes.

Summary

Functions

Builds the Ref for a validated Candidate.

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

Returns the stable textual representation.

Checks the shape and supported digest algorithm.

Verifies that a Ref addresses the supplied Candidate.

Types

t()

@type t() :: %Spectre.Definition.Candidate.Ref{algorithm: :sha256, digest: String.t()}

Functions

new(candidate)

@spec new(Spectre.Definition.Candidate.t()) :: t()

Builds the Ref for a validated Candidate.

parse(value)

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

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

to_string(ref)

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

Returns the stable textual representation.

valid?(arg1)

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

Checks the shape and supported digest algorithm.

verify(expected, candidate)

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

Verifies that a Ref addresses the supplied Candidate.