I am trying to run this js code in python. Is it possible to do it ?
import { recoverPersonalSignature } from 'eth-sig-util';
import { bufferToHex } from 'ethereumjs-util';
const msg = `I am signing my one-time nonce: ${user.nonce}`;
// We now are in possession of msg, publicAddress and signature. We
// will use a helper from eth-sig-util to extract the address from the signature
const msgBufferHex = bufferToHex(Buffer.from(msg, 'utf8'));
const address = recoverPersonalSignature({
data: msgBufferHex,
sig: signature,
});
// The signature verification is successful if the address found with
// sigUtil.recoverPersonalSignature matches the initial publicAddress
return address;