diff --git a/src/utils/crypto/checkStealthAddress.ts b/src/utils/crypto/checkStealthAddress.ts index 20c28ad..730dc5e 100644 --- a/src/utils/crypto/checkStealthAddress.ts +++ b/src/utils/crypto/checkStealthAddress.ts @@ -57,8 +57,7 @@ function checkStealthAddress({ schemeId }); - // Compare derived stealth address with the user's stealth address - return stealthAddress === userStealthAddress; + return stealthAddress.toLowerCase() === userStealthAddress.toLowerCase(); } export default checkStealthAddress; diff --git a/src/utils/crypto/test/checkStealthAddress.test.ts b/src/utils/crypto/test/checkStealthAddress.test.ts index 420a9a7..558fa4d 100644 --- a/src/utils/crypto/test/checkStealthAddress.test.ts +++ b/src/utils/crypto/test/checkStealthAddress.test.ts @@ -70,4 +70,25 @@ describe('checkStealthAddress', () => { expect(isForUser).toBe(false); }); + + test('matches addresses regardless of case', () => { + // Test with different case variations + const variations = [ + stealthAddress.toLowerCase(), + stealthAddress.toUpperCase() + ]; + + for (const addressVariation of variations) { + const result = checkStealthAddress({ + ephemeralPublicKey, + schemeId, + spendingPublicKey: bytesToHex(spendingPublicKey), + viewingPrivateKey, + userStealthAddress: addressVariation as `0x${string}`, + viewTag + }); + + expect(result).toBe(true); + } + }); });