Skip to content

Commit

Permalink
Avoid undefined values
Browse files Browse the repository at this point in the history
  • Loading branch information
jmsm412 committed Nov 29, 2024
1 parent d5b32ea commit 1fc11c3
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions rair-node/bin/integrations/ethers/web3Signature.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,11 +168,15 @@ module.exports = {
}
const recovered = await recoverUserFromSignature(MetaMessage, MetaSignature);
const storedOwner = cache.get(`${userAddress}secret`);
if (recovered?.toLowerCase() === storedOwner?.toLowerCase()) {
if (
recovered !== undefined &&
storedOwner !== undefined &&
recovered.toLowerCase() === storedOwner.toLowerCase()
) {
cache.del(userAddress.toLowerCase());
cache.del(MetaMessage);
cache.del(`${userAddress}secret`);
req.metaAuth = { recovered: userAddress };
req.metaAuth = { recovered: recovered.toLowerCase() };
req.web3LoginMethod = 'web3auth';
} else {
req.metaAuth = undefined;
Expand Down

0 comments on commit 1fc11c3

Please sign in to comment.