Enact.Actor protocol (Enact v0.1.0)

Copy Markdown View Source

Answers anonymous?/1 for any actor term.

Anonymity must be a pattern-matchable value, never an absence — actor: nil always raises in the runner. The fallback impl returns false for any term, so authenticated actors need no impl at all.

Two ways to represent an anonymous caller:

  • the bare :anonymous atom — zero-ceremony option for simple apps
  • a host-app impl for a scope struct (%Scope{user: nil} → true), enabling rich anonymous scopes carrying session id / IP for rate limiting — the idiomatic Phoenix 1.8 shape

An anonymous actor is only permitted by actions declaring anonymous?: true in config/0; the runner rejects it with :forbidden everywhere else, before any pipeline work.

Summary

Types

t()

All the types that implement this protocol.

Types

t()

@type t() :: term()

All the types that implement this protocol.

Functions

anonymous?(actor)

@spec anonymous?(t()) :: boolean()