# `Alternera.Plugin.Provisional.Identity`
[🔗](https://github.com/10e-ab/alternera-sdk/blob/v0.9.0/alternera_plugin_sdk/lib/alternera/plugin/provisional/identity.ex#L1)

Provisional: added for Assert caller, and a change to it needs a changelog
line but no new major (`docs/USER_PLUGINS_DESIGN.md`).

The exchange's signed-in caller, as the application knows it, through
`Alternera.Plugin.Host`:

  * `caller/3` answers the claims of an assertion naming the caller for
    `audience`, valid `lifetime_seconds` (string keys; `"sub"` is the
    caller), or `:anonymous` when no one signed in. The host reads the
    exchange's sign-in from the context;
  * `sign/2` signs those claims with the tenant's key: `{:ok, token}`, a
    JWT an upstream checks against the tenant's published key set, or
    `{:error, message}`.

A preview signs nothing: the plugin reads `context.dry_run?` and writes
what the header would hold instead.

# `caller`

```elixir
@spec caller(map(), String.t(), pos_integer()) :: {:ok, map()} | :anonymous
```

The assertion's claims for the exchange's caller, or `:anonymous`.

# `sign`

```elixir
@spec sign(map(), map()) :: {:ok, String.t()} | {:error, String.t()}
```

Signs `claims` with the tenant's key.

---

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