nostr-tools 0.10.0 → 0.10.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/relay.js +7 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nostr-tools",
3
- "version": "0.10.0",
3
+ "version": "0.10.1",
4
4
  "description": "Tools for making a Nostr client.",
5
5
  "repository": {
6
6
  "type": "git",
package/relay.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import 'websocket-polyfill'
2
2
 
3
3
  import {verifySignature} from './event'
4
+ import {matchFilters} from './filter'
4
5
 
5
6
  export function normalizeRelayURL(url) {
6
7
  let [host, ...qs] = url.split('?')
@@ -88,10 +89,12 @@ export function relayConnect(url, onNotice) {
88
89
  let channel = data[1]
89
90
  let event = data[2]
90
91
 
91
- if (await verifySignature(event)) {
92
- if (channels[channel]) {
93
- channels[channel](event)
94
- }
92
+ if (
93
+ (await verifySignature(event)) &&
94
+ channels[channel] &&
95
+ matchFilters(openSubs[channel], event)
96
+ ) {
97
+ channels[channel](event)
95
98
  }
96
99
  return
97
100
  }