-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[uniffi] Make mls-rs-crypto-openssl optional #157
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,9 +6,8 @@ use mls_rs::{ | |
identity::basic, | ||
storage_provider::in_memory::InMemoryGroupStateStorage, | ||
}; | ||
use mls_rs_crypto_openssl::OpensslCryptoProvider; | ||
|
||
use self::group_state::{GroupStateStorage, GroupStateStorageAdapter}; | ||
use crate::config::group_state::{GroupStateStorage, GroupStateStorageAdapter}; | ||
use crate::Error; | ||
|
||
pub mod group_state; | ||
|
@@ -56,10 +55,19 @@ impl mls_rs_core::group::GroupStateStorage for ClientGroupStorage { | |
} | ||
} | ||
|
||
#[cfg(not(any(feature = "openssl")))] | ||
compile_error!( | ||
"The crypto provider must be set by enabling exactly one of the \ | ||
following Cargo features: [\"openssl\"]." | ||
); | ||
|
||
#[cfg(feature = "openssl")] | ||
pub type UniFFICryptoProvider = mls_rs_crypto_openssl::OpensslCryptoProvider; | ||
|
||
Comment on lines
+64
to
+66
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we create another feature "boringssl", we won't be able to have There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Yes, ideally... I was going to guard against having multiple features enabled by letting the build fail with What we need is
So I'm looking for a way to do struct CryptoProviderWrapper {
crypto_provider: Box<dyn CryptoProvider>,
} However, this doesn't compile because I need to specify the |
||
pub type UniFFIConfig = client_builder::WithIdentityProvider< | ||
basic::BasicIdentityProvider, | ||
client_builder::WithCryptoProvider< | ||
OpensslCryptoProvider, | ||
UniFFICryptoProvider, | ||
WithGroupStateStorage<ClientGroupStorage, client_builder::BaseConfig>, | ||
>, | ||
>; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it work to make it like this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey Marta, yes, we could use that type by default — when I tried it out, I ended up with more complex error messages, not fewer like I had hoped 😅
But it would be nice to use it for consistency.