chore: enforce event kind limits

This commit is contained in:
Ricardo Arturo Cabral Mejia 2022-09-22 21:36:17 +00:00
parent 54ece3641b
commit 45fe91ae66
No known key found for this signature in database
GPG Key ID: 5931EBF43A650245

View File

@ -79,5 +79,17 @@ export class EventMessageHandler implements IMessageHandler {
return `insufficient proof of work: pubkey has less than ${limits.pubkey.minLeadingZeroBits} leading zero bits`
}
}
if (limits.kind.blacklist.length > 0) {
if (limits.kind.blacklist.includes(event.kind)) {
return `event kind ${event.kind} is not allowed`
}
}
if (limits.kind.whitelist.length > 0) {
if (!limits.kind.whitelist.includes(event.kind)) {
return `event kind ${event.kind} is not allowed`
}
}
}
}