mirror of
https://github.com/Cameri/nostream.git
synced 2025-10-04 12:06:54 +02:00
chore: enforce pubkey whitelist/blacklist
This commit is contained in:
@@ -70,7 +70,7 @@ export class EventMessageHandler implements IMessageHandler {
|
||||
|
||||
if (limits.eventId.minLeadingZeroBits > 0) {
|
||||
if (getEventProofOfWork(event) < limits.eventId.minLeadingZeroBits) {
|
||||
return `insufficient proof of work: eventId has less than ${limits.eventId.minLeadingZeroBits} leading zero bits`
|
||||
return `insufficient proof of work: event Id has less than ${limits.eventId.minLeadingZeroBits} leading zero bits`
|
||||
}
|
||||
}
|
||||
|
||||
@@ -80,6 +80,18 @@ export class EventMessageHandler implements IMessageHandler {
|
||||
}
|
||||
}
|
||||
|
||||
if (limits.pubkey.blacklist.length > 0) {
|
||||
if (limits.pubkey.blacklist.includes(event.pubkey)) {
|
||||
return `pubkey ${event.pubkey} is not allowed`
|
||||
}
|
||||
}
|
||||
|
||||
if (limits.pubkey.whitelist.length > 0) {
|
||||
if (!limits.pubkey.whitelist.includes(event.pubkey)) {
|
||||
return `pubkey ${event.pubkey} is not allowed`
|
||||
}
|
||||
}
|
||||
|
||||
if (limits.kind.blacklist.length > 0) {
|
||||
if (limits.kind.blacklist.includes(event.kind)) {
|
||||
return `event kind ${event.kind} is not allowed`
|
||||
|
Reference in New Issue
Block a user