nostr

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var KindHandlers map[string]KindHandler

Functions

func AuthTimeCheck

func AuthTimeCheck(eventCreatedAt int64) (bool, string)

func BuildCborResponse

func BuildCborResponse(messageType string, params ...interface{}) []byte

func BuildResponse

func BuildResponse(messageType string, params ...interface{}) []byte

func ClearHandlers

func ClearHandlers()

func CloseStream

func CloseStream(stream network.Stream)

func ExtractInterfaceValues

func ExtractInterfaceValues(data ...interface{}) []interface{}

ExtractInterfaceValues is the exported form of extractInterfaceValues.

func GetHandler

func GetHandler(kind string) func(read KindReader, write KindWriter)

func GetHandlers

func GetHandlers() map[string]KindHandler

func IsKindAllowed

func IsKindAllowed(kind int) bool

func IsRegisteredKind

func IsRegisteredKind(kind int) bool

IsRegisteredKind checks if a kind number has a registered handler

func RegisterHandler

func RegisterHandler(kind string, handler func(read KindReader, write KindWriter)) error

func Responder

func Responder(stream network.Stream, messageType string, params ...interface{})

responder sends a response string through the given network stream

func TimeCheck

func TimeCheck(eventCreatedAt int64) bool

Check if the event is pretending it can time travel

func ValidateEvent

func ValidateEvent(write KindWriter, env nostr.EventEnvelope, expectedKind int) bool

Gerneric event validation that almost all kinds will use

Types

type KindHandler

type KindHandler func(read KindReader, write KindWriter)

type KindReader

type KindReader func() ([]byte, error)

type KindWriter

type KindWriter func(messageType string, params ...interface{})

Jump to

Keyboard shortcuts

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