Parrhesia.API.Admin (parrhesia v0.12.0)

Copy Markdown

Public management API facade.

This module exposes the DX-friendly control plane for administrative tasks. It wraps storage-backed management methods and a set of built-in helpers for ACL, identity, sync, and listener management.

execute/3 accepts the same method names used by NIP-86 style management endpoints, while the dedicated functions (stats/1, health/1, list_audit_logs/1) are easier to call from Elixir code.

Summary

Functions

Executes a management method by name.

Returns the overall management health payload.

Lists persisted audit log entries from the configured admin storage backend.

Returns aggregate relay stats plus nested sync stats.

Functions

execute(method, params, opts \\ [])

@spec execute(String.t() | atom(), map(), keyword()) ::
  {:ok, map()} | {:error, term()}

Executes a management method by name.

Built-in methods include:

  • supportedmethods
  • stats
  • health
  • list_audit_logs
  • acl_grant, acl_revoke, acl_list
  • identity_get, identity_ensure, identity_import, identity_rotate
  • listener_reload
  • sync_*

Unknown methods are delegated to the configured Parrhesia.Storage.Admin implementation.

health(opts \\ [])

@spec health(keyword()) :: {:ok, map()} | {:error, term()}

Returns the overall management health payload.

The top-level "status" is currently derived from sync health, while relay-specific health details remain delegated to storage-backed management methods.

list_audit_logs(opts \\ [])

@spec list_audit_logs(keyword()) :: {:ok, [map()]} | {:error, term()}

Lists persisted audit log entries from the configured admin storage backend.

Supported options are storage-adapter specific. The built-in admin execution path forwards :limit, :method, and :actor_pubkey.

stats(opts \\ [])

@spec stats(keyword()) :: {:ok, map()} | {:error, term()}

Returns aggregate relay stats plus nested sync stats.