mirror of
https://github.com/waku-org/js-waku.git
synced 2025-02-13 12:56:43 +00:00
Fix bad comparison logic
This commit is contained in:
parent
44db58d2fd
commit
66d450ae36
@ -58,9 +58,10 @@ export async function handleDirectMessage(
|
|||||||
console.log('Direct Message received:', wakuMsg);
|
console.log('Direct Message received:', wakuMsg);
|
||||||
if (!wakuMsg.payload) return;
|
if (!wakuMsg.payload) return;
|
||||||
const directMessage: DirectMessage = decode(wakuMsg.payload);
|
const directMessage: DirectMessage = decode(wakuMsg.payload);
|
||||||
// Do not return our own messages
|
// Only decrypt messages for us
|
||||||
if (directMessage.toAddress === address) return;
|
if (!equalByteArrays(directMessage.toAddress, address)) return;
|
||||||
|
|
||||||
|
try {
|
||||||
const text = await decryptMessage(privateKey, directMessage);
|
const text = await decryptMessage(privateKey, directMessage);
|
||||||
|
|
||||||
const timestamp = wakuMsg.timestamp ? wakuMsg.timestamp : new Date();
|
const timestamp = wakuMsg.timestamp ? wakuMsg.timestamp : new Date();
|
||||||
@ -74,4 +75,7 @@ export async function handleDirectMessage(
|
|||||||
});
|
});
|
||||||
return copy;
|
return copy;
|
||||||
});
|
});
|
||||||
|
} catch (e) {
|
||||||
|
console.log(' Failed to decrypt message', e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user