The ecrecover function get the address from ethSignedMessage hash and signature

return the address or address(0)

Screen Shot 2022-08-18 at 18.26.14.png

function recoverSigner(bytes32 _ethSignedMessageHash, bytes memory _signature)
        public
        pure
        returns (address)
    {
        (bytes32 r, bytes32 s, uint8 v) = splitSignature(_signature);

        return ecrecover(_ethSignedMessageHash, v, r, s);
    }

https://solidity-by-example.org/signature/

https://youtu.be/vYwYe-Gv_XI