Add check for user DID before key verification

Throws an error if the user DID is not available before attempting to verify the key on the server, preventing potential runtime errors.
This commit is contained in:
Christopher
2026-01-28 06:12:51 -08:00
parent a87977241c
commit 015d4ecbd8
+3
View File
@@ -61,6 +61,9 @@ export function useSodiumChat() {
// Verify key exists on server // Verify key exists on server
console.log('[Sodium] Verifying key on server...'); console.log('[Sodium] Verifying key on server...');
if (!user.did) {
throw new Error('User DID not available');
}
const checkResponse = await fetch(`/api/chat/keys?did=${encodeURIComponent(user.did)}`); const checkResponse = await fetch(`/api/chat/keys?did=${encodeURIComponent(user.did)}`);
let shouldPublish = false; let shouldPublish = false;