fix: check all sigs
This commit is contained in:
parent
9251d5b90a
commit
87bb9dafeb
@ -59,6 +59,7 @@ export abstract class EventExt {
|
||||
* @returns True if valid signature
|
||||
*/
|
||||
static verify(e: NostrEvent) {
|
||||
if ((e.sig?.length ?? 0) < 64) return false;
|
||||
const id = this.createId(e);
|
||||
const result = secp.schnorr.verify(e.sig, id, e.pubkey);
|
||||
return result;
|
||||
@ -175,6 +176,6 @@ export abstract class EventExt {
|
||||
if (type === EventType.ParameterizedReplaceable) {
|
||||
if (!findTag(ev, "d")) return false;
|
||||
}
|
||||
return true;
|
||||
return EventExt.verify(ev);
|
||||
}
|
||||
}
|
||||
|
@ -179,7 +179,10 @@ export class NostrSystem extends ExternalStore<SystemSnapshot> implements System
|
||||
}
|
||||
|
||||
#onEvent(sub: string, ev: TaggedNostrEvent) {
|
||||
if (!EventExt.isValid(ev)) return;
|
||||
if (!EventExt.isValid(ev)) {
|
||||
this.#log("Rejecting invalid event %O", ev);
|
||||
return;
|
||||
}
|
||||
|
||||
for (const [, v] of this.Queries) {
|
||||
v.handleEvent(sub, ev);
|
||||
|
Loading…
x
Reference in New Issue
Block a user