Skip to content

Commit

Permalink
refactor: move anoncreds to a separate crate (#1175)
Browse files Browse the repository at this point in the history
Signed-off-by: Ondrej Prazak <[email protected]>
Co-authored-by: Ondrej Prazak <[email protected]>
  • Loading branch information
xprazak2 and Ondrej Prazak authored Apr 16, 2024
1 parent ac2d946 commit ea35186
Show file tree
Hide file tree
Showing 106 changed files with 642 additions and 1,348 deletions.
48 changes: 3 additions & 45 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -140,28 +140,6 @@ jobs:
- name: "Verify clippy across the entire workspace with default features"
run: just clippy-aries-vcx ${{ matrix.backend }}

aries_vcx_core_clippy:
runs-on: ubuntu-20.04
strategy:
matrix:
backend: ["credx,vdrtools_wallet", "vdr_proxy_ledger,askar_wallet"]
steps:
- name: "Git checkout"
uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
toolchain: ${{ env.RUST_TOOLCHAIN_VERSION }}
default: true
components: clippy
- name: "Install dependencies"
shell: bash
run: |
sudo apt-get update -y
sudo apt-get install -y libsodium-dev libssl-dev libzmq3-dev
sudo snap install --edge --classic just
- name: "Verify clippy across the entire workspace with default features"
run: just clippy-aries-vcx-core ${{ matrix.backend }}

##########################################################################################
############################## DOCKER BUILD ##########################################

Expand Down Expand Up @@ -294,27 +272,7 @@ jobs:
- name: "Run wallet migration tests"
run: just test-wallet-migrator

test-intergation-aries-vcx-core:
needs: workflow-setup
runs-on: ubuntu-20.04
strategy:
matrix:
wallet: ["vdrtools_wallet", "askar_wallet"]
steps:
- name: "Git checkout"
uses: actions/checkout@v3
- name: "Setup rust testing environment"
uses: ./.github/actions/setup-testing-rust
with:
rust-toolchain-version: ${{ env.RUST_TOOLCHAIN_VERSION }}
default: true
skip-docker-setup: true
- name: "Install just"
run: sudo snap install --edge --classic just
- name: "Run aries-vcx-core integration tests"
run: just test-integration-aries-vcx-core ${{ matrix.wallet }}

test-compatibility-aries-vcx-core:
test-compatibility-aries-vcx-wallet:
needs: workflow-setup
runs-on: ubuntu-20.04
steps:
Expand All @@ -328,8 +286,8 @@ jobs:
skip-docker-setup: true
- name: "Install just"
run: sudo snap install --edge --classic just
- name: "Run aries-vcx-core compatibility tests"
run: just test-compatibility-aries-vcx-core
- name: "Run aries-vcx-wallet compatibility tests"
run: just test-compatibility-aries-vcx-wallet

test-integration-aries-vcx:
needs: workflow-setup
Expand Down
29 changes: 10 additions & 19 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ members = [
"aries/agents/aries-vcx-agent",
"aries/agents/aath-backchannel",
"aries/wrappers/uniffi-aries-vcx/core",
"aries/aries_vcx_core",
"aries/aries_vcx_anoncreds",
"aries/aries_vcx_wallet",
"aries/aries_vcx_ledger",
"aries/misc/indy_ledger_response_parser",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use anoncreds_types::data_types::messages::pres_request::{
AttributeInfo, NonRevokedInterval, PredicateInfo, PresentationRequestPayload,
};
use aries_vcx_agent::aries_vcx::{
aries_vcx_core::anoncreds::base_anoncreds::BaseAnonCreds,
aries_vcx_anoncreds::anoncreds::base_anoncreds::BaseAnonCreds,
handlers::util::PresentationProposalData,
messages::msg_fields::protocols::present_proof::v1::propose::{Predicate, PresentationAttr},
protocols::proof_presentation::{
Expand Down
6 changes: 4 additions & 2 deletions aries/agents/aath-backchannel/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,12 @@ impl std::convert::From<aries_vcx::errors::error::AriesVcxError> for HarnessErro
}
}

impl std::convert::From<aries_vcx::aries_vcx_core::errors::error::AriesVcxCoreError>
impl std::convert::From<aries_vcx::aries_vcx_anoncreds::errors::error::VcxAnoncredsError>
for HarnessError
{
fn from(vcx_err: aries_vcx::aries_vcx_core::errors::error::AriesVcxCoreError) -> HarnessError {
fn from(
vcx_err: aries_vcx::aries_vcx_anoncreds::errors::error::VcxAnoncredsError,
) -> HarnessError {
let kind = HarnessErrorType::InternalServerError;
HarnessError {
message: vcx_err.to_string(),
Expand Down
5 changes: 1 addition & 4 deletions aries/agents/aries-vcx-agent/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,10 @@ edition.workspace = true
[dependencies]
serde = "1.0.145"
aries_vcx = { path = "../../aries_vcx" }
aries_vcx_core = { path = "../../aries_vcx_core", features = [
"credx",
"vdrtools_wallet",
] }
aries_vcx_wallet = { path = "../../aries_vcx_wallet", features = [
"vdrtools_wallet",
] }
aries_vcx_anoncreds = { path = "../../aries_vcx_anoncreds", features = ["credx"] }
aries_vcx_ledger = { path = "../../aries_vcx_ledger"}
anoncreds_types = { path = "../../misc/anoncreds_types" }
shared = { path = "../../misc/shared" }
Expand Down
2 changes: 1 addition & 1 deletion aries/agents/aries-vcx-agent/src/agent/agent_struct.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::sync::Arc;

use aries_vcx_core::anoncreds::credx_anoncreds::IndyCredxAnonCreds;
use aries_vcx_anoncreds::anoncreds::credx_anoncreds::IndyCredxAnonCreds;
use aries_vcx_ledger::ledger::indy_vdr_ledger::{DefaultIndyLedgerRead, DefaultIndyLedgerWrite};
use aries_vcx_wallet::wallet::base_wallet::BaseWallet;

Expand Down
2 changes: 1 addition & 1 deletion aries/agents/aries-vcx-agent/src/agent/init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use aries_vcx::{
did_parser_nom::Did,
global::settings::DEFAULT_LINK_SECRET_ALIAS,
};
use aries_vcx_core::{
use aries_vcx_anoncreds::{
self,
anoncreds::{base_anoncreds::BaseAnonCreds, credx_anoncreds::IndyCredxAnonCreds},
};
Expand Down
9 changes: 0 additions & 9 deletions aries/agents/aries-vcx-agent/src/error/convertors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ use aries_vcx::{
errors::error::{AriesVcxError, AriesVcxErrorKind},
protocols::did_exchange::state_machine::generic::GenericDidExchange,
};
use aries_vcx_core::errors::error::AriesVcxCoreError;
use aries_vcx_ledger::errors::error::VcxLedgerError;
use did_resolver_sov::did_resolver::did_doc::schema::utils::error::DidDocumentLookupError;

Expand All @@ -31,14 +30,6 @@ impl From<serde_json::Error> for AgentError {
}
}

impl From<AriesVcxCoreError> for AgentError {
fn from(err: AriesVcxCoreError) -> Self {
let kind = AgentErrorKind::GenericAriesVcxError;
let message = format!("AriesVcxCore Error; err: {:?}", err.to_string());
AgentError { message, kind }
}
}

impl From<VcxLedgerError> for AgentError {
fn from(err: VcxLedgerError) -> Self {
let kind = AgentErrorKind::GenericAriesVcxError;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::sync::{Arc, Mutex};

use anoncreds_types::data_types::identifiers::schema_id::SchemaId;
use aries_vcx::{common::primitives::credential_definition::CredentialDef, did_parser_nom::Did};
use aries_vcx_core::anoncreds::credx_anoncreds::IndyCredxAnonCreds;
use aries_vcx_anoncreds::anoncreds::credx_anoncreds::IndyCredxAnonCreds;
use aries_vcx_ledger::ledger::indy_vdr_ledger::{DefaultIndyLedgerRead, DefaultIndyLedgerWrite};
use aries_vcx_wallet::wallet::base_wallet::BaseWallet;

Expand Down
2 changes: 1 addition & 1 deletion aries/agents/aries-vcx-agent/src/handlers/holder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use aries_vcx::{
},
protocols::{issuance::holder::state_machine::HolderState, SendClosure},
};
use aries_vcx_core::anoncreds::credx_anoncreds::IndyCredxAnonCreds;
use aries_vcx_anoncreds::anoncreds::credx_anoncreds::IndyCredxAnonCreds;
use aries_vcx_ledger::ledger::indy_vdr_ledger::DefaultIndyLedgerRead;
use aries_vcx_wallet::wallet::base_wallet::BaseWallet;

Expand Down
2 changes: 1 addition & 1 deletion aries/agents/aries-vcx-agent/src/handlers/issuer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use aries_vcx::{
},
protocols::{issuance::issuer::state_machine::IssuerState, SendClosure},
};
use aries_vcx_core::anoncreds::credx_anoncreds::IndyCredxAnonCreds;
use aries_vcx_anoncreds::anoncreds::credx_anoncreds::IndyCredxAnonCreds;
use aries_vcx_wallet::wallet::base_wallet::BaseWallet;

use crate::{
Expand Down
2 changes: 1 addition & 1 deletion aries/agents/aries-vcx-agent/src/handlers/prover.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use aries_vcx::{
},
protocols::{proof_presentation::prover::state_machine::ProverState, SendClosure},
};
use aries_vcx_core::anoncreds::credx_anoncreds::IndyCredxAnonCreds;
use aries_vcx_anoncreds::anoncreds::credx_anoncreds::IndyCredxAnonCreds;
use aries_vcx_ledger::ledger::indy_vdr_ledger::DefaultIndyLedgerRead;
use aries_vcx_wallet::wallet::base_wallet::BaseWallet;
use serde_json::Value;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use std::{

use anoncreds_types::data_types::identifiers::cred_def_id::CredentialDefinitionId;
use aries_vcx::{common::primitives::revocation_registry::RevocationRegistry, did_parser_nom::Did};
use aries_vcx_core::anoncreds::credx_anoncreds::IndyCredxAnonCreds;
use aries_vcx_anoncreds::anoncreds::credx_anoncreds::IndyCredxAnonCreds;
use aries_vcx_ledger::ledger::indy_vdr_ledger::{DefaultIndyLedgerRead, DefaultIndyLedgerWrite};
use aries_vcx_wallet::wallet::base_wallet::BaseWallet;

Expand Down
2 changes: 1 addition & 1 deletion aries/agents/aries-vcx-agent/src/handlers/schema.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::sync::{Arc, Mutex};

use aries_vcx::{common::primitives::credential_schema::Schema, did_parser_nom::Did};
use aries_vcx_core::anoncreds::credx_anoncreds::IndyCredxAnonCreds;
use aries_vcx_anoncreds::anoncreds::credx_anoncreds::IndyCredxAnonCreds;
use aries_vcx_ledger::ledger::{
base_ledger::AnoncredsLedgerRead,
indy_vdr_ledger::{DefaultIndyLedgerRead, DefaultIndyLedgerWrite},
Expand Down
2 changes: 1 addition & 1 deletion aries/agents/aries-vcx-agent/src/handlers/verifier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use aries_vcx::{
SendClosure,
},
};
use aries_vcx_core::anoncreds::credx_anoncreds::IndyCredxAnonCreds;
use aries_vcx_anoncreds::anoncreds::credx_anoncreds::IndyCredxAnonCreds;
use aries_vcx_ledger::ledger::indy_vdr_ledger::DefaultIndyLedgerRead;
use aries_vcx_wallet::wallet::base_wallet::BaseWallet;

Expand Down
3 changes: 0 additions & 3 deletions aries/agents/mediator/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@ aries_vcx = { path = "../../aries_vcx" }
aries_vcx_wallet = { path = "../../aries_vcx_wallet", features = [
"vdrtools_wallet",
] }
aries_vcx_core = { path = "../../aries_vcx_core", features = [
"vdrtools_wallet",
] }
async-trait = "0.1.73"
axum = "0.6"
axum-macros = "0.3.8"
Expand Down
3 changes: 0 additions & 3 deletions aries/agents/mediator/client-tui/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
aries_vcx_core = { path = "../../../aries_vcx_core", features = [
"vdrtools_wallet",
] }
aries_vcx_wallet = { path = "../../../aries_vcx_wallet", features = [
"vdrtools_wallet",
] }
Expand Down
Loading

0 comments on commit ea35186

Please sign in to comment.