@@ -62,13 +62,18 @@ contract Account is AccountCore, ContractMetadata, ERC1271, ERC721Holder, ERC115
62
62
super .supportsInterface (interfaceId);
63
63
}
64
64
65
- /// @notice See EIP-1271
65
+ /**
66
+ * @notice See EIP-1271
67
+ *
68
+ * @param _hash The original message hash of the data to sign (before mixing this contract's domain separator)
69
+ * @param _signature The signature produced on signing the typed data hash (result of `getMessageHash(abi.encode(rawData))`)
70
+ */
66
71
function isValidSignature (
67
- bytes32 _message ,
72
+ bytes32 _hash ,
68
73
bytes memory _signature
69
74
) public view virtual override returns (bytes4 magicValue ) {
70
- bytes32 messageHash = getMessageHash (abi.encode (_message) );
71
- address signer = messageHash .recover (_signature);
75
+ bytes32 targetDigest = getMessageHash (_hash );
76
+ address signer = targetDigest .recover (_signature);
72
77
73
78
if (isAdmin (signer)) {
74
79
return MAGICVALUE;
@@ -89,12 +94,13 @@ contract Account is AccountCore, ContractMetadata, ERC1271, ERC721Holder, ERC115
89
94
90
95
/**
91
96
* @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))`
93
- * @return Hashed message
97
+ * @param _hash The message hash to sign for the EIP-1271 origin verifying contract.
98
+ * @return messageHash The digest to sign for EIP-1271 verification.
94
99
*/
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));
100
+ function getMessageHash (bytes32 _hash ) public view returns (bytes32 ) {
101
+ bytes32 messageHash = keccak256 (abi.encode (_hash));
102
+ bytes32 typedDataHash = keccak256 (abi.encode (MSG_TYPEHASH, messageHash));
103
+ return keccak256 (abi.encodePacked ("\x19\x01 " , _domainSeparatorV4 (), typedDataHash));
98
104
}
99
105
100
106
/*///////////////////////////////////////////////////////////////
0 commit comments