AshVault.Macaroon.Definition (AshVault v0.2.0)

Copy Markdown View Source

The target of the macaroon entity in the ash_vault section. See AshVault.Dsl for the options and Macaroons for the design.

Summary

Functions

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

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

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

Types

t()

@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()
}

Functions

mint_action(definition)

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

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

read_action(definition)

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

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

vault_field(definition)

@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.