Documentation
¶
Index ¶
- func CheckSignature(evt nostr.Event) bool
- func EventExpiration(evt nostr.Event) (int64, bool)
- func IsExpired(evt nostr.Event, now int64) bool
- func IsProtectedEvent(evt nostr.Event) bool
- func ResolveTimeBounds(cfg *cfgType.ServerConfig) (minCreatedAt, maxCreatedAt int64)
- func ValidateEventTimestamp(evt nostr.Event, cfg *cfgType.ServerConfig) bool
- type Result
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckSignature ¶
CheckSignature verifies the event's signature and ID
func EventExpiration ¶ added in v0.6.0
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
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
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 ResolveTimeBounds ¶ added in v0.8.0
func ResolveTimeBounds(cfg *cfgType.ServerConfig) (minCreatedAt, maxCreatedAt int64)
ResolveTimeBounds resolves the effective min/max created_at the relay enforces at this moment, applying the same "now±offset" / absolute / default rules for both bounds. Both the timestamp validator and the NIP-11 limitation advertisement read from here, so the advertised created_at_lower_limit / created_at_upper_limit match what's actually enforced (recomputed per call, so relative "now±X" bounds stay accurate).
func ValidateEventTimestamp ¶
func ValidateEventTimestamp(evt nostr.Event, cfg *cfgType.ServerConfig) bool
Types ¶
type Result ¶
Result represents the outcome of a validation check
func CheckBlacklistAndWhitelistCached ¶
CheckBlacklistAndWhitelistCached uses cached pubkey lists for validation
func CheckRateAndSizeLimits ¶
CheckRateAndSizeLimits checks if an event passes per-client rate limits and global size limits.