Fix hasValidSignature, rename to isValid

This commit is contained in:
Jon Staab
2024-09-05 13:57:51 -07:00
parent 44f29c9da4
commit ed7efac977
3 changed files with 8 additions and 8 deletions
+2 -2
View File
@@ -13,7 +13,7 @@ export type NetContext = {
onAuth: (url: string, challenge: string) => void
onOk: (url: string, id: string, ok: boolean, message: string) => void
isDeleted: (url: string, event: TrustedEvent) => boolean
hasValidSignature: (url: string, event: TrustedEvent) => boolean
isValid: (url: string, event: TrustedEvent) => boolean
matchFilters: (url: string, filters: Filter[], event: TrustedEvent) => boolean
optimizeSubscriptions: (subs: Subscription[]) => RelaysAndFilters[]
}
@@ -33,8 +33,8 @@ export const getDefaultNetContext = () => ({
onEvent: noop,
pool: new Pool(),
isDeleted: always(false),
isValid: (url: string, event: TrustedEvent) => isSignedEvent(event) && hasValidSignature(event),
getExecutor: (relays: string[]) => new Executor(new Relays(relays.map((relay: string) => ctx.net.pool.get(relay)))),
hasValidSignature: (url: string, event: TrustedEvent) => isSignedEvent(event) && hasValidSignature(event),
matchFilters: (url: string, filters: Filter[], event: TrustedEvent) => matchFilters(filters, event),
optimizeSubscriptions: defaultOptimizeSubscriptions,
})