From 3a752a761acfef7e9dfed1997ccfce9e9e60df8e Mon Sep 17 00:00:00 2001 From: Gigi Date: Fri, 17 Oct 2025 20:54:45 +0200 Subject: [PATCH] refactor: remove artificial timeouts from bookmark decryption Removed all withTimeout wrappers - now matches debug page behavior: - Direct decrypt calls with no artificial timeouts - Let operations fail naturally and quickly - Bunker responds instantly (success or rejection) No timeouts needed because: 1. Account queue is disabled (requests sent immediately) 2. Only decrypting truly encrypted content (no wasted attempts) 3. Bunker either succeeds quickly or fails quickly This makes bookmark decryption instant, just like the debug page encryption/decryption tests. --- src/services/bookmarkProcessing.ts | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/src/services/bookmarkProcessing.ts b/src/services/bookmarkProcessing.ts index 0e0a8846..2bb33e01 100644 --- a/src/services/bookmarkProcessing.ts +++ b/src/services/bookmarkProcessing.ts @@ -5,7 +5,6 @@ import { } from '../types/bookmarks' import { BookmarkHiddenSymbol, hasNip04Decrypt, hasNip44Decrypt, processApplesauceBookmarks } from './bookmarkHelpers' import type { NostrEvent } from './bookmarkHelpers' -import { withTimeout } from '../utils/async' type DecryptFn = (pubkey: string, content: string) => Promise type UnlockHiddenTagsFn = typeof Helpers.unlockHiddenTags @@ -42,13 +41,10 @@ async function decryptEvent( // NIP-44 starts with version byte (currently 0x02), NIP-04 is base64 const looksLikeNip44 = evt.content.length > 0 && !evt.content.includes('?iv=') - // Try the likely method first, with a 5s timeout + // Try the likely method first (no timeout - let it fail naturally like debug page) if (looksLikeNip44 && hasNip44Decrypt(signerCandidate)) { try { - decryptedContent = await withTimeout( - (signerCandidate as { nip44: { decrypt: DecryptFn } }).nip44.decrypt(evt.pubkey, evt.content), - 5000 - ) + decryptedContent = await (signerCandidate as { nip44: { decrypt: DecryptFn } }).nip44.decrypt(evt.pubkey, evt.content) } catch (err) { console.log("[bunker] ❌ nip44.decrypt failed:", err instanceof Error ? err.message : String(err)) } @@ -57,10 +53,7 @@ async function decryptEvent( // Fallback to nip04 if nip44 failed or content looks like nip04 if (!decryptedContent && hasNip04Decrypt(signerCandidate)) { try { - decryptedContent = await withTimeout( - (signerCandidate as { nip04: { decrypt: DecryptFn } }).nip04.decrypt(evt.pubkey, evt.content), - 5000 - ) + decryptedContent = await (signerCandidate as { nip04: { decrypt: DecryptFn } }).nip04.decrypt(evt.pubkey, evt.content) } catch (err) { console.log("[bunker] ❌ nip04.decrypt failed:", err instanceof Error ? err.message : String(err)) }