mirror of
https://github.com/nbd-wtf/nostr-tools.git
synced 2025-12-08 16:28:49 +00:00
fixed security issue around event verification
the use of id has been removed and the hash is computed instead
This commit is contained in:
committed by
fiatjaf
parent
50c3f24b25
commit
5db1934fa4
6
event.ts
6
event.ts
@@ -73,10 +73,8 @@ export function validateEvent(event: Event): boolean {
|
||||
return true
|
||||
}
|
||||
|
||||
export function verifySignature(
|
||||
event: Event & {id: string; sig: string}
|
||||
): boolean {
|
||||
return secp256k1.schnorr.verifySync(event.sig, event.id, event.pubkey)
|
||||
export function verifySignature(event: Event & {sig: string}): boolean {
|
||||
return secp256k1.schnorr.verifySync(event.sig, getEventHash(event), event.pubkey)
|
||||
}
|
||||
|
||||
export function signEvent(event: Event, key: string): string {
|
||||
|
||||
Reference in New Issue
Block a user