event

package
v0.0.0-...-9268282 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 23, 2026 License: MIT Imports: 2 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package event keeps relay feature kind, job and room-reference semantics separate from the reusable values in protocol/nostr. Event and Filter are transitional aliases for the public types; parsing, encoding, signing and generic matching delegate to that package. Matches additionally preserves the host's private-kind search exclusion for existing consumers.

Index

Constants

View Source
const (
	KIND_PROFILE             = 0
	KIND_DELETION            = 5
	KIND_VANISH              = 62
	KIND_AUTH                = 22242
	KIND_DM                  = 14
	KIND_WRAP                = 1059
	KIND_REPORT              = 1984
	KIND_NOSTR_CONNECT       = 24133
	KIND_APP_DATA            = 30078
	KIND_VIEW                = KIND_APP_DATA
	KIND_PRESENCE            = 20078
	KIND_MEMBER_ADDED        = 8000
	KIND_MEMBER_REMOVED      = 8001
	KIND_ROSTER              = 13534
	KIND_ROLE_DEF            = 33534
	KIND_NIP43_JOIN          = 28934
	KIND_NIP43_INVITE        = 28935
	KIND_NIP43_LEAVE         = 28936
	KIND_PUT_USER            = 9000
	KIND_REMOVE_USER         = 9001
	KIND_EDIT_METADATA       = 9002
	KIND_DELETE_EVENT        = 9005
	KIND_CREATE_GROUP        = 9007
	KIND_DELETE_GROUP        = 9008
	KIND_CREATE_INVITE       = 9009
	KIND_PINS                = 9010
	KIND_JOIN                = 9021
	KIND_LEAVE               = 9022
	KIND_GROUP_METADATA      = 39000
	KIND_GROUP_ADMINS        = 39001
	KIND_GROUP_MEMBERS       = 39002
	KIND_GROUP_ROLES         = 39003
	KIND_GROUP_PINS          = 39005
	KIND_RELAY_DISCOVERY     = 30166
	KIND_SITE                = 15128
	KIND_NAMED_SITE          = 35128
	KIND_SITE_SNAPSHOT       = 5128
	KIND_MARMOT_GROUP        = 445
	KIND_MARMOT_KEY_PACKAGE  = 30443
	KIND_REPO                = 30617
	KIND_REPO_STATE          = 30618
	KIND_GIT_PATCH           = 1617
	KIND_GIT_PR              = 1618
	KIND_GIT_PR_UPDATE       = 1619
	KIND_GIT_ISSUE           = 1621
	KIND_PUSH_REGISTRATION   = 30390
	KIND_CHAT                = 9
	KIND_THREAD              = 11
	KIND_THREAD_REPLY        = 12
	KIND_ROOM_PRESENCE       = 20001
	KIND_ROOM_TYPING         = 20002
	KIND_RICH_CONTENT        = 40002
	KIND_CONTENT_EDIT        = 40003
	KIND_ROOM_MEMBER_ADDED   = 44100
	KIND_ROOM_MEMBER_REMOVED = 44101

	// NIP-54 wiki: articles, merge requests and redirects.
	KIND_WIKI_ARTICLE  = 30818
	KIND_WIKI_MERGE    = 818
	KIND_WIKI_REDIRECT = 30819
	KIND_AGENT_GRANT   = 30392
)
View Source
const (
	KIND_JOB_REQUEST  = 43001
	KIND_JOB_ACCEPTED = 43002
	KIND_JOB_PROGRESS = 43003
	KIND_JOB_RESULT   = 43004
	KIND_JOB_CANCEL   = 43005
	KIND_JOB_ERROR    = 43006
)

Long tasks use the six job kinds Buzz reserves. A requester publishes a request; the keys it asks answer while they work and finish with a result or an error; the requester may cancel. Kind 5128 belongs to NIP-5A site snapshots and is unrelated.

Variables

This section is empty.

Functions

func Canonical

func Canonical(e Event) ([]byte, error)

func CommittedDifficulty

func CommittedDifficulty(e Event) int

func Difficulty

func Difficulty(id string) int

func Expiration

func Expiration(e Event) int64

func GenerateKey

func GenerateKey() (string, error)

func IsAddressable

func IsAddressable(k int) bool

func IsEphemeral

func IsEphemeral(k int) bool

func IsJobAnswer

func IsJobAnswer(kind int) bool

IsJobAnswer reports whether kind is one of the answers an asked key publishes: accepted, progress, result or error.

func IsJobCancel

func IsJobCancel(kind int) bool

IsJobCancel reports whether kind is a requester's cancel.

func IsJobKind

func IsJobKind(kind int) bool

IsJobKind reports whether kind is any of the six long-task kinds.

func IsJobRequest

func IsJobRequest(kind int) bool

IsJobRequest reports whether kind is a long-task request.

func IsJobResult

func IsJobResult(kind int) bool

IsJobResult reports whether kind is a long-task result.

func IsJobTerminal

func IsJobTerminal(kind int) bool

IsJobTerminal reports whether kind ends a long task: result, cancel or error.

func IsPrivate

func IsPrivate(k int) bool

IsPrivate is the host's recipient-scoped kind classification, not a generic Nostr range. Keep feature privacy decisions outside protocol/nostr.

func IsReplaceable

func IsReplaceable(k int) bool

func Matches

func Matches(f Filter, e Event) bool

Matches preserves the host's search visibility rule for existing consumers. Generic field, tag and content matching lives in protocol/nostr.

func PublicKey

func PublicKey(secretHex string) (string, error)

func RoomReplyRoot

func RoomReplyRoot(e Event) string

RoomReplyRoot reads NIP-10 marked references and the older unmarked NIP-29 thread convention. A mention or q tag never makes a reply.

func SearchTerms

func SearchTerms(query string) []string

func Sign

func Sign(e *Event, secretHex string) error

func Tag

func Tag(e Event, name string) string

func TagValues

func TagValues(e Event, name string) []string

func Validate

func Validate(e Event) error

Types

type Event

type Event = nostr.Event

Event is the public Nostr wire value. The alias keeps feature consumers source-compatible while they migrate to protocol/nostr.

func Parse

func Parse(raw []byte) (Event, error)

type Filter

type Filter = nostr.Filter

Filter is the public subscription and query value.

func ParseFilter

func ParseFilter(raw []byte) (Filter, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL