groups

package
v1.0.17 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2026 License: Unlicense Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PRIMARY_ROLE_NAME   = "admin"
	SECONDARY_ROLE_NAME = "moderator"
)

Variables

This section is empty.

Functions

func GetGroupIDFromEvent

func GetGroupIDFromEvent(event nostr.Event) string

func Init

func Init(relay *khatru.Relay)

Types

type Group

type Group struct {
	nip29.Group
	// contains filtered or unexported fields
}

func (*Group) AnyOfTheseIsAMember

func (g *Group) AnyOfTheseIsAMember(pubkeys []nostr.PubKey) bool

func (*Group) IsPrimaryRole

func (g *Group) IsPrimaryRole(member nostr.PubKey) bool

type GroupsState

type GroupsState struct {
	Domain string
	Groups *xsync.MapOf[string, *Group]
	DB     eventstore.Store
	// contains filtered or unexported fields
}
var (
	Handler = &MuxHandler{}
	State   *GroupsState
)

func NewGroupsState

func NewGroupsState(opts Options) *GroupsState

func (*GroupsState) GetGroupFromEvent

func (s *GroupsState) GetGroupFromEvent(event nostr.Event) *Group

func (*GroupsState) NewGroup

func (s *GroupsState) NewGroup(id string) *Group

NewGroup creates a new group from scratch (but doesn't store it in the groups map)

func (*GroupsState) ProcessEvent

func (s *GroupsState) ProcessEvent(ctx context.Context, event nostr.Event)

func (*GroupsState) Query

func (s *GroupsState) Query(ctx context.Context, filter nostr.Filter) iter.Seq[nostr.Event]

func (*GroupsState) RejectEvent

func (s *GroupsState) RejectEvent(ctx context.Context, event nostr.Event) (reject bool, msg string)

func (*GroupsState) RequestAuthWhenNecessary

func (s *GroupsState) RequestAuthWhenNecessary(
	ctx context.Context,
	filter nostr.Filter,
) (reject bool, msg string)

func (*GroupsState) WipeGroup added in v1.0.9

func (s *GroupsState) WipeGroup(groupId string) error

type MuxHandler added in v1.0.4

type MuxHandler struct {
	// contains filtered or unexported fields
}

func (*MuxHandler) ServeHTTP added in v1.0.4

func (mh *MuxHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

type Options

type Options struct {
	Domain    string
	DB        eventstore.Store
	SecretKey nostr.SecretKey
	Broadcast func(nostr.Event) int
}

Jump to

Keyboard shortcuts

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