# `Macaw.Auth.Ash.Notifier`
[🔗](https://github.com/dcoai/macaw_auth_ash/blob/v0.3.2/lib/macaw/auth/ash/notifier.ex#L1)

Tells open pages of a revocation made through Ash, outside `Macaw.Auth`.

`Macaw.Auth.revoke/2` tells a user's open LiveViews which of their
sessions ended, and they disconnect at once. But a host on Ash may revoke
a token without it: AshAuthentication's sign-out revokes by token, an
admin action may revoke by jti, log-out-everywhere revokes them all.
Without this notifier those pages would learn only at their next
re-check (`Macaw.Auth.Live`, every minute by default). The host adds it
to the token resource, which `Macaw.Auth.Ash.TokenResource` insists on:

    use Ash.Resource, ..., notifiers: [Macaw.Auth.Ash.Notifier]

On every notification whose record is now a revocation (purpose
`"revocation"`), it tells the token's user's open pages
`{:sessions_revoked, [jti]}`: the jti is a `Macaw.Auth.Ash` session's id.
Revocations made with the `quiet/0` context are not announced. Two
actions are left to others, so a page is told once: Macaw's own
revocation (`:macaw_auth_revoke`), which `Macaw.Auth.revoke/2` announces,
and `revoke_all_stored_for_subject`, a bulk update that sends no
notifications, which `Macaw.Auth.Ash.AnnounceRevocation` announces.

**How it tells them:** `Macaw.Auth.announce_revoked/2` (macaw_auth 0.1.1),
the public way to tell a user's open pages that sessions ended, over
whichever channel macaw_auth is configured with (a `Registry`, or
Phoenix.PubSub). It does so only while `Macaw.Auth.Ash` is the configured
backend; under another backend these tokens are not Macaw sessions.

Notifications arrive after the transaction commits.

# `announce`

```elixir
@spec announce(module(), [map()]) :: :ok
```

Tells the open pages of each revoked token's user: `records` are token
rows (`jti`, `subject`). Tokens of another resource's subjects are
skipped. A no-op unless `Macaw.Auth.Ash` is the configured backend.

# `load`

# `quiet`

```elixir
@spec quiet() :: map()
```

The context that keeps a revocation unannounced: `Macaw.Auth.Ash`'s
revocation of the token AshAuthentication's sign-in signs, which was
never anyone's session.

# `requires_original_data?`

---

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