From 1888e338f2ccef16ccdb738cfdd04ffe516e023a Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Thu, 13 Feb 2025 10:18:04 -0800 Subject: add uid to default app --- lib/nwc.ts | 3 ++- lib/register.ts | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) (limited to 'lib') diff --git a/lib/nwc.ts b/lib/nwc.ts index 53cda3b4..f92017d8 100644 --- a/lib/nwc.ts +++ b/lib/nwc.ts @@ -123,6 +123,7 @@ const handle = (method, params, ev, app, user) => (a, b) => a + (Math.abs(parseInt(b.amount || 0)) + + parseInt(b.tip || 0) + parseInt(b.fee || 0) + parseInt(b.ourfee || 0)), 0, @@ -348,7 +349,7 @@ const handle = (method, params, ev, app, user) => description: p.memo, preimage: p.ref, payment_hash, - amount: Math.abs(p.amount * 1000), + amount: (Math.abs(p.amount) + p.tip) * 1000, fees_paid: p.fee * 1000, created_at, expires_at: created_at + week, diff --git a/lib/register.ts b/lib/register.ts index 90cfe060..1493211c 100644 --- a/lib/register.ts +++ b/lib/register.ts @@ -70,10 +70,12 @@ export default async (user, ip) => { name: "Spending", }); - const secret = bytesToHex(randomBytes(32)); + const bytes = randomBytes(32); + const secret = bytesToHex(bytes); const app = { + uid: id, secret, - pubkey: getPublicKey(secret), + pubkey: getPublicKey(bytes), max_amount: 10000, budget_renewal: "weekly", name: username, -- cgit v1.2.3