middleware

package
v0.0.0-...-7adc47f Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2025 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// NIP98EventKind is the kind for HTTP auth events as per NIP-98
	NIP98EventKind = 27235
	// DefaultTimeWindow is the default time window for event validity (60 seconds)
	DefaultTimeWindow = 60 * time.Second
)
View Source
const NIP98PubkeyKey = "nip98_pubkey"

NIP98Context key for storing validated pubkey in request context

Variables

This section is empty.

Functions

func ApiKeyMiddleware

func ApiKeyMiddleware(c *fiber.Ctx) error

func GetNIP98Pubkey

func GetNIP98Pubkey(c *fiber.Ctx) (string, error)

GetNIP98Pubkey extracts the validated pubkey from the request context

func JwtMiddleware

func JwtMiddleware(c *fiber.Ctx, store stores.Store) error

func NIP98Middleware

func NIP98Middleware(config ...NIP98Config) fiber.Handler

NIP98Middleware validates NIP-98 authorization for HTTP requests

func NIP98ProtectedHandler

func NIP98ProtectedHandler(handler fiber.Handler, config ...NIP98Config) fiber.Handler

NIP98ProtectedHandler is a helper to create handlers that require NIP-98 auth

func RateLimiterMiddleware

func RateLimiterMiddleware() fiber.Handler

Types

type NIP98Config

type NIP98Config struct {
	TimeWindow time.Duration
}

NIP98Config holds configuration for NIP-98 middleware

func DefaultNIP98Config

func DefaultNIP98Config() NIP98Config

DefaultNIP98Config returns default configuration

Jump to

Keyboard shortcuts

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