diff --git a/single_use_seals/src/lib.rs b/single_use_seals/src/lib.rs index 3e27762e..49ef1dc0 100644 --- a/single_use_seals/src/lib.rs +++ b/single_use_seals/src/lib.rs @@ -264,7 +264,7 @@ pub trait SealWitness { /// Verifies that the seal was indeed closed over the message with the /// provided seal closure witness. - fn verify_seal(&self, seal: &Seal, msg: &Self::Message) -> Result; + fn verify_seal(&self, seal: &Seal, msg: &Self::Message) -> Result<(), Self::Error>; /// Performs batch verification of the seals. /// @@ -275,16 +275,14 @@ pub trait SealWitness { &self, seals: impl IntoIterator, msg: &Self::Message, - ) -> Result + ) -> Result<(), Self::Error> where Seal: 'seal, { for seal in seals { - if !self.verify_seal(seal, msg)? { - return Ok(false); - } + self.verify_seal(seal, msg)?; } - Ok(true) + Ok(()) } } @@ -436,11 +434,7 @@ where Seal: Sync + Send /// Verifies that the seal was indeed closed over the message with the /// provided seal closure witness. - async fn verify_seal_async( - &self, - seal: &Seal, - msg: &Self::Message, - ) -> Result; + async fn verify_seal_async(&self, seal: &Seal, msg: &Self::Message) -> Result<(), Self::Error>; /// Performs batch verification of the seals. /// @@ -451,18 +445,16 @@ where Seal: Sync + Send &self, seals: I, msg: &Self::Message, - ) -> Result + ) -> Result<(), Self::Error> where I: IntoIterator + Send, I::IntoIter: Send, Seal: 'seal, { for seal in seals { - if !self.verify_seal_async(seal, msg).await? { - return Ok(false); - } + self.verify_seal_async(seal, msg).await?; } - return Ok(true); + return Ok(()); } } diff --git a/src/api.rs b/src/api.rs index fb8db061..cbe75bdd 100644 --- a/src/api.rs +++ b/src/api.rs @@ -424,8 +424,8 @@ mod test { type Message = Vec; type Error = Issue; - fn verify_seal(&self, _seal: &Seal, _msg: &Self::Message) -> Result { - Ok(true) + fn verify_seal(&self, _seal: &Seal, _msg: &Self::Message) -> Result<(), Self::Error> { + Ok(()) } }