Spectre.Subject.Registry (Spectre v0.3.0)

Copy Markdown View Source

Authoritative in-memory resolver for Subjects and authenticated identities.

Resolution is exact and Agent-scoped. The registry never compares display names, phone-number similarity, address books, message text, or model output. Linking requires either an explicit trusted bootstrap proof or the destination-channel challenge protocol.

Durable storage for these records belongs to the later continuity phase. The registry deliberately exposes plain value objects that a store adapter can persist without process handles or secrets.

Summary

Functions

Creates the first explicit link for a Subject from a trusted host proof.

Confirms a LinkIntent from its authenticated destination identity.

Applies the optional second confirmation from the already linked source.

Returns a LinkIntent by id for audit and channel workflows.

Lists every retained link for an Agent and Subject, including revocations.

Opens a one-time destination challenge from an identity already linked to the Subject.

Resolves an exact authenticated identity to its canonical Subject and link.

Revokes an active link without deleting the Subject or Instance state.

Starts a Subject Registry.

Types

server()

@type server() :: GenServer.server()

Functions

bind(agent_ref, subject, identity, opts \\ [])

Creates the first explicit link for a Subject from a trusted host proof.

This is the bootstrap boundary for an already authenticated identity. The :proof option is mandatory so importing or provisioning an identity cannot accidentally degrade into heuristic linking.

bind(server, agent_ref, subject, identity, opts)

confirm_link(intent_id, identity, challenge, opts \\ [])

@spec confirm_link(String.t(), Spectre.ExternalIdentity.t(), String.t(), keyword()) ::
  {:ok, Spectre.SubjectLink.t() | Spectre.LinkIntent.t()} | {:error, term()}

Confirms a LinkIntent from its authenticated destination identity.

confirm_link(server, intent_id, identity, challenge, opts)

@spec confirm_link(
  server(),
  String.t(),
  Spectre.ExternalIdentity.t(),
  String.t(),
  keyword()
) ::
  {:ok, Spectre.SubjectLink.t() | Spectre.LinkIntent.t()} | {:error, term()}

confirm_source(intent_id, identity, opts \\ [])

@spec confirm_source(String.t(), Spectre.ExternalIdentity.t(), keyword()) ::
  {:ok, Spectre.SubjectLink.t()} | {:error, term()}

Applies the optional second confirmation from the already linked source.

confirm_source(server, intent_id, identity, opts)

@spec confirm_source(server(), String.t(), Spectre.ExternalIdentity.t(), keyword()) ::
  {:ok, Spectre.SubjectLink.t()} | {:error, term()}

intent(intent_id)

@spec intent(String.t()) ::
  {:ok, Spectre.LinkIntent.t()} | {:error, :unknown_link_intent}

Returns a LinkIntent by id for audit and channel workflows.

intent(server, intent_id)

@spec intent(server(), String.t()) ::
  {:ok, Spectre.LinkIntent.t()} | {:error, :unknown_link_intent}

links(agent_ref, subject)

@spec links(Spectre.AgentRef.t() | module(), Spectre.Subject.t() | term()) ::
  {:ok, [Spectre.SubjectLink.t()]} | {:error, term()}

Lists every retained link for an Agent and Subject, including revocations.

links(server, agent_ref, subject)

@spec links(server(), Spectre.AgentRef.t() | module(), Spectre.Subject.t() | term()) ::
  {:ok, [Spectre.SubjectLink.t()]} | {:error, term()}

open_link(agent_ref, subject, source_identity, destination_identity, opts \\ [])

Opens a one-time destination challenge from an identity already linked to the Subject.

The returned challenge is never retained by the registry.

open_link(server, agent_ref, subject, source_identity, destination_identity, opts)

resolve(agent_ref, identity)

Resolves an exact authenticated identity to its canonical Subject and link.

resolve(server, agent_ref, identity)

revoke(link_id, opts \\ [])

@spec revoke(
  String.t(),
  keyword()
) :: {:ok, Spectre.SubjectLink.t()} | {:error, term()}

Revokes an active link without deleting the Subject or Instance state.

revoke(server, link_id, opts)

@spec revoke(server(), String.t(), keyword()) ::
  {:ok, Spectre.SubjectLink.t()} | {:error, term()}

start_link(opts \\ [])

@spec start_link(keyword()) :: GenServer.on_start()

Starts a Subject Registry.