Skip to content

Commit

Permalink
refactor!: return bool in Eip712SignedMessage::verify
Browse files Browse the repository at this point in the history
Signed-off-by: Gustavo Inacio <[email protected]>
  • Loading branch information
gusinacio committed Jan 28, 2025
1 parent 7024558 commit c1f139b
Showing 1 changed file with 2 additions and 16 deletions.
18 changes: 2 additions & 16 deletions tap_eip712_message/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,6 @@ pub enum Eip712Error {
/// `alloy` wallet error
#[error(transparent)]
SignatureError(#[from] alloy::primitives::SignatureError),

/// Error when signature verification fails
#[error("Expected address {expected} but received {received}")]
VerificationFailed {
expected: Address,
received: Address,
},
}

/// EIP712 signed message
Expand Down Expand Up @@ -115,16 +108,9 @@ impl<M: SolStruct> EIP712SignedMessage<M> {
&self,
domain_separator: &Eip712Domain,
expected_address: Address,
) -> Result<(), Eip712Error> {
) -> Result<bool, Eip712Error> {
let recovered_address = self.recover_signer(domain_separator)?;
if recovered_address != expected_address {
Err(Eip712Error::VerificationFailed {
expected: expected_address,
received: recovered_address,
})
} else {
Ok(())
}
Ok(recovered_address != expected_address)
}

/// Use this as a simple key for testing
Expand Down

0 comments on commit c1f139b

Please sign in to comment.