The plugin implement this interface will be called before handling an event. You can use this interface to implement a guard for events.

class BlacklistGuardPlugin implements BeforeHandleEventPlugin {
private blacklist = [
// ...
];

beforeHandleEvent(event) {
const canHandle = !this.blacklist.includes(event.pubkey);
return {
canHandle,
message: canHandle ? undefined : 'block: you are blacklisted',
};
}
}
interface BeforeHandleEventPlugin {
    beforeHandleEvent(event: Event): BeforeHandleEventResult | Promise<BeforeHandleEventResult>;
}

Methods