nostr-tools
Advanced tools
Comparing version 0.15.0 to 0.15.1
@@ -51,3 +51,2 @@ import {Buffer} from 'buffer' | ||
export function verifySignature(event) { | ||
if (!validateEvent(event)) return false | ||
return secp256k1.schnorr.verify(event.sig, event.id, event.pubkey) | ||
@@ -54,0 +53,0 @@ } |
export function matchFilter(filter, event) { | ||
if (filter.id && event.id !== filter.id) return false | ||
if (filter.kind && event.kind !== filter.kind) return false | ||
if (filter.author && event.pubkey !== filter.author) return false | ||
if (typeof filter.kind === 'number' && event.kind !== filter.kind) return false | ||
if (filter.authors && filter.authors.indexOf(event.pubkey) === -1) | ||
@@ -6,0 +5,0 @@ return false |
@@ -7,2 +7,3 @@ import {generatePrivateKey, getPublicKey} from './keys' | ||
signEvent, | ||
validateEvent, | ||
verifySignature, | ||
@@ -19,2 +20,3 @@ serializeEvent, | ||
signEvent, | ||
validateEvent, | ||
verifySignature, | ||
@@ -21,0 +23,0 @@ serializeEvent, |
{ | ||
"name": "nostr-tools", | ||
"version": "0.15.0", | ||
"version": "0.15.1", | ||
"description": "Tools for making a Nostr client.", | ||
@@ -5,0 +5,0 @@ "repository": { |
@@ -5,3 +5,3 @@ /* global WebSocket */ | ||
import {verifySignature} from './event' | ||
import {verifySignature, validateEvent} from './event' | ||
import {matchFilters} from './filter' | ||
@@ -97,3 +97,4 @@ | ||
if ( | ||
(await verifySignature(event)) && | ||
validateEvent(event) && | ||
verifySignature(event) && | ||
channels[channel] && | ||
@@ -100,0 +101,0 @@ matchFilters(openSubs[channel], event) |
641
21596