validation

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckSignature

func CheckSignature(evt nostr.Event) bool

CheckSignature verifies the event's signature and ID

func EventExpiration added in v0.6.0

func EventExpiration(evt nostr.Event) (int64, bool)

EventExpiration returns the unix timestamp from a NIP-40 `expiration` tag, or (0, false) if the event has no expiration tag. Malformed values are treated as no-expiration so a bad tag never permanently rejects an otherwise-valid event — but the warning is logged for the operator.

func IsExpired added in v0.6.0

func IsExpired(evt nostr.Event, now int64) bool

IsExpired reports whether the event carries a NIP-40 expiration that has already passed relative to `now` (unix seconds).

func IsProtectedEvent added in v0.6.0

func IsProtectedEvent(evt nostr.Event) bool

IsProtectedEvent reports whether the event carries a NIP-70 protection marker — a single-element `["-"]` tag. Per NIP-70 such events MUST only be accepted from an authenticated connection whose pubkey matches the event author.

func ValidateEventTimestamp

func ValidateEventTimestamp(evt nostr.Event, cfg *cfgType.ServerConfig) bool

Types

type Result

type Result struct {
	Valid   bool
	Message string
}

Result represents the outcome of a validation check

func CheckBlacklistAndWhitelistCached

func CheckBlacklistAndWhitelistCached(evt noatr.Event) Result

CheckBlacklistAndWhitelistCached uses cached pubkey lists for validation

func CheckRateAndSizeLimits

func CheckRateAndSizeLimits(client noatr.ClientInterface, evt noatr.Event, eventSize int) Result

CheckRateAndSizeLimits checks if an event passes per-client rate limits and global size limits.

Jump to

Keyboard shortcuts

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