# `Spectre.ExternalIdentity`
[🔗](https://github.com/elchemista/spectre/blob/0.4.0/lib/spectre/external_identity.ex#L1)

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.

# `t`

```elixir
@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()
}
```

# `from_source`

```elixir
@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`

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

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

# `new`

```elixir
@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.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
