# `Chronicle.Identity`
[🔗](https://github.com/Cratis/Chronicle.Elixir/blob/main/lib/chronicle/identity.ex#L4)

Represents the identity that caused a state change.

# `t`

```elixir
@type t() :: %Chronicle.Identity{
  name: String.t(),
  on_behalf_of: t() | nil,
  subject: String.t(),
  user_name: String.t()
}
```

# `new`

```elixir
@spec new(String.t(), String.t(), String.t(), t() | nil) :: t()
```

Creates a new identity.

# `not_set`

```elixir
@spec not_set() :: t()
```

Returns the sentinel identity for explicitly unset identity values.

# `system`

```elixir
@spec system() :: t()
```

Returns the default system identity.

# `unknown`

```elixir
@spec unknown() :: t()
```

Returns the sentinel identity for unknown identity values.

# `without_duplicates`

```elixir
@spec without_duplicates(t()) :: t()
```

Removes duplicate subjects from an on-behalf-of identity chain.

Keeps the first occurrence of each subject.

---

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