Skip to content
This repository was archived by the owner on Jul 30, 2026. It is now read-only.
This repository was archived by the owner on Jul 30, 2026. It is now read-only.

Decrypt into reading pane instead of taskpane #6

Description

@rubenhensen

Problem

When a user decrypts a PostGuard-encrypted email for the first time (no cached JWT), the decrypted content is shown in the taskpane sidebar rather than replacing the email body in the reading pane. On subsequent opens the OnMessageRead launch event auto-decrypts with the cached JWT and replaces the body inline via event.completed({ emailBody }), which is the ideal experience.

Why this happens

The event.completed({ emailBody }) API (Mailbox 1.15) that replaces the displayed email body is only available inside launch event handlers. There is no equivalent API for taskpanes in read mode — body.setAsync() only works in compose mode.

The taskpane is needed because PostGuard requires interactive Yivi QR-code authentication when there is no cached JWT, which cannot run inside a launch event (no UI).

Approaches explored

  • displayMessageForm(itemId): After auth, reopen the message in a new inspector window so the launch event fires with the now-cached JWT. Problem: the pinned taskpane follows into the new window, giving a poor experience.
  • body.setAsync() from taskpane: Not available in read mode.
  • EWS / Graph API to permanently replace message: Would modify the stored message, which defeats the purpose of encryption at rest. Also has permission/availability issues in launch events.

Current behavior

  1. First open (no cached JWT): taskpane shows decrypt button → Yivi QR auth → decrypted content displayed in the taskpane sidebar
  2. Subsequent opens (cached JWT): launch event auto-decrypts → body replaced inline in the reading pane via event.completed({ emailBody })

Desired behavior

Both first-time and subsequent decryptions should replace the email body inline in the reading pane.

Possible future solutions

  • Microsoft may add a read-mode body replacement API for taskpanes (e.g. display.body.setAsync())
  • A shared runtime between taskpane and launch event might allow re-triggering the launch event programmatically after caching the JWT
  • If displayMessageForm could open without carrying over the pinned taskpane, that approach would work

Reference

  • Microsoft encrypt/decrypt sample — uses event.completed({ emailBody }) exclusively (no taskpane at all, no interactive auth needed)
  • event.completed({ emailBody }) docs: requires Mailbox requirement set 1.15

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions