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
the verify function should return the same contract address as the signer but it does not.
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import {MessageHashUtils} from "@openzeppelin/contracts/utils/cryptography/MessageHashUtils.sol";
contract SignatureVerification {
using ECDSA for bytes32;
using Address for address;
using MessageHashUtils for bytes32;
function _verify(bytes32 data, bytes memory signature) internal pure returns (address) {
return data.toEthSignedMessageHash().recover(signature);
}
function verify(bytes32 data, bytes memory signature) external pure returns (address){
return _verify( data, signature);
}
}
When using web3js its working perfectly. Here is the example.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
dear wagmi community,
could someone help us with this issue please ?
the signature generated with
signMessageAsync()
is send to a smartcontract function to verify its ownerthe verify function should return the same contract address as the signer but it does not.
When using web3js its working perfectly. Here is the example.
Any idea what am i doing wrong ? why does the wagmi hook returns another signature than the web3js sign ?
much appreciated.
Beta Was this translation helpful? Give feedback.
All reactions