Move matrix-sdk-crypto enum definitions out of UDL

This commit is contained in:
Jonas Platte
2024-01-08 11:32:33 +01:00
committed by Jonas Platte
parent 25ecf089aa
commit 18eefcffdb
9 changed files with 12 additions and 22 deletions

1
Cargo.lock generated
View File

@@ -3132,6 +3132,7 @@ dependencies = [
"tokio-stream",
"tracing",
"ulid",
"uniffi",
"vodozemac",
"zeroize",
]

View File

@@ -41,7 +41,7 @@ features = ["lax_deserialize"]
[dependencies.matrix-sdk-crypto]
workspace = true
features = ["qrcode", "automatic-room-key-forwarding"]
features = ["qrcode", "automatic-room-key-forwarding", "uniffi"]
[dependencies.matrix-sdk-sqlite]
workspace = true
@@ -53,7 +53,6 @@ default_features = false
features = ["rt-multi-thread"]
[build-dependencies]
uniffi = { workspace = true, features = ["build"] }
vergen = { version = "8.2.5", features = ["build", "git", "gitcl"] }
[dev-dependencies]

View File

@@ -31,7 +31,6 @@ fn setup_x86_64_android_workaround() {
fn main() -> Result<(), Box<dyn Error>> {
setup_x86_64_android_workaround();
uniffi::generate_scaffolding("./src/olm.udl")?;
EmitBuilder::builder().git_sha(true).git_describe(true, false, None).emit()?;

View File

@@ -31,11 +31,10 @@ pub use logger::{set_logger, Logger};
pub use machine::{KeyRequestPair, OlmMachine, SignatureVerification};
use matrix_sdk_common::deserialized_responses::ShieldState as RustShieldState;
use matrix_sdk_crypto::{
backups::SignatureState,
olm::{IdentityKeys, InboundGroupSession, Session},
store::{Changes, CryptoStore, PendingChanges, RoomSettings as RustRoomSettings},
types::{EventEncryptionAlgorithm as RustEventEncryptionAlgorithm, SigningKey},
EncryptionSettings as RustEncryptionSettings, LocalTrust,
EncryptionSettings as RustEncryptionSettings,
};
use matrix_sdk_sqlite::SqliteCryptoStore;
pub use responses::{
@@ -886,7 +885,7 @@ fn vodozemac_version() -> String {
vodozemac::VERSION.to_owned()
}
uniffi::include_scaffolding!("olm");
uniffi::setup_scaffolding!();
#[cfg(test)]
mod tests {

View File

@@ -1,15 +0,0 @@
namespace matrix_sdk_crypto_ffi {};
enum LocalTrust {
"Verified",
"BlackListed",
"Ignored",
"Unset",
};
enum SignatureState {
"Missing",
"Invalid",
"ValidButNotTrusted",
"ValidAndTrusted",
};

View File

@@ -21,6 +21,7 @@ js = ["ruma/js", "vodozemac/js", "matrix-sdk-common/js"]
qrcode = ["dep:matrix-sdk-qrcode"]
message-ids = ["dep:ulid"]
experimental-algorithms = []
uniffi = ["dep:uniffi"]
# Testing helpers for implementations based upon this
testing = ["dep:http"]
@@ -56,6 +57,7 @@ tokio = { workspace = true }
thiserror = { workspace = true }
tracing = { workspace = true, features = ["attributes"] }
ulid = { version = "1.0.0", optional = true }
uniffi = { workspace = true, optional = true }
vodozemac = { workspace = true }
zeroize = { workspace = true, features = ["zeroize_derive"] }

View File

@@ -108,6 +108,7 @@ impl SignatureVerification {
/// The result of a signature check.
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
#[cfg_attr(feature = "uniffi", derive(uniffi::Enum))]
pub enum SignatureState {
/// The signature is missing.
#[default]

View File

@@ -500,8 +500,9 @@ impl UserDevices {
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
/// The local trust state of a device.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "uniffi", derive(uniffi::Enum))]
pub enum LocalTrust {
/// The device has been verified and is trusted.
Verified = 0,

View File

@@ -107,3 +107,6 @@ pub static VERSION: &str = env!("CARGO_PKG_VERSION");
#[cfg(test)]
matrix_sdk_test::init_tracing_for_tests!();
#[cfg(feature = "uniffi")]
uniffi::setup_scaffolding!();