diff options
| author | Adam Soltys <[email protected]> | 2025-02-11 13:40:05 -0800 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2025-02-11 13:40:05 -0800 |
| commit | de7435e34580e1a9b4b8d95b2a5013112414098f (patch) | |
| tree | 97074cadf3a63512c2c5f554a3083924fd046b74 /lib/nostr.ts | |
| parent | 8add46c0975686ce0967c2c38514a31aad6ee8cb (diff) | |
| download | coinos-server-de7435e34580e1a9b4b8d95b2a5013112414098f.tar.gz coinos-server-de7435e34580e1a9b4b8d95b2a5013112414098f.zip | |
default app on register
Diffstat (limited to 'lib/nostr.ts')
| -rw-r--r-- | lib/nostr.ts | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/nostr.ts b/lib/nostr.ts index 77726f38..9f5a2698 100644 --- a/lib/nostr.ts +++ b/lib/nostr.ts @@ -3,7 +3,7 @@ import { db, g, s } from "$lib/db"; import { l, warn } from "$lib/logging"; import { scan } from "$lib/strfry"; import { fail, fields, getUser, pick } from "$lib/utils"; -import { finalizeEvent, getPublicKey, nip19 } from "nostr-tools"; +import { finalizeEvent, getPublicKey, nip19, verifyEvent } from "nostr-tools"; import type { Event } from "nostr-tools"; import { AbstractSimplePool } from "nostr-tools/abstract-pool"; import { Relay } from "nostr-tools/relay"; @@ -30,8 +30,8 @@ export const anon = (pubkey) => ({ followers: [], }); -export async function send(ev, url = config.nostr) { - if (!ev?.id) return; +export async function publish(ev, url = config.nostr) { + if (!verifyEvent(ev)) fail("Invalid event"); const r = await Relay.connect(url); await r.publish(ev); r.close(); @@ -98,7 +98,7 @@ export async function handleZap(invoice, sender = undefined) { l("sending receipt"); const relays = relays_tag.slice(1).filter((r) => r?.startsWith("ws")); - relays.push(config.nostr); + relays.push(config.nostr); relays.map(async (url) => { try { const r = await Relay.connect(url); |
