Spectre.ExternalIdentity (Spectre v0.3.0)

Copy Markdown View Source

Authenticated external principal presented by a channel boundary.

The raw provider principal is reduced to an opaque identifier at construction time. Similar names, numbers, address-book entries, or message text never imply that two values represent the same Subject.

Summary

Functions

Converts an authenticated normalized input source into an identity.

Returns the exact, opaque identity key used by the Subject Registry.

Builds an authenticated external identity.

Types

t()

@type t() :: %Spectre.ExternalIdentity{
  authenticated_at: integer(),
  channel: atom() | String.t(),
  endpoint: term(),
  id: String.t(),
  metadata: map(),
  proof_ref: String.t() | nil,
  provider: atom() | String.t()
}

Functions

from_source(source, opts \\ [])

@spec from_source(
  Spectre.Input.Source.t(),
  keyword()
) :: t()

Converts an authenticated normalized input source into an identity.

Channel adapters must call this only after authenticating the endpoint and sender; the core does not infer authentication from source fields.

key(identity)

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

Returns the exact, opaque identity key used by the Subject Registry.

new(identity)

@spec new(t() | map() | keyword()) :: t()

Builds an authenticated external identity.

Pass the provider's authenticated identifier as :principal_id, :external_id, or :actor_id. It is hashed and is not retained.