# `AshVault.Macaroon.Definition`
[🔗](https://github.com/jakeschurch/ash_vault/blob/main/lib/ash_vault/macaroon/definition.ex#L1)

The target of the `macaroon` entity in the `ash_vault` section. See `AshVault.Dsl` for
the options and [Macaroons](macaroons.md) for the design.

# `t`

```elixir
@type t() :: %AshVault.Macaroon.Definition{
  __identifier__: term(),
  __spark_metadata__: term(),
  accepted_key_versions: pos_integer() | :all | mfa() | {module(), keyword()},
  caveats: [AshVault.Macaroon.CaveatDefinition.t()],
  default_ttl: pos_integer() | :infinity | {module(), keyword()},
  identity: atom(),
  max_ttl: pos_integer() | :infinity | nil,
  mint_action: atom() | nil,
  name: atom(),
  prefix: binary(),
  read_action: atom() | nil,
  require_authorize_enforcement?: boolean(),
  revoked_when: term()
}
```

# `mint_action`

```elixir
@spec mint_action(t()) :: atom()
```

The generated mint action's name: `mint_action`, or `:mint_<name>`.

# `read_action`

```elixir
@spec read_action(t()) :: atom()
```

The generated verifying read action's name: `read_action`, or `:<name>_by_token`.

# `vault_field`

```elixir
@spec vault_field(t()) :: atom()
```

The `field` of the vault context a macaroon's root signature is computed under:
`:"macaroon:<name>"`.

A reserved label rather than the bare name, so that no ordinary `Vault.mac!/2` call
for an attribute or field of the same resource — whose field is an attribute name and
never contains `:` — shares associated data with the root signature. Otherwise code
that MACs caller-chosen bytes for a field named like the macaroon would be an oracle
for forging root signatures.

---

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