You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
16 lines
632 B
16 lines
632 B
// SPDX-License-Identifier: MIT
|
|
|
|
pragma solidity ^0.8.20;
|
|
|
|
import {ECDSA} from "../utils/cryptography/ECDSA.sol";
|
|
import {EIP712} from "../utils/cryptography/EIP712.sol";
|
|
|
|
abstract contract EIP712Verifier is EIP712 {
|
|
function verify(bytes memory signature, address signer, address mailTo, string memory mailContents) external view {
|
|
bytes32 digest = _hashTypedDataV4(
|
|
keccak256(abi.encode(keccak256("Mail(address to,string contents)"), mailTo, keccak256(bytes(mailContents))))
|
|
);
|
|
address recoveredSigner = ECDSA.recover(digest, signature);
|
|
require(recoveredSigner == signer);
|
|
}
|
|
}
|
|
|