feat: add debugging for private bookmark decryption

- Added detailed logging to understand why getHiddenBookmarks returns undefined
- Check bookmark list content and encryption format
- Verify account has decryption capabilities
- Pass full account object with extension capabilities to applesauce helpers
- This will help diagnose the NIP-44 vs NIP-04 encryption issue
This commit is contained in:
Gigi
2025-10-02 10:02:50 +02:00
parent 559e7ee944
commit 4be8eff80a
2 changed files with 20 additions and 2 deletions

View File

@@ -20,6 +20,12 @@ interface ApplesauceBookmarks {
urls?: BookmarkData[]
}
interface AccountWithExtension {
pubkey: string
[key: string]: unknown // Allow other properties from the full account object
}
const processBookmarks = (
bookmarks: unknown,
activeAccount: ActiveAccount,
@@ -75,9 +81,10 @@ const processApplesauceBookmarks = (
return processBookmarks(bookmarks, activeAccount, isPrivate)
}
export const fetchBookmarks = async (
relayPool: RelayPool,
activeAccount: ActiveAccount,
activeAccount: AccountWithExtension, // Full account object with extension capabilities
setBookmarks: (bookmarks: Bookmark[]) => void,
setLoading: (loading: boolean) => void,
timeoutId: number
@@ -114,6 +121,14 @@ export const fetchBookmarks = async (
console.log('Public bookmarks:', publicBookmarks)
console.log('Private bookmarks:', privateBookmarks)
// Debug the bookmark list event content
console.log('Bookmark list content:', bookmarkListEvent.content)
console.log('Bookmark list content type:', typeof bookmarkListEvent.content)
console.log('Has encrypted content:', bookmarkListEvent.content && bookmarkListEvent.content.includes(':'))
console.log('Account type:', typeof activeAccount)
console.log('Account has decrypt method:', typeof activeAccount.decrypt)
// Process bookmarks using DRY helper function
// Handle the structure that applesauce returns: {notes: [], articles: [], hashtags: [], urls: []}
const publicItems = processApplesauceBookmarks(publicBookmarks, activeAccount, false)