Spectre.GAM.Mind.Turn (Spectre v0.4.0)

Copy Markdown View Source

Ephemeral, capability-free input to one deliberation.

A Turn contains a sanitized authenticated context and immutable Evidence, but no authority view, Grant, executor or secret. The context seal is removed before the Turn crosses into application deliberation. Evidence references and the conservative label union are derived from the records instead of being stored a second time.

Summary

Functions

Returns the trusted context fields suitable for Evidence bindings.

Returns the canonical Evidence references visible to the Turn.

Returns the conservative union of labels inherited from visible Evidence.

Builds a Turn from an authenticated context and the exact visible Evidence.

Types

t()

@type t() :: %Spectre.GAM.Mind.Turn{
  context: Spectre.GAM.SubmissionContext.t(),
  context_window: map() | nil,
  evidence: [Spectre.GAM.Evidence.t()],
  mind_ref: String.t(),
  opened_at: integer(),
  ref: String.t(),
  seal: String.t() | nil
}

Functions

context_bindings(turn)

@spec context_bindings(t()) :: map()

Returns the trusted context fields suitable for Evidence bindings.

evidence_refs(turn)

@spec evidence_refs(t()) :: [String.t()]

Returns the canonical Evidence references visible to the Turn.

labels(turn)

@spec labels(t()) :: {:ok, [Spectre.GAM.Label.t()]} | {:error, term()}

Returns the conservative union of labels inherited from visible Evidence.

new(context, ref, mind_ref, evidence, opened_at)

@spec new(
  Spectre.GAM.SubmissionContext.t(),
  String.t(),
  String.t(),
  [Spectre.GAM.Evidence.t()],
  integer()
) :: {:ok, t()} | {:error, term()}

Builds a Turn from an authenticated context and the exact visible Evidence.