@@ -715,10 +715,10 @@ public async Task<string> PersonalSign(string message)
715
715
716
716
var sig = factorySupports712
717
717
? await EIP712 . GenerateSignature_SmartAccount_AccountMessage ( "Account" , "1" , this . _chainId , await this . GetAddress ( ) , originalMsgHash , this . _personalAccount )
718
- : await this . _personalAccount . PersonalSign ( originalMsgHash ) ;
718
+ : await this . _personalAccount . PersonalSign ( message ) ;
719
719
720
720
var isValid = await this . IsValidSignature ( message , sig ) ;
721
- return isValid ? sig : throw new Exception ( "Invalid signature. Outside of the signer being incorrect, this can happen if the caller if not an approved target. " ) ;
721
+ return isValid ? sig : throw new Exception ( "Invalid signature." ) ;
722
722
}
723
723
else
724
724
{
@@ -735,12 +735,20 @@ public async Task<bool> IsValidSignature(string message, string signature)
735
735
{
736
736
try
737
737
{
738
- var magicValue = await ThirdwebContract . Read < byte [ ] > ( this . _accountContract , "isValidSignature" , Encoding . UTF8 . GetBytes ( message ) . HashPrefixedMessage ( ) , signature . HexToBytes ( ) ) ;
738
+ var magicValue = await ThirdwebContract . Read < byte [ ] > ( this . _accountContract , "isValidSignature" , message . StringToHex ( ) , signature . HexToBytes ( ) ) ;
739
739
return magicValue . BytesToHex ( ) == new byte [ ] { 0x16 , 0x26 , 0xba , 0x7e } . BytesToHex ( ) ;
740
740
}
741
741
catch
742
742
{
743
- return false ;
743
+ try
744
+ {
745
+ var magicValue = await ThirdwebContract . Read < byte [ ] > ( this . _accountContract , "isValidSignature" , Encoding . UTF8 . GetBytes ( message ) . HashPrefixedMessage ( ) , signature . HexToBytes ( ) ) ;
746
+ return magicValue . BytesToHex ( ) == new byte [ ] { 0x16 , 0x26 , 0xba , 0x7e } . BytesToHex ( ) ;
747
+ }
748
+ catch
749
+ {
750
+ return false ;
751
+ }
744
752
}
745
753
}
746
754
0 commit comments