From ae0a433d6e936361adbbb2df60a223e1a30c46fc Mon Sep 17 00:00:00 2001 From: Miroslav Kovar Date: Fri, 11 Aug 2023 16:33:32 +0200 Subject: [PATCH] Remove ursa as (direct) depedency of indy-ledger-response-parser Signed-off-by: Miroslav Kovar --- Cargo.lock | 45 ++++++++++++++++++- indy_ledger_response_parser/Cargo.toml | 2 +- .../src/domain/rev_reg.rs | 2 +- indy_ledger_response_parser/src/lib.rs | 5 +-- 4 files changed, 48 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 312e0bd065..d9c8669454 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -389,6 +389,25 @@ dependencies = [ "libc", ] +[[package]] +name = "anoncreds-clsignatures" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f683463c4f5558a4eab7fe4625d94f08b7de9691453032bac43facf06fe46d2e" +dependencies = [ + "amcl", + "glass_pumpkin", + "log", + "num-bigint 0.4.3", + "num-integer", + "num-traits", + "once_cell", + "openssl", + "rand 0.8.5", + "serde", + "sha2 0.10.7", +] + [[package]] name = "anyhow" version = "1.0.72" @@ -1161,6 +1180,15 @@ version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa" +[[package]] +name = "core2" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b49ba7ef1ad6107f8824dbe97de947cbaac53c44e7f9756a1fba0d37c1eec505" +dependencies = [ + "memchr", +] + [[package]] name = "cpufeatures" version = "0.2.9" @@ -2253,6 +2281,20 @@ version = "0.27.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b6c80984affa11d98d1b88b66ac8853f143217b399d3c74116778ff8fdb4ed2e" +[[package]] +name = "glass_pumpkin" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e847fe780e2fd8aa993bef2124361c285349ff0e9315e8285f8126386b54a9" +dependencies = [ + "core2", + "num-bigint 0.4.3", + "num-integer", + "num-traits", + "once_cell", + "rand_core 0.6.4", +] + [[package]] name = "glob" version = "0.3.1" @@ -2619,12 +2661,12 @@ dependencies = [ name = "indy-ledger-response-parser" version = "0.1.0" dependencies = [ + "anoncreds-clsignatures", "indy-vdr", "serde", "serde_json", "thiserror", "time 0.3.20", - "ursa", ] [[package]] @@ -3365,6 +3407,7 @@ dependencies = [ "autocfg 1.1.0", "num-integer", "num-traits", + "rand 0.8.5", ] [[package]] diff --git a/indy_ledger_response_parser/Cargo.toml b/indy_ledger_response_parser/Cargo.toml index cf78808fcb..6645e612f0 100644 --- a/indy_ledger_response_parser/Cargo.toml +++ b/indy_ledger_response_parser/Cargo.toml @@ -7,6 +7,6 @@ edition = "2021" serde = { version = "1.0.163", features = ["derive"] } serde_json = "1.0.96" time = "=0.3.20" -ursa = { version = "0.3.7" } indy-vdr = { git = "https://github.com/Patrik-Stas/indy-vdr.git", rev = "3cd499ad75", default-features = false, features = ["log"] } thiserror = "1.0.44" +anoncreds-clsignatures = "0.2.0" diff --git a/indy_ledger_response_parser/src/domain/rev_reg.rs b/indy_ledger_response_parser/src/domain/rev_reg.rs index 2ec938dd80..6731917a51 100644 --- a/indy_ledger_response_parser/src/domain/rev_reg.rs +++ b/indy_ledger_response_parser/src/domain/rev_reg.rs @@ -1,7 +1,7 @@ use super::constants::{GET_REVOC_REG, GET_REVOC_REG_DELTA}; +use anoncreds_clsignatures::RevocationRegistry; use indy_vdr::ledger::{identifiers::RevocationRegistryId, requests::rev_reg::RevocationRegistryV1}; -use ursa::cl::RevocationRegistry; use super::response::{GetReplyResultV1, ReplyType}; diff --git a/indy_ledger_response_parser/src/lib.rs b/indy_ledger_response_parser/src/lib.rs index 35b450accc..92ff393d8f 100644 --- a/indy_ledger_response_parser/src/lib.rs +++ b/indy_ledger_response_parser/src/lib.rs @@ -6,6 +6,7 @@ extern crate serde_json; mod domain; pub mod error; +use anoncreds_clsignatures::RevocationRegistryDelta as ClRevocationRegistryDelta; pub use domain::author_agreement::GetTxnAuthorAgreementData; use domain::author_agreement::GetTxnAuthorAgreementResult; use error::LedgerResponseParserError; @@ -22,8 +23,6 @@ use indy_vdr::{ utils::did::DidValue, }; use serde::de::DeserializeOwned; -// TODO: Can we replace this to get rid of dependency on Ursa -use ursa::cl::RevocationRegistryDelta as UrsaRevocationDelta; use crate::domain::{ cred_def::GetCredDefReplyResult, @@ -219,7 +218,7 @@ impl ResponseParser { }; let revoc_reg_delta = RevocationRegistryDeltaV1 { - value: serde_json::to_value(UrsaRevocationDelta::from_parts( + value: serde_json::to_value(ClRevocationRegistryDelta::from_parts( revoc_reg.value.accum_from.map(|accum| accum.value).as_ref(), &revoc_reg.value.accum_to.value, &revoc_reg.value.issued,