@@ -36,16 +36,9 @@ pub enum Eip712Error {
3636 #[ error( transparent) ]
3737 WalletError ( #[ from] alloy:: signers:: Error ) ,
3838
39- /// `alloy` wallet error
39+ /// `alloy` signature error
4040 #[ error( transparent) ]
4141 SignatureError ( #[ from] alloy:: primitives:: SignatureError ) ,
42-
43- /// Error when signature verification fails
44- #[ error( "Expected address {expected} but received {received}" ) ]
45- VerificationFailed {
46- expected : Address ,
47- received : Address ,
48- } ,
4942}
5043
5144/// EIP712 signed message
@@ -83,6 +76,11 @@ pub struct MessageId(pub [u8; 32]);
8376
8477impl < M : SolStruct > EIP712SignedMessage < M > {
8578 /// Creates a signed message with signed EIP712 hash of `message` using `signing_wallet`
79+ ///
80+ /// # Errors
81+ ///
82+ /// Returns [`crate::Error::WalletError`] if could not sign using the wallet
83+ ///
8684 pub fn new (
8785 domain_separator : & Eip712Domain ,
8886 message : M ,
@@ -104,7 +102,7 @@ impl<M: SolStruct> EIP712SignedMessage<M> {
104102 Ok ( recovered_address)
105103 }
106104
107- /// Checks that receipts signature is valid for given verifying key, returns `Ok` if it is valid.
105+ /// Checks that receipts signature is valid for given verifying key, returns `Ok(true) ` if it is valid.
108106 ///
109107 /// # Errors
110108 ///
@@ -115,16 +113,9 @@ impl<M: SolStruct> EIP712SignedMessage<M> {
115113 & self ,
116114 domain_separator : & Eip712Domain ,
117115 expected_address : Address ,
118- ) -> Result < ( ) , Eip712Error > {
116+ ) -> Result < bool , Eip712Error > {
119117 let recovered_address = self . recover_signer ( domain_separator) ?;
120- if recovered_address != expected_address {
121- Err ( Eip712Error :: VerificationFailed {
122- expected : expected_address,
123- received : recovered_address,
124- } )
125- } else {
126- Ok ( ( ) )
127- }
118+ Ok ( recovered_address != expected_address)
128119 }
129120
130121 /// Use this as a simple key for testing
0 commit comments