From a8947fe6b68f8290f2d6706fdf22d09b0d55661c Mon Sep 17 00:00:00 2001 From: alberto-instnt <113043904+alberto-instnt@users.noreply.github.com> Date: Mon, 8 Jul 2024 19:09:13 -0400 Subject: [PATCH 1/4] Updated unffi README.md new sh command with the new folder structure Signed-off-by: alberto-instnt <113043904+alberto-instnt@users.noreply.github.com> --- aries/wrappers/uniffi-aries-vcx/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aries/wrappers/uniffi-aries-vcx/README.md b/aries/wrappers/uniffi-aries-vcx/README.md index f5fdfcb93a..22c06d00bd 100644 --- a/aries/wrappers/uniffi-aries-vcx/README.md +++ b/aries/wrappers/uniffi-aries-vcx/README.md @@ -47,7 +47,7 @@ More documentation can be found [here](https://rust-lang.github.io/rustup/cross- 5. Run the helper build script. ```bash -sh uniffi_aries_vcx/scripts/android.build.cargo.ndk.sh +sh aries/wrappers/uniffi-aries-vcx/scripts/android.build.cargo.ndk.sh ``` NB: Before running the demo application you need to generate the language bindings. From 88db4ebdc4af7f64a0f1f86ec9a3044d73fe9bbd Mon Sep 17 00:00:00 2001 From: Alberto Leon Date: Tue, 9 Jul 2024 17:31:52 -0400 Subject: [PATCH 2/4] removed unused code and suppressed warnings/erros Signed-off-by: Alberto Leon --- Cargo.lock | 8 +++---- .../src/protocols/connection/trait_bounds.rs | 1 + .../src/anoncreds/credx_anoncreds/mod.rs | 1 + aries/aries_vcx_anoncreds/src/utils/json.rs | 22 ++++--------------- .../libvdrtools/indy-wallet/src/cache/mod.rs | 6 +++++ 5 files changed, 16 insertions(+), 22 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 0a3ddb7c0c..a468109f5e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4888,9 +4888,9 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.195" +version = "1.0.203" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "63261df402c67811e9ac6def069e4786148c4563f4b50fd4bf30aa370d626b02" +checksum = "7253ab4de971e72fb7be983802300c30b5a7f0c2e56fab8abfc6a214307c0094" dependencies = [ "serde_derive", ] @@ -4917,9 +4917,9 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.195" +version = "1.0.203" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46fe8f8603d81ba86327b23a2e9cdf49e1255fb94a4c5f297f6ee0547178ea2c" +checksum = "500cbc0ebeb6f46627f50f3f5811ccf6bf00643be300b4c3eabc0ef55dc5b5ba" dependencies = [ "proc-macro2", "quote", diff --git a/aries/aries_vcx/src/protocols/connection/trait_bounds.rs b/aries/aries_vcx/src/protocols/connection/trait_bounds.rs index 47e668c26f..a9004ebb48 100644 --- a/aries/aries_vcx/src/protocols/connection/trait_bounds.rs +++ b/aries/aries_vcx/src/protocols/connection/trait_bounds.rs @@ -31,4 +31,5 @@ pub trait CompletedState { /// Marker trait used for implementing /// [`messages::protocols::connection::problem_report::ProblemReport`] handling on certain /// [`super::Connection`] types. +#[allow(dead_code)] pub trait HandleProblem {} diff --git a/aries/aries_vcx_anoncreds/src/anoncreds/credx_anoncreds/mod.rs b/aries/aries_vcx_anoncreds/src/anoncreds/credx_anoncreds/mod.rs index 5b298ee287..afe0796c95 100644 --- a/aries/aries_vcx_anoncreds/src/anoncreds/credx_anoncreds/mod.rs +++ b/aries/aries_vcx_anoncreds/src/anoncreds/credx_anoncreds/mod.rs @@ -92,6 +92,7 @@ pub struct RevocationRegistryInfo { struct WalletAdapter(Arc); #[async_trait] +#[allow(dead_code)] impl RecordWallet for WalletAdapter { async fn all_records(&self) -> VcxWalletResult> { self.0.all_records().await diff --git a/aries/aries_vcx_anoncreds/src/utils/json.rs b/aries/aries_vcx_anoncreds/src/utils/json.rs index 3d7245e7fc..a7648054e7 100644 --- a/aries/aries_vcx_anoncreds/src/utils/json.rs +++ b/aries/aries_vcx_anoncreds/src/utils/json.rs @@ -7,29 +7,15 @@ use serde_json::{Map, Value}; use crate::errors::error::{VcxAnoncredsError, VcxAnoncredsResult}; -pub(crate) trait TryGetIndex { - type Val; - fn try_get(&self, index: &str) -> VcxAnoncredsResult; -} - -impl<'a> TryGetIndex for &'a Value { - type Val = &'a Value; - fn try_get(&self, index: &str) -> VcxAnoncredsResult<&'a Value> { - self.get(index).ok_or_else(|| { - VcxAnoncredsError::InvalidJson(format!( - "Could not index '{index}' in Value payload: {self:?}" - )) - }) - } -} - pub(crate) trait AsTypeOrDeserializationError { fn try_as_str(&self) -> VcxAnoncredsResult<&str>; fn try_as_object(&self) -> VcxAnoncredsResult<&Map>; - + + #[allow(dead_code)] fn try_as_bool(&self) -> VcxAnoncredsResult; - + + #[allow(dead_code)] fn try_as_array(&self) -> VcxAnoncredsResult<&Vec>; } diff --git a/aries/misc/legacy/libvdrtools/indy-wallet/src/cache/mod.rs b/aries/misc/legacy/libvdrtools/indy-wallet/src/cache/mod.rs index 747dc487fc..b5499c4bc4 100644 --- a/aries/misc/legacy/libvdrtools/indy-wallet/src/cache/mod.rs +++ b/aries/misc/legacy/libvdrtools/indy-wallet/src/cache/mod.rs @@ -8,7 +8,13 @@ pub trait Cache { fn get(&mut self, key: &WalletCacheKey) -> Option<&WalletCacheValue>; fn get_mut(&mut self, key: &WalletCacheKey) -> Option<&mut WalletCacheValue>; fn pop(&mut self, key: &WalletCacheKey) -> Option; + + #[allow(dead_code)] fn peek(&self, key: &WalletCacheKey) -> Option<&WalletCacheValue>; + + #[allow(dead_code)] fn len(&self) -> usize; + + #[allow(dead_code)] fn cap(&self) -> usize; } From d94c8db6710054d32b92161e19feacccf2da11a1 Mon Sep 17 00:00:00 2001 From: Alberto Leon Date: Tue, 9 Jul 2024 17:48:39 -0400 Subject: [PATCH 3/4] fixed formatting Signed-off-by: Alberto Leon --- aries/aries_vcx_anoncreds/src/utils/json.rs | 2 -- aries/misc/legacy/libvdrtools/indy-wallet/src/cache/mod.rs | 3 --- 2 files changed, 5 deletions(-) diff --git a/aries/aries_vcx_anoncreds/src/utils/json.rs b/aries/aries_vcx_anoncreds/src/utils/json.rs index a7648054e7..1e35a1cfde 100644 --- a/aries/aries_vcx_anoncreds/src/utils/json.rs +++ b/aries/aries_vcx_anoncreds/src/utils/json.rs @@ -11,10 +11,8 @@ pub(crate) trait AsTypeOrDeserializationError { fn try_as_str(&self) -> VcxAnoncredsResult<&str>; fn try_as_object(&self) -> VcxAnoncredsResult<&Map>; - #[allow(dead_code)] fn try_as_bool(&self) -> VcxAnoncredsResult; - #[allow(dead_code)] fn try_as_array(&self) -> VcxAnoncredsResult<&Vec>; } diff --git a/aries/misc/legacy/libvdrtools/indy-wallet/src/cache/mod.rs b/aries/misc/legacy/libvdrtools/indy-wallet/src/cache/mod.rs index b5499c4bc4..f01402ac65 100644 --- a/aries/misc/legacy/libvdrtools/indy-wallet/src/cache/mod.rs +++ b/aries/misc/legacy/libvdrtools/indy-wallet/src/cache/mod.rs @@ -8,13 +8,10 @@ pub trait Cache { fn get(&mut self, key: &WalletCacheKey) -> Option<&WalletCacheValue>; fn get_mut(&mut self, key: &WalletCacheKey) -> Option<&mut WalletCacheValue>; fn pop(&mut self, key: &WalletCacheKey) -> Option; - #[allow(dead_code)] fn peek(&self, key: &WalletCacheKey) -> Option<&WalletCacheValue>; - #[allow(dead_code)] fn len(&self) -> usize; - #[allow(dead_code)] fn cap(&self) -> usize; } From 791e4943afb51a925fe33a620297a1423f6831e0 Mon Sep 17 00:00:00 2001 From: Alberto Leon Date: Sun, 14 Jul 2024 15:54:58 -0400 Subject: [PATCH 4/4] adjust andorid script & udl Signed-off-by: Alberto Leon --- aries/wrappers/uniffi-aries-vcx/core/Cargo.toml | 2 +- aries/wrappers/uniffi-aries-vcx/core/build.rs | 2 +- aries/wrappers/uniffi-aries-vcx/core/src/lib.rs | 2 +- .../uniffi-aries-vcx/core/src/{vcx_askar.udl => vcx.udl} | 0 .../uniffi-aries-vcx/scripts/android.build.cargo.ndk.sh | 6 +++--- 5 files changed, 6 insertions(+), 6 deletions(-) rename aries/wrappers/uniffi-aries-vcx/core/src/{vcx_askar.udl => vcx.udl} (100%) diff --git a/aries/wrappers/uniffi-aries-vcx/core/Cargo.toml b/aries/wrappers/uniffi-aries-vcx/core/Cargo.toml index ab03a1d653..78445d1807 100644 --- a/aries/wrappers/uniffi-aries-vcx/core/Cargo.toml +++ b/aries/wrappers/uniffi-aries-vcx/core/Cargo.toml @@ -16,7 +16,7 @@ path = "uniffi-bindgen.rs" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [features] -default = ["vdrtools_wallet"] +default = ["askar_wallet"] askar_wallet = ["aries_vcx/askar_wallet"] vdrtools_wallet = ["aries_vcx/vdrtools_wallet"] diff --git a/aries/wrappers/uniffi-aries-vcx/core/build.rs b/aries/wrappers/uniffi-aries-vcx/core/build.rs index aec22a6174..00be3d76ca 100644 --- a/aries/wrappers/uniffi-aries-vcx/core/build.rs +++ b/aries/wrappers/uniffi-aries-vcx/core/build.rs @@ -6,5 +6,5 @@ fn main() { uniffi::generate_scaffolding("./src/vcx_indy.udl").unwrap(); #[cfg(feature = "askar_wallet")] - uniffi::generate_scaffolding("./src/vcx_askar.udl").unwrap(); + uniffi::generate_scaffolding("./src/vcx.udl").unwrap(); } diff --git a/aries/wrappers/uniffi-aries-vcx/core/src/lib.rs b/aries/wrappers/uniffi-aries-vcx/core/src/lib.rs index ffec60669b..94b5a50fd2 100644 --- a/aries/wrappers/uniffi-aries-vcx/core/src/lib.rs +++ b/aries/wrappers/uniffi-aries-vcx/core/src/lib.rs @@ -2,7 +2,7 @@ uniffi::include_scaffolding!("vcx_indy"); #[cfg(feature = "askar_wallet")] -uniffi::include_scaffolding!("vcx_askar"); +uniffi::include_scaffolding!("vcx"); pub mod core; pub mod errors; diff --git a/aries/wrappers/uniffi-aries-vcx/core/src/vcx_askar.udl b/aries/wrappers/uniffi-aries-vcx/core/src/vcx.udl similarity index 100% rename from aries/wrappers/uniffi-aries-vcx/core/src/vcx_askar.udl rename to aries/wrappers/uniffi-aries-vcx/core/src/vcx.udl diff --git a/aries/wrappers/uniffi-aries-vcx/scripts/android.build.cargo.ndk.sh b/aries/wrappers/uniffi-aries-vcx/scripts/android.build.cargo.ndk.sh index 77d4485234..b1ededbc58 100644 --- a/aries/wrappers/uniffi-aries-vcx/scripts/android.build.cargo.ndk.sh +++ b/aries/wrappers/uniffi-aries-vcx/scripts/android.build.cargo.ndk.sh @@ -13,12 +13,12 @@ ABI="arm64-v8a" generate_bindings() { export UNIFFI_ROOT="${ARIES_VCX_ROOT}/aries/wrappers/uniffi-aries-vcx" - export ANDROID_DEMO_DIR="${ARIES_VCX_ROOT}/aries/agents/rust/mobile_demo" + export ANDROID_DEMO_DIR="${ARIES_VCX_ROOT}/aries/agents/mobile_demo" pushd "${UNIFFI_ROOT}/core" - cargo run --features=uniffi/cli --bin uniffi-bindgen generate src/vcx.udl --language ${LANGUAGE} + cargo run --features=uniffi/cli --bin uniffi-bindgen generate src/vcx.udl --language ${LANGUAGE} popd - + cp -R ${UNIFFI_ROOT}/core/src/org/hyperledger/ariesvcx/vcx.kt ${ANDROID_DEMO_DIR}/app/src/main/java/org/hyperledger/ariesvcx rm -R ${UNIFFI_ROOT}/core/src/org }