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:
@@ -523,6 +523,29 @@ private fun MessageWithReactions(
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
horizontalArrangement = Arrangement.spacedBy(4.dp),
|
||||
) {
|
||||
// Encryption badge
|
||||
when (event) {
|
||||
is PrivateDmEvent -> {
|
||||
Icon(
|
||||
Icons.Default.LockOpen,
|
||||
contentDescription = "NIP-04 (legacy)",
|
||||
modifier = Modifier.size(12.dp),
|
||||
tint = MaterialTheme.colorScheme.onSurfaceVariant.copy(alpha = 0.4f),
|
||||
)
|
||||
}
|
||||
|
||||
is com.vitorpamplona.quartz.nip17Dm.messages.ChatMessageEvent,
|
||||
is ChatMessageEncryptedFileHeaderEvent,
|
||||
-> {
|
||||
Icon(
|
||||
Icons.Default.Lock,
|
||||
contentDescription = "NIP-17 (encrypted)",
|
||||
modifier = Modifier.size(12.dp),
|
||||
tint = MaterialTheme.colorScheme.primary.copy(alpha = 0.6f),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
// Timestamp
|
||||
note.createdAt()?.let { timestamp ->
|
||||
Text(
|
||||
|
||||
Reference in New Issue
Block a user