You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Nov 9, 2026. It is now read-only.
Repository navigation
This repository was archived by the owner on Nov 9, 2026. It is now read-only.
Hey there, I'm using eth-sig-util to do some signature validation on my backend. I recently redeployed the same code I had been using in a new project and found it was no longer working. This was because of an upgrade to eth-sig-util. I've gone ahead and created an example test that passes in 2.1.2, but fails in 2.2.0. I've narrowed it down to 0fbac01 as being the commit to break this. The signature and data blob here are from a real project using MetaMask v6.7.2 to do the signature.
OK, I can confirm that this works fine when I generate and recover a signature for the same data blob, minus verifyingContract. So it looks like MetaMask still has this issue when signing data with 0x in front, and it causes this library to recover it incorrectly. I'm guessing this wasn't caught because there are no tests for recoverTypedSignature.
I ran into this while passing a string with 0x in the front.
@wbobeirne Great job on reproducing and getting to the bottom of the issue! Btw, in your case, verifyingContract should be defined as an address, right? Fortunately, that helped cause the issue, so all good :)
Facing the same issue. When I try to recover a signature it fails with: Invalid signature length. Just as in OPs example, my signature is 132 characters, but in ethereumjs-util/dist/index.js.exports.fromRpcSig (index.js:438) the signature is expected to have 65 characters.
Activity
wbobeirne commentedon Jul 10, 2019
OK, I can confirm that this works fine when I generate and recover a signature for the same data blob, minus verifyingContract. So it looks like MetaMask still has this issue when signing data with
0xin front, and it causes this library to recover it incorrectly. I'm guessing this wasn't caught because there are no tests forrecoverTypedSignature.SwaroopH commentedon Jul 22, 2019
I ran into this while passing a string with
0xin the front.@wbobeirne Great job on reproducing and getting to the bottom of the issue! Btw, in your case,
verifyingContractshould be defined as an address, right? Fortunately, that helped cause the issue, so all good :)janhesters commentedon Dec 5, 2019
Facing the same issue. When I try to recover a signature it fails with:
Invalid signature length. Just as in OPs example, my signature is 132 characters, but inethereumjs-util/dist/index.js.exports.fromRpcSig (index.js:438)the signature is expected to have 65 characters.jdowning100 commentedon May 27, 2020
I have this issue too. Why is a signature generated by web3 considered invalid, signed by Metamask no less? Guess I'll use a different library.