Nostr. Event. ListMute
(Nostr Lib v0.2.1)
(event)
(nip51)
View Source
Mute List (Kind 10000)
A list of things the user doesn't want to see in their feeds. Items can be stored publicly in tags or privately in encrypted content.
Supported Item Types
ptags - Pubkeys of users to mutettags - Hashtags to mutewordtags - Lowercase strings/words to muteetags - Event IDs (threads) to mute
Private Items
Private mute items are encrypted in the event content using NIP-44 encryption (with NIP-04 fallback for reading legacy data). The encryption uses the author's own keypair (same key for sender and recipient).
Defined in NIP 51 https://github.com/nostr-protocol/nips/blob/master/51.md
Summary
Functions
Creates a new mute list event (kind 10000).
Decrypts the private mute items using your secret key.
Parses a kind 10000 event into a ListMute struct.
Types
@type t() :: %Nostr.Event.ListMute{ event: Nostr.Event.t(), hashtags: [binary()], private_hashtags: :not_loaded | [binary()], private_pubkeys: :not_loaded | [binary()], private_threads: :not_loaded | [binary()], private_words: :not_loaded | [binary()], pubkeys: [binary()], threads: [binary()], words: [binary()] }
Functions
Creates a new mute list event (kind 10000).
Arguments
items- Map or keyword list with mute itemsopts- Event options including:seckeyfor encrypting private items
Item Keys
:pubkeys- List of pubkeys to mute publicly:hashtags- List of hashtags to mute publicly:words- List of words to mute publicly:threads- List of event IDs to mute publicly:private_pubkeys- List of pubkeys to mute privately (encrypted):private_hashtags- List of hashtags to mute privately:private_words- List of words to mute privately:private_threads- List of event IDs to mute privately
Options
:seckey- Required if any private items are specified:pubkey- Event author pubkey (derived from seckey if not provided):created_at- Event timestamp
Examples
# Public-only mute list
ListMute.create(%{pubkeys: ["abc123"], hashtags: ["spam"]})
# With private items
ListMute.create(
%{
pubkeys: ["abc123"],
private_pubkeys: ["def456"],
private_words: ["annoying"]
},
seckey: my_secret_key
)
Decrypts the private mute items using your secret key.
The secret key must match the event's pubkey (you can only decrypt your own mute list). Automatically detects NIP-44 vs legacy NIP-04 encryption.
Returns
- Updated struct with private items populated
- Raises if secret key doesn't match event pubkey
@spec parse(Nostr.Event.t()) :: t()
Parses a kind 10000 event into a ListMute struct.
Public items are parsed from tags. Private items remain encrypted until
decrypt_private/2 is called.