aboutsummaryrefslogtreecommitdiffstats
path: root/lib/nostr.ts
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2026-02-05 19:00:39 -0800
committerAdam Soltys <[email protected]>2026-02-06 09:00:22 -0800
commit310568dea00de03edd27b702a881e66fd7b5b837 (patch)
tree370e6efc22b2b1d49d26d6739d5f7b6daca911e2 /lib/nostr.ts
parent808e7535d33ffca4c1bf859d8bf0afe134f3e1d7 (diff)
downloadcoinos-server-310568dea00de03edd27b702a881e66fd7b5b837.tar.gz
coinos-server-310568dea00de03edd27b702a881e66fd7b5b837.zip
upgrade dependencies
- Fastify 4→5 with all plugins - @noble/hashes 1→2, @scure/base 1→2, @scure/bip32 1→2 - redis 4→5, pino 8→10, got 13→14, uuid 8→13, ws 7→8 - nostr-tools 2.16→2.23 (fix getPublicKey to pass Uint8Array) - Remove unused deps: date-fns, buffer-crc32, readable-stream-clone - Fix @noble/hashes import paths for v2 (.js extensions) - Fix Fastify maxParamLength deprecation (use routerOptions) - Convert sharp require() to ES import Co-Authored-By: Claude Opus 4.6 <[email protected]>
Diffstat (limited to 'lib/nostr.ts')
-rw-r--r--lib/nostr.ts8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/nostr.ts b/lib/nostr.ts
index 1d4ab56f..354f928b 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 { bytesToHex } from "@noble/hashes/utils";
+import { bytesToHex, hexToBytes } from "@noble/hashes/utils.js";
import { finalizeEvent, getPublicKey, nip19, verifyEvent } from "nostr-tools";
import type { Event } from "nostr-tools";
import { AbstractSimplePool } from "nostr-tools/abstract-pool";
@@ -20,8 +20,8 @@ export const serverSecret2 = bytesToHex(
nip19.decode(config.nostrKey2).data as Uint8Array,
);
-export const serverPubkey = getPublicKey(serverSecret);
-export const serverPubkey2 = getPublicKey(serverSecret2);
+export const serverPubkey = getPublicKey(hexToBytes(serverSecret));
+export const serverPubkey2 = getPublicKey(hexToBytes(serverSecret2));
const alwaysTrue: any = (t: Event) => {
t[Symbol("verified")] = true;
@@ -100,7 +100,7 @@ export async function handleZap(invoice, sender = undefined) {
tags.push(["preimage", invoice.payment_preimage]);
const ev = { pubkey, kind, created_at, content, tags };
- const signed = await finalizeEvent(ev, serverSecret2);
+ const signed = await finalizeEvent(ev, hexToBytes(serverSecret2));
l("sending receipt");