Spectre.Definition.Manifest (Spectre v0.3.0)

Copy Markdown View Source

Sealed Manifest V2 for one canonical Definition.

A Manifest binds the Definition Ref, its effective Authority Envelope, its Execution Closure, and the exact component-contract interpretation used at publication time. Integrity is content-addressed; publisher trust, approval, revocation, and current authority remain separate host concerns.

Summary

Functions

Returns the mandatory reflective Stack/Manifest contract version.

Decodes and validates canonical Manifest bytes.

Returns the content digest of the sealed Manifest.

Encodes a Manifest into portable canonical bytes.

Encodes a Manifest or raises on invalid canonical data.

Restores a Manifest from decoded canonical data.

Builds and validates a Manifest from already normalized fields.

Builds and seals a Manifest for a canonical Definition.

Builds a Manifest or raises with its stable validation reason.

Returns the Manifest schema version.

Returns the portable Manifest representation.

Verifies the Definition binding and its exact component-contract snapshot.

Types

t()

@type t() :: %Spectre.Definition.Manifest{
  authority: Spectre.Authority.Envelope.t(),
  component_contracts: [map()],
  contract_version: pos_integer(),
  definition_ref: Spectre.Definition.Ref.t(),
  execution_closure: Spectre.Execution.Closure.t(),
  parent_refs: [Spectre.Definition.Ref.t()],
  provenance_refs: [String.t()],
  publisher_ref: String.t() | nil,
  receipt_refs: [String.t()],
  schema_version: pos_integer()
}

Functions

contract_version()

@spec contract_version() :: pos_integer()

Returns the mandatory reflective Stack/Manifest contract version.

decode(encoded)

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

Decodes and validates canonical Manifest bytes.

digest(manifest)

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

Returns the content digest of the sealed Manifest.

encode(manifest)

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

Encodes a Manifest into portable canonical bytes.

encode!(manifest)

@spec encode!(t()) :: binary()

Encodes a Manifest or raises on invalid canonical data.

from_data(data)

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

Restores a Manifest from decoded canonical data.

new(manifest)

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

Builds and validates a Manifest from already normalized fields.

new(canonical, authority, closure, opts \\ [])

Builds and seals a Manifest for a canonical Definition.

new!(canonical, authority, closure, opts \\ [])

Builds a Manifest or raises with its stable validation reason.

schema_version()

@spec schema_version() :: pos_integer()

Returns the Manifest schema version.

to_data(manifest)

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

Returns the portable Manifest representation.

verify(manifest, canonical, registry \\ ContractRegistry.default())

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

Verifies the Definition binding and its exact component-contract snapshot.