fix bookmarks decryption
This commit is contained in:
@@ -83,6 +83,16 @@ object AmberUtils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun decryptBookmark(encryptedContent: String, pubKey: HexKey, id: String, signerType: SignerType = SignerType.NIP04_DECRYPT) {
|
||||||
|
openAmber(
|
||||||
|
encryptedContent,
|
||||||
|
signerType,
|
||||||
|
IntentUtils.activityResultLauncher,
|
||||||
|
pubKey,
|
||||||
|
id
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
fun decryptGossip(event: Event) {
|
fun decryptGossip(event: Event) {
|
||||||
if (IntentUtils.eventCache.get(event.id) == null) {
|
if (IntentUtils.eventCache.get(event.id) == null) {
|
||||||
IntentUtils.eventCache.put(event.id, event)
|
IntentUtils.eventCache.put(event.id, event)
|
||||||
|
|||||||
@@ -17,14 +17,24 @@ object BookmarkPrivateFeedFilter : FeedFilter<Note>() {
|
|||||||
val bookmarks = account.userProfile().latestBookmarkList
|
val bookmarks = account.userProfile().latestBookmarkList
|
||||||
|
|
||||||
if (account.loginWithAmber) {
|
if (account.loginWithAmber) {
|
||||||
if (AmberUtils.content.isBlank()) {
|
val id = bookmarks?.id
|
||||||
AmberUtils.decrypt(bookmarks?.content ?: "", account.keyPair.pubKey.toHexKey(), "")
|
if (id != null) {
|
||||||
bookmarks?.decryptedContent = AmberUtils.content
|
val decryptedContent = AmberUtils.cachedDecryptedContent[id]
|
||||||
|
if (decryptedContent == null) {
|
||||||
|
AmberUtils.decryptBookmark(
|
||||||
|
bookmarks.content,
|
||||||
|
account.keyPair.pubKey.toHexKey(),
|
||||||
|
id
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
bookmarks.decryptedContent = decryptedContent
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
val decryptedContent = AmberUtils.cachedDecryptedContent[id] ?: ""
|
||||||
|
|
||||||
val notes = bookmarks?.privateTaggedEvents(bookmarks.decryptedContent)
|
val notes = bookmarks?.privateTaggedEvents(decryptedContent)
|
||||||
?.mapNotNull { LocalCache.checkGetOrCreateNote(it) } ?: emptyList()
|
?.mapNotNull { LocalCache.checkGetOrCreateNote(it) } ?: emptyList()
|
||||||
val addresses = bookmarks?.privateTaggedAddresses(bookmarks.decryptedContent)
|
val addresses = bookmarks?.privateTaggedAddresses(decryptedContent)
|
||||||
?.map { LocalCache.getOrCreateAddressableNote(it) } ?: emptyList()
|
?.map { LocalCache.getOrCreateAddressableNote(it) } ?: emptyList()
|
||||||
|
|
||||||
return notes.plus(addresses).toSet()
|
return notes.plus(addresses).toSet()
|
||||||
|
|||||||
Reference in New Issue
Block a user