Skip to content

Latest commit

 

History

History
77 lines (39 loc) · 1.04 KB

PowRateLimiter.md

File metadata and controls

77 lines (39 loc) · 1.04 KB

nostr-websocket-utils v0.3.0


nostr-websocket-utils / PowRateLimiter

Interface: PowRateLimiter

Rate limiter interface for proof of work

Methods

shouldRateLimit()

shouldRateLimit(pubkey, currentTime): boolean

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

Defined in

nips/nip-13.ts:154


recordEvent()

recordEvent(pubkey, difficulty, currentTime): void

Records an event for rate limiting

Parameters

pubkey

string

Publisher's public key

difficulty

number

Event difficulty

currentTime

number

Current timestamp

Returns

void

Defined in

nips/nip-13.ts:162