metamask-mobile icon indicating copy to clipboard operation
metamask-mobile copied to clipboard

"personal_sign" response verification failure

Open kaplandroid opened this issue 4 years ago • 11 comments

We are developing android and ios dapps using WalletConnect library. After requesting wallet address, I call "personal_sign" method to verify user and I get the signature string. In order to validate the signature we use nethereum on server side. Here comes the problem. Until Metamask v4.1.1 this process was working without any problem but after v4.1.1 we can not verify the signature. If I run my application code on a device that has metamask v4.0.1 it works normally but even though i can get signature string using newer versions validation can’t success.

Anyone has an idea about this?

Smartphone (please complete the following information):

  • Device: Google Pixel 3A
  • OS: Android 12
  • App Version 4.2.2

kaplandroid avatar Mar 22 '22 18:03 kaplandroid

Our app is experiencing exactly the same error

rollue avatar Mar 23 '22 07:03 rollue

We found the reason and a solution to this error. When you request wallet address from the older versions of Metamask it returns the address using both lowercase and uppercase characters like "0x593A4e.....15A23aD3". In the newer versions it only returns in lowercase like "0x593a4e.....15a23ad3". In the signature verification result, you get wallet address with mixed lowercase and uppercase characters. So you should ignore the case sensitivity for comparing wallet address’.

kaplandroid avatar Mar 23 '22 11:03 kaplandroid

Hey @rollue, did @KAPLANDROID's solution also worked for you?

gantunesr avatar Mar 29 '22 16:03 gantunesr

@KAPLANDROID

Hey, can you please give me more detail.s

Where to apply the change ?

Bcz, control is going to Metamask, but dialog is not showing up.

I checked the address, I am getting all small cases after connection and for signing I am also passing all small cases.

jayvs6341 avatar May 06 '22 07:05 jayvs6341

@jayvs6341
After signing the message on MetaMask app, you get the signature response. While decrypting this signature you will retrieve the wallet address in mixed case like "0x593A4e.....15A23aD3". So you need to ignore case sensitivity while comparing wallet addresses. This was the problem we faced while validating the signature.

kaplandroid avatar May 09 '22 09:05 kaplandroid

@KAPLANDROID But, for V4.1.1 after metamask , the signing dialog is not coming. I am struggling to get the dialog in metamask. For V4.1.1 and before, it shows the dialog.

jayvs6341 avatar May 09 '22 10:05 jayvs6341

@jayvs6341 I don't face this problem. Probably, you have problem with "personal_sign" call. You can check this code snipped. It works on my end.

Session.MethodCall.Custom( txRequest, "personal_sign", arrayListOf( getFormattedMessage(), // message to sign walletAddress ), ) session.performMethodCall(customMessage, ::handlePersonalSignResponse)

kaplandroid avatar May 09 '22 10:05 kaplandroid

@KAPLANDROID Did you try to send a transaction function ? Can you help me with that? My main focus is to send transactions. I want to approve the transaction through metamask. As I told you, metamask V4.1.1 works fine, I can see the transaction approval dialog. But After V4.1.1, my app can redirect to mertamask, but I don't see any dialog.

jayvs6341 avatar May 09 '22 10:05 jayvs6341

@jayvs6341 sorry i edited my previous comment. It is just for "personal_sign" dialog not transaction.

kaplandroid avatar May 09 '22 11:05 kaplandroid

@KAPLANDROID Okay, Thanks for your answer,still I am not getting the dialog in metamask. Not sure why.

jayvs6341 avatar May 09 '22 12:05 jayvs6341

@jayvs6341 I have encountered the same problem.In v5.1.1, i don't see any dialog,but V3.7.0 it works fine. How did you solve it?

afterlifehy avatar Jun 09 '22 14:06 afterlifehy