AccrueAdmin.StepUp (accrue_admin v0.3.1)

Copy Markdown View Source

Shared admin step-up workflow for destructive LiveView actions.

The service keeps a per-LiveView grace window in assigns, delegates the actual challenge/verification work to Accrue.Auth, and records admin.step_up.* audit rows through the core event ledger.

Escape and explicit cancel dismissals (dismiss_challenge/1) clear a pending challenge without running the deferred continuation and without emitting new Events.record/1 rows — only successful or denied verification outcomes are audited.

Summary

Functions

Clears a pending step-up without invoking the stored continuation and without writing audit events. Used for operator cancel / Escape flows.

Types

continuation()

@type continuation() :: (Phoenix.LiveView.Socket.t() -> Phoenix.LiveView.Socket.t())

Functions

dismiss_challenge(socket)

@spec dismiss_challenge(Phoenix.LiveView.Socket.t()) :: Phoenix.LiveView.Socket.t()

Clears a pending step-up without invoking the stored continuation and without writing audit events. Used for operator cancel / Escape flows.

fresh?(socket, opts \\ [])

@spec fresh?(
  Phoenix.LiveView.Socket.t(),
  keyword()
) :: boolean()

require_fresh(socket, action, continuation, opts \\ [])

@spec require_fresh(Phoenix.LiveView.Socket.t(), map(), continuation(), keyword()) ::
  {:ok, Phoenix.LiveView.Socket.t()}
  | {:challenge, Phoenix.LiveView.Socket.t()}
  | {:error, term(), Phoenix.LiveView.Socket.t()}

verify(socket, params, opts \\ [])