# `AshVault.Verifiers.VerifyMacaroons`
[🔗](https://github.com/jakeschurch/ash_vault/blob/main/lib/ash_vault/verifiers/verify_macaroons.ex#L1)

Post-compile checks on every `macaroon` in the `ash_vault` section:

  * `prefix` is 2-32 characters of `[a-z][a-z0-9]*` (no `_`: it separates the prefix
    from the payload) and unique among the resource's macaroons
  * `identity` names the single primary key attribute or a one-key identity — so it is
    unique — of a type a token can carry (string, ci_string, UUID, integer)
  * the scope is resolvable from a token: `:global`, or `:tenant` on a resource with
    multitenancy. A custom `AshVault.Scope` cannot be inverted from a token's scope
    back to a tenant, so it is refused
  * the vault (a plain module) exports `mac_at!/3` and `mac_key_version!/1`, and its key
    provider serves the `:mac` purpose
  * warns when a macaroon declares `phase: :authorize` caveats and none of the
    resource's own policies reference `AshVault.Checks.MacaroonAllows` (unless the
    macaroon sets `require_authorize_enforcement? true`)
  * the resource has a primary read action, which the mint action loads through
  * every caveat has a type with a stable encoding (`AshVault.Macaroon.CaveatCodec`), a
    name other than the reserved `:expires_at`, and a check module that is compiled
    and exports `check/3`

---

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