Spectre.GAM.Ingress behaviour (Spectre v0.4.0)

Copy Markdown View Source

Authenticated boundary that creates a Spectre.GAM.SubmissionContext.

A Domain is wired to exactly one ingress module. ref/0 must return that adapter's stable, non-secret identity; every context and observed Evidence produced by the adapter carries the same reference. Candidate payloads and ordinary call options are intentionally absent from authentication. They cannot select the authenticated principal or replace the Domain's adapter.

use Spectre.GAM.Ingress, ref: "ingress:my-app:v1" declares the behaviour and an overridable ref/0. The reference is explicit and stays stable across module renames. Implement authenticate/5 and observe/4 yourself; no authentication, observation or permissive defaults are generated.

This contract describes the mediated same-BEAM boundary. It does not turn a shared VM into a sandbox; stronger deployments isolate the ingress and make its authentication mechanism independently verifiable.

Summary

Types

Validated module and its stable ingress reference.

Callbacks

Returns this adapter's stable identity within SubmissionContext records.

Functions

Builds observed Evidence with every trusted ingress binding forced by the context.

Types

binding()

@type binding() :: {module(), String.t()}

Validated module and its stable ingress reference.

Callbacks

authenticate(t, t, term, non_neg_integer, keyword)

@callback authenticate(String.t(), String.t(), term(), non_neg_integer(), keyword()) ::
  {:ok, Spectre.GAM.SubmissionContext.t()} | {:error, term()}

observe(t, term, integer, keyword)

@callback observe(Spectre.GAM.SubmissionContext.t(), term(), integer(), keyword()) ::
  {:ok, Spectre.GAM.Evidence.t() | [Spectre.GAM.Evidence.t()]}
  | {:error, term()}

ref()

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

Returns this adapter's stable identity within SubmissionContext records.

Functions

evidence(context, observed_at, attrs)

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

Builds observed Evidence with every trusted ingress binding forced by the context.