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:
@@ -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('');
|
||||
|
||||
Reference in New Issue
Block a user