aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2026-03-13 10:13:34 -0700
committerAdam Soltys <[email protected]>2026-03-13 10:13:34 -0700
commitfa5188d7e4781e90d1f315274f840f60db326f7e (patch)
tree6961757c2723efa2cc13334a0d7d3740a3ce7f7a /lib
parent69d17aea7e0cfdd6429fdbb07c2a1f5c7497e798 (diff)
downloadcoinos-server-fa5188d7e4781e90d1f315274f840f60db326f7e.tar.gz
coinos-server-fa5188d7e4781e90d1f315274f840f60db326f7e.zip
use bytes for nostr tools
Diffstat (limited to 'lib')
-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..69c4758a 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";
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");