@@ -62,13 +62,18 @@ contract Account is AccountCore, ContractMetadata, ERC1271, ERC721Holder, ERC115
6262 super .supportsInterface (interfaceId);
6363 }
6464
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+ */
6671 function isValidSignature (
67- bytes32 _message ,
72+ bytes32 _hash ,
6873 bytes memory _signature
6974 ) 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);
7277
7378 if (isAdmin (signer)) {
7479 return MAGICVALUE;
@@ -89,12 +94,13 @@ contract Account is AccountCore, ContractMetadata, ERC1271, ERC721Holder, ERC115
8994
9095 /**
9196 * @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.
9499 */
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));
98104 }
99105
100106 /*///////////////////////////////////////////////////////////////
0 commit comments