nostr-websocket-utils

nostr-websocket-utils v0.3.16


nostr-websocket-utils / PowRateLimiter

Interface: PowRateLimiter

Defined in: nips/nip-13.ts:147

Rate limiter interface for proof of work

Methods

shouldRateLimit()

shouldRateLimit(pubkey, currentTime): boolean

Defined in: nips/nip-13.ts:154

Checks if an event should be rate limited

Parameters

pubkey

string

Publisher’s public key

currentTime

number

Current timestamp

Returns

boolean

True if should be rate limited


recordEvent()

recordEvent(pubkey, difficulty, currentTime): void

Defined in: nips/nip-13.ts:162

Records an event for rate limiting

Parameters

pubkey

string

Publisher’s public key

difficulty

number

Event difficulty

currentTime

number

Current timestamp

Returns

void