diff options
| author | Adam Soltys <[email protected]> | 2026-02-05 19:00:39 -0800 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2026-02-06 09:00:22 -0800 |
| commit | 310568dea00de03edd27b702a881e66fd7b5b837 (patch) | |
| tree | 370e6efc22b2b1d49d26d6739d5f7b6daca911e2 /lib | |
| parent | 808e7535d33ffca4c1bf859d8bf0afe134f3e1d7 (diff) | |
| download | coinos-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')
| -rw-r--r-- | lib/app.ts | 2 | ||||
| -rw-r--r-- | lib/nostr.ts | 8 | ||||
| -rw-r--r-- | lib/notifications.ts | 2 | ||||
| -rw-r--r-- | lib/nwc.ts | 2 | ||||
| -rw-r--r-- | lib/register.ts | 2 | ||||
| -rw-r--r-- | lib/upload.ts | 3 | ||||
| -rw-r--r-- | lib/zmq.ts | 2 |
7 files changed, 10 insertions, 11 deletions
@@ -16,7 +16,7 @@ import { jwtStrategy } from "$lib/auth"; const app = fastify({ logger: true, disableRequestLogging: true, - maxParamLength: 500, + routerOptions: { maxParamLength: 500 }, }); const reqLogger = pino(pino.destination("req")); 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"); diff --git a/lib/notifications.ts b/lib/notifications.ts index 31175916..d1e43392 100644 --- a/lib/notifications.ts +++ b/lib/notifications.ts @@ -7,7 +7,7 @@ import mqtt from "$lib/mqtt"; import { publish, serverSecret2 } from "$lib/nostr"; import { emit } from "$lib/sockets"; import { f, fiat, fmt, getUser, link, nada, t } from "$lib/utils"; -import { hexToBytes } from "@noble/hashes/utils"; +import { hexToBytes } from "@noble/hashes/utils.js"; import { finalizeEvent, nip04 } from "nostr-tools"; import webpush from "web-push"; @@ -14,7 +14,7 @@ import { sendInternal, sendKeysend, sendLightning } from "$lib/payments"; import { getBalance } from "$lib/tb"; import { fail, getInvoice, sleep } from "$lib/utils"; import rpc from "@coinos/rpc"; -import { hexToBytes } from "@noble/hashes/utils"; +import { hexToBytes } from "@noble/hashes/utils.js"; import { Relay } from "nostr"; import { finalizeEvent, nip04 } from "nostr-tools"; import type { UnsignedEvent } from "nostr-tools"; diff --git a/lib/register.ts b/lib/register.ts index acffa9f2..816782c1 100644 --- a/lib/register.ts +++ b/lib/register.ts @@ -4,7 +4,7 @@ import { db, s } from "$lib/db"; import { l, warn } from "$lib/logging"; import { createBalanceAccount, createCreditAccounts } from "$lib/tb"; import { fail } from "$lib/utils"; -import { bytesToHex, randomBytes } from "@noble/hashes/utils"; +import { bytesToHex, randomBytes } from "@noble/hashes/utils.js"; import { got } from "got"; import { getPublicKey, nip19 } from "nostr-tools"; import { encrypt as nip49encrypt } from "nostr-tools/nip49"; diff --git a/lib/upload.ts b/lib/upload.ts index ed06d7e0..7b5ad86d 100644 --- a/lib/upload.ts +++ b/lib/upload.ts @@ -3,8 +3,7 @@ import { writeFileSync } from "fs"; import { err } from "$lib/logging"; import { bail, fail } from "$lib/utils"; import { fileTypeFromBuffer } from "file-type"; - -const sharp = require("sharp"); +import sharp from "sharp"; export default async (req, res) => { try { @@ -5,7 +5,7 @@ import { err, l, warn } from "$lib/logging"; import { processWatchedTx } from "$lib/payments"; import { Transaction } from "@scure/btc-signer"; import { concatBytes, sha256x2 } from "@scure/btc-signer/utils.js"; -import { bytesToHex } from "@noble/hashes/utils"; +import { bytesToHex } from "@noble/hashes/utils.js"; const zmqHost = config.bitcoin.host || "127.0.0.1"; const zmqRawTxPort = config.bitcoin.zmq?.rawtx || 18507; |
