fix(e2ee): heal orphaned encrypted sidebar previews on deferred decrypt#965
Merged
Conversation
The sidebar preview (conversationMeta.lastMessage) can carry an encryptedPayload + "[OpenPGP-encrypted message]" fallback that persists across launches, but every deferred-decrypt heal path keys off the message stores (in-memory conversation arrays, IndexedDB messages) — none re-decrypt a preview from the ciphertext stashed in the preview itself. When the preview's message is absent or already decrypted in those stores (evicted, healed-in-IndexedDB, or set preview-only by a MAM preview refresh), the preview stays stuck on the fallback until the conversation is opened. Add a symmetric preview-level heal to retryPending(): enumerate previews still carrying encryptedPayload (new getEncryptedPreviews binding) and re-decrypt straight from the stash, applying refreshLastMessageContent. Dedup against handledChatKeys so a preview a store pass already repaired is not re-processed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
An OpenPGP sidebar preview could stay stuck on
[OpenPGP-encrypted message]until the conversation was opened.The preview (
conversationMeta.lastMessage) can carry anencryptedPayload+ fallback body that persists across launches, but every deferred-decrypt heal path keys off the message stores (in-memory conversation arrays, IndexedDB messages) — none re-decrypt a preview from the ciphertext stashed in the preview itself. So when the preview's message is absent or already decrypted in those stores (evicted, healed-in-IndexedDB, or set preview-only by a MAM preview refresh), only opening the conversation heals it.Adds a symmetric preview-level heal to
retryPending(): enumerate previews still carryingencryptedPayload(newgetEncryptedPreviewsbinding) and re-decrypt straight from the stash, applyingrefreshLastMessageContent. Dedups againsthandledChatKeysso a preview a store pass already repaired is not re-processed. Runs on every launch via the plugin-registered retry, so no explicit key-unlock is required.