Spectre.GAM.Candidate (Spectre v0.4.0)

Copy Markdown View Source

Portable proposal with no authority or execution capability.

A candidate contains every field that may materially affect classification, mandate matching, consent or admission. identity_key provides idempotency: the same key and material digest is the same proposal; the same key with a different digest is a conflict for the kernel to reject.

consent is one closed, portable declaration of the exact material a person must evaluate. Consent uses a separate pre-consent binding covering that declaration and every other field knowable before presentation. Only verified approval Evidence for that Presentation may be excluded to break the causal cycle; all other Evidence remains bound. The final candidate digest still covers the Presentation and every Evidence ref.

Summary

Functions

Returns the plain, string-keyed ledger representation.

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

Returns the stable digest of the complete candidate.

Restores a candidate from its canonical map and verifies its digest.

Returns exactly the fields bound by material_digest.

Builds and validates a candidate, computing its material digest and ref.

Returns the exact, acyclic candidate material bound by a Presentation.

Fields a proposer may supply before the Turn binds proposer and Scope.

Types

t()

@type t() :: %Spectre.GAM.Candidate{
  accountable_ref: String.t(),
  class: String.t(),
  consent: Spectre.GAM.Consent.t() | nil,
  consequence: term(),
  disclosure: Spectre.GAM.Disclosure.t() | nil,
  evidence_refs: [String.t()],
  executor_contract_ref: String.t(),
  executor_ref: String.t(),
  identity_key: String.t(),
  material_digest: String.t(),
  meter_requests: %{optional(String.t()) => non_neg_integer()},
  observation_window_ms: non_neg_integer(),
  presentation_ref: String.t() | nil,
  proposer_ref: String.t(),
  purpose_params: map(),
  purpose_ref: String.t(),
  ref: String.t(),
  requested_mandate_ref: String.t() | nil,
  row: Spectre.GAM.Row.t(),
  schema_version: 1,
  scope_ref: String.t(),
  subject_refs: [String.t()],
  target_refs: [String.t()]
}

Functions

canonical(candidate)

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

Returns the plain, string-keyed ledger representation.

content_ref(candidate)

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

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

digest(candidate)

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

Returns the stable digest of the complete candidate.

from_canonical(value)

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

Restores a candidate from its canonical map and verifies its digest.

material(candidate)

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

Returns exactly the fields bound by material_digest.

new(candidate)

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

Builds and validates a candidate, computing its material digest and ref.

presentation_binding(candidate, approval_evidence_refs \\ [])

@spec presentation_binding(t(), [String.t()]) :: map()

Returns the exact, acyclic candidate material bound by a Presentation.

presentation_binding_ref(candidate, approval_evidence_refs \\ [])

@spec presentation_binding_ref(t(), [String.t()]) :: String.t()

Returns the content address of presentation_binding/2.

request_fields()

@spec request_fields() :: [atom()]

Fields a proposer may supply before the Turn binds proposer and Scope.