From 77ba507c69dbffdf7ad4aa3eb435aa083616042f Mon Sep 17 00:00:00 2001 From: boufni95 Date: Mon, 15 Dec 2025 18:56:05 +0000 Subject: [PATCH] fix and clean --- src/services/main/unlocker.ts | 9 ++------- src/services/serverMethods/index.ts | 1 - src/services/storage/liquidityStorage.ts | 3 ++- 3 files changed, 4 insertions(+), 9 deletions(-) diff --git a/src/services/main/unlocker.ts b/src/services/main/unlocker.ts index e18ab600..2f1ade76 100644 --- a/src/services/main/unlocker.ts +++ b/src/services/main/unlocker.ts @@ -211,12 +211,10 @@ export class Unlocker { throw new Error("node pub not found") } const encrypted = await this.storage.liquidityStorage.GetNoodeSeed(this.nodePub) - if (!encrypted || !encrypted.seed) { + if (!encrypted) { throw new Error("seed not found") } - this.log("seed found, decrypting") - const decrypted = this.DecryptWalletSeed(JSON.parse(encrypted.seed)) - this.log("seed decrypted") + const decrypted = this.DecryptWalletSeed(JSON.parse(encrypted)) return { seed: decrypted } } @@ -278,12 +276,9 @@ export class Unlocker { const secret = Buffer.from(sec, 'hex') const iv = Buffer.from(data.iv, 'hex') const encrypted = Buffer.from(data.encrypted, 'hex') - this.log("decoded encrypted data") const decipher = crypto.createDecipheriv('aes-256-cbc', secret, iv) const decrypted = decipher.update(encrypted) - this.log("decrypted data") const raw = Buffer.concat([decrypted, decipher.final()]) - this.log("got raw data") return raw.toString('utf-8') } diff --git a/src/services/serverMethods/index.ts b/src/services/serverMethods/index.ts index 456eac22..c9f92932 100644 --- a/src/services/serverMethods/index.ts +++ b/src/services/serverMethods/index.ts @@ -110,7 +110,6 @@ export default (mainHandler: Main): Types.ServerMethods => { return mainHandler.appUserManager.BanUser(req.user_id) }, GetSeed: async ({ ctx }) => { - console.log("admin getting seed") return mainHandler.unlocker.GetSeed() }, SetMockInvoiceAsPaid: async ({ ctx, req }) => { diff --git a/src/services/storage/liquidityStorage.ts b/src/services/storage/liquidityStorage.ts index 0a609ed5..74364e33 100644 --- a/src/services/storage/liquidityStorage.ts +++ b/src/services/storage/liquidityStorage.ts @@ -18,7 +18,8 @@ export class LiquidityStorage { } async GetNoodeSeed(pubkey: string) { - return this.dbs.FindOne('LndNodeInfo', { where: { pubkey, seed: Not(IsNull()) } }) + const node = await this.dbs.FindOne('LndNodeInfo', { where: { pubkey/* , seed: Not(IsNull()) */ } }) + return node?.seed } async SaveNodeSeed(pubkey: string, seed: string) {