feat(chats): per-message encryption badge — lock for NIP-17, lock-open for NIP-04
Show a small lock icon next to the timestamp on each DM message: - NIP-17 (ChatMessageEvent, ChatMessageEncryptedFileHeaderEvent): filled lock in primary color — relay can't see sender/recipient - NIP-04 (PrivateDmEvent): open lock in muted gray — legacy encryption, metadata visible to relays Matches Android's IncognitoBadge pattern. Both NIP-04 and NIP-17 messages in the same 1-on-1 conversation produce identical ChatroomKeys, so they merge into one conversation — the badge is the only way to tell them apart. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
# Brainstorm: Per-Message Encryption Badge in DMs
|
||||
|
||||
**Date:** 2026-03-19
|
||||
**Status:** Ready for implementation
|
||||
|
||||
## What We're Building
|
||||
|
||||
Per-message encryption indicator in DM chat bubbles — lock icon (NIP-17) or lock-open icon (NIP-04) next to the timestamp. Matches Android's approach with incognito badges.
|
||||
|
||||
## Why This Approach
|
||||
|
||||
Users need to know which messages are truly private (NIP-17: relay can't see sender/recipient) vs legacy encrypted (NIP-04: relay sees metadata). Android already does this with incognito badges. Desktop uses lock/lock-open icons (already imported in ChatPane) for consistency with the existing NIP-17 toggle.
|
||||
|
||||
## Key Decisions
|
||||
|
||||
| Decision | Choice | Rationale |
|
||||
|----------|--------|-----------|
|
||||
| Indicator type | Lock icon per message | Matches existing lock icon pattern in desktop NIP-17 toggle |
|
||||
| NIP-17 icon | Lock (filled) in primary color | Private, secure |
|
||||
| NIP-04 icon | LockOpen in muted gray | Legacy, weaker privacy |
|
||||
| Placement | Next to timestamp in detailRow | Matches Android's IncognitoBadge placement |
|
||||
| Tooltip | None (match Android) | Keep it subtle, not alarming |
|
||||
|
||||
## Implementation
|
||||
|
||||
The badge goes in `MessageWithReactions` in ChatPane.kt, in the `detailRow` slot of `ChatMessageCompose`. Check `note.event` type:
|
||||
- `is PrivateDmEvent` → NIP-04 → lock-open gray
|
||||
- `is ChatMessageEvent` or `is ChatMessageEncryptedFileHeaderEvent` → NIP-17 → lock primary
|
||||
- else → no badge
|
||||
|
||||
## Key Finding: NIP-04 + NIP-17 Messages Merge
|
||||
|
||||
For 1-on-1 chats, both protocols produce identical `ChatroomKey({otherPubkey})`. Messages from both protocols appear in the same conversation. The per-message badge is the only way to tell them apart.
|
||||
Reference in New Issue
Block a user