From bf5347c9669b770fe2045bb59ed7a3581bab9abc Mon Sep 17 00:00:00 2001 From: Mathieu Amiot Date: Mon, 29 Jan 2024 18:07:29 +0100 Subject: [PATCH] fix: Send/Sync handling for async validations --- openmls/src/treesync/node/validate.rs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/openmls/src/treesync/node/validate.rs b/openmls/src/treesync/node/validate.rs index 66d8ed07e6..ac8bcef1cd 100644 --- a/openmls/src/treesync/node/validate.rs +++ b/openmls/src/treesync/node/validate.rs @@ -38,7 +38,8 @@ impl ValidatableLeafNode for VerifiableCommitLeafNode { } } -#[async_trait::async_trait(?Send)] +#[cfg_attr(target_family = "wasm", async_trait::async_trait(?Send))] +#[cfg_attr(not(target_family = "wasm"), async_trait::async_trait)] impl ValidatableLeafNode for VerifiableUpdateLeafNode { async fn validate( self, @@ -87,8 +88,8 @@ impl VerifiableUpdateLeafNode { } } -#[async_trait::async_trait(?Send)] - +#[cfg_attr(target_family = "wasm", async_trait::async_trait(?Send))] +#[cfg_attr(not(target_family = "wasm"), async_trait::async_trait)] impl ValidatableLeafNode for VerifiableKeyPackageLeafNode { async fn validate( self, @@ -132,8 +133,9 @@ impl VerifiableKeyPackageLeafNode { } } -#[async_trait::async_trait(?Send)] -pub(crate) trait ValidatableLeafNode: Verifiable + Sized +#[cfg_attr(target_family = "wasm", async_trait::async_trait(?Send))] +#[cfg_attr(not(target_family = "wasm"), async_trait::async_trait)] +pub(crate) trait ValidatableLeafNode: Verifiable + Send + Sync + Sized where LeafNode: VerifiedStruct, {