Caravela.Auth (Caravela v0.13.2)

Copy Markdown View Source

Trait-based authentication support.

When an entity declares an authenticatable block, the compiler invokes inject/1 on the IR to add credential-storage fields (hashed_password, confirmed_at, api_tokens) alongside the entity's explicit fields. The generators in Caravela.Gen.Auth consume those fields like any other.

This module only transforms the IR — the actual auth context, plugs, LiveView hooks, controller, and session schema live in the templates under priv/templates/auth_*.eex.

Summary

Functions

Extend every authenticatable entity with the hidden credential fields required by its declared strategies. A no-op for non-authenticatable domains.

Returns true if the given field was auto-injected by Caravela.Auth.

Name of the generated session schema module suffix.

Functions

inject(domain)

Extend every authenticatable entity with the hidden credential fields required by its declared strategies. A no-op for non-authenticatable domains.

injected?(field)

@spec injected?(Caravela.Schema.Field.t()) :: boolean()

Returns true if the given field was auto-injected by Caravela.Auth.

session_module_suffix()

@spec session_module_suffix() :: :UserSession

Name of the generated session schema module suffix.