Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Signature Validity Duration #2

Open
juddydev opened this issue Jul 4, 2024 · 0 comments
Open

Signature Validity Duration #2

juddydev opened this issue Jul 4, 2024 · 0 comments

Comments

@juddydev
Copy link
Owner

juddydev commented Jul 4, 2024

The contract does not limit the validity period of signatures, potentially allowing a claim to be valid indefinitely. Adding a timestamp to the signature data and verifying that the signature is recent would mitigate this issue.

function _validateClaimParams(
uint256 _amount,
address _claimer,
bytes calldata _signature,
uint256 _timestamp
) internal view returns (bool) {
require(block.timestamp <= _timestamp + 1 days, "Signature expired");
bytes32 hash = keccak256(abi.encodePacked(_claimer, _amount, _timestamp));
bytes32 message = ECDSA.toEthSignedMessageHash(hash);
address recoveredAddress = ECDSA.recover(message, _signature);
return (recoveredAddress == signer);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant