mirror of
https://github.com/dergigi/boris.git
synced 2025-12-18 23:24:22 +01:00
debug: add signer method inspection for NIP-44 decryption
- Add logging to inspect available methods on the applesauce signer - Try multiple possible method names for NIP-44 decryption - This will help identify the correct method name for decryption
This commit is contained in:
@@ -143,10 +143,30 @@ export const fetchBookmarks = async (
|
|||||||
if (bookmarkListEvent.content && activeAccount.signer) {
|
if (bookmarkListEvent.content && activeAccount.signer) {
|
||||||
try {
|
try {
|
||||||
console.log('Decrypting private bookmarks...')
|
console.log('Decrypting private bookmarks...')
|
||||||
const decryptedContent = await activeAccount.signer.nip44_decrypt(
|
console.log('Signer methods:', Object.getOwnPropertyNames(activeAccount.signer))
|
||||||
|
console.log('Signer prototype methods:', Object.getOwnPropertyNames(Object.getPrototypeOf(activeAccount.signer)))
|
||||||
|
|
||||||
|
// Try different possible method names
|
||||||
|
let decryptedContent = null
|
||||||
|
if (typeof activeAccount.signer.nip44_decrypt === 'function') {
|
||||||
|
decryptedContent = await activeAccount.signer.nip44_decrypt(
|
||||||
bookmarkListEvent.content,
|
bookmarkListEvent.content,
|
||||||
activeAccount.pubkey
|
activeAccount.pubkey
|
||||||
)
|
)
|
||||||
|
} else if (typeof activeAccount.signer.decrypt === 'function') {
|
||||||
|
decryptedContent = await activeAccount.signer.decrypt(
|
||||||
|
bookmarkListEvent.content,
|
||||||
|
activeAccount.pubkey
|
||||||
|
)
|
||||||
|
} else if (typeof activeAccount.signer.nip44Decrypt === 'function') {
|
||||||
|
decryptedContent = await activeAccount.signer.nip44Decrypt(
|
||||||
|
bookmarkListEvent.content,
|
||||||
|
activeAccount.pubkey
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
console.log('No suitable decrypt method found on signer')
|
||||||
|
throw new Error('No suitable decrypt method found on signer')
|
||||||
|
}
|
||||||
|
|
||||||
console.log('Decrypted content:', decryptedContent)
|
console.log('Decrypted content:', decryptedContent)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user