Improve chat key fetch and self-repair logic

Refactors the chat key fetch API to support fallback lookups using user handle and did:web aliasing, improving reliability when primary lookups fail. Updates useChatEncryption to detect and repair 'Zombie State' where local keys exist but are missing on the server, ensuring keys are republished as needed. Modifies sendMessage to pass recipient handle and bind sessions to the correct DID, supporting aliasing scenarios.
This commit is contained in:
Christopher
2026-01-27 19:45:36 -08:00
parent 7eae96bc44
commit 96053ebd65
3 changed files with 113 additions and 62 deletions
+2 -2
View File
@@ -278,7 +278,7 @@ export default function ChatPage() {
if (!did) throw new Error('User not found');
}
await sendMessage(did, newMessage, nodeDomain);
await sendMessage(did, newMessage, nodeDomain, selectedConversation.participant2.handle);
// Legacy UI expects message reload.
setNewMessage('');
@@ -306,7 +306,7 @@ export default function ChatPage() {
}
// Send "Hello" to init session
await sendMessage(data.user.did, '👋', data.user.nodeDomain);
await sendMessage(data.user.did, '👋', data.user.nodeDomain, data.user.handle);
setShowNewChat(false);
setNewChatHandle('');