Spectre.Forge.OracleApproval (Spectre v0.3.0)

Copy Markdown View Source

Independent host approval binding one proposed evaluation case to an oracle.

Approval is evidence, not activation authority. It cannot select an evaluator implementation; oracle_ref must resolve through a host registry.

Summary

Functions

Checks whether this approval binds the supplied case and oracle.

Restores an approval from decoded transport data.

Builds a content-bound oracle approval.

Builds an approval or raises with its stable validation reason.

Returns the stable approval reference.

Returns the oracle-approval transport schema version.

Returns JSON-shaped approval data.

Revalidates the complete approval.

Types

t()

@type t() :: %Spectre.Forge.OracleApproval{
  approved_at: non_neg_integer(),
  approver_ref: String.t(),
  case_digest: String.t(),
  digest: String.t(),
  oracle_ref: String.t(),
  provenance: map(),
  schema_version: pos_integer()
}

Functions

approves?(approval, case_digest, oracle_ref)

@spec approves?(t(), String.t(), String.t()) :: boolean()

Checks whether this approval binds the supplied case and oracle.

from_data(data)

Restores an approval from decoded transport data.

new(approval)

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

Builds a content-bound oracle approval.

new!(attrs)

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

Builds an approval or raises with its stable validation reason.

ref(oracle_approval)

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

Returns the stable approval reference.

schema_version()

@spec schema_version() :: pos_integer()

Returns the oracle-approval transport schema version.

to_data(approval)

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

Returns JSON-shaped approval data.

verify(approval)

@spec verify(t()) :: :ok | {:error, term()}

Revalidates the complete approval.