Nostr. NIP29
(Nostr Lib v0.2.1)
(nip29)
View Source
NIP-29: Relay-based Groups helpers.
This module provides relay-agnostic kind classification and tag extraction helpers for group events.
Summary
Functions
Extracts group id using NIP-29 kind-specific tag source (h or d).
Extracts group id from the first d tag on an event.
Extracts group id from the first h tag on an event.
Returns true for kind 9021 join requests.
Returns true for kind 9022 leave requests.
Returns true when kind belongs to NIP-29 management path.
Returns true for NIP-29 relay-generated metadata kinds (39000-39003).
Returns true for NIP-29 moderation kinds (9000-9020).
Collects moderation target values from p, e, a, and code tags.
Collects all previous references from previous tags preserving order.
Returns true when event kind requires a d tag (39000-39003).
Returns true when event kind requires an h group tag by NIP-29 semantics.
Validates NIP-29 group id format: lowercase alnum, -, _.
Validates required d tag and optional group-id charset check.
Validates required h tag and optional group-id charset check.
Validates required NIP-29 structural tags for an event kind.
Types
Functions
@spec group_id(Nostr.Event.t()) :: binary() | nil
Extracts group id using NIP-29 kind-specific tag source (h or d).
@spec group_id_from_d(Nostr.Event.t()) :: binary() | nil
Extracts group id from the first d tag on an event.
@spec group_id_from_h(Nostr.Event.t()) :: binary() | nil
Extracts group id from the first h tag on an event.
Returns true for kind 9021 join requests.
Returns true for kind 9022 leave requests.
Returns true when kind belongs to NIP-29 management path.
Returns true for NIP-29 relay-generated metadata kinds (39000-39003).
Returns true for NIP-29 moderation kinds (9000-9020).
@spec moderation_targets(Nostr.Event.t()) :: %{ required(moderation_target_key()) => [binary()] }
Collects moderation target values from p, e, a, and code tags.
@spec previous_refs(Nostr.Event.t()) :: [binary()]
Collects all previous references from previous tags preserving order.
Returns true when event kind requires a d tag (39000-39003).
Returns true when event kind requires an h group tag by NIP-29 semantics.
Validates NIP-29 group id format: lowercase alnum, -, _.
@spec validate_d_tag( Nostr.Event.t(), keyword() ) :: {:ok, binary()} | {:error, validation_error()}
Validates required d tag and optional group-id charset check.
@spec validate_h_tag( Nostr.Event.t(), keyword() ) :: {:ok, binary()} | {:error, validation_error()}
Validates required h tag and optional group-id charset check.
@spec validate_required_group_tag( Nostr.Event.t(), keyword() ) :: {:ok, nil | binary()} | {:error, validation_error()}
Validates required NIP-29 structural tags for an event kind.