Page MenuHomePhorge

D15542.1765026788.diff
No OneTemporary

Size
91 KB
Referenced Files
None
Subscribers
None

D15542.1765026788.diff

diff --git a/Cargo.lock b/Cargo.lock
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -545,7 +545,7 @@
"nom",
"num-traits",
"rusticata-macros",
- "thiserror 1.0.61",
+ "thiserror 1.0.69",
"time",
]
@@ -888,7 +888,7 @@
"once_cell",
"percent-encoding",
"regex-lite",
- "sha2 0.10.8",
+ "sha2 0.10.9",
"tracing",
"url",
]
@@ -1004,7 +1004,7 @@
"p256 0.11.1",
"percent-encoding",
"ring 0.17.8",
- "sha2 0.10.8",
+ "sha2 0.10.9",
"subtle",
"time",
"tracing",
@@ -1039,7 +1039,7 @@
"md-5",
"pin-project-lite",
"sha1",
- "sha2 0.10.8",
+ "sha2 0.10.9",
"tracing",
]
@@ -1343,7 +1343,7 @@
"serde",
"serde-wasm-bindgen",
"serde_json",
- "sha2 0.10.8",
+ "sha2 0.10.9",
"tokio",
"tokio-tungstenite 0.20.1",
"tokio-tungstenite-wasm",
@@ -1395,9 +1395,9 @@
[[package]]
name = "base64ct"
-version = "1.6.0"
+version = "1.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b"
+checksum = "55248b47b0caf0546f7988906588779981c43bb1bc9d0c44087278f80cdb44ba"
[[package]]
name = "bincode"
@@ -1791,7 +1791,7 @@
"reqwest 0.11.27",
"serde",
"serde_json",
- "sha2 0.10.8",
+ "sha2 0.10.9",
"tokio",
"tokio-stream",
"tracing",
@@ -1834,7 +1834,7 @@
"reqwest 0.11.27",
"serde",
"serde_json",
- "sha2 0.10.8",
+ "sha2 0.10.9",
"tokio",
"tokio-tungstenite 0.18.0",
"tonic 0.8.3",
@@ -2315,8 +2315,8 @@
"once_cell",
"openssl",
"serde",
- "sha2 0.10.8",
- "thiserror 1.0.61",
+ "sha2 0.10.9",
+ "thiserror 1.0.69",
]
[[package]]
@@ -2831,7 +2831,7 @@
"futures-sink",
"futures-util",
"http 0.2.12",
- "indexmap 2.2.6",
+ "indexmap 2.12.0",
"slab",
"tokio",
"tokio-util",
@@ -2850,7 +2850,7 @@
"futures-core",
"futures-sink",
"http 1.1.0",
- "indexmap 2.2.6",
+ "indexmap 2.12.0",
"slab",
"tokio",
"tokio-util",
@@ -2873,6 +2873,12 @@
"allocator-api2",
]
+[[package]]
+name = "hashbrown"
+version = "0.16.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5419bdc4f6a9207fbeba6d11b604d481addf78ecd10c11ad51e76c2f6482748d"
+
[[package]]
name = "heck"
version = "0.4.1"
@@ -3221,7 +3227,7 @@
"reqwest 0.11.27",
"serde",
"serde_json",
- "sha2 0.10.8",
+ "sha2 0.10.9",
"siwe",
"time",
"tokio",
@@ -3268,12 +3274,12 @@
[[package]]
name = "indexmap"
-version = "2.2.6"
+version = "2.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26"
+checksum = "6717a8d2a5a929a1a2eb43a12812498ed141a0bcfb7e8f7844fbdbe4303bba9f"
dependencies = [
"equivalent",
- "hashbrown 0.14.5",
+ "hashbrown 0.16.0",
]
[[package]]
@@ -3412,7 +3418,7 @@
"ecdsa 0.16.9",
"elliptic-curve 0.13.8",
"once_cell",
- "sha2 0.10.8",
+ "sha2 0.10.9",
"signature 2.2.0",
]
@@ -3951,8 +3957,8 @@
"rand 0.8.5",
"rc2",
"sha1",
- "sha2 0.10.8",
- "thiserror 1.0.61",
+ "sha2 0.10.9",
+ "thiserror 1.0.69",
"x509-parser",
]
@@ -3964,7 +3970,7 @@
dependencies = [
"ecdsa 0.14.8",
"elliptic-curve 0.12.3",
- "sha2 0.10.8",
+ "sha2 0.10.9",
]
[[package]]
@@ -3976,7 +3982,7 @@
"ecdsa 0.16.9",
"elliptic-curve 0.13.8",
"primeorder",
- "sha2 0.10.8",
+ "sha2 0.10.9",
]
[[package]]
@@ -3988,7 +3994,7 @@
"ecdsa 0.16.9",
"elliptic-curve 0.13.8",
"primeorder",
- "sha2 0.10.8",
+ "sha2 0.10.9",
]
[[package]]
@@ -4096,7 +4102,7 @@
checksum = "b4c5cc86750666a3ed20bdaf5ca2a0344f9c67674cae0515bec2da16fbaa47db"
dependencies = [
"fixedbitset",
- "indexmap 2.2.6",
+ "indexmap 2.12.0",
]
[[package]]
@@ -4191,7 +4197,7 @@
"der 0.7.9",
"pbkdf2",
"scrypt",
- "sha2 0.10.8",
+ "sha2 0.10.9",
"spki 0.7.3",
]
@@ -4276,7 +4282,7 @@
"reqwest 0.12.5",
"serde",
"serde_json",
- "thiserror 1.0.61",
+ "thiserror 1.0.69",
"time",
"typed-builder",
"url",
@@ -4349,9 +4355,9 @@
[[package]]
name = "proc-macro2"
-version = "1.0.83"
+version = "1.0.103"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0b33eb56c327dec362a9e55b3ad14f9d2f0904fb5a5b03b513ab5465399e9f43"
+checksum = "5ee95bc4ef87b8d5ba32e8b7714ccc834865276eab0aed5c9958d00ec45f49e8"
dependencies = [
"unicode-ident",
]
@@ -4464,9 +4470,9 @@
[[package]]
name = "quote"
-version = "1.0.36"
+version = "1.0.41"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7"
+checksum = "ce25767e7b499d1b604768e7cde645d14cc8584231ea6b295e9c9eb22c02e1d1"
dependencies = [
"proc-macro2",
]
@@ -4805,7 +4811,7 @@
"pkcs1",
"pkcs8 0.10.2",
"rand_core 0.6.4",
- "sha2 0.10.8",
+ "sha2 0.10.9",
"signature 2.2.0",
"spki 0.7.3",
"subtle",
@@ -5077,7 +5083,7 @@
dependencies = [
"pbkdf2",
"salsa20",
- "sha2 0.10.8",
+ "sha2 0.10.9",
]
[[package]]
@@ -5126,7 +5132,7 @@
dependencies = [
"der 0.4.5",
"pem 0.8.3",
- "thiserror 1.0.61",
+ "thiserror 1.0.69",
]
[[package]]
@@ -5173,10 +5179,11 @@
[[package]]
name = "serde"
-version = "1.0.219"
+version = "1.0.228"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6"
+checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e"
dependencies = [
+ "serde_core",
"serde_derive",
]
@@ -5191,11 +5198,20 @@
"wasm-bindgen",
]
+[[package]]
+name = "serde_core"
+version = "1.0.228"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad"
+dependencies = [
+ "serde_derive",
+]
+
[[package]]
name = "serde_derive"
-version = "1.0.219"
+version = "1.0.228"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00"
+checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79"
dependencies = [
"proc-macro2",
"quote",
@@ -5272,9 +5288,9 @@
[[package]]
name = "sha2"
-version = "0.10.8"
+version = "0.10.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8"
+checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283"
dependencies = [
"cfg-if",
"cpufeatures",
@@ -5343,7 +5359,7 @@
dependencies = [
"num-bigint",
"num-traits",
- "thiserror 1.0.61",
+ "thiserror 1.0.69",
"time",
]
@@ -5359,7 +5375,7 @@
"k256",
"rand 0.8.5",
"sha3",
- "thiserror 1.0.61",
+ "thiserror 1.0.69",
"time",
]
@@ -5572,11 +5588,11 @@
[[package]]
name = "thiserror"
-version = "1.0.61"
+version = "1.0.69"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c546c80d6be4bc6a00c0f01730c08df82eaa7a7a61f11d656526506112cc1709"
+checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52"
dependencies = [
- "thiserror-impl 1.0.61",
+ "thiserror-impl 1.0.69",
]
[[package]]
@@ -5590,9 +5606,9 @@
[[package]]
name = "thiserror-impl"
-version = "1.0.61"
+version = "1.0.69"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "46c3384250002a6d5af4d114f2845d37b57521033f30d5c3f46c4d70e1197533"
+checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1"
dependencies = [
"proc-macro2",
"quote",
@@ -5812,7 +5828,7 @@
"http 0.2.12",
"httparse",
"js-sys",
- "thiserror 1.0.61",
+ "thiserror 1.0.69",
"tokio",
"tokio-tungstenite 0.20.1",
"wasm-bindgen",
@@ -6134,7 +6150,7 @@
"native-tls",
"rand 0.8.5",
"sha1",
- "thiserror 1.0.61",
+ "thiserror 1.0.69",
"url",
"utf-8",
]
@@ -6155,7 +6171,7 @@
"rand 0.8.5",
"rustls 0.21.12",
"sha1",
- "thiserror 1.0.61",
+ "thiserror 1.0.69",
"url",
"utf-8",
]
@@ -6376,7 +6392,7 @@
"generic-array",
"rand_core 0.6.4",
"serde",
- "sha2 0.10.8",
+ "sha2 0.10.9",
"subtle",
"zeroize",
]
@@ -6891,7 +6907,7 @@
"nom",
"oid-registry",
"rusticata-macros",
- "thiserror 1.0.61",
+ "thiserror 1.0.69",
"time",
]
diff --git a/Cargo.toml b/Cargo.toml
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -25,6 +25,7 @@
"web/backup-client-wasm",
"web/opaque-ke-wasm",
"native/native_rust_library",
+ "native/vodozemac_bindings",
"services/.idea",
"shared/.idea",
]
diff --git a/native/cpp/CommonCpp/CryptoTools/CryptoModule.h b/native/cpp/CommonCpp/CryptoTools/CryptoModule.h
--- a/native/cpp/CommonCpp/CryptoTools/CryptoModule.h
+++ b/native/cpp/CommonCpp/CryptoTools/CryptoModule.h
@@ -10,6 +10,12 @@
#include "Session.h"
#include "Tools.h"
+#ifndef ANDROID
+#include "vodozemac_bindings.rs.h"
+#else
+#include "lib.rs.h"
+#endif
+
namespace comm {
namespace crypto {
diff --git a/native/cpp/CommonCpp/CryptoTools/CryptoModule.cpp b/native/cpp/CommonCpp/CryptoTools/CryptoModule.cpp
--- a/native/cpp/CommonCpp/CryptoTools/CryptoModule.cpp
+++ b/native/cpp/CommonCpp/CryptoTools/CryptoModule.cpp
@@ -12,6 +12,12 @@
#include <stdexcept>
#include <string>
+#ifndef ANDROID
+#include "vodozemac_bindings.rs.h"
+#else
+#include "lib.rs.h"
+#endif
+
namespace comm {
namespace crypto {
diff --git a/native/cpp/CommonCpp/CryptoTools/Session.h b/native/cpp/CommonCpp/CryptoTools/Session.h
--- a/native/cpp/CommonCpp/CryptoTools/Session.h
+++ b/native/cpp/CommonCpp/CryptoTools/Session.h
@@ -8,6 +8,12 @@
#include "olm/olm.h"
+#ifndef ANDROID
+#include "vodozemac_bindings.rs.h"
+#else
+#include "lib.rs.h"
+#endif
+
namespace comm {
namespace crypto {
diff --git a/native/cpp/CommonCpp/CryptoTools/Session.cpp b/native/cpp/CommonCpp/CryptoTools/Session.cpp
--- a/native/cpp/CommonCpp/CryptoTools/Session.cpp
+++ b/native/cpp/CommonCpp/CryptoTools/Session.cpp
@@ -4,6 +4,12 @@
#include <optional>
#include <stdexcept>
+#ifndef ANDROID
+#include "vodozemac_bindings.rs.h"
+#else
+#include "lib.rs.h"
+#endif
+
namespace comm {
namespace crypto {
diff --git a/native/ios/Comm.xcodeproj/project.pbxproj b/native/ios/Comm.xcodeproj/project.pbxproj
--- a/native/ios/Comm.xcodeproj/project.pbxproj
+++ b/native/ios/Comm.xcodeproj/project.pbxproj
@@ -65,6 +65,10 @@
8B99BAAC28D50F3000EB5ADB /* libnative_rust_library.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 8B99BAAB28D50F3000EB5ADB /* libnative_rust_library.a */; };
8B99BAAE28D511FF00EB5ADB /* lib.rs.cc in Sources */ = {isa = PBXBuildFile; fileRef = 8B99BAAD28D511FF00EB5ADB /* lib.rs.cc */; };
8BC9568529FC49B00060AE4A /* JSIRust.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8BC9568429FC49B00060AE4A /* JSIRust.cpp */; };
+ 8BVODO0C28D50F3000EB5ADB /* libvodozemac_bindings.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 8BVODO0B28D50F3000EB5ADB /* libvodozemac_bindings.a */; };
+ 8BVODO0E28D511FF00EB5ADB /* vodozemac_bindings.rs.cc in Sources */ = {isa = PBXBuildFile; fileRef = 8BVODO0D28D511FF00EB5ADB /* vodozemac_bindings.rs.cc */; };
+ 8BVODO1328D50F3000EB5ADB /* libvodozemac_bindings.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 8BVODO0B28D50F3000EB5ADB /* libvodozemac_bindings.a */; };
+ 8BVODO1428D511FF00EB5ADB /* vodozemac_bindings.rs.cc in Sources */ = {isa = PBXBuildFile; fileRef = 8BVODO0D28D511FF00EB5ADB /* vodozemac_bindings.rs.cc */; };
8E1805562DA954B600B772A4 /* SQLiteSchema.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8E1805552DA954B600B772A4 /* SQLiteSchema.cpp */; };
8E18055A2DA95E7C00B772A4 /* SQLiteSchemaMigrations.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8E1805582DA95E7C00B772A4 /* SQLiteSchemaMigrations.cpp */; };
8E2CC2592B5C99B0000C94D6 /* KeyserverStore.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8E2CC2582B5C99B0000C94D6 /* KeyserverStore.cpp */; };
@@ -278,6 +282,10 @@
8B99BAAD28D511FF00EB5ADB /* lib.rs.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = lib.rs.cc; sourceTree = "<group>"; };
8BC9568329FC49920060AE4A /* JSIRust.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSIRust.h; sourceTree = "<group>"; };
8BC9568429FC49B00060AE4A /* JSIRust.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSIRust.cpp; sourceTree = "<group>"; };
+ 8BVODO0B28D50F3000EB5ADB /* libvodozemac_bindings.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libvodozemac_bindings.a; path = ../vodozemac_bindings/target/universal/release/libvodozemac_bindings.a; sourceTree = "<group>"; };
+ 8BVODO0D28D511FF00EB5ADB /* vodozemac_bindings.rs.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = vodozemac_bindings.rs.cc; sourceTree = "<group>"; };
+ 8BVODO0F28D511FF00EB5ADB /* vodozemac_bindings.rs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = vodozemac_bindings.rs.h; sourceTree = "<group>"; };
+ 8BVODO1028D511FF00EB5ADB /* vodozemac_cxx.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = vodozemac_cxx.h; sourceTree = "<group>"; };
8E1805542DA954B600B772A4 /* SQLiteSchema.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SQLiteSchema.h; sourceTree = "<group>"; };
8E1805552DA954B600B772A4 /* SQLiteSchema.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = SQLiteSchema.cpp; sourceTree = "<group>"; };
8E1805582DA95E7C00B772A4 /* SQLiteSchemaMigrations.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = SQLiteSchemaMigrations.cpp; sourceTree = "<group>"; };
@@ -414,6 +422,7 @@
buildActionMask = 2147483647;
files = (
8B99BAAC28D50F3000EB5ADB /* libnative_rust_library.a in Frameworks */,
+ 8BVODO0C28D50F3000EB5ADB /* libvodozemac_bindings.a in Frameworks */,
7F761E602201141E001B6FB7 /* JavaScriptCore.framework in Frameworks */,
D7DB6E0F85B2DBE15B01EC21 /* libPods-Comm.a in Frameworks */,
);
@@ -430,6 +439,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
+ 8BVODO1328D50F3000EB5ADB /* libvodozemac_bindings.a in Frameworks */,
724995FB27BA9E8D00323FCE /* UserNotifications.framework in Frameworks */,
F02C296C528B51ADAB5AA19D /* libPods-NotificationService.a in Frameworks */,
);
@@ -712,6 +722,7 @@
isa = PBXGroup;
children = (
8B99BAAB28D50F3000EB5ADB /* libnative_rust_library.a */,
+ 8BVODO0B28D50F3000EB5ADB /* libvodozemac_bindings.a */,
CB3C621327CE66540054F24C /* libEXSecureStore.a */,
724995FA27BA9E8C00323FCE /* UserNotifications.framework */,
711CF80E25DC096000A00FBD /* libFolly.a */,
@@ -727,6 +738,7 @@
children = (
CB3220912BDA66B900DB6C5C /* PrivacyInfo.xcprivacy */,
8B99AF6B28D50D4800EB5ADB /* native_rust_library */,
+ 8BVODO1128D50D4800EB5ADB /* vodozemac_bindings */,
71BE84362636A944002849D2 /* cpp */,
13B07FAE1A68108700A75B9A /* Comm */,
713EE40726C6676B003D7C48 /* CommTests */,
@@ -772,6 +784,17 @@
path = ../native_rust_library;
sourceTree = "<group>";
};
+ 8BVODO1128D50D4800EB5ADB /* vodozemac_bindings */ = {
+ isa = PBXGroup;
+ children = (
+ 8BVODO0D28D511FF00EB5ADB /* vodozemac_bindings.rs.cc */,
+ 8BVODO0F28D511FF00EB5ADB /* vodozemac_bindings.rs.h */,
+ 8BVODO1028D511FF00EB5ADB /* vodozemac_cxx.h */,
+ );
+ name = vodozemac_bindings;
+ path = ../vodozemac_bindings;
+ sourceTree = "<group>";
+ };
8EA59BD02A6E786200EB4F53 /* DataStores */ = {
isa = PBXGroup;
children = (
@@ -1014,6 +1037,7 @@
buildConfigurationList = 724995DD27B4103A00323FCE /* Build configuration list for PBXNativeTarget "NotificationService" */;
buildPhases = (
6735FA74B2C82E3B27E18258 /* [CP] Check Pods Manifest.lock */,
+ 8BVODO1228B795E200E20C13 /* Build Vodozemac library */,
105D2A7B69CF49C7EF865A3B /* [Expo] Configure project */,
724995CD27B4103A00323FCE /* Sources */,
724995CE27B4103A00323FCE /* Frameworks */,
@@ -1261,6 +1285,26 @@
shellPath = /bin/sh;
shellScript = "${SRCROOT}/../../scripts/build-rust-native-library.sh\n";
};
+ 8BVODO1228B795E200E20C13 /* Build Vodozemac library */ = {
+ isa = PBXShellScriptBuildPhase;
+ alwaysOutOfDate = 1;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ inputFileListPaths = (
+ );
+ inputPaths = (
+ );
+ name = "Build Vodozemac library";
+ outputFileListPaths = (
+ );
+ outputPaths = (
+ "${SRCROOT}/../vodozemac_bindings/vodozemac_bindings.rs.cc",
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ shellPath = /bin/sh;
+ shellScript = "${SRCROOT}/../../scripts/build-rust-vodozemac-bindings.sh\n";
+ };
DB38BFA0686C805CE44F051F /* [CP] Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
@@ -1425,6 +1469,7 @@
8E8A8DFD2E15A4F100519F55 /* HolderStore.cpp in Sources */,
8ECF4E182DDDD9EF0079D3D6 /* WebSQLiteConnectionManager.cpp in Sources */,
8B99BAAE28D511FF00EB5ADB /* lib.rs.cc in Sources */,
+ 8BVODO0E28D511FF00EB5ADB /* vodozemac_bindings.rs.cc in Sources */,
8EF0F6032DCA43CD00F2B171 /* SQLiteBackup.cpp in Sources */,
71CA4AEC262F236100835C89 /* Tools.mm in Sources */,
CBB0DF602B768007008E22FF /* CommMMKV.mm in Sources */,
@@ -1504,6 +1549,7 @@
CB4821AA27CFB153001AB7E1 /* Tools.mm in Sources */,
CB3C621227CE65030054F24C /* CommSecureStoreIOSWrapper.mm in Sources */,
CB3C621127CE4A320054F24C /* Logger.mm in Sources */,
+ 8BVODO1428D511FF00EB5ADB /* vodozemac_bindings.rs.cc in Sources */,
724995D527B4103A00323FCE /* NotificationService.mm in Sources */,
CB4821AF27CFB19D001AB7E1 /* PlatformSpecificTools.mm in Sources */,
1F537ACC7B60DC049C0ECFA7 /* ExpoModulesProvider.swift in Sources */,
@@ -1553,6 +1599,7 @@
"$(SRCROOT)/../node_modules/react-native/Libraries/LinkingIOS",
"$(PODS_ROOT)/boost-for-react-native",
"$(SRCROOT)/../native_rust_library",
+ "$(SRCROOT)/../vodozemac_bindings",
"$(PODS_ROOT)/Headers/Private/React-bridging/react/bridging",
);
INFOPLIST_FILE = Comm/Info.debug.plist;
@@ -1642,10 +1689,12 @@
"LIBRARY_SEARCH_PATHS[sdk=iphoneos*]" = (
"$(inherited)",
"$(SRCROOT)/../native_rust_library/target/aarch64-apple-ios/debug",
+ "$(SRCROOT)/../vodozemac_bindings/target/aarch64-apple-ios/debug",
);
"LIBRARY_SEARCH_PATHS[sdk=iphonesimulator*]" = (
"$(inherited)",
"$(SRCROOT)/../native_rust_library/target/x86_64-apple-ios/debug",
+ "$(SRCROOT)/../vodozemac_bindings/target/x86_64-apple-ios/debug",
);
OTHER_CPLUSPLUSFLAGS = (
"-DFOLLY_MOBILE=1",
@@ -1693,6 +1742,7 @@
"$(inherited)",
"$(SRCROOT)/../node_modules/react-native/Libraries/LinkingIOS",
"$(PODS_ROOT)/boost-for-react-native",
+ "$(SRCROOT)/../vodozemac_bindings",
"$(SRCROOT)/../native_rust_library",
"$(PODS_ROOT)/Headers/Private/React-bridging/react/bridging",
);
@@ -1783,10 +1833,12 @@
"LIBRARY_SEARCH_PATHS[sdk=iphoneos*]" = (
"$(inherited)",
"$(SRCROOT)/../native_rust_library/target/aarch64-apple-ios/release",
+ "$(SRCROOT)/../vodozemac_bindings/target/aarch64-apple-ios/release",
);
"LIBRARY_SEARCH_PATHS[sdk=iphonesimulator*]" = (
"$(inherited)",
"$(SRCROOT)/../native_rust_library/target/x86_64-apple-ios/release",
+ "$(SRCROOT)/../vodozemac_bindings/target/x86_64-apple-ios/release",
);
ONLY_ACTIVE_ARCH = YES;
OTHER_CPLUSPLUSFLAGS = (
@@ -1923,6 +1975,11 @@
"$(inherited)",
);
GENERATE_INFOPLIST_FILE = YES;
+ HEADER_SEARCH_PATHS = (
+ "$(inherited)",
+ "$(SRCROOT)/../native_rust_library",
+ "$(SRCROOT)/../vodozemac_bindings",
+ );
INFOPLIST_FILE = NotificationService/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = NotificationService;
INFOPLIST_KEY_NSHumanReadableCopyright = "Copyright © 2022 Comm Technologies, Inc. All rights reserved.";
@@ -1932,6 +1989,16 @@
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
+ "LIBRARY_SEARCH_PATHS[sdk=iphoneos*]" = (
+ "$(inherited)",
+ "$(SRCROOT)/../native_rust_library/target/aarch64-apple-ios/debug",
+ "$(SRCROOT)/../vodozemac_bindings/target/aarch64-apple-ios/debug",
+ );
+ "LIBRARY_SEARCH_PATHS[sdk=iphonesimulator*]" = (
+ "$(inherited)",
+ "$(SRCROOT)/../native_rust_library/target/x86_64-apple-ios/debug",
+ "$(SRCROOT)/../vodozemac_bindings/target/x86_64-apple-ios/debug",
+ );
MARKETING_VERSION = 1.0.556;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
@@ -1980,6 +2047,142 @@
"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = arm64;
GCC_C_LANGUAGE_STANDARD = gnu11;
GENERATE_INFOPLIST_FILE = YES;
+ HEADER_SEARCH_PATHS = (
+ "$(inherited)",
+ "\"${PODS_ROOT}/Headers/Public\"",
+ "\"${PODS_ROOT}/Headers/Public/DVAssetLoaderDelegate\"",
+ "\"${PODS_ROOT}/Headers/Public/DoubleConversion\"",
+ "\"${PODS_ROOT}/Headers/Public/EXApplication\"",
+ "\"${PODS_ROOT}/Headers/Public/EXConstants\"",
+ "\"${PODS_ROOT}/Headers/Public/EXImageLoader\"",
+ "\"${PODS_ROOT}/Headers/Public/EXJSONUtils\"",
+ "\"${PODS_ROOT}/Headers/Public/Expo\"",
+ "\"${PODS_ROOT}/Headers/Public/ExpoFileSystem\"",
+ "\"${PODS_ROOT}/Headers/Public/ExpoMediaLibrary\"",
+ "\"${PODS_ROOT}/Headers/Public/ExpoModulesCore\"",
+ "\"${PODS_ROOT}/Headers/Public/FBLazyVector\"",
+ "\"${PODS_ROOT}/Headers/Public/MMKV\"",
+ "\"${PODS_ROOT}/Headers/Public/MMKVAppExtension\"",
+ "\"${PODS_ROOT}/Headers/Public/MMKVCore\"",
+ "\"${PODS_ROOT}/Headers/Public/OLMKit\"",
+ "\"${PODS_ROOT}/Headers/Public/RCT-Folly\"",
+ "\"${PODS_ROOT}/Headers/Public/RCTDeprecation\"",
+ "\"${PODS_ROOT}/Headers/Public/RCTRequired\"",
+ "\"${PODS_ROOT}/Headers/Public/RCTTypeSafety\"",
+ "\"${PODS_ROOT}/Headers/Public/RNCAsyncStorage\"",
+ "\"${PODS_ROOT}/Headers/Public/RNCClipboard\"",
+ "\"${PODS_ROOT}/Headers/Public/RNCMaskedView\"",
+ "\"${PODS_ROOT}/Headers/Public/RNDeviceInfo\"",
+ "\"${PODS_ROOT}/Headers/Public/RNFS\"",
+ "\"${PODS_ROOT}/Headers/Public/RNGestureHandler\"",
+ "\"${PODS_ROOT}/Headers/Public/RNKeychain\"",
+ "\"${PODS_ROOT}/Headers/Public/RNReanimated\"",
+ "\"${PODS_ROOT}/Headers/Public/RNSVG\"",
+ "\"${PODS_ROOT}/Headers/Public/RNScreens\"",
+ "\"${PODS_ROOT}/Headers/Public/React-Core\"",
+ "\"${PODS_ROOT}/Headers/Public/React-Fabric\"",
+ "\"${PODS_ROOT}/Headers/Public/React-FabricComponents\"",
+ "\"${PODS_ROOT}/Headers/Public/React-FabricImage\"",
+ "\"${PODS_ROOT}/Headers/Public/React-ImageManager\"",
+ "\"${PODS_ROOT}/Headers/Public/React-Mapbuffer\"",
+ "\"${PODS_ROOT}/Headers/Public/React-NativeModulesApple\"",
+ "\"${PODS_ROOT}/Headers/Public/React-RCTAnimation\"",
+ "\"${PODS_ROOT}/Headers/Public/React-RCTAppDelegate\"",
+ "\"${PODS_ROOT}/Headers/Public/React-RCTBlob\"",
+ "\"${PODS_ROOT}/Headers/Public/React-RCTFBReactNativeSpec\"",
+ "\"${PODS_ROOT}/Headers/Public/React-RCTFabric\"",
+ "\"${PODS_ROOT}/Headers/Public/React-RCTRuntime\"",
+ "\"${PODS_ROOT}/Headers/Public/React-RCTText\"",
+ "\"${PODS_ROOT}/Headers/Public/React-RuntimeApple\"",
+ "\"${PODS_ROOT}/Headers/Public/React-RuntimeCore\"",
+ "\"${PODS_ROOT}/Headers/Public/React-RuntimeHermes\"",
+ "\"${PODS_ROOT}/Headers/Public/React-callinvoker\"",
+ "\"${PODS_ROOT}/Headers/Public/React-cxxreact\"",
+ "\"${PODS_ROOT}/Headers/Public/React-debug\"",
+ "\"${PODS_ROOT}/Headers/Public/React-defaultsnativemodule\"",
+ "\"${PODS_ROOT}/Headers/Public/React-domnativemodule\"",
+ "\"${PODS_ROOT}/Headers/Public/React-featureflags\"",
+ "\"${PODS_ROOT}/Headers/Public/React-featureflagsnativemodule\"",
+ "\"${PODS_ROOT}/Headers/Public/React-graphics\"",
+ "\"${PODS_ROOT}/Headers/Public/React-hermes\"",
+ "\"${PODS_ROOT}/Headers/Public/React-idlecallbacksnativemodule\"",
+ "\"${PODS_ROOT}/Headers/Public/React-jserrorhandler\"",
+ "\"${PODS_ROOT}/Headers/Public/React-jsi\"",
+ "\"${PODS_ROOT}/Headers/Public/React-jsiexecutor\"",
+ "\"${PODS_ROOT}/Headers/Public/React-jsinspector\"",
+ "\"${PODS_ROOT}/Headers/Public/React-jsinspectorcdp\"",
+ "\"${PODS_ROOT}/Headers/Public/React-jsinspectornetwork\"",
+ "\"${PODS_ROOT}/Headers/Public/React-jsinspectortracing\"",
+ "\"${PODS_ROOT}/Headers/Public/React-jsitooling\"",
+ "\"${PODS_ROOT}/Headers/Public/React-logger\"",
+ "\"${PODS_ROOT}/Headers/Public/React-microtasksnativemodule\"",
+ "\"${PODS_ROOT}/Headers/Public/React-oscompat\"",
+ "\"${PODS_ROOT}/Headers/Public/React-perflogger\"",
+ "\"${PODS_ROOT}/Headers/Public/React-performancetimeline\"",
+ "\"${PODS_ROOT}/Headers/Public/React-rendererconsistency\"",
+ "\"${PODS_ROOT}/Headers/Public/React-renderercss\"",
+ "\"${PODS_ROOT}/Headers/Public/React-rendererdebug\"",
+ "\"${PODS_ROOT}/Headers/Public/React-runtimeexecutor\"",
+ "\"${PODS_ROOT}/Headers/Public/React-runtimescheduler\"",
+ "\"${PODS_ROOT}/Headers/Public/React-timing\"",
+ "\"${PODS_ROOT}/Headers/Public/React-utils\"",
+ "\"${PODS_ROOT}/Headers/Public/ReactAppDependencyProvider\"",
+ "\"${PODS_ROOT}/Headers/Public/ReactCodegen\"",
+ "\"${PODS_ROOT}/Headers/Public/ReactCommon\"",
+ "\"${PODS_ROOT}/Headers/Public/ReactNativeKeyboardInput\"",
+ "\"${PODS_ROOT}/Headers/Public/ReactNativeKeyboardTrackingView\"",
+ "\"${PODS_ROOT}/Headers/Public/SDWebImage\"",
+ "\"${PODS_ROOT}/Headers/Public/SDWebImageAVIFCoder\"",
+ "\"${PODS_ROOT}/Headers/Public/SDWebImageSVGCoder\"",
+ "\"${PODS_ROOT}/Headers/Public/SDWebImageWebPCoder\"",
+ "\"${PODS_ROOT}/Headers/Public/SPTPersistentCache\"",
+ "\"${PODS_ROOT}/Headers/Public/SQLCipher-Amalgamation\"",
+ "\"${PODS_ROOT}/Headers/Public/SocketRocket\"",
+ "\"${PODS_ROOT}/Headers/Public/VisionCamera\"",
+ "\"${PODS_ROOT}/Headers/Public/Yoga\"",
+ "\"${PODS_ROOT}/Headers/Public/boost\"",
+ "\"${PODS_ROOT}/Headers/Public/expo-dev-launcher\"",
+ "\"${PODS_ROOT}/Headers/Public/expo-dev-menu\"",
+ "\"${PODS_ROOT}/Headers/Public/fast_float\"",
+ "\"${PODS_ROOT}/Headers/Public/fmt\"",
+ "\"${PODS_ROOT}/Headers/Public/glog\"",
+ "\"${PODS_ROOT}/Headers/Public/hermes-engine\"",
+ "\"${PODS_ROOT}/Headers/Public/libavif\"",
+ "\"${PODS_ROOT}/Headers/Public/libdav1d\"",
+ "\"${PODS_ROOT}/Headers/Public/libwebp\"",
+ "\"${PODS_ROOT}/Headers/Public/lottie-react-native\"",
+ "\"${PODS_ROOT}/Headers/Public/react-native-in-app-message\"",
+ "\"${PODS_ROOT}/Headers/Public/react-native-keyboard-controller\"",
+ "\"${PODS_ROOT}/Headers/Public/react-native-netinfo\"",
+ "\"${PODS_ROOT}/Headers/Public/react-native-orientation-locker\"",
+ "\"${PODS_ROOT}/Headers/Public/react-native-pager-view\"",
+ "\"${PODS_ROOT}/Headers/Public/react-native-safe-area-context\"",
+ "\"${PODS_ROOT}/Headers/Public/react-native-video\"",
+ "\"${PODS_ROOT}/Headers/Public/react-native-webview\"",
+ "\"$(PODS_ROOT)/DoubleConversion\"",
+ "\"${PODS_CONFIGURATION_BUILD_DIR}/EXManifests/Swift Compatibility Header\"",
+ "\"${PODS_CONFIGURATION_BUILD_DIR}/EXUpdatesInterface/Swift Compatibility Header\"",
+ "\"${PODS_CONFIGURATION_BUILD_DIR}/Expo/Swift Compatibility Header\"",
+ "\"$(PODS_ROOT)/Headers/Private/Yoga\"",
+ "\"${PODS_CONFIGURATION_BUILD_DIR}/ExpoModulesCore/Swift Compatibility Header\"",
+ "\"$(PODS_ROOT)/Headers/Private/Yoga\"",
+ "\"$(PODS_ROOT)/boost\"",
+ "\"$(PODS_ROOT)/boost\"",
+ "\"$(PODS_ROOT)/boost-for-react-native\"",
+ "\"$(PODS_ROOT)/glog\"",
+ "\"$(PODS_ROOT)/RCT-Folly\"",
+ "\"$(PODS_ROOT)/Headers/Public/React-hermes\"",
+ "\"$(PODS_ROOT)/Headers/Public/hermes-engine\"",
+ "\"$(PODS_ROOT)/../../../node_modules/react-native/ReactCommon\"",
+ "\"$(PODS_ROOT)/../../../node_modules/react-native-reanimated/apple\"",
+ "\"$(PODS_ROOT)/../../../node_modules/react-native-reanimated/Common/cpp\"",
+ "\"$(PODS_ROOT)/Headers/Private/React-Core\"",
+ "\"$(PODS_ROOT)/Headers/Private/React-Core\"",
+ "\"$(PODS_ROOT)/Headers/Private/Yoga\"",
+ "\"${PODS_CONFIGURATION_BUILD_DIR}/expo-dev-menu-interface/Swift Compatibility Header\"",
+ "$(SRCROOT)/../node_modules/@commapp/sqlcipher-amalgamation/src",
+ "$(SRCROOT)/../vodozemac_bindings",
+ );
INFOPLIST_FILE = NotificationService/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = NotificationService;
INFOPLIST_KEY_NSHumanReadableCopyright = "Copyright © 2022 Comm Technologies, Inc. All rights reserved.";
@@ -1989,6 +2192,16 @@
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
+ "LIBRARY_SEARCH_PATHS[sdk=iphoneos*]" = (
+ "$(inherited)",
+ "$(SRCROOT)/../native_rust_library/target/aarch64-apple-ios/release",
+ "$(SRCROOT)/../vodozemac_bindings/target/aarch64-apple-ios/release",
+ );
+ "LIBRARY_SEARCH_PATHS[sdk=iphonesimulator*]" = (
+ "$(inherited)",
+ "$(SRCROOT)/../native_rust_library/target/x86_64-apple-ios/release",
+ "$(SRCROOT)/../vodozemac_bindings/target/x86_64-apple-ios/release",
+ );
MARKETING_VERSION = 1.0.556;
MTL_FAST_MATH = YES;
ONLY_ACTIVE_ARCH = YES;
diff --git a/native/native_rust_library/Cargo.lock b/native/native_rust_library/Cargo.lock
--- a/native/native_rust_library/Cargo.lock
+++ b/native/native_rust_library/Cargo.lock
@@ -17,6 +17,27 @@
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe"
+[[package]]
+name = "aead"
+version = "0.5.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d122413f284cf2d62fb1b7db97e02edb8cda96d769b16e443a4f6195e35662b0"
+dependencies = [
+ "crypto-common",
+ "generic-array",
+]
+
+[[package]]
+name = "aes"
+version = "0.8.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0"
+dependencies = [
+ "cfg-if",
+ "cipher",
+ "cpufeatures",
+]
+
[[package]]
name = "aho-corasick"
version = "1.1.2"
@@ -43,9 +64,9 @@
[[package]]
name = "anyhow"
-version = "1.0.75"
+version = "1.0.100"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6"
+checksum = "a23eb6b1614318a8071c9b2521f36b424b2c83db5eb3a0fead4a6c0809af6e61"
[[package]]
name = "argon2"
@@ -59,6 +80,15 @@
"password-hash",
]
+[[package]]
+name = "arrayvec"
+version = "0.7.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50"
+dependencies = [
+ "serde",
+]
+
[[package]]
name = "async-stream"
version = "0.3.5"
@@ -78,7 +108,7 @@
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.51",
+ "syn 2.0.108",
]
[[package]]
@@ -89,7 +119,7 @@
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.51",
+ "syn 2.0.108",
]
[[package]]
@@ -194,11 +224,17 @@
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567"
+[[package]]
+name = "base64"
+version = "0.22.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6"
+
[[package]]
name = "base64ct"
-version = "1.5.2"
+version = "1.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ea2b2456fd614d856680dcd9fcc660a51a820fa09daef2e49772b56a193c8474"
+checksum = "55248b47b0caf0546f7988906588779981c43bb1bc9d0c44087278f80cdb44ba"
[[package]]
name = "bincode"
@@ -236,7 +272,7 @@
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4"
dependencies = [
- "block-padding",
+ "block-padding 0.2.1",
"generic-array",
]
@@ -255,6 +291,15 @@
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8d696c370c750c948ada61c69a0ee2cbbb9c50b1019ddb86d9317157a99c2cae"
+[[package]]
+name = "block-padding"
+version = "0.3.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a8894febbff9f758034a5b8e12d87918f56dfc64a8e1fe757d65e29041538d93"
+dependencies = [
+ "generic-array",
+]
+
[[package]]
name = "bumpalo"
version = "3.12.0"
@@ -273,6 +318,15 @@
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d71b6127be86fdcfddb610f7182ac57211d4b18a3e9c82eb2d17662f2227ad6a"
+[[package]]
+name = "cbc"
+version = "0.1.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "26b52a9543ae338f279b96b0b9fed9c8093744685043739079ce85cd58f289a6"
+dependencies = [
+ "cipher",
+]
+
[[package]]
name = "cc"
version = "1.0.83"
@@ -288,6 +342,30 @@
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
+[[package]]
+name = "chacha20"
+version = "0.9.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c3613f74bd2eac03dad61bd53dbe620703d4371614fe0bc3b9f04dd36fe4e818"
+dependencies = [
+ "cfg-if",
+ "cipher",
+ "cpufeatures",
+]
+
+[[package]]
+name = "chacha20poly1305"
+version = "0.10.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "10cd79432192d1c0f4e1a0fef9527696cc039165d729fb41b3f4f4f354c2dc35"
+dependencies = [
+ "aead",
+ "chacha20",
+ "cipher",
+ "poly1305",
+ "zeroize",
+]
+
[[package]]
name = "chrono"
version = "0.4.38"
@@ -303,6 +381,17 @@
"windows-targets 0.52.5",
]
+[[package]]
+name = "cipher"
+version = "0.4.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad"
+dependencies = [
+ "crypto-common",
+ "inout",
+ "zeroize",
+]
+
[[package]]
name = "codespan-reporting"
version = "0.11.1"
@@ -318,7 +407,7 @@
version = "0.1.0"
dependencies = [
"anyhow",
- "base64",
+ "base64 0.21.7",
"chrono",
"constant_time_eq",
"derive_more",
@@ -422,6 +511,7 @@
checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3"
dependencies = [
"generic-array",
+ "rand_core",
"typenum",
]
@@ -444,9 +534,11 @@
"cfg-if",
"cpufeatures",
"curve25519-dalek-derive",
+ "digest 0.10.7",
"fiat-crypto",
"rand_core",
"rustc_version",
+ "serde",
"subtle",
"zeroize",
]
@@ -459,7 +551,7 @@
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.51",
+ "syn 2.0.108",
]
[[package]]
@@ -536,7 +628,7 @@
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.51",
+ "syn 2.0.108",
]
[[package]]
@@ -592,7 +684,33 @@
"der 0.4.5",
"elliptic-curve 0.10.4",
"hmac 0.11.0",
- "signature",
+ "signature 1.3.2",
+]
+
+[[package]]
+name = "ed25519"
+version = "2.2.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "115531babc129696a58c64a4fef0a8bf9e9698629fb97e9e40767d235cfbcd53"
+dependencies = [
+ "pkcs8",
+ "serde",
+ "signature 2.2.0",
+]
+
+[[package]]
+name = "ed25519-dalek"
+version = "2.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "70e796c081cee67dc755e1a36a0a172b897fab85fc3f6bc48307991f64e4eca9"
+dependencies = [
+ "curve25519-dalek",
+ "ed25519",
+ "rand_core",
+ "serde",
+ "sha2",
+ "subtle",
+ "zeroize",
]
[[package]]
@@ -643,6 +761,12 @@
"cfg-if",
]
+[[package]]
+name = "equivalent"
+version = "1.0.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f"
+
[[package]]
name = "fastrand"
version = "1.8.0"
@@ -743,7 +867,7 @@
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.51",
+ "syn 2.0.108",
]
[[package]]
@@ -789,9 +913,9 @@
[[package]]
name = "getrandom"
-version = "0.2.11"
+version = "0.2.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fe9006bed769170c11f845cf00c7c1e9092aeb3f268e007c3e760ac68008070f"
+checksum = "335ff9f135e4384c8150d6f27c6daed433577f86b4750418338c01a1a2528592"
dependencies = [
"cfg-if",
"js-sys",
@@ -833,7 +957,7 @@
version = "0.1.0"
dependencies = [
"derive_more",
- "prost",
+ "prost 0.11.9",
"serde",
"tonic",
"tonic-build",
@@ -853,7 +977,7 @@
"futures-sink",
"futures-util",
"http",
- "indexmap",
+ "indexmap 1.9.1",
"slab",
"tokio",
"tokio-util",
@@ -866,6 +990,12 @@
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888"
+[[package]]
+name = "hashbrown"
+version = "0.16.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5419bdc4f6a9207fbeba6d11b604d481addf78ecd10c11ad51e76c2f6482748d"
+
[[package]]
name = "heck"
version = "0.4.0"
@@ -889,9 +1019,9 @@
[[package]]
name = "hkdf"
-version = "0.12.3"
+version = "0.12.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "791a029f6b9fc27657f6f188ec6e5e43f6911f6f878e0dc5501396e09809d437"
+checksum = "7b5f8eb2ad728638ea2c7d47a21db23b7b58a72ed6a38256b8a1849f15fbbdf7"
dependencies = [
"hmac 0.12.1",
]
@@ -1052,7 +1182,27 @@
checksum = "10a35a97730320ffe8e2d410b5d3b69279b98d2c14bdb8b70ea89ecf7888d41e"
dependencies = [
"autocfg",
- "hashbrown",
+ "hashbrown 0.12.3",
+]
+
+[[package]]
+name = "indexmap"
+version = "2.12.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6717a8d2a5a929a1a2eb43a12812498ed141a0bcfb7e8f7844fbdbe4303bba9f"
+dependencies = [
+ "equivalent",
+ "hashbrown 0.16.0",
+]
+
+[[package]]
+name = "inout"
+version = "0.1.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "879f10e63c20629ecabbb64a8010319738c66a5cd0c29b02d63d272b03751d01"
+dependencies = [
+ "block-padding 0.3.3",
+ "generic-array",
]
[[package]]
@@ -1169,6 +1319,29 @@
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b87248edafb776e59e6ee64a79086f65890d3510f2c656c000bf2a7e8a0aea40"
+[[package]]
+name = "matrix-pickle"
+version = "0.2.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4e2551de3bba2cc65b52dc6b268df6114011fe118ac24870fbcf1b35537bd721"
+dependencies = [
+ "matrix-pickle-derive",
+ "thiserror 1.0.69",
+]
+
+[[package]]
+name = "matrix-pickle-derive"
+version = "0.2.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f75de44c3120d78e978adbcf6d453b20ba011f3c46363e52d1dbbc72f545e9fb"
+dependencies = [
+ "proc-macro-crate",
+ "proc-macro-error2",
+ "proc-macro2",
+ "quote",
+ "syn 2.0.108",
+]
+
[[package]]
name = "memchr"
version = "2.7.1"
@@ -1247,7 +1420,7 @@
dependencies = [
"argon2",
"backup_client",
- "base64",
+ "base64 0.21.7",
"comm-lib",
"comm-opaque2",
"cxx",
@@ -1263,6 +1436,7 @@
"tokio-util",
"tonic",
"tracing",
+ "vodozemac",
]
[[package]]
@@ -1370,7 +1544,7 @@
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.51",
+ "syn 2.0.108",
]
[[package]]
@@ -1421,7 +1595,7 @@
checksum = "e6d5014253a1331579ce62aa67443b4a658c5e7dd03d4bc6d302b94474888143"
dependencies = [
"fixedbitset",
- "indexmap",
+ "indexmap 1.9.1",
]
[[package]]
@@ -1456,12 +1630,33 @@
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184"
+[[package]]
+name = "pkcs8"
+version = "0.10.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7"
+dependencies = [
+ "der 0.7.9",
+ "spki",
+]
+
[[package]]
name = "pkg-config"
version = "0.3.27"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964"
+[[package]]
+name = "poly1305"
+version = "0.8.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8159bd90725d2df49889a078b54f4f79e87f1f8a8444194cdca81d38f5393abf"
+dependencies = [
+ "cpufeatures",
+ "opaque-debug",
+ "universal-hash",
+]
+
[[package]]
name = "ppv-lite86"
version = "0.2.16"
@@ -1478,11 +1673,41 @@
"syn 1.0.99",
]
+[[package]]
+name = "proc-macro-crate"
+version = "3.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "219cb19e96be00ab2e37d6e299658a0cfa83e52429179969b0f0121b4ac46983"
+dependencies = [
+ "toml_edit",
+]
+
+[[package]]
+name = "proc-macro-error-attr2"
+version = "2.0.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "96de42df36bb9bba5542fe9f1a054b8cc87e172759a1868aa05c1f3acc89dfc5"
+dependencies = [
+ "proc-macro2",
+ "quote",
+]
+
+[[package]]
+name = "proc-macro-error2"
+version = "2.0.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "11ec05c52be0a07b08061f7dd003e7d7092e0472bc731b4af7bb1ef876109802"
+dependencies = [
+ "proc-macro-error-attr2",
+ "proc-macro2",
+ "quote",
+]
+
[[package]]
name = "proc-macro2"
-version = "1.0.78"
+version = "1.0.103"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae"
+checksum = "5ee95bc4ef87b8d5ba32e8b7714ccc834865276eab0aed5c9958d00ec45f49e8"
dependencies = [
"unicode-ident",
]
@@ -1494,7 +1719,17 @@
checksum = "0b82eaa1d779e9a4bc1c3217db8ffbeabaae1dca241bf70183242128d48681cd"
dependencies = [
"bytes",
- "prost-derive",
+ "prost-derive 0.11.9",
+]
+
+[[package]]
+name = "prost"
+version = "0.14.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7231bd9b3d3d33c86b58adbac74b5ec0ad9f496b19d22801d773636feaa95f3d"
+dependencies = [
+ "bytes",
+ "prost-derive 0.14.1",
]
[[package]]
@@ -1511,7 +1746,7 @@
"multimap",
"petgraph",
"prettyplease",
- "prost",
+ "prost 0.11.9",
"prost-types",
"regex",
"syn 1.0.99",
@@ -1532,20 +1767,33 @@
"syn 1.0.99",
]
+[[package]]
+name = "prost-derive"
+version = "0.14.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9120690fafc389a67ba3803df527d0ec9cbbc9cc45e4cc20b332996dfb672425"
+dependencies = [
+ "anyhow",
+ "itertools",
+ "proc-macro2",
+ "quote",
+ "syn 2.0.108",
+]
+
[[package]]
name = "prost-types"
version = "0.11.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "213622a1460818959ac1181aaeb2dc9c7f63df720db7d788b3e24eacd1983e13"
dependencies = [
- "prost",
+ "prost 0.11.9",
]
[[package]]
name = "quote"
-version = "1.0.35"
+version = "1.0.41"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef"
+checksum = "ce25767e7b499d1b604768e7cde645d14cc8584231ea6b295e9c9eb22c02e1d1"
dependencies = [
"proc-macro2",
]
@@ -1648,7 +1896,7 @@
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "046cd98826c46c2ac8ddecae268eb5c2e58628688a5fc7a2643704a73faba95b"
dependencies = [
- "base64",
+ "base64 0.21.7",
"bytes",
"encoding_rs",
"futures-core",
@@ -1736,7 +1984,7 @@
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2d3987094b1d07b653b7dfdc3f70ce9a1da9c51ac18c1b06b662e4f9a0e9f4b2"
dependencies = [
- "base64",
+ "base64 0.21.7",
]
[[package]]
@@ -1840,10 +2088,11 @@
[[package]]
name = "serde"
-version = "1.0.203"
+version = "1.0.228"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7253ab4de971e72fb7be983802300c30b5a7f0c2e56fab8abfc6a214307c0094"
+checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e"
dependencies = [
+ "serde_core",
"serde_derive",
]
@@ -1858,26 +2107,47 @@
"wasm-bindgen",
]
+[[package]]
+name = "serde_bytes"
+version = "0.11.19"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a5d440709e79d88e51ac01c4b72fc6cb7314017bb7da9eeff678aa94c10e3ea8"
+dependencies = [
+ "serde",
+ "serde_core",
+]
+
+[[package]]
+name = "serde_core"
+version = "1.0.228"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad"
+dependencies = [
+ "serde_derive",
+]
+
[[package]]
name = "serde_derive"
-version = "1.0.203"
+version = "1.0.228"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "500cbc0ebeb6f46627f50f3f5811ccf6bf00643be300b4c3eabc0ef55dc5b5ba"
+checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.51",
+ "syn 2.0.108",
]
[[package]]
name = "serde_json"
-version = "1.0.117"
+version = "1.0.145"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "455182ea6142b14f93f4bc5320a2b31c1f266b66a4a5c858b013302a5d8cbfc3"
+checksum = "402a6f66d8c709116cf22f558eab210f5a50187f702eb4d7e5ef38d9a7f1c79c"
dependencies = [
"itoa",
+ "memchr",
"ryu",
"serde",
+ "serde_core",
]
[[package]]
@@ -1905,9 +2175,9 @@
[[package]]
name = "sha2"
-version = "0.10.6"
+version = "0.10.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "82e6b795fe2e3b1e845bafcb27aa35405c4d47cdfc92af5fc8d3002f76cebdc0"
+checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283"
dependencies = [
"cfg-if",
"cpufeatures",
@@ -1945,6 +2215,15 @@
"rand_core",
]
+[[package]]
+name = "signature"
+version = "2.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de"
+dependencies = [
+ "rand_core",
+]
+
[[package]]
name = "siwe"
version = "0.3.0"
@@ -1958,7 +2237,7 @@
"k256",
"rand",
"sha3",
- "thiserror",
+ "thiserror 1.0.69",
]
[[package]]
@@ -2002,6 +2281,16 @@
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d"
+[[package]]
+name = "spki"
+version = "0.7.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d"
+dependencies = [
+ "base64ct",
+ "der 0.7.9",
+]
+
[[package]]
name = "subtle"
version = "2.6.1"
@@ -2021,9 +2310,9 @@
[[package]]
name = "syn"
-version = "2.0.51"
+version = "2.0.108"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6ab617d94515e94ae53b8406c628598680aa0c9587474ecbe58188f7b345d66c"
+checksum = "da58917d35242480a05c2897064da0a80589a2a0476c9a3f2fdc83b53502e917"
dependencies = [
"proc-macro2",
"quote",
@@ -2094,22 +2383,42 @@
[[package]]
name = "thiserror"
-version = "1.0.50"
+version = "1.0.69"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52"
+dependencies = [
+ "thiserror-impl 1.0.69",
+]
+
+[[package]]
+name = "thiserror"
+version = "2.0.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f9a7210f5c9a7156bb50aa36aed4c95afb51df0df00713949448cf9e97d382d2"
+checksum = "f63587ca0f12b72a0600bcba1d40081f830876000bb46dd2337a3051618f4fc8"
dependencies = [
- "thiserror-impl",
+ "thiserror-impl 2.0.17",
]
[[package]]
name = "thiserror-impl"
-version = "1.0.50"
+version = "1.0.69"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "266b2e40bc00e5a6c09c3584011e08b06f123c00362c92b975ba9843aaaa14b8"
+checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.51",
+ "syn 2.0.108",
+]
+
+[[package]]
+name = "thiserror-impl"
+version = "2.0.17"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3ff15c8ecd7de3849db632e14d18d2571fa09dfc5ed93479bc4485c7a517c913"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 2.0.108",
]
[[package]]
@@ -2172,7 +2481,7 @@
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.51",
+ "syn 2.0.108",
]
[[package]]
@@ -2234,7 +2543,7 @@
"http",
"httparse",
"js-sys",
- "thiserror",
+ "thiserror 1.0.69",
"tokio",
"tokio-tungstenite",
"wasm-bindgen",
@@ -2254,6 +2563,36 @@
"tokio",
]
+[[package]]
+name = "toml_datetime"
+version = "0.7.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f2cdb639ebbc97961c51720f858597f7f24c4fc295327923af55b74c3c724533"
+dependencies = [
+ "serde_core",
+]
+
+[[package]]
+name = "toml_edit"
+version = "0.23.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6485ef6d0d9b5d0ec17244ff7eb05310113c3f316f2d14200d4de56b3cb98f8d"
+dependencies = [
+ "indexmap 2.12.0",
+ "toml_datetime",
+ "toml_parser",
+ "winnow",
+]
+
+[[package]]
+name = "toml_parser"
+version = "1.0.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c0cbe268d35bdb4bb5a56a2de88d0ad0eb70af5384a99d648cd4b3d04039800e"
+dependencies = [
+ "winnow",
+]
+
[[package]]
name = "tonic"
version = "0.9.2"
@@ -2263,7 +2602,7 @@
"async-stream",
"async-trait",
"axum",
- "base64",
+ "base64 0.21.7",
"bytes",
"futures-core",
"futures-util",
@@ -2274,7 +2613,7 @@
"hyper-timeout",
"percent-encoding",
"pin-project",
- "prost",
+ "prost 0.11.9",
"rustls-pemfile",
"tokio",
"tokio-rustls",
@@ -2307,7 +2646,7 @@
dependencies = [
"futures-core",
"futures-util",
- "indexmap",
+ "indexmap 1.9.1",
"pin-project",
"pin-project-lite",
"rand",
@@ -2350,7 +2689,7 @@
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.51",
+ "syn 2.0.108",
]
[[package]]
@@ -2414,7 +2753,7 @@
"rand",
"rustls",
"sha1",
- "thiserror",
+ "thiserror 1.0.69",
"url",
"utf-8",
]
@@ -2467,6 +2806,16 @@
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c"
+[[package]]
+name = "universal-hash"
+version = "0.5.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "fc1de2c688dc15305988b563c3854064043356019f97a4b46276fe734c4f07ea"
+dependencies = [
+ "crypto-common",
+ "subtle",
+]
+
[[package]]
name = "untrusted"
version = "0.7.1"
@@ -2518,6 +2867,35 @@
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
+[[package]]
+name = "vodozemac"
+version = "0.9.0"
+source = "git+https://github.com/xsanm/vodozemac#e1d34da279eccb220ee393aa6a465917ae60d0cc"
+dependencies = [
+ "aes",
+ "arrayvec",
+ "base64 0.22.1",
+ "base64ct",
+ "cbc",
+ "chacha20poly1305",
+ "curve25519-dalek",
+ "ed25519-dalek",
+ "getrandom",
+ "hkdf",
+ "hmac 0.12.1",
+ "matrix-pickle",
+ "prost 0.14.1",
+ "rand",
+ "serde",
+ "serde_bytes",
+ "serde_json",
+ "sha2",
+ "subtle",
+ "thiserror 2.0.17",
+ "x25519-dalek",
+ "zeroize",
+]
+
[[package]]
name = "voprf"
version = "0.4.1"
@@ -2574,7 +2952,7 @@
"once_cell",
"proc-macro2",
"quote",
- "syn 2.0.51",
+ "syn 2.0.108",
"wasm-bindgen-shared",
]
@@ -2608,7 +2986,7 @@
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.51",
+ "syn 2.0.108",
"wasm-bindgen-backend",
"wasm-bindgen-shared",
]
@@ -2838,6 +3216,15 @@
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0"
+[[package]]
+name = "winnow"
+version = "0.7.13"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "21a0236b59786fed61e2a80582dd500fe61f18b5dca67a4a067d0bc9039339cf"
+dependencies = [
+ "memchr",
+]
+
[[package]]
name = "winreg"
version = "0.50.0"
@@ -2848,6 +3235,18 @@
"windows-sys",
]
+[[package]]
+name = "x25519-dalek"
+version = "2.0.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c7e468321c81fb07fa7f4c636c3972b9100f0346e5b6a9f2bd0603a52f7ed277"
+dependencies = [
+ "curve25519-dalek",
+ "rand_core",
+ "serde",
+ "zeroize",
+]
+
[[package]]
name = "zeroize"
version = "1.8.1"
diff --git a/native/native_rust_library/Cargo.toml b/native/native_rust_library/Cargo.toml
--- a/native/native_rust_library/Cargo.toml
+++ b/native/native_rust_library/Cargo.toml
@@ -21,6 +21,7 @@
grpc_clients = { path = "../../shared/grpc_clients" }
base64 = "0.21"
regex = "1.10"
+vodozemac = { git = "https://github.com/xsanm/vodozemac", features = ["libolm-compat"] }
[target.'cfg(target_os = "android")'.dependencies]
backup_client = { path = "../../shared/backup_client", default-features = false, features = [
diff --git a/native/native_rust_library/build.rs b/native/native_rust_library/build.rs
--- a/native/native_rust_library/build.rs
+++ b/native/native_rust_library/build.rs
@@ -197,6 +197,7 @@
.expect("Couldn't write backup service config");
println!("cargo:rerun-if-changed=src/lib.rs");
+ println!("cargo:rerun-if-changed=src/session.rs");
println!("cargo:rerun-if-changed={}", IdentityServiceConfig::FILEPATH);
println!("cargo:rerun-if-changed={}", BackupServiceConfig::FILEPATH);
}
diff --git a/native/native_rust_library/src/lib.rs b/native/native_rust_library/src/lib.rs
--- a/native/native_rust_library/src/lib.rs
+++ b/native/native_rust_library/src/lib.rs
@@ -10,10 +10,12 @@
mod backup;
mod constants;
mod identity;
+mod session;
mod utils;
use crate::argon2_tools::compute_backup_key_str;
use crate::utils::jsi_callbacks::handle_string_result_as_callback;
+use session::{session_from_pickle, EncryptResult, VodozemacSession};
mod generated {
// We get the CODE_VERSION from this generated file
@@ -564,6 +566,38 @@
#[cxx_name = "rejectFuture"]
fn reject_future(future_id: usize, error: String);
}
+
+ // Future handling from C++
+ extern "Rust" {
+ // Vodozemac crypto functions (wrapper implementations)
+ #[cfg(target_os = "android")]
+ type VodozemacSession;
+ #[cfg(target_os = "android")]
+ type EncryptResult;
+ #[cfg(target_os = "android")]
+ fn pickle(self: &VodozemacSession, pickle_key: &[u8; 32]) -> String;
+ #[cfg(target_os = "android")]
+ fn encrypted_message(self: &EncryptResult) -> String;
+ #[cfg(target_os = "android")]
+ fn message_type(self: &EncryptResult) -> u32;
+ #[cfg(target_os = "android")]
+ fn encrypt(
+ self: &mut VodozemacSession,
+ plaintext: &str,
+ ) -> Result<Box<EncryptResult>>;
+ #[cfg(target_os = "android")]
+ fn decrypt(
+ self: &mut VodozemacSession,
+ encrypted_message: String,
+ message_type: u32,
+ ) -> Result<String>;
+
+ #[cfg(target_os = "android")]
+ pub fn session_from_pickle(
+ session_state: String,
+ session_key: String,
+ ) -> Result<Box<VodozemacSession>>;
+ }
}
#[derive(Debug, derive_more::Display)]
diff --git a/native/native_rust_library/src/session.rs b/native/native_rust_library/src/session.rs
new file mode 100644
--- /dev/null
+++ b/native/native_rust_library/src/session.rs
@@ -0,0 +1,114 @@
+use vodozemac::olm::{Session, SessionPickle};
+use vodozemac::{olm, PickleError};
+
+pub struct VodozemacSession(pub(crate) vodozemac::olm::Session);
+
+impl From<Session> for VodozemacSession {
+ fn from(session: Session) -> Self {
+ VodozemacSession(session)
+ }
+}
+
+pub struct EncryptResult {
+ pub encrypted_message: String,
+ pub message_type: u32,
+}
+
+impl EncryptResult {
+ pub fn encrypted_message(&self) -> String {
+ self.encrypted_message.clone()
+ }
+
+ pub fn message_type(&self) -> u32 {
+ self.message_type
+ }
+}
+
+impl VodozemacSession {
+ pub fn pickle(&self, pickle_key: &[u8; 32]) -> String {
+ self.0.pickle().encrypt(pickle_key)
+ }
+
+ pub fn encrypt(
+ &mut self,
+ plaintext: &str,
+ ) -> Result<Box<EncryptResult>, String> {
+ let olm_message = self.0.encrypt(plaintext.as_bytes());
+
+ let (message_type, encrypted_message) = match olm_message {
+ olm::OlmMessage::Normal(msg) => (1, msg.to_base64()),
+ olm::OlmMessage::PreKey(msg) => (0, msg.to_base64()),
+ };
+
+ Ok(Box::from(EncryptResult {
+ encrypted_message,
+ message_type: message_type as u32,
+ }))
+ }
+
+ pub fn decrypt(
+ &mut self,
+ encrypted_message: String,
+ message_type: u32,
+ ) -> Result<String, String> {
+ let olm_message: vodozemac::olm::OlmMessage = match message_type {
+ 0 => olm::PreKeyMessage::from_base64(encrypted_message.as_str())
+ .map_err(|e| e.to_string())?
+ .into(),
+ 1 => olm::Message::from_base64(encrypted_message.as_str())
+ .map_err(|e| e.to_string())?
+ .into(),
+ _ => return Err("wrong message type".to_string()),
+ };
+
+ let result = self.0.decrypt(&olm_message).map_err(|e| e.to_string())?;
+ let plaintext = String::from_utf8(result).expect("Invalid UTF-8");
+
+ Ok(plaintext)
+ }
+}
+
+pub fn session_from_pickle(
+ session_state: String,
+ session_key: String,
+) -> Result<Box<VodozemacSession>, String> {
+ let key_bytes = session_key.as_bytes();
+
+ //NOTE: vvodozemac works only with 32-byte keys.
+ // We have sessions pickled with 64-byte keys. Additionally, this key
+ // is used in backup, so it can't simply be migrated. Instead, we're going
+ // to just use the first 32 bytes of the existing secret key.
+ let key: &[u8; 32] = &key_bytes[0..32]
+ .try_into()
+ .expect("String must be at least 32 bytes");
+
+ let session_pickle =
+ match SessionPickle::from_encrypted(session_state.as_str(), key) {
+ Ok(pickle) => Some(pickle),
+ Err(e) => {
+ match e {
+ PickleError::Base64(base64_error) => {
+ return Err(base64_error.to_string());
+ }
+ //TODO: Use only specific error type
+ PickleError::Decryption(_) => {
+ println!("Decryption error, will try from_libolm_pickle");
+ None
+ }
+ PickleError::Serialization(serialization_error) => {
+ return Err(serialization_error.to_string());
+ }
+ }
+ }
+ };
+
+ let session: VodozemacSession = if let Some(pickle) = session_pickle {
+ Session::from_pickle(pickle).into()
+ } else {
+ Session::from_libolm_pickle(&session_state, session_key.as_bytes())
+ .map_err(|e| e.to_string())?
+ .into()
+ };
+
+ Ok(Box::from(session))
+}
diff --git a/native/vodozemac_bindings/.gitignore b/native/vodozemac_bindings/.gitignore
new file mode 100644
--- /dev/null
+++ b/native/vodozemac_bindings/.gitignore
@@ -0,0 +1,7 @@
+target
+cxx.h
+lib.rs.cc
+vodozemac_cxx.h
+vodozemac_bindings.rs.cc
+vodozemac_bindings.rs.h
+lib.rs.h
\ No newline at end of file
diff --git a/native/vodozemac_bindings/Cargo.lock b/native/vodozemac_bindings/Cargo.lock
new file mode 100644
--- /dev/null
+++ b/native/vodozemac_bindings/Cargo.lock
@@ -0,0 +1,1029 @@
+# This file is automatically @generated by Cargo.
+# It is not intended for manual editing.
+version = 4
+
+[[package]]
+name = "aead"
+version = "0.5.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d122413f284cf2d62fb1b7db97e02edb8cda96d769b16e443a4f6195e35662b0"
+dependencies = [
+ "crypto-common",
+ "generic-array",
+]
+
+[[package]]
+name = "aes"
+version = "0.8.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0"
+dependencies = [
+ "cfg-if",
+ "cipher",
+ "cpufeatures",
+]
+
+[[package]]
+name = "aho-corasick"
+version = "1.1.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ddd31a130427c27518df266943a5308ed92d4b226cc639f5a8f1002816174301"
+dependencies = [
+ "memchr",
+]
+
+[[package]]
+name = "anyhow"
+version = "1.0.100"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a23eb6b1614318a8071c9b2521f36b424b2c83db5eb3a0fead4a6c0809af6e61"
+
+[[package]]
+name = "arrayvec"
+version = "0.7.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50"
+dependencies = [
+ "serde",
+]
+
+[[package]]
+name = "base64"
+version = "0.22.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6"
+
+[[package]]
+name = "base64ct"
+version = "1.8.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "55248b47b0caf0546f7988906588779981c43bb1bc9d0c44087278f80cdb44ba"
+
+[[package]]
+name = "block-buffer"
+version = "0.10.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71"
+dependencies = [
+ "generic-array",
+]
+
+[[package]]
+name = "block-padding"
+version = "0.3.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a8894febbff9f758034a5b8e12d87918f56dfc64a8e1fe757d65e29041538d93"
+dependencies = [
+ "generic-array",
+]
+
+[[package]]
+name = "bytes"
+version = "1.10.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d71b6127be86fdcfddb610f7182ac57211d4b18a3e9c82eb2d17662f2227ad6a"
+
+[[package]]
+name = "cbc"
+version = "0.1.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "26b52a9543ae338f279b96b0b9fed9c8093744685043739079ce85cd58f289a6"
+dependencies = [
+ "cipher",
+]
+
+[[package]]
+name = "cc"
+version = "1.2.44"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "37521ac7aabe3d13122dc382493e20c9416f299d2ccd5b3a5340a2570cdeb0f3"
+dependencies = [
+ "find-msvc-tools",
+ "shlex",
+]
+
+[[package]]
+name = "cfg-if"
+version = "1.0.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801"
+
+[[package]]
+name = "chacha20"
+version = "0.9.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c3613f74bd2eac03dad61bd53dbe620703d4371614fe0bc3b9f04dd36fe4e818"
+dependencies = [
+ "cfg-if",
+ "cipher",
+ "cpufeatures",
+]
+
+[[package]]
+name = "chacha20poly1305"
+version = "0.10.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "10cd79432192d1c0f4e1a0fef9527696cc039165d729fb41b3f4f4f354c2dc35"
+dependencies = [
+ "aead",
+ "chacha20",
+ "cipher",
+ "poly1305",
+ "zeroize",
+]
+
+[[package]]
+name = "cipher"
+version = "0.4.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad"
+dependencies = [
+ "crypto-common",
+ "inout",
+ "zeroize",
+]
+
+[[package]]
+name = "codespan-reporting"
+version = "0.11.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3538270d33cc669650c4b093848450d380def10c331d38c768e34cac80576e6e"
+dependencies = [
+ "termcolor",
+ "unicode-width",
+]
+
+[[package]]
+name = "const-oid"
+version = "0.9.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8"
+
+[[package]]
+name = "convert_case"
+version = "0.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e"
+
+[[package]]
+name = "cpufeatures"
+version = "0.2.17"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280"
+dependencies = [
+ "libc",
+]
+
+[[package]]
+name = "crypto-common"
+version = "0.1.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3"
+dependencies = [
+ "generic-array",
+ "rand_core",
+ "typenum",
+]
+
+[[package]]
+name = "curve25519-dalek"
+version = "4.1.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "97fb8b7c4503de7d6ae7b42ab72a5a59857b4c937ec27a3d4539dba95b5ab2be"
+dependencies = [
+ "cfg-if",
+ "cpufeatures",
+ "curve25519-dalek-derive",
+ "digest",
+ "fiat-crypto",
+ "rustc_version",
+ "serde",
+ "subtle",
+ "zeroize",
+]
+
+[[package]]
+name = "curve25519-dalek-derive"
+version = "0.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 2.0.108",
+]
+
+[[package]]
+name = "cxx"
+version = "1.0.75"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8b7df2292959b7e22a5cb39d37b7e72b2c748b12f956cc409b529fddcdc8857b"
+dependencies = [
+ "cc",
+ "cxxbridge-flags",
+ "cxxbridge-macro",
+ "link-cplusplus",
+]
+
+[[package]]
+name = "cxx-build"
+version = "1.0.75"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0806e5c64f74bd64b94d857b1c28cc3d493579a65f5f31e7d3451706d4025405"
+dependencies = [
+ "cc",
+ "codespan-reporting",
+ "once_cell",
+ "proc-macro2",
+ "quote",
+ "scratch",
+ "syn 1.0.109",
+]
+
+[[package]]
+name = "cxxbridge-flags"
+version = "1.0.75"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d2069b1573efd6e5901004e8fdca2e28bc6f47f86dc24da81182851e71cf3208"
+
+[[package]]
+name = "cxxbridge-macro"
+version = "1.0.75"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d980827d1ec28ea6e0db545fceaa611eb8e43f70eff8c1c33cc2c96ffa0f0476"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 1.0.109",
+]
+
+[[package]]
+name = "der"
+version = "0.7.10"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e7c1832837b905bbfb5101e07cc24c8deddf52f93225eee6ead5f4d63d53ddcb"
+dependencies = [
+ "const-oid",
+ "zeroize",
+]
+
+[[package]]
+name = "derive_more"
+version = "0.99.20"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6edb4b64a43d977b8e99788fe3a04d483834fba1215a7e02caa415b626497f7f"
+dependencies = [
+ "convert_case",
+ "proc-macro2",
+ "quote",
+ "rustc_version",
+ "syn 2.0.108",
+]
+
+[[package]]
+name = "digest"
+version = "0.10.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292"
+dependencies = [
+ "block-buffer",
+ "crypto-common",
+ "subtle",
+]
+
+[[package]]
+name = "ed25519"
+version = "2.2.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "115531babc129696a58c64a4fef0a8bf9e9698629fb97e9e40767d235cfbcd53"
+dependencies = [
+ "pkcs8",
+ "serde",
+ "signature",
+]
+
+[[package]]
+name = "ed25519-dalek"
+version = "2.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "70e796c081cee67dc755e1a36a0a172b897fab85fc3f6bc48307991f64e4eca9"
+dependencies = [
+ "curve25519-dalek",
+ "ed25519",
+ "rand_core",
+ "serde",
+ "sha2",
+ "subtle",
+ "zeroize",
+]
+
+[[package]]
+name = "either"
+version = "1.15.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719"
+
+[[package]]
+name = "equivalent"
+version = "1.0.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f"
+
+[[package]]
+name = "fiat-crypto"
+version = "0.2.9"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "28dea519a9695b9977216879a3ebfddf92f1c08c05d984f8996aecd6ecdc811d"
+
+[[package]]
+name = "find-msvc-tools"
+version = "0.1.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "52051878f80a721bb68ebfbc930e07b65ba72f2da88968ea5c06fd6ca3d3a127"
+
+[[package]]
+name = "generic-array"
+version = "0.14.9"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4bb6743198531e02858aeaea5398fcc883e71851fcbcb5a2f773e2fb6cb1edf2"
+dependencies = [
+ "typenum",
+ "version_check",
+]
+
+[[package]]
+name = "getrandom"
+version = "0.2.16"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "335ff9f135e4384c8150d6f27c6daed433577f86b4750418338c01a1a2528592"
+dependencies = [
+ "cfg-if",
+ "libc",
+ "wasi",
+]
+
+[[package]]
+name = "hashbrown"
+version = "0.16.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5419bdc4f6a9207fbeba6d11b604d481addf78ecd10c11ad51e76c2f6482748d"
+
+[[package]]
+name = "hkdf"
+version = "0.12.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7b5f8eb2ad728638ea2c7d47a21db23b7b58a72ed6a38256b8a1849f15fbbdf7"
+dependencies = [
+ "hmac",
+]
+
+[[package]]
+name = "hmac"
+version = "0.12.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e"
+dependencies = [
+ "digest",
+]
+
+[[package]]
+name = "indexmap"
+version = "2.12.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6717a8d2a5a929a1a2eb43a12812498ed141a0bcfb7e8f7844fbdbe4303bba9f"
+dependencies = [
+ "equivalent",
+ "hashbrown",
+]
+
+[[package]]
+name = "inout"
+version = "0.1.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "879f10e63c20629ecabbb64a8010319738c66a5cd0c29b02d63d272b03751d01"
+dependencies = [
+ "block-padding",
+ "generic-array",
+]
+
+[[package]]
+name = "itertools"
+version = "0.12.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569"
+dependencies = [
+ "either",
+]
+
+[[package]]
+name = "itoa"
+version = "1.0.15"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c"
+
+[[package]]
+name = "libc"
+version = "0.2.177"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2874a2af47a2325c2001a6e6fad9b16a53b802102b528163885171cf92b15976"
+
+[[package]]
+name = "link-cplusplus"
+version = "1.0.12"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7f78c730aaa7d0b9336a299029ea49f9ee53b0ed06e9202e8cb7db9bae7b8c82"
+dependencies = [
+ "cc",
+]
+
+[[package]]
+name = "matrix-pickle"
+version = "0.2.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4e2551de3bba2cc65b52dc6b268df6114011fe118ac24870fbcf1b35537bd721"
+dependencies = [
+ "matrix-pickle-derive",
+ "thiserror 1.0.69",
+]
+
+[[package]]
+name = "matrix-pickle-derive"
+version = "0.2.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f75de44c3120d78e978adbcf6d453b20ba011f3c46363e52d1dbbc72f545e9fb"
+dependencies = [
+ "proc-macro-crate",
+ "proc-macro-error2",
+ "proc-macro2",
+ "quote",
+ "syn 2.0.108",
+]
+
+[[package]]
+name = "memchr"
+version = "2.7.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f52b00d39961fc5b2736ea853c9cc86238e165017a493d1d5c8eac6bdc4cc273"
+
+[[package]]
+name = "once_cell"
+version = "1.21.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d"
+
+[[package]]
+name = "opaque-debug"
+version = "0.3.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381"
+
+[[package]]
+name = "pkcs8"
+version = "0.10.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7"
+dependencies = [
+ "der",
+ "spki",
+]
+
+[[package]]
+name = "poly1305"
+version = "0.8.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8159bd90725d2df49889a078b54f4f79e87f1f8a8444194cdca81d38f5393abf"
+dependencies = [
+ "cpufeatures",
+ "opaque-debug",
+ "universal-hash",
+]
+
+[[package]]
+name = "ppv-lite86"
+version = "0.2.21"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9"
+dependencies = [
+ "zerocopy",
+]
+
+[[package]]
+name = "proc-macro-crate"
+version = "3.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "219cb19e96be00ab2e37d6e299658a0cfa83e52429179969b0f0121b4ac46983"
+dependencies = [
+ "toml_edit",
+]
+
+[[package]]
+name = "proc-macro-error-attr2"
+version = "2.0.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "96de42df36bb9bba5542fe9f1a054b8cc87e172759a1868aa05c1f3acc89dfc5"
+dependencies = [
+ "proc-macro2",
+ "quote",
+]
+
+[[package]]
+name = "proc-macro-error2"
+version = "2.0.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "11ec05c52be0a07b08061f7dd003e7d7092e0472bc731b4af7bb1ef876109802"
+dependencies = [
+ "proc-macro-error-attr2",
+ "proc-macro2",
+ "quote",
+]
+
+[[package]]
+name = "proc-macro2"
+version = "1.0.103"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5ee95bc4ef87b8d5ba32e8b7714ccc834865276eab0aed5c9958d00ec45f49e8"
+dependencies = [
+ "unicode-ident",
+]
+
+[[package]]
+name = "prost"
+version = "0.14.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7231bd9b3d3d33c86b58adbac74b5ec0ad9f496b19d22801d773636feaa95f3d"
+dependencies = [
+ "bytes",
+ "prost-derive",
+]
+
+[[package]]
+name = "prost-derive"
+version = "0.14.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9120690fafc389a67ba3803df527d0ec9cbbc9cc45e4cc20b332996dfb672425"
+dependencies = [
+ "anyhow",
+ "itertools",
+ "proc-macro2",
+ "quote",
+ "syn 2.0.108",
+]
+
+[[package]]
+name = "quote"
+version = "1.0.41"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ce25767e7b499d1b604768e7cde645d14cc8584231ea6b295e9c9eb22c02e1d1"
+dependencies = [
+ "proc-macro2",
+]
+
+[[package]]
+name = "rand"
+version = "0.8.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404"
+dependencies = [
+ "libc",
+ "rand_chacha",
+ "rand_core",
+]
+
+[[package]]
+name = "rand_chacha"
+version = "0.3.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88"
+dependencies = [
+ "ppv-lite86",
+ "rand_core",
+]
+
+[[package]]
+name = "rand_core"
+version = "0.6.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c"
+dependencies = [
+ "getrandom",
+]
+
+[[package]]
+name = "regex"
+version = "1.12.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "843bc0191f75f3e22651ae5f1e72939ab2f72a4bc30fa80a066bd66edefc24d4"
+dependencies = [
+ "aho-corasick",
+ "memchr",
+ "regex-automata",
+ "regex-syntax",
+]
+
+[[package]]
+name = "regex-automata"
+version = "0.4.13"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5276caf25ac86c8d810222b3dbb938e512c55c6831a10f3e6ed1c93b84041f1c"
+dependencies = [
+ "aho-corasick",
+ "memchr",
+ "regex-syntax",
+]
+
+[[package]]
+name = "regex-syntax"
+version = "0.8.8"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7a2d987857b319362043e95f5353c0535c1f58eec5336fdfcf626430af7def58"
+
+[[package]]
+name = "rustc_version"
+version = "0.4.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92"
+dependencies = [
+ "semver",
+]
+
+[[package]]
+name = "ryu"
+version = "1.0.20"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f"
+
+[[package]]
+name = "scratch"
+version = "1.0.9"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d68f2ec51b097e4c1a75b681a8bec621909b5e91f15bb7b840c4f2f7b01148b2"
+
+[[package]]
+name = "semver"
+version = "1.0.27"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d767eb0aabc880b29956c35734170f26ed551a859dbd361d140cdbeca61ab1e2"
+
+[[package]]
+name = "serde"
+version = "1.0.228"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e"
+dependencies = [
+ "serde_core",
+ "serde_derive",
+]
+
+[[package]]
+name = "serde_bytes"
+version = "0.11.19"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a5d440709e79d88e51ac01c4b72fc6cb7314017bb7da9eeff678aa94c10e3ea8"
+dependencies = [
+ "serde",
+ "serde_core",
+]
+
+[[package]]
+name = "serde_core"
+version = "1.0.228"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad"
+dependencies = [
+ "serde_derive",
+]
+
+[[package]]
+name = "serde_derive"
+version = "1.0.228"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 2.0.108",
+]
+
+[[package]]
+name = "serde_json"
+version = "1.0.145"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "402a6f66d8c709116cf22f558eab210f5a50187f702eb4d7e5ef38d9a7f1c79c"
+dependencies = [
+ "itoa",
+ "memchr",
+ "ryu",
+ "serde",
+ "serde_core",
+]
+
+[[package]]
+name = "sha2"
+version = "0.10.9"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283"
+dependencies = [
+ "cfg-if",
+ "cpufeatures",
+ "digest",
+]
+
+[[package]]
+name = "shlex"
+version = "1.3.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
+
+[[package]]
+name = "signature"
+version = "2.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de"
+dependencies = [
+ "rand_core",
+]
+
+[[package]]
+name = "spki"
+version = "0.7.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d"
+dependencies = [
+ "base64ct",
+ "der",
+]
+
+[[package]]
+name = "subtle"
+version = "2.6.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292"
+
+[[package]]
+name = "syn"
+version = "1.0.109"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "unicode-ident",
+]
+
+[[package]]
+name = "syn"
+version = "2.0.108"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "da58917d35242480a05c2897064da0a80589a2a0476c9a3f2fdc83b53502e917"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "unicode-ident",
+]
+
+[[package]]
+name = "termcolor"
+version = "1.4.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755"
+dependencies = [
+ "winapi-util",
+]
+
+[[package]]
+name = "thiserror"
+version = "1.0.69"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52"
+dependencies = [
+ "thiserror-impl 1.0.69",
+]
+
+[[package]]
+name = "thiserror"
+version = "2.0.17"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f63587ca0f12b72a0600bcba1d40081f830876000bb46dd2337a3051618f4fc8"
+dependencies = [
+ "thiserror-impl 2.0.17",
+]
+
+[[package]]
+name = "thiserror-impl"
+version = "1.0.69"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 2.0.108",
+]
+
+[[package]]
+name = "thiserror-impl"
+version = "2.0.17"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3ff15c8ecd7de3849db632e14d18d2571fa09dfc5ed93479bc4485c7a517c913"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 2.0.108",
+]
+
+[[package]]
+name = "toml_datetime"
+version = "0.7.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f2cdb639ebbc97961c51720f858597f7f24c4fc295327923af55b74c3c724533"
+dependencies = [
+ "serde_core",
+]
+
+[[package]]
+name = "toml_edit"
+version = "0.23.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6485ef6d0d9b5d0ec17244ff7eb05310113c3f316f2d14200d4de56b3cb98f8d"
+dependencies = [
+ "indexmap",
+ "toml_datetime",
+ "toml_parser",
+ "winnow",
+]
+
+[[package]]
+name = "toml_parser"
+version = "1.0.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c0cbe268d35bdb4bb5a56a2de88d0ad0eb70af5384a99d648cd4b3d04039800e"
+dependencies = [
+ "winnow",
+]
+
+[[package]]
+name = "typenum"
+version = "1.19.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "562d481066bde0658276a35467c4af00bdc6ee726305698a55b86e61d7ad82bb"
+
+[[package]]
+name = "unicode-ident"
+version = "1.0.22"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9312f7c4f6ff9069b165498234ce8be658059c6728633667c526e27dc2cf1df5"
+
+[[package]]
+name = "unicode-width"
+version = "0.1.14"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af"
+
+[[package]]
+name = "universal-hash"
+version = "0.5.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "fc1de2c688dc15305988b563c3854064043356019f97a4b46276fe734c4f07ea"
+dependencies = [
+ "crypto-common",
+ "subtle",
+]
+
+[[package]]
+name = "version_check"
+version = "0.9.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a"
+
+[[package]]
+name = "vodozemac"
+version = "0.9.0"
+source = "git+https://github.com/xsanm/vodozemac#e1d34da279eccb220ee393aa6a465917ae60d0cc"
+dependencies = [
+ "aes",
+ "arrayvec",
+ "base64",
+ "base64ct",
+ "cbc",
+ "chacha20poly1305",
+ "curve25519-dalek",
+ "ed25519-dalek",
+ "getrandom",
+ "hkdf",
+ "hmac",
+ "matrix-pickle",
+ "prost",
+ "rand",
+ "serde",
+ "serde_bytes",
+ "serde_json",
+ "sha2",
+ "subtle",
+ "thiserror 2.0.17",
+ "x25519-dalek",
+ "zeroize",
+]
+
+[[package]]
+name = "vodozemac_bindings"
+version = "0.1.0"
+dependencies = [
+ "anyhow",
+ "cxx",
+ "cxx-build",
+ "derive_more",
+ "regex",
+ "serde",
+ "serde_json",
+ "vodozemac",
+]
+
+[[package]]
+name = "wasi"
+version = "0.11.1+wasi-snapshot-preview1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b"
+
+[[package]]
+name = "winapi-util"
+version = "0.1.11"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22"
+dependencies = [
+ "windows-sys",
+]
+
+[[package]]
+name = "windows-link"
+version = "0.2.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5"
+
+[[package]]
+name = "windows-sys"
+version = "0.61.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc"
+dependencies = [
+ "windows-link",
+]
+
+[[package]]
+name = "winnow"
+version = "0.7.13"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "21a0236b59786fed61e2a80582dd500fe61f18b5dca67a4a067d0bc9039339cf"
+dependencies = [
+ "memchr",
+]
+
+[[package]]
+name = "x25519-dalek"
+version = "2.0.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c7e468321c81fb07fa7f4c636c3972b9100f0346e5b6a9f2bd0603a52f7ed277"
+dependencies = [
+ "curve25519-dalek",
+ "rand_core",
+ "serde",
+ "zeroize",
+]
+
+[[package]]
+name = "zerocopy"
+version = "0.8.27"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0894878a5fa3edfd6da3f88c4805f4c8558e2b996227a3d864f47fe11e38282c"
+dependencies = [
+ "zerocopy-derive",
+]
+
+[[package]]
+name = "zerocopy-derive"
+version = "0.8.27"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "88d2b8d9c68ad2b9e4340d7832716a4d21a22a1154777ad56ea55c51a9cf3831"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 2.0.108",
+]
+
+[[package]]
+name = "zeroize"
+version = "1.8.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b97154e67e32c85465826e8bcc1c59429aaaf107c1e4a9e53c8d8ccd5eff88d0"
+dependencies = [
+ "zeroize_derive",
+]
+
+[[package]]
+name = "zeroize_derive"
+version = "1.4.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 2.0.108",
+]
diff --git a/native/vodozemac_bindings/Cargo.toml b/native/vodozemac_bindings/Cargo.toml
new file mode 100644
--- /dev/null
+++ b/native/vodozemac_bindings/Cargo.toml
@@ -0,0 +1,21 @@
+[package]
+name = "vodozemac_bindings"
+version = "0.1.0"
+edition = "2021"
+
+[dependencies]
+cxx = "=1.0.75"
+vodozemac = { git = "https://github.com/xsanm/vodozemac", features = ["libolm-compat"] }
+serde = { version = "1.0", features = ["derive"] }
+serde_json = "1.0"
+derive_more = "0.99"
+anyhow = "1.0.97"
+
+[build-dependencies]
+cxx-build = "=1.0.75"
+regex = "1"
+serde = { version = "1.0", features = ["derive"] }
+serde_json = "1.0"
+
+[lib]
+crate-type = ["staticlib", "rlib"]
\ No newline at end of file
diff --git a/native/vodozemac_bindings/build.rs b/native/vodozemac_bindings/build.rs
new file mode 100644
--- /dev/null
+++ b/native/vodozemac_bindings/build.rs
@@ -0,0 +1,6 @@
+fn main() {
+ let _cxx_build =
+ cxx_build::bridge("src/lib.rs").flag_if_supported("-std=c++17");
+
+ println!("cargo:rerun-if-changed=src/lib.rs");
+}
diff --git a/native/vodozemac_bindings/src/lib.rs b/native/vodozemac_bindings/src/lib.rs
new file mode 100644
--- /dev/null
+++ b/native/vodozemac_bindings/src/lib.rs
@@ -0,0 +1,59 @@
+use std::error::Error as StdError;
+
+mod session;
+
+use session::{session_from_pickle, VodozemacSession};
+
+use crate::session::*;
+
+#[cxx::bridge]
+pub mod ffi {
+
+ // Vodozemac crypto functions only
+ extern "Rust" {
+
+ type VodozemacSession;
+ type EncryptResult;
+ fn pickle(self: &VodozemacSession, pickle_key: &[u8; 32]) -> String;
+ fn encrypted_message(self: &EncryptResult) -> String;
+ fn message_type(self: &EncryptResult) -> u32;
+ fn encrypt(
+ self: &mut VodozemacSession,
+ plaintext: &str,
+ ) -> Result<Box<EncryptResult>>;
+ fn decrypt(
+ self: &mut VodozemacSession,
+ encrypted_message: String,
+ message_type: u32,
+ ) -> Result<String>;
+
+ pub fn session_from_pickle(
+ session_state: String,
+ session_key: String,
+ ) -> Result<Box<VodozemacSession>>;
+
+ }
+}
+
+// Error types for compatibility
+#[derive(Debug, derive_more::Display)]
+pub struct StringError(String);
+
+impl StdError for StringError {}
+
+#[derive(
+ Debug, derive_more::Display, derive_more::From, derive_more::Error,
+)]
+pub enum Error {
+ #[display(fmt = "Generic error: {}", "_0")]
+ Generic(StringError),
+}
+
+#[cfg(test)]
+mod tests {
+ #[test]
+ fn test_basic_crypto() {
+ // Basic smoke test
+ assert!(true);
+ }
+}
diff --git a/native/vodozemac_bindings/src/session.rs b/native/vodozemac_bindings/src/session.rs
new file mode 100644
--- /dev/null
+++ b/native/vodozemac_bindings/src/session.rs
@@ -0,0 +1,114 @@
+use vodozemac::olm::{Session, SessionPickle};
+use vodozemac::{olm, PickleError};
+
+pub struct VodozemacSession(pub(crate) vodozemac::olm::Session);
+
+impl From<Session> for VodozemacSession {
+ fn from(session: Session) -> Self {
+ VodozemacSession(session)
+ }
+}
+
+pub struct EncryptResult {
+ pub encrypted_message: String,
+ pub message_type: u32,
+}
+
+impl EncryptResult {
+ pub fn encrypted_message(&self) -> String {
+ self.encrypted_message.clone()
+ }
+
+ pub fn message_type(&self) -> u32 {
+ self.message_type
+ }
+}
+
+impl VodozemacSession {
+ pub fn pickle(&self, pickle_key: &[u8; 32]) -> String {
+ self.0.pickle().encrypt(pickle_key)
+ }
+
+ pub fn encrypt(
+ &mut self,
+ plaintext: &str,
+ ) -> Result<Box<EncryptResult>, String> {
+ let olm_message = self.0.encrypt(plaintext.as_bytes());
+
+ let (message_type, encrypted_message) = match olm_message {
+ olm::OlmMessage::Normal(msg) => (1, msg.to_base64()),
+ olm::OlmMessage::PreKey(msg) => (0, msg.to_base64()),
+ };
+
+ Ok(Box::from(EncryptResult {
+ encrypted_message,
+ message_type: message_type as u32,
+ }))
+ }
+
+ pub fn decrypt(
+ &mut self,
+ encrypted_message: String,
+ message_type: u32,
+ ) -> Result<String, String> {
+ let olm_message: vodozemac::olm::OlmMessage = match message_type {
+ 0 => olm::PreKeyMessage::from_base64(encrypted_message.as_str())
+ .map_err(|e| e.to_string())?
+ .into(),
+ 1 => olm::Message::from_base64(encrypted_message.as_str())
+ .map_err(|e| e.to_string())?
+ .into(),
+ _ => return Err("wrong message type".to_string()),
+ };
+
+ let result = self.0.decrypt(&olm_message).map_err(|e| e.to_string())?;
+ let plaintext = String::from_utf8(result).expect("Invalid UTF-8");
+
+ Ok(plaintext)
+ }
+}
+
+pub fn session_from_pickle(
+ session_state: String,
+ session_key: String,
+) -> Result<Box<VodozemacSession>, String> {
+ let key_bytes = session_key.as_bytes();
+
+ //NOTE: vvodozemac works only with 32-byte keys.
+ // We have sessions pickled with 64-byte keys. Additionally, this key
+ // is used in backup, so it can't simply be migrated. Instead, we're going
+ // to just use the first 32 bytes of the existing secret key.
+ let key: &[u8; 32] = &key_bytes[0..32]
+ .try_into()
+ .expect("String must be at least 32 bytes");
+
+ let session_pickle =
+ match SessionPickle::from_encrypted(session_state.as_str(), key) {
+ Ok(pickle) => Some(pickle),
+ Err(e) => {
+ match e {
+ PickleError::Base64(base64_error) => {
+ return Err(base64_error.to_string());
+ }
+ //TODO: Use only specific error type
+ PickleError::Decryption(_) => {
+ println!("Decryption error, will try from_libolm_pickle");
+ None
+ }
+ PickleError::Serialization(serialization_error) => {
+ return Err(serialization_error.to_string());
+ }
+ }
+ }
+ };
+
+ let session: VodozemacSession = if let Some(pickle) = session_pickle {
+ Session::from_pickle(pickle).into()
+ } else {
+ Session::from_libolm_pickle(&session_state, session_key.as_bytes())
+ .map_err(|e| e.to_string())?
+ .into()
+ };
+
+ Ok(Box::from(session))
+}
diff --git a/scripts/build-rust-vodozemac-bindings.sh b/scripts/build-rust-vodozemac-bindings.sh
new file mode 100755
--- /dev/null
+++ b/scripts/build-rust-vodozemac-bindings.sh
@@ -0,0 +1,51 @@
+#!/usr/bin/env bash
+
+set -euxo pipefail
+
+COMM_NIX_PATH="$HOME/.cache/comm/path"
+PRJ_ROOT="$(git rev-parse --show-toplevel)"
+
+# If in nix environment, re-expose nix PATH
+if [[ -f "$COMM_NIX_PATH" ]]; then
+ # shellcheck source=/dev/null
+ source "$COMM_NIX_PATH"
+fi
+
+# Set the architecture based on Xcode's ARCHS variable
+if [[ "$ARCHS" == "arm64" ]]; then
+ TARGET="aarch64-apple-ios"
+elif [[ "$ARCHS" == "x86_64" ]]; then
+ TARGET="x86_64-apple-ios"
+else
+ echo "Unsupported architecture: $ARCHS"
+ exit 1
+fi
+
+# The $PATH used by Xcode likely won't contain Cargo, fix that.
+# In addition, the $PATH used by XCode has lots of Apple-specific
+# developer tools that your Cargo isn't expecting to use, fix that.
+# Note: This assumes a default `rustup` setup and default path.
+build_path="$HOME/.cargo/bin:/usr/local/bin:/usr/bin:/bin${PATH:+:}$PATH"
+
+# cd to Cargo project
+cd "${SRCROOT}/../vodozemac_bindings" || exit
+
+# Ensure rust tooling is available
+env PATH="${build_path}" "$PRJ_ROOT/scripts/ensure_rustup_setup.sh"
+
+# Set C++ standard and build cxx bridge
+export CXXFLAGS="-std=c++14"
+# Use the determined TARGET for the build
+# Check if the build configuration is Release
+if [[ "$CONFIGURATION" == "Release" ]]; then
+ env PATH="${build_path}" cargo build --release --target="$TARGET"
+else
+ env PATH="${build_path}" cargo build --target="$TARGET"
+fi
+# Unset the flag specifying C++ standard
+unset CXXFLAGS
+# Copy the CXX files to the cargo project root to make them
+# available to XCode with unique names to avoid conflicts
+cp "$(readlink target/${TARGET}/cxxbridge/vodozemac_bindings/src/lib.rs.cc)" vodozemac_bindings.rs.cc
+cp "$(readlink target/${TARGET}/cxxbridge/vodozemac_bindings/src/lib.rs.h)" vodozemac_bindings.rs.h
+cp "$(readlink target/${TARGET}/cxxbridge/rust/cxx.h)" vodozemac_cxx.h
\ No newline at end of file

File Metadata

Mime Type
text/plain
Expires
Sat, Dec 6, 1:13 PM (18 h, 20 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5837877
Default Alt Text
D15542.1765026788.diff (91 KB)

Event Timeline