Parrhesia.Policy.EventPolicy (parrhesia v0.12.0)

Copy Markdown

Write/read policy checks for relay operations.

Summary

Types

policy_error()

@type policy_error() ::
  :auth_required
  | :pubkey_not_allowed
  | :restricted_giftwrap
  | :sync_read_not_allowed
  | :sync_write_not_allowed
  | :marmot_group_h_tag_required
  | :marmot_group_h_values_exceeded
  | :marmot_group_filter_window_too_wide
  | :media_metadata_tags_exceeded
  | :media_metadata_tag_value_too_large
  | :media_metadata_url_too_long
  | :media_metadata_invalid_url
  | :media_metadata_invalid_hash
  | :media_metadata_invalid_mime
  | :media_metadata_mime_not_allowed
  | :media_metadata_unsupported_version
  | :push_notification_relay_tags_exceeded
  | :push_notification_payload_too_large
  | :push_notification_replay_window_exceeded
  | :push_notification_missing_expiration
  | :push_notification_expiration_too_far
  | :push_notification_server_recipients_exceeded
  | :protected_event_requires_auth
  | :protected_event_pubkey_mismatch
  | :pow_below_minimum
  | :pubkey_banned
  | :event_banned

Functions

authorize_read(filters, authenticated_pubkeys)

@spec authorize_read([map()], MapSet.t(String.t())) :: :ok | {:error, policy_error()}

authorize_read(filters, authenticated_pubkeys, context)

@spec authorize_read([map()], MapSet.t(String.t()), Parrhesia.API.RequestContext.t()) ::
  :ok | {:error, policy_error()}

authorize_write(event, authenticated_pubkeys)

@spec authorize_write(map(), MapSet.t(String.t())) :: :ok | {:error, policy_error()}

authorize_write(event, authenticated_pubkeys, context)

@spec authorize_write(map(), MapSet.t(String.t()), Parrhesia.API.RequestContext.t()) ::
  :ok | {:error, policy_error()}

error_message(atom)

@spec error_message(policy_error()) :: String.t()