Spectre.GAM.Presentation (Spectre v0.4.0)

Copy Markdown View Source

Immutable material prepared for a later, governed consent request.

A Presentation records what may be shown; recording it does not claim that anybody saw it. Delivery is the closed presentation.show consequence and must cross the normal Candidate -> Act -> Attempt -> Outcome boundary.

candidate_binding_ref addresses the final Candidate's acyclic pre-consent material. The final Candidate may therefore add this Presentation and the later approval Evidence without creating a reference cycle.

Approval is observed Evidence for the exact Presentation and the exact successful show Act. Its source must be one of approval_source_refs, and its authenticated issuer must be one of the declared recipients.

Summary

Functions

Returns the closed proposition approving one successful show Act.

Classifies a reserved approval proposition and rejects non-canonical variants.

Returns the plain, string-keyed ledger representation.

Recalculates the closed consent material represented by this Presentation.

Returns the content-derived reference, independent of an assigned ref.

Returns the stable digest of the complete presentation.

Restores a presentation from its canonical map.

Returns the fields whose exact value is material to consent.

Builds and validates prepared consent material.

Builds an authenticated supporting or contradicting response to one exact show Act.

Returns the one reserved class used to show prepared material.

Returns the exact executor-facing consequence for this Presentation.

Returns the exact Row dimensions of presentation.show.

Extracts a Presentation ref only from the closed show consequence.

Returns the exact Row of presentation.show.

Validates one approval against its prepared material and successful show.

Validates an approval and returns its exact Evidence basis.

Validates every consent field against one current Candidate-like record.

Validates either a supporting approval or a contradicting response with its basis.

Validates the closed show semantics shared by a Candidate and its Act.

Types

t()

@type t() :: %Spectre.GAM.Presentation{
  alternatives: [term()],
  approval_source_refs: [String.t()],
  candidate_binding_ref: String.t(),
  cost: term(),
  data: term(),
  disclosure: Spectre.GAM.Disclosure.t(),
  material_digest: String.t(),
  prepared_at: integer(),
  purpose_params: map(),
  purpose_ref: String.t(),
  recipient_refs: [String.t()],
  ref: String.t(),
  rendered_payload: term(),
  rendered_payload_ref: String.t() | nil,
  renderer_ref: String.t(),
  reversibility: term(),
  risk: term(),
  schema_version: 1,
  scope_ref: String.t()
}

Functions

approval_proposition(presentation_ref, show_act_ref)

@spec approval_proposition(String.t(), String.t()) :: map()

Returns the closed proposition approving one successful show Act.

approval_refs(evidence)

@spec approval_refs(Spectre.GAM.Evidence.t()) ::
  :not_approval | {:ok, String.t(), String.t()} | {:error, term()}

Classifies a reserved approval proposition and rejects non-canonical variants.

canonical(presentation)

@spec canonical(t()) :: map()

Returns the plain, string-keyed ledger representation.

content_ref(presentation)

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

Returns the content-derived reference, independent of an assigned ref.

digest(presentation)

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

Returns the stable digest of the complete presentation.

from_canonical(value)

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

Restores a presentation from its canonical map.

material(presentation)

@spec material(t()) :: map()

Returns the fields whose exact value is material to consent.

new(presentation)

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

Builds and validates prepared consent material.

response_evidence(context, presentation, show_act, stance, observed_at, attrs)

@spec response_evidence(
  Spectre.GAM.SubmissionContext.t(),
  t(),
  Spectre.GAM.Act.t(),
  Spectre.GAM.Evidence.stance(),
  integer(),
  map() | keyword()
) :: {:ok, Spectre.GAM.Evidence.t()} | {:error, term()}

Builds an authenticated supporting or contradicting response to one exact show Act.

show_class()

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

Returns the one reserved class used to show prepared material.

show_consequence(presentation)

@spec show_consequence(t()) :: map()

Returns the exact executor-facing consequence for this Presentation.

show_dimensions()

@spec show_dimensions() :: [Spectre.GAM.Row.dimension()]

Returns the exact Row dimensions of presentation.show.

show_presentation_ref(consequence)

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

Extracts a Presentation ref only from the closed show consequence.

show_row()

@spec show_row() :: Spectre.GAM.Row.t()

Returns the exact Row of presentation.show.

validate_approval(approval, presentation, show_act, outcomes, evidence, time)

@spec validate_approval(
  Spectre.GAM.Evidence.t(),
  t(),
  map(),
  [Spectre.GAM.Outcome.t()],
  [Spectre.GAM.Evidence.t()],
  integer()
) :: :ok | {:error, term()}

Validates one approval against its prepared material and successful show.

validate_approval_with_basis(approval, presentation, show_act, outcomes, evidence, time)

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

Validates an approval and returns its exact Evidence basis.

validate_candidate(candidate, presentation)

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

Validates every consent field against one current Candidate-like record.

validate_response_with_basis(response, presentation, show_act, outcomes, evidence, time)

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

Validates either a supporting approval or a contradicting response with its basis.

validate_show(record, presentation)

@spec validate_show(Spectre.GAM.Candidate.t() | Spectre.GAM.Act.t(), t()) ::
  :ok | {:error, term()}

Validates the closed show semantics shared by a Candidate and its Act.