@@ -64,11 +64,13 @@ contract Account is AccountCore, ContractMetadata, ERC1271, ERC721Holder, ERC115
64
64
65
65
/// @notice See EIP-1271
66
66
function isValidSignature (
67
- bytes32 _message ,
67
+ bytes32 _originalMessageHash ,
68
68
bytes memory _signature
69
69
) public view virtual override returns (bytes4 magicValue ) {
70
- bytes32 messageHash = getMessageHash (abi.encode (_message));
71
- address signer = messageHash.recover (_signature);
70
+ bytes32 typedDataHash = keccak256 (abi.encode (MSG_TYPEHASH, _originalMessageHash));
71
+ bytes32 targetDigest = keccak256 (abi.encodePacked ("\x19\x01 " , _domainSeparatorV4 (), typedDataHash));
72
+
73
+ address signer = targetDigest.recover (_signature);
72
74
73
75
if (isAdmin (signer)) {
74
76
return MAGICVALUE;
@@ -89,12 +91,13 @@ contract Account is AccountCore, ContractMetadata, ERC1271, ERC721Holder, ERC115
89
91
90
92
/**
91
93
* @notice Returns the hash of message that should be signed for EIP1271 verification.
92
- * @param message Message to be hashed i.e. `keccak256( abi.encode(data) )`
94
+ * @param _message The raw abi encoded data to hash and sign i.e. `abi.encode(data)`
93
95
* @return Hashed message
94
96
*/
95
- function getMessageHash (bytes memory message ) public view returns (bytes32 ) {
96
- bytes32 messageHash = keccak256 (abi.encode (MSG_TYPEHASH, keccak256 (message)));
97
- return keccak256 (abi.encodePacked ("\x19\x01 " , _domainSeparatorV4 (), messageHash));
97
+ function getMessageHash (bytes memory _message ) public view returns (bytes32 ) {
98
+ bytes32 messageHash = keccak256 (_message);
99
+ bytes32 typedDataHash = keccak256 (abi.encode (MSG_TYPEHASH, messageHash));
100
+ return keccak256 (abi.encodePacked ("\x19\x01 " , _domainSeparatorV4 (), typedDataHash));
98
101
}
99
102
100
103
/*///////////////////////////////////////////////////////////////
0 commit comments