From 72fee02ab87c502c1ecb5196a4865206ffe8b900 Mon Sep 17 00:00:00 2001 From: Pilou <76021631+0xPilou@users.noreply.github.com> Date: Mon, 29 Jan 2024 09:37:48 +0100 Subject: [PATCH] added signature check in beforeRoyaltyClaim hook --- src/utils/ABKYCModule.sol | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/utils/ABKYCModule.sol b/src/utils/ABKYCModule.sol index 92fa793..042ea98 100644 --- a/src/utils/ABKYCModule.sol +++ b/src/utils/ABKYCModule.sol @@ -137,7 +137,12 @@ contract ABKYCModule is IABKYCModule, AccessControlUpgradeable { * @param _user user address * @param _signature signature generated by AB Backend and signed by AB KYC Signer */ - function beforeRoyaltyClaim(address _user, bytes calldata _signature) external view {} + function beforeRoyaltyClaim(address _user, bytes calldata _signature) external view { + bytes32 digest = keccak256( + abi.encodePacked("\x19Ethereum Signed Message:\n32", keccak256(abi.encodePacked(_user, currentNonce))) + ); + if (digest.recover(_signature) != defaultSigner) revert ABErrors.NO_KYC(); + } // ____ __ ___ __ _ // / __ \____ / /_ __ / | ____/ /___ ___ (_)___