Open edzillion opened 5 years ago
I am having problems signing and recovering; with the caveat that we are using ethers
on the FE and web3
on the API:
I did a test in which I signed the same message with web3
and ethers
and compared them:
ethers_sig: {
recoveryParam: 0,
r:'0x26a12022a1d49a2b9ca2d...',
s:'0x2989604fc395b312e4cc3...',
v: 27
},
web3_sig: {
message: '1554463955373',
messageHash: '0x26fe319265cb6443a61ae7dad32240c...',
v: '0x1b',
r: '0x826a7627420...',
s: '0x77526a66118...',
signature: '0x826a7627420f67dbd44a1e779c392a13...'
}
If I run web3.eth.accounts.recover
with the web3
signature I get the correct address.
Current implementation is to send
message
&signature
to the backend to verify account ownership. The message is a timestamp. If the message is within ~5 (10?) mins of current time the the account address recovered from the msg and sig is used to find the relevant user record and send a verif to the phone.