How use ECDSA?

Hi, I'm in need of help using Lib ECDSA.
What am I trying to do?
I'm trying to get a subscription and check my Smart Contract if everything is ok.

Below I'm putting my files that I have so far.

When I run the tests it is entering the "else" condition, shouldn't it enter the IF condition? or am i using recover with the wrong parameters?

Would they be able to help me?

pragma solidity >=0.4.22 <0.9.0;

import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
import "./TokenERC20.sol";

contract InstanceCoin{

    address contractInstance;

    constructor(address _contract){
        contractInstance = _contract;

    function reedemToken(uint _amount, bytes32 _hash, bytes memory _signature) public {
        // TokenERC20 token = TokenERC20(contractInstance);
        if(ECDSA.recover(_hash, _signature) == msg.sender)
            revert("is correct");
            revert("is not correct"); //revert just test

My file Test Unit js is:

const InstanceCoin = artifacts.require('coins/InstanceCoin');
const EthCrypto = require("eth-crypto");

const signerIdentity = EthCrypto.createIdentity();
const message = EthCrypto.hash.keccak256 ([ 
    {type: "uint256", value: "500"},     
const signature = EthCrypto.sign(signerIdentity.privateKey, message);

console.log(`message: ${message}`);
console.log(`signature: ${signature}`);
console.log(`signer public key: ${signerIdentity.address}`);

contract("InstanceCoin", (accounts) => {    
    let [alice, bob, cain, dan] = accounts;
    let contractInstance;
    beforeEach(async () => {        
        contractInstance = await InstanceCoin.deployed();              
    describe("deploys", async () => {
        it("just only test", async () => {
            await contractInstance.reedemToken(10, message, signature, {from: alice});

Output test:

     Error: Returned error: VM Exception while processing transaction: revert is not correct -- Reason given: is not correct.     

Hi @Roni_Sommerfeld, Sorry for the really late reply.

The contract is recovering the signer address correctly. The issue is that the message is signed by signerIdentity, whereas the msg.sender of the transaction is alice, a completely different private key.

Thanks for answers, a new question.. how I get values from my hash, its possible?

If you're asking how to retrieve the parameters that went into creating the hash, it's not possible. You always need to send to the contract the signature and all of the parameters. The contract has to create the hash from the parameters and then check it against the signature.